Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
This particular RMA test is filled with stupid calls... We send errors for most of...
[simgrid.git] / teshsuite / smpi / mpich3-test / rma / manyget.c
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  *  (C) 2015 by Argonne National Laboratory.
4  *      See COPYRIGHT in top-level directory.
5  */
6
7 /* This test triggers a limitation in the Portals4 netmod where
8  * too many large messages can overflow the available ME entries
9  * (PTL_NO_SPACE). Our approach is to queue the entire send message
10  * in the Rportals layer until we know there is ME space available.
11  */
12 #include <stdlib.h>
13 #include <stdio.h>
14 #include <mpi.h>
15 #include "mpitest.h"
16
17 #define BUFSIZE (32*1024)
18
19 int main(int argc, char *argv[])
20 {
21     int i, rank, size;
22     int *buf;
23     MPI_Win win;
24
25     MPI_Init(&argc, &argv);
26
27     buf = malloc(BUFSIZE);
28     MTEST_VG_MEM_INIT(buf, BUFSIZE);
29
30     MPI_Comm_rank(MPI_COMM_WORLD, &rank);
31     MPI_Comm_size(MPI_COMM_WORLD, &size);
32
33     if (size != 2) {
34         printf("test must be run with 2 processes!\n");
35         MPI_Abort(MPI_COMM_WORLD, 1);
36     }
37
38     if (rank == 0)
39         MPI_Win_create(buf, BUFSIZE, sizeof(int), MPI_INFO_NULL, MPI_COMM_WORLD, &win);
40     else
41         MPI_Win_create(MPI_BOTTOM, 0, 1, MPI_INFO_NULL, MPI_COMM_WORLD, &win);
42
43     MPI_Win_fence(0, win);
44
45     if (rank == 1) {
46         for (i = 0; i < 1000; i++)
47             MPI_Get(buf, BUFSIZE / sizeof(int), MPI_INT, 0, 0, BUFSIZE / sizeof(int), MPI_INT, win);
48     }
49
50     MPI_Win_fence(0, win);
51     MPI_Win_free(&win);
52
53     if (rank == 0)
54         printf(" No Errors\n");
55
56     free(buf);
57     MPI_Finalize();
58
59     return 0;
60 }