int count, size, rank;
int cerrcnt;
-struct int_test { int a; int b; };
-struct long_test { long a; int b; };
-struct short_test { short a; int b; };
-struct float_test { float a; int b; };
-struct double_test { double a; int b; };
+struct int_test {
+ int a;
+ int b;
+};
+struct long_test {
+ long a;
+ int b;
+};
+struct short_test {
+ short a;
+ int b;
+};
+struct float_test {
+ float a;
+ int b;
+};
+struct double_test {
+ double a;
+ int b;
+};
#define mpi_op2str(op) \
((op == MPI_SUM) ? "MPI_SUM" : \
rank, name, mpi_op2str(mpi_op)); \
} \
free(in); free(out); free(sol); \
- } while(0)
+ } while (0)
-/* The logic on the error check on MPI_Allreduce assumes that all
+/* The logic on the error check on MPI_Allreduce assumes that all
MPI_Allreduce routines return a failure if any do - this is sufficient
for MPI implementations that reject some of the valid op/datatype pairs
- (and motivated this addition, as some versions of the IBM MPI
+ (and motivated this addition, as some versions of the IBM MPI
failed in just this way).
*/
#define ALLREDUCE_AND_FREE(mpi_type, mpi_op, in, out, sol) \
{ \
int i, rc, lerrcnt = 0; \
rc = MPI_Allreduce(in, out, count, mpi_type, mpi_op, MPI_COMM_WORLD); \
- if (rc) { lerrcnt++; cerrcnt++; MTestPrintError( rc ); } \
+ if (rc) { lerrcnt++; cerrcnt++; MTestPrintError(rc); } \
else { \
for (i = 0; i < count; i++) { \
if (out[i] != sol[i]) { \
{ \
int i, rc, lerrcnt = 0; \
rc = MPI_Allreduce(in, out, count, mpi_type, mpi_op, MPI_COMM_WORLD); \
- if (rc) { lerrcnt++; cerrcnt++; MTestPrintError( rc ); } \
+ if (rc) { lerrcnt++; cerrcnt++; MTestPrintError(rc); } \
else { \
for (i = 0; i < count; i++) { \
if ((out[i].a != sol[i].a) || (out[i].b != sol[i].b)) { \
op##_test##post(unsigned char, MPI_BYTE); \
}
-/* Make sure that we test complex and double complex, even if long
+/* Make sure that we test complex and double complex, even if long
double complex is not available */
#if defined(USE_LONG_DOUBLE_COMPLEX)
#else
#if MTEST_HAVE_MIN_MPI_VERSION(2,2) && defined(HAVE_FLOAT__COMPLEX) \
- && defined(HAVE_DOUBLE__COMPLEX)
+ && defined(HAVE_DOUBLE__COMPLEX)
#define test_types_set4(op, post) \
do { \
op##_test##post(float _Complex, MPI_C_FLOAT_COMPLEX); \
#define test_types_set5(op, post) do { } while (0)
#endif
-int main( int argc, char **argv )
+int main(int argc, char **argv)
{
- MTest_Init( &argc, &argv );
+ MTest_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if (size < 2) {
- fprintf( stderr, "At least 2 processes required\n" );
- MPI_Abort( MPI_COMM_WORLD, 1 );
+ fprintf(stderr, "At least 2 processes required\n");
+ MPI_Abort(MPI_COMM_WORLD, 1);
}
- /* Set errors return so that we can provide better information
- should a routine reject one of the operand/datatype pairs */
- MPI_Errhandler_set( MPI_COMM_WORLD, MPI_ERRORS_RETURN );
+ /* Set errors return so that we can provide better information
+ * should a routine reject one of the operand/datatype pairs */
+ MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
count = 10;
/* Allow an argument to override the count.
- Note that the product tests may fail if the count is very large.
+ * Note that the product tests may fail if the count is very large.
*/
if (argc >= 2) {
- count = atoi( argv[1] );
- if (count <= 0) {
- fprintf( stderr, "Invalid count argument %s\n", argv[1] );
- MPI_Abort( MPI_COMM_WORLD, 1 );
- }
+ count = atoi(argv[1]);
+ if (count <= 0) {
+ fprintf(stderr, "Invalid count argument %s\n", argv[1]);
+ MPI_Abort(MPI_COMM_WORLD, 1);
+ }
}
test_types_set2(sum, 1);
minloc_test(struct float_test, MPI_FLOAT_INT);
minloc_test(struct double_test, MPI_DOUBLE_INT);
- MPI_Errhandler_set( MPI_COMM_WORLD, MPI_ERRORS_ARE_FATAL );
- MTest_Finalize( cerrcnt );
+ MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_ARE_FATAL);
+ MTest_Finalize(cerrcnt);
MPI_Finalize();
return 0;
}