Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reduce the size of partial shared malloc tests.
[simgrid.git] / teshsuite / smpi / mpich3-test / rma / nb_test.c
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  *  (C) 2001 by Argonne National Laboratory.
4  *      See COPYRIGHT in top-level directory.
5  */
6 #include <stdio.h>
7 #include <mpi.h>
8 #include <mpitest.h>
9
10 int main(int argc, char *argv[])
11 {
12     MPI_Win win;
13     int flag, tmp, rank;
14     int base[1024], errs = 0;
15     MPI_Request req;
16
17     MTest_Init(&argc, &argv);
18     MPI_Comm_rank(MPI_COMM_WORLD, &rank);
19
20     MPI_Win_create(base, 1024 * sizeof(int), sizeof(int), MPI_INFO_NULL, MPI_COMM_WORLD, &win);
21
22     if (rank == 0) {
23         MPI_Win_lock(MPI_LOCK_EXCLUSIVE, 0, 0, win);
24         MPI_Barrier(MPI_COMM_WORLD);
25         MPI_Barrier(MPI_COMM_WORLD);
26         MPI_Win_unlock(0, win);
27     }
28     else {
29         MPI_Barrier(MPI_COMM_WORLD);
30         MPI_Win_lock(MPI_LOCK_EXCLUSIVE, 0, 0, win);
31         MPI_Rput(&tmp, 1, MPI_INT, 0, 0, 1, MPI_INT, win, &req);
32         MPI_Test(&req, &flag, MPI_STATUS_IGNORE);
33         MPI_Barrier(MPI_COMM_WORLD);
34         MPI_Win_unlock(0, win);
35     }
36
37     MPI_Win_free(&win);
38
39     MTest_Finalize(errs);
40     MPI_Finalize();
41     return 0;
42 }