[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1b1-105-g7ff6a97
mysql vizuser
noreply at mpich.org
Fri Oct 25 10:39:30 CDT 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".
The branch, master has been updated
via 7ff6a970336dea004f567410e2e81d22de3de10f (commit)
from 10073a335d707b2ad5ddb40b77b902140b95119f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/7ff6a970336dea004f567410e2e81d22de3de10f
commit 7ff6a970336dea004f567410e2e81d22de3de10f
Author: Rob Latham <robl at mcs.anl.gov>
Date: Thu Oct 24 16:27:34 2013 -0500
another big type test
Jeff Hammond's test to send/recieve a message described by a large datatype.
diff --git a/test/mpi/datatype/Makefile.am b/test/mpi/datatype/Makefile.am
index c0f5425..ef48b29 100644
--- a/test/mpi/datatype/Makefile.am
+++ b/test/mpi/datatype/Makefile.am
@@ -36,6 +36,7 @@ noinst_PROGRAMS = \
indexed-misc \
large-count \
large_type \
+ large_type_sendrec \
lbub \
localpack \
longdouble \
diff --git a/test/mpi/datatype/large_type_sendrec.c b/test/mpi/datatype/large_type_sendrec.c
new file mode 100644
index 0000000..ff3fef6
--- /dev/null
+++ b/test/mpi/datatype/large_type_sendrec.c
@@ -0,0 +1,181 @@
+/*
+ * Author(s):
+ *
+ * Jeff R. Hammond
+ * Leadership Computing Facility
+ * Argonne National Laboratory
+ * jhammond at anl.gov
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* Defines INT32_MAX, which is not appropriate for int types. */
+#include <stdint.h>
+
+/* Defines INT_MAX */
+#include <limits.h>
+
+#include <mpi.h>
+
+#include <assert.h>
+static void MPIX_Verbose_abort(int errorcode)
+{
+ /* We do not check error codes here
+ * because if MPI is in a really sorry state,
+ * all of them might fail. */
+
+ int rank;
+ MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+
+ char errorstring[MPI_MAX_ERROR_STRING];
+ memset(errorstring, 0, MPI_MAX_ERROR_STRING); /* optional */
+
+ int errorclass;
+ MPI_Error_class(errorcode, &errorclass);
+
+ int resultlen;
+ MPI_Error_string(errorcode, errorstring, &resultlen);
+
+ fprintf(stderr, "%d: MPI failed (%d: %s) \n", rank, errorclass, errorstring);
+ fflush(stderr); /* almost certainly redundant with the following... */
+
+ MPI_Abort(MPI_COMM_WORLD, errorclass);
+
+ return;
+}
+#define MPI_ASSERT(rc) \
+ ((void) ((rc==MPI_SUCCESS) ? 0 : MPIX_Verbose_abort(rc) ))
+
+int MPIX_Type_contiguous_x(MPI_Count count, MPI_Datatype oldtype,
+ MPI_Datatype * newtype);
+
+#define BIGMPI_MAX INT_MAX
+
+/*
+ * Synopsis
+ *
+ * int MPIX_Type_contiguous_x(MPI_Count count,
+ * MPI_Datatype oldtype,
+ * MPI_Datatype * newtype)
+ *
+ * Input Parameters
+ *
+ * count replication count (nonnegative integer)
+ * oldtype old datatype (handle)
+ *
+ * Output Parameter
+ *
+ * newtype new datatype (handle)
+ *
+ */
+int MPIX_Type_contiguous_x(MPI_Count count, MPI_Datatype oldtype, MPI_Datatype * newtype)
+{
+ MPI_Count c = count/BIGMPI_MAX;
+ MPI_Count r = count%BIGMPI_MAX;
+
+ MPI_Datatype chunk;
+ MPI_ASSERT(MPI_Type_contiguous(BIGMPI_MAX, oldtype, &chunk));
+
+ MPI_Datatype chunks;
+ MPI_ASSERT(MPI_Type_contiguous(c, chunk, &chunks));
+
+ MPI_Datatype remainder;
+ MPI_ASSERT(MPI_Type_contiguous(r, oldtype, &remainder));
+
+ int typesize;
+ MPI_ASSERT(MPI_Type_size(oldtype, &typesize));
+
+ MPI_Aint remdisp = (MPI_Aint)c*BIGMPI_MAX*typesize; /* must explicit-cast to avoid overflow */
+ int array_of_blocklengths[2] = {1,1};
+ MPI_Aint array_of_displacements[2] = {0,remdisp};
+ MPI_Datatype array_of_types[2] = {chunks,remainder};
+
+ MPI_ASSERT(MPI_Type_create_struct(2, array_of_blocklengths, array_of_displacements, array_of_types, newtype));
+ MPI_ASSERT(MPI_Type_commit(newtype));
+
+ MPI_ASSERT(MPI_Type_free(&chunk));
+ MPI_ASSERT(MPI_Type_free(&chunks));
+ MPI_ASSERT(MPI_Type_free(&remainder));
+
+ return MPI_SUCCESS;
+}
+
+
+int main(int argc, char * argv[])
+{
+ int provided;
+ size_t i;
+ MPI_Count j;
+ MPI_ASSERT(MPI_Init_thread(&argc, &argv, MPI_THREAD_SINGLE, &provided));
+
+ int rank, size;
+ MPI_ASSERT(MPI_Comm_rank(MPI_COMM_WORLD, &rank));
+ MPI_ASSERT(MPI_Comm_size(MPI_COMM_WORLD, &size));
+
+ int logn = (argc>1) ? atoi(argv[1]) : 32;
+ size_t count = (size_t)1<<logn; /* explicit cast required */
+
+ MPI_Datatype bigtype;
+ MPI_ASSERT(MPIX_Type_contiguous_x( (MPI_Count)count, MPI_CHAR, &bigtype));
+ MPI_ASSERT(MPI_Type_commit(&bigtype));
+
+ char * rbuf = NULL;
+ char * sbuf = NULL;
+
+ rbuf = malloc( count * sizeof(char)); assert(rbuf!=NULL);
+ sbuf = malloc( count * sizeof(char)); assert(sbuf!=NULL);
+
+ for (i=0; i<count; i++)
+ rbuf[i] = 'a';
+ for (i=0; i<count; i++)
+ sbuf[i] = 'z';
+
+ MPI_Request requests[2];
+ MPI_Status statuses[2];
+
+ if (rank==(size-1)) {
+ MPI_ASSERT(MPI_Irecv(rbuf, 1, bigtype, 0, 0, MPI_COMM_WORLD, &(requests[1]) ));
+ }
+ if (rank==0) {
+ MPI_ASSERT(MPI_Isend(sbuf, 1, bigtype, size-1, 0, MPI_COMM_WORLD, &(requests[0]) ));
+ }
+
+ MPI_Count ocount[2];
+
+ if (size==1) {
+ MPI_ASSERT(MPI_Waitall(2, requests, statuses));
+ MPI_ASSERT(MPI_Get_elements_x( &(statuses[1]), MPI_CHAR, &(ocount[1])));
+ }
+ else {
+ if (rank==(size-1)) {
+ MPI_ASSERT(MPI_Wait( &(requests[1]), &(statuses[1]) ));
+ MPI_ASSERT(MPI_Get_elements_x( &(statuses[1]), MPI_CHAR, &(ocount[1]) ));
+ } else if (rank==0) {
+ MPI_ASSERT(MPI_Wait( &(requests[0]), &(statuses[0]) ));
+ MPI_ASSERT(MPI_Get_elements_x( &(statuses[0]), MPI_CHAR, &(ocount[0]) ));
+ }
+ }
+
+ /* correctness check */
+ if (rank==(size-1)) {
+ MPI_Count errors = 0;
+ for (j=0; j<count; j++)
+ errors += ( rbuf[j] != 'z' );
+ if (errors == 0) {
+ printf(" No Errors\n");
+ } else {
+ printf("errors = %lld \n", errors);
+ }
+ }
+
+ free(rbuf);
+ free(sbuf);
+
+ MPI_ASSERT(MPI_Type_free(&bigtype));
+
+ MPI_ASSERT(MPI_Finalize());
+
+ return 0;
+}
diff --git a/test/mpi/datatype/testlist b/test/mpi/datatype/testlist
index 77701be..b64d59e 100644
--- a/test/mpi/datatype/testlist
+++ b/test/mpi/datatype/testlist
@@ -51,3 +51,5 @@ longdouble 1
large-count 1 mpiversion=3.0 xfail=ticket1767
cxx-types 1 mpiversion=3.0
large_type 1 mpiversion=3.0 xfail=ticket1893
+large_type_sendrec 2 arg=31 mpiversion=3.0 xfail=ticket1893
+large_type_sendrec 2 arg=32 mpiversion=3.0 xfail=ticket1893
-----------------------------------------------------------------------
Summary of changes:
test/mpi/datatype/Makefile.am | 1 +
test/mpi/datatype/large_type_sendrec.c | 181 ++++++++++++++++++++++++++++++++
test/mpi/datatype/testlist | 2 +
3 files changed, 184 insertions(+), 0 deletions(-)
create mode 100644 test/mpi/datatype/large_type_sendrec.c
hooks/post-receive
--
MPICH primary repository
More information about the commits
mailing list