1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
3 * (C) 2010 by Argonne National Laboratory.
4 * See COPYRIGHT in top-level directory.
11 /* tests send/recv of a message > 2GB. count=270M, type=long long
12 run with 3 processes to exercise both shared memory and TCP in Nemesis tests*/
14 int main(int argc, char *argv[])
16 int ierr, i, size, rank;
24 MTest_Init(&argc, &argv);
26 /* need large memory */
27 if (sizeof(void *) < 8) {
33 ierr = MPI_Comm_size(MPI_COMM_WORLD, &size);
34 ierr = MPI_Comm_rank(MPI_COMM_WORLD, &rank);
36 fprintf(stderr, "[%d] usage: mpiexec -n 3 %s\n", rank, argv[0]);
37 MPI_Abort(MPI_COMM_WORLD, 1);
40 cols = malloc(cnt * sizeof(long long));
42 printf("malloc of >2GB array failed\n");
50 for (i = 0; i < cnt; i++)
52 /* printf("[%d] sending...\n",rank); */
53 ierr = MPI_Send(cols, cnt, MPI_LONG_LONG_INT, 1, 0, MPI_COMM_WORLD);
54 ierr = MPI_Send(cols, cnt, MPI_LONG_LONG_INT, 2, 0, MPI_COMM_WORLD);
57 /* printf("[%d] receiving...\n",rank); */
58 for (i = 0; i < cnt; i++)
60 ierr = MPI_Recv(cols, cnt, MPI_LONG_LONG_INT, 0, 0, MPI_COMM_WORLD, &status);
61 ierr = MPI_Get_count(&status,MPI_LONG_LONG_INT,&stat_cnt);
62 if (cnt != stat_cnt) {
63 fprintf(stderr, "Output of MPI_Get_count (%d) does not match expected count (%d).\n", stat_cnt, cnt);
66 for (i = 0; i < cnt; i++) {
68 /*printf("Rank %d, cols[i]=%lld, should be %d\n", rank, cols[i], i); */