1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
3 * (C) 2015 by Argonne National Laboratory.
4 * See COPYRIGHT in top-level directory.
7 /* This code tests the case when origin process issues 10 ACC
8 * operations for each data size to the target process, and each
9 * operation is followed by a MPI_Win_flush_local. */
11 /* FIXME: we should merge this into a comprehensive test for RMA
12 * operations + MPI_Win_flush_local. */
19 #define MIN_DATA_SIZE (262144)
20 #define MAX_DATA_SIZE (8 * 262144)
24 int main(int argc, char *argv[])
26 int rank, nproc, i, j;
32 MPI_Init(&argc, &argv);
34 MPI_Comm_size(MPI_COMM_WORLD, &nproc);
35 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
37 MPI_Alloc_mem(MAX_DATA_SIZE, MPI_INFO_NULL, &orig_buf);
38 MPI_Alloc_mem(MAX_DATA_SIZE, MPI_INFO_NULL, &tar_buf);
40 /* run this test for LOOP times */
42 for (j = 0; j < LOOP; j++) {
44 MPI_Win_create(tar_buf, MAX_DATA_SIZE, 1, MPI_INFO_NULL, MPI_COMM_WORLD, &win);
46 MPI_Win_lock_all(0, win);
49 for (data_size = MIN_DATA_SIZE; data_size <= MAX_DATA_SIZE; data_size *= 2) {
50 for (i = 0; i < OPS_NUM; i++) {
51 MPI_Accumulate(orig_buf, data_size, MPI_BYTE,
52 0, 0, data_size, MPI_BYTE, MPI_SUM, win);
53 MPI_Win_flush_local(0, win);
55 MPI_Win_flush(0, win);
59 MPI_Win_unlock_all(win);
65 printf(" No Errors\n");
67 MPI_Free_mem(orig_buf);
68 MPI_Free_mem(tar_buf);