|
Packit Service |
c5cf8c |
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
* (C) 2010 by Argonne National Laboratory.
|
|
Packit Service |
c5cf8c |
* See COPYRIGHT in top-level directory.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* This is a very weak sanity test that all nonblocking collectives specified by
|
|
Packit Service |
c5cf8c |
* MPI-3 are present in the library and take arguments as expected. This test
|
|
Packit Service |
c5cf8c |
* does not check for progress, matching issues, or sensible output buffer
|
|
Packit Service |
c5cf8c |
* values. */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#include "mpi.h"
|
|
Packit Service |
c5cf8c |
#include <stdio.h>
|
|
Packit Service |
c5cf8c |
#include <stdlib.h>
|
|
Packit Service |
c5cf8c |
#include "mpitest.h"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define NUM_INTS (2)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define my_assert(cond_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
if (!(cond_)) { \
|
|
Packit Service |
c5cf8c |
fprintf(stderr, "assertion (%s) failed, aborting\n", #cond_); \
|
|
Packit Service |
c5cf8c |
MPI_Abort(MPI_COMM_WORLD, 1); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
int main(int argc, char **argv)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
int errs = 0;
|
|
Packit Service |
c5cf8c |
int i;
|
|
Packit Service |
c5cf8c |
int rank, size;
|
|
Packit Service |
c5cf8c |
int *sbuf = NULL;
|
|
Packit Service |
c5cf8c |
int *rbuf = NULL;
|
|
Packit Service |
c5cf8c |
int *scounts = NULL;
|
|
Packit Service |
c5cf8c |
int *rcounts = NULL;
|
|
Packit Service |
c5cf8c |
int *sdispls = NULL;
|
|
Packit Service |
c5cf8c |
int *rdispls = NULL;
|
|
Packit Service |
c5cf8c |
MPI_Datatype *types = NULL;
|
|
Packit Service |
c5cf8c |
MPI_Comm comm;
|
|
Packit Service |
c5cf8c |
MPI_Request req;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MTest_Init(&argc, &argv);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
comm = MPI_COMM_WORLD;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Comm_size(comm, &size);
|
|
Packit Service |
c5cf8c |
MPI_Comm_rank(comm, &rank;;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* enough space for every process to contribute at least NUM_INTS ints to any
|
|
Packit Service |
c5cf8c |
* collective operation */
|
|
Packit Service |
c5cf8c |
sbuf = malloc(NUM_INTS * size * sizeof(int));
|
|
Packit Service |
c5cf8c |
my_assert(sbuf);
|
|
Packit Service |
c5cf8c |
rbuf = malloc(NUM_INTS * size * sizeof(int));
|
|
Packit Service |
c5cf8c |
my_assert(rbuf);
|
|
Packit Service |
c5cf8c |
scounts = malloc(size * sizeof(int));
|
|
Packit Service |
c5cf8c |
my_assert(scounts);
|
|
Packit Service |
c5cf8c |
rcounts = malloc(size * sizeof(int));
|
|
Packit Service |
c5cf8c |
my_assert(rcounts);
|
|
Packit Service |
c5cf8c |
sdispls = malloc(size * sizeof(int));
|
|
Packit Service |
c5cf8c |
my_assert(sdispls);
|
|
Packit Service |
c5cf8c |
rdispls = malloc(size * sizeof(int));
|
|
Packit Service |
c5cf8c |
my_assert(rdispls);
|
|
Packit Service |
c5cf8c |
types = malloc(size * sizeof(MPI_Datatype));
|
|
Packit Service |
c5cf8c |
my_assert(types);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
for (i = 0; i < size; ++i) {
|
|
Packit Service |
c5cf8c |
sbuf[2 * i] = i;
|
|
Packit Service |
c5cf8c |
sbuf[2 * i + 1] = i;
|
|
Packit Service |
c5cf8c |
rbuf[2 * i] = i;
|
|
Packit Service |
c5cf8c |
rbuf[2 * i + 1] = i;
|
|
Packit Service |
c5cf8c |
scounts[i] = NUM_INTS;
|
|
Packit Service |
c5cf8c |
rcounts[i] = NUM_INTS;
|
|
Packit Service |
c5cf8c |
sdispls[i] = i * NUM_INTS;
|
|
Packit Service |
c5cf8c |
rdispls[i] = i * NUM_INTS;
|
|
Packit Service |
c5cf8c |
types[i] = MPI_INT;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Ibarrier(comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Ibcast(sbuf, NUM_INTS, MPI_INT, 0, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Igather(sbuf, NUM_INTS, MPI_INT, rbuf, NUM_INTS, MPI_INT, 0, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (0 == rank)
|
|
Packit Service |
c5cf8c |
MPI_Igather(MPI_IN_PLACE, -1, MPI_DATATYPE_NULL, rbuf, NUM_INTS, MPI_INT, 0, comm, &req;;
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
MPI_Igather(sbuf, NUM_INTS, MPI_INT, rbuf, NUM_INTS, MPI_INT, 0, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Igatherv(sbuf, NUM_INTS, MPI_INT, rbuf, rcounts, rdispls, MPI_INT, 0, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (0 == rank)
|
|
Packit Service |
c5cf8c |
MPI_Igatherv(MPI_IN_PLACE, -1, MPI_DATATYPE_NULL, rbuf, rcounts, rdispls, MPI_INT, 0, comm,
|
|
Packit Service |
c5cf8c |
&req;;
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
MPI_Igatherv(sbuf, NUM_INTS, MPI_INT, rbuf, rcounts, rdispls, MPI_INT, 0, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Iscatter(sbuf, NUM_INTS, MPI_INT, rbuf, NUM_INTS, MPI_INT, 0, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (0 == rank)
|
|
Packit Service |
c5cf8c |
MPI_Iscatter(sbuf, NUM_INTS, MPI_INT, MPI_IN_PLACE, -1, MPI_DATATYPE_NULL, 0, comm, &req;;
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
MPI_Iscatter(sbuf, NUM_INTS, MPI_INT, rbuf, NUM_INTS, MPI_INT, 0, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Iscatterv(sbuf, scounts, sdispls, MPI_INT, rbuf, NUM_INTS, MPI_INT, 0, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (0 == rank)
|
|
Packit Service |
c5cf8c |
MPI_Iscatterv(sbuf, scounts, sdispls, MPI_INT, MPI_IN_PLACE, -1, MPI_DATATYPE_NULL, 0, comm,
|
|
Packit Service |
c5cf8c |
&req;;
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
MPI_Iscatterv(sbuf, scounts, sdispls, MPI_INT, rbuf, NUM_INTS, MPI_INT, 0, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Iallgather(sbuf, NUM_INTS, MPI_INT, rbuf, NUM_INTS, MPI_INT, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Iallgather(MPI_IN_PLACE, -1, MPI_DATATYPE_NULL, rbuf, NUM_INTS, MPI_INT, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Iallgatherv(sbuf, NUM_INTS, MPI_INT, rbuf, rcounts, rdispls, MPI_INT, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Iallgatherv(MPI_IN_PLACE, -1, MPI_DATATYPE_NULL, rbuf, rcounts, rdispls, MPI_INT, comm,
|
|
Packit Service |
c5cf8c |
&req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Ialltoall(sbuf, NUM_INTS, MPI_INT, rbuf, NUM_INTS, MPI_INT, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Ialltoall(MPI_IN_PLACE, -1, MPI_DATATYPE_NULL, rbuf, NUM_INTS, MPI_INT, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Ialltoallv(sbuf, scounts, sdispls, MPI_INT, rbuf, rcounts, rdispls, MPI_INT, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Ialltoallv(MPI_IN_PLACE, NULL, NULL, MPI_DATATYPE_NULL, rbuf, rcounts, rdispls, MPI_INT,
|
|
Packit Service |
c5cf8c |
comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Ialltoallw(sbuf, scounts, sdispls, types, rbuf, rcounts, rdispls, types, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Ialltoallw(MPI_IN_PLACE, NULL, NULL, NULL, rbuf, rcounts, rdispls, types, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Ireduce(sbuf, rbuf, NUM_INTS, MPI_INT, MPI_SUM, 0, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (0 == rank)
|
|
Packit Service |
c5cf8c |
MPI_Ireduce(MPI_IN_PLACE, rbuf, NUM_INTS, MPI_INT, MPI_SUM, 0, comm, &req;;
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
MPI_Ireduce(sbuf, rbuf, NUM_INTS, MPI_INT, MPI_SUM, 0, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Iallreduce(sbuf, rbuf, NUM_INTS, MPI_INT, MPI_SUM, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Iallreduce(MPI_IN_PLACE, rbuf, NUM_INTS, MPI_INT, MPI_SUM, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Ireduce_scatter(sbuf, rbuf, rcounts, MPI_INT, MPI_SUM, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Ireduce_scatter(MPI_IN_PLACE, rbuf, rcounts, MPI_INT, MPI_SUM, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Ireduce_scatter_block(sbuf, rbuf, NUM_INTS, MPI_INT, MPI_SUM, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Ireduce_scatter_block(MPI_IN_PLACE, rbuf, NUM_INTS, MPI_INT, MPI_SUM, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Iscan(sbuf, rbuf, NUM_INTS, MPI_INT, MPI_SUM, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Iscan(MPI_IN_PLACE, rbuf, NUM_INTS, MPI_INT, MPI_SUM, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Iexscan(sbuf, rbuf, NUM_INTS, MPI_INT, MPI_SUM, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Iexscan(MPI_IN_PLACE, rbuf, NUM_INTS, MPI_INT, MPI_SUM, comm, &req;;
|
|
Packit Service |
c5cf8c |
MPI_Wait(&req, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (sbuf)
|
|
Packit Service |
c5cf8c |
free(sbuf);
|
|
Packit Service |
c5cf8c |
if (rbuf)
|
|
Packit Service |
c5cf8c |
free(rbuf);
|
|
Packit Service |
c5cf8c |
if (scounts)
|
|
Packit Service |
c5cf8c |
free(scounts);
|
|
Packit Service |
c5cf8c |
if (rcounts)
|
|
Packit Service |
c5cf8c |
free(rcounts);
|
|
Packit Service |
c5cf8c |
if (sdispls)
|
|
Packit Service |
c5cf8c |
free(sdispls);
|
|
Packit Service |
c5cf8c |
if (rdispls)
|
|
Packit Service |
c5cf8c |
free(rdispls);
|
|
Packit Service |
c5cf8c |
if (types)
|
|
Packit Service |
c5cf8c |
free(types);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MTest_Finalize(errs);
|
|
Packit Service |
c5cf8c |
return MTestReturnValue(errs);
|
|
Packit Service |
c5cf8c |
}
|