Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
try to appease ubsan a bit
[simgrid.git] / teshsuite / smpi / mpich3-test / rma / manyrma2.c
index 571d29e..f86619e 100644 (file)
@@ -15,9 +15,9 @@
 #include <stdlib.h>
 #include <string.h>
 
-#define MAX_COUNT 65536*4/16
-#define MAX_RMA_SIZE 2  /* 16 in manyrma performance test */
-#define MAX_RUNS 10
+#define MAX_COUNT 512
+#define MAX_RMA_SIZE 1  /* 16 in manyrma performance test */
+#define MAX_RUNS 8
 #define MAX_ITER_TIME  5.0      /* seconds */
 
 typedef enum { SYNC_NONE = 0,
@@ -112,6 +112,14 @@ int main(int argc, char *argv[])
     MPI_Group_free(&wgroup);
 
     arraysize = maxSz * MAX_COUNT;
+#ifdef USE_WIN_ALLOCATE
+    MPI_Win_allocate(arraysize * sizeof(int), (int) sizeof(int), MPI_INFO_NULL,
+                     MPI_COMM_WORLD, &arraybuffer, &win);
+    if (!arraybuffer) {
+        fprintf(stderr, "Unable to allocate %d words\n", arraysize);
+        MPI_Abort(MPI_COMM_WORLD, 1);
+    }
+#else
     arraybuffer = (int *) malloc(arraysize * sizeof(int));
     if (!arraybuffer) {
         fprintf(stderr, "Unable to allocate %d words\n", arraysize);
@@ -120,6 +128,7 @@ int main(int argc, char *argv[])
 
     MPI_Win_create(arraybuffer, arraysize * sizeof(int), (int) sizeof(int),
                    MPI_INFO_NULL, MPI_COMM_WORLD, &win);
+#endif
 
     if (maxCount > MAX_COUNT) {
         fprintf(stderr, "MaxCount must not exceed %d\n", MAX_COUNT);
@@ -212,6 +221,10 @@ int main(int argc, char *argv[])
 
     MPI_Win_free(&win);
 
+#ifndef USE_WIN_ALLOCATE
+    free(arraybuffer);
+#endif
+
     MPI_Group_free(&accessGroup);
     MPI_Group_free(&exposureGroup);