1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
3 * (C) 2001 by Argonne National Laboratory.
4 * See COPYRIGHT in top-level directory.
12 #define DATA_NELTS 1000
14 #define DATA_SZ (DATA_NELTS*sizeof(int))
16 static int verbose = 0;
18 int main(int argc, char **argv)
21 void *base_ptrs[NUM_WIN];
22 MPI_Win windows[NUM_WIN];
24 MPI_Init(&argc, &argv);
26 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
27 MPI_Comm_size(MPI_COMM_WORLD, &nproc);
31 printf("Starting MPI window creation test with %d processes\n", nproc);
33 /* Perform a pile of window creations */
34 for (i = 0; i < NUM_WIN; i++) {
37 printf(" + Creating window %d\n", i);
39 MPI_Alloc_mem(DATA_SZ, MPI_INFO_NULL, &base_ptrs[i]);
40 MPI_Win_create(base_ptrs[i], DATA_SZ, 1, MPI_INFO_NULL, MPI_COMM_WORLD, &windows[i]);
43 MPI_Barrier(MPI_COMM_WORLD);
45 /* Free all the windows */
46 for (i = 0; i < NUM_WIN; i++) {
49 printf(" + Freeing window %d\n", i);
51 MPI_Win_free(&windows[i]);
52 MPI_Free_mem(base_ptrs[i]);
56 printf(" No Errors\n");