+++ /dev/null
-set(tesh_files
- ${tesh_files}
-
- PARENT_SCOPE
- )
-set(xml_files
- ${xml_files}
- PARENT_SCOPE
- )
-set(examples_src
- ${examples_src}
- PARENT_SCOPE
- )
-set(bin_files
- ${bin_files}
- PARENT_SCOPE
- )
-
-#set(stdo_std_smpi
-# ${CMAKE_CURRENT_SOURCE_DIR}/topol/cartmap.std
-# ${CMAKE_CURRENT_SOURCE_DIR}/topol/graphtest.std
-# ${CMAKE_CURRENT_SOURCE_DIR}/topol/cartf.std
-#)
-
-if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_HOME_DIRECTORY}")
-else()
- foreach(srcfile ${stdo_std_smpi})
- set(dstfile ${srcfile})
- string(REPLACE "${CMAKE_HOME_DIRECTORY}" "${CMAKE_BINARY_DIR}" dstfile "${dstfile}")
- #message("copy ${srcfile} to ${dstfile}")
- configure_file("${srcfile}" "${dstfile}" COPYONLY)
- endforeach()
-endif()
-
-set(txt_files
- ${txt_files}
- ${CMAKE_CURRENT_SOURCE_DIR}/README
- ${CMAKE_CURRENT_SOURCE_DIR}/runbase
- PARENT_SCOPE)
+++ /dev/null
-This directory contains a variety of different test codes
-of different types. This directory and many of the files in
-it are still undergoing active development and change. Please
-forgive (and report) any problems you have with these programs.
-
-These tests may be used with any MPI implementation. In a few cases,
-differences in error messages may be reported; these are not errors, of
-course. However, the accuracy and detail of the messages should be evaluated.
-
-To build and run the tests, execute configure followed by make testing.
-The options to configure for some MPI implementations follow:
-
-SGI:
- ./configure -cc=cc -fc=f77
-IBM:
- ./configure -cc=mpcc -fc=mpxlf
- (You also need a script called "mpirun" that takes a -np number-of-procs
- argument, since there are so many different ways to run parallel
- programs on IBM systems)
-MPICH:
- ./configure -mpichpath=<path to MPICH build bin directory>
-
-The directories are as follows:
-
-pt2pt - Test cases that generally cover various point to point
- routines, such as send, isend, probe, etc... The
- README in this directory contains some additional
- useful information about running the tests. The tests
- in this directory are most complete.
-
-
-coll - Test programs for various collective operations
-
-context - Test programs for context operations
-
-env - Test programs for the environment routines
-
-profile - Test program(s) for MPI_Pcontrol
-
-topol - Test programs for the topology routines
-
-lederman- A series of tests of various types written by Steve
- Lederman
-
-
-Other directories and additional tests will be added in the future.
-
-To run the test, but not leave the executables around, do (in this directory)
-
- make TESTARGS=-small testing >& testing.out
-
-If your MPI requires a boot step before running programs, use the target
-testing-boot instead of testint:
-
- make TESTARGS=-small testing-boot >& testing.out
-
-This will boot any MPI startup demons, and it will stop them at the end of the
-test.
-
-If you are NOT using the MPICH implementation, then you can run the configure
-script in this directory. If you need to view the configure options, then type
- configure -help
-and a list of configure options will be provided.
-
-You will probably also have to provide an "mpirun" program or script.
-This has roughly the form
-
- mpirun -mvhome -np n -mvback "string" programname programargs
-
-The options -mvhome and -mvback "string" can be ignored; they are needed only
-on systems that do not share file systems with the system running the runtests
-script (yes, there is one such system). The option "-np n" specifies that
-"n" processes are needed. Note that this is not always a power of 2; systems
-must be prepared to accept any (small) value of n.
-
+++ /dev/null
-cmake_minimum_required(VERSION 2.6)
-
-if(enable_smpi)
-
- if(WIN32)
- set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h")
- else()
- set(CMAKE_C_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc")
- set(CMAKE_Fortran_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff")
- endif()
-
- set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
- set(MPICH_FLAGS "-DHAVE_STDLIB_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STRING_H=1 -DUSE_STDARG=1 -DHAVE_LONG_DOUBLE=1 -DHAVE_PROTOTYPES=1 -DHAVE_SIGNAL_H=1 -DHAVE_SIGACTION=1 -DHAVE_SLEEP=1 -DHAVE_SYSCONF=1")
-
- include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi")
-
- add_executable(coll1 coll1.c test.c)
- add_executable(coll2 coll2.c test.c)
- add_executable(coll3 coll3.c test.c)
- add_executable(coll4 coll4.c test.c)
- add_executable(coll5 coll5.c test.c)
- add_executable(coll6 coll6.c test.c)
- add_executable(coll7 coll7.c test.c)
- add_executable(coll8 coll8.c test.c)
- add_executable(coll9 coll9.c test.c)
- add_executable(coll10 coll10.c test.c)
- add_executable(coll11 coll11.c test.c)
- add_executable(coll12 coll12.c test.c)
- add_executable(coll13 coll13.c)
- add_executable(allredmany allredmany.c)
- add_executable(bcastbug2 bcastbug2.c test.c)
- add_executable(bcastbug bcastbug.c test.c)
- add_executable(bcastvec bcastvec.c test.c )
- add_executable(grouptest grouptest.c test.c)
- add_executable(redtst redtst.c test.c)
- add_executable(barrier barrier.c test.c)
- add_executable(bcast_mpich bcast.c test.c)
- add_executable(allred allred.c ../pt2pt/gcomm.c)
- add_executable(allred2 allred2.c ../pt2pt/gcomm.c)
- add_executable(scatterv scatterv.c)
- add_executable(scattern scattern.c)
- add_executable(redscat redscat.c)
- add_executable(alltoallv_mpich alltoallv.c)
- add_executable(scantst scantst.c test.c)
- add_executable(longuser longuser.c test.c)
-
- if(SMPI_F2C)
- add_executable(allredf allredf.f)
- add_executable(assocf assocf.f)
- add_executable(allgatherf allgatherf.f)
- add_executable(bcastlog bcastlog.f)
- endif()
-
- target_link_libraries(coll1 simgrid)
- target_link_libraries(coll2 simgrid)
- target_link_libraries(coll3 simgrid)
- target_link_libraries(coll4 simgrid)
- target_link_libraries(coll5 simgrid)
- target_link_libraries(coll6 simgrid)
- target_link_libraries(coll7 simgrid)
- target_link_libraries(coll8 simgrid)
- target_link_libraries(coll9 simgrid)
- target_link_libraries(coll10 simgrid)
- target_link_libraries(coll11 simgrid)
- target_link_libraries(coll12 simgrid)
- target_link_libraries(coll13 simgrid)
- target_link_libraries(allredmany simgrid)
- target_link_libraries(bcastbug simgrid)
- target_link_libraries(bcastbug2 simgrid)
- target_link_libraries(bcastvec simgrid)
- target_link_libraries(grouptest simgrid)
- target_link_libraries(redtst simgrid)
- target_link_libraries(barrier simgrid)
- target_link_libraries(bcast_mpich simgrid)
- target_link_libraries(allred simgrid)
- target_link_libraries(allred2 simgrid)
- target_link_libraries(scatterv simgrid)
- target_link_libraries(scattern simgrid)
- target_link_libraries(redscat simgrid)
- target_link_libraries(longuser simgrid)
- target_link_libraries(alltoallv_mpich simgrid)
- target_link_libraries(scantst simgrid)
- if(SMPI_F2C)
- target_link_libraries(allredf simgrid)
- target_link_libraries(assocf simgrid)
- target_link_libraries(allgatherf simgrid)
- target_link_libraries(bcastlog simgrid)
- endif()
-
- set_target_properties(coll1 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(coll2 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(coll3 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(coll4 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(coll5 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(coll6 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(coll7 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(coll8 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(coll9 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(coll10 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(coll11 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(coll12 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(coll13 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(allredmany PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(bcastbug PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(bcastbug2 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(bcastvec PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(grouptest PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(redtst PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(barrier PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(bcast_mpich PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(allred PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(allred2 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(scatterv PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(scattern PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(redscat PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(longuser PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(alltoallv_mpich PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(scantst PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- if(SMPI_F2C)
- set_target_properties(allredf PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(assocf PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(allgatherf PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(bcastlog PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- endif()
-
-endif()
-
-set(tesh_files
- ${tesh_files}
- PARENT_SCOPE
- )
-set(xml_files
- ${xml_files}
- PARENT_SCOPE
- )
-set(examples_src
- ${examples_src}
- ${CMAKE_CURRENT_SOURCE_DIR}/coll1.c
- ${CMAKE_CURRENT_SOURCE_DIR}/coll2.c
- ${CMAKE_CURRENT_SOURCE_DIR}/coll3.c
- ${CMAKE_CURRENT_SOURCE_DIR}/coll4.c
- ${CMAKE_CURRENT_SOURCE_DIR}/coll5.c
- ${CMAKE_CURRENT_SOURCE_DIR}/coll6.c
- ${CMAKE_CURRENT_SOURCE_DIR}/coll7.c
- ${CMAKE_CURRENT_SOURCE_DIR}/coll8.c
- ${CMAKE_CURRENT_SOURCE_DIR}/coll9.c
- ${CMAKE_CURRENT_SOURCE_DIR}/coll10.c
- ${CMAKE_CURRENT_SOURCE_DIR}/coll11.c
- ${CMAKE_CURRENT_SOURCE_DIR}/coll12.c
- ${CMAKE_CURRENT_SOURCE_DIR}/coll13.c
- ${CMAKE_CURRENT_SOURCE_DIR}/allredmany.c
- ${CMAKE_CURRENT_SOURCE_DIR}/bcastbug.c
- ${CMAKE_CURRENT_SOURCE_DIR}/bcastbug2.c
- ${CMAKE_CURRENT_SOURCE_DIR}/bcastvec.c
- ${CMAKE_CURRENT_SOURCE_DIR}/grouptest.c
- ${CMAKE_CURRENT_SOURCE_DIR}/redtst.c
- ${CMAKE_CURRENT_SOURCE_DIR}/barrier.c
- ${CMAKE_CURRENT_SOURCE_DIR}/bcast.c
- ${CMAKE_CURRENT_SOURCE_DIR}/allred.c
- ${CMAKE_CURRENT_SOURCE_DIR}/allred2.c
- ${CMAKE_CURRENT_SOURCE_DIR}/scatterv.c
- ${CMAKE_CURRENT_SOURCE_DIR}/scattern.c
- ${CMAKE_CURRENT_SOURCE_DIR}/redscat.c
- ${CMAKE_CURRENT_SOURCE_DIR}/longuser.c
- ${CMAKE_CURRENT_SOURCE_DIR}/alltoallv.c
- ${CMAKE_CURRENT_SOURCE_DIR}/scantst.c
- ${CMAKE_CURRENT_SOURCE_DIR}/test.c
- ${CMAKE_CURRENT_SOURCE_DIR}/test.h
- ${CMAKE_CURRENT_SOURCE_DIR}/allgatherf.f
- ${CMAKE_CURRENT_SOURCE_DIR}/allredf.f
- ${CMAKE_CURRENT_SOURCE_DIR}/allredf.std
- ${CMAKE_CURRENT_SOURCE_DIR}/assocf.f
- ${CMAKE_CURRENT_SOURCE_DIR}/bcastlog.f
-
- PARENT_SCOPE
- )
-set(bin_files
- ${bin_files}
- PARENT_SCOPE
- )
-set(txt_files
- ${txt_files}
- ${CMAKE_CURRENT_SOURCE_DIR}/runtests
- ${CMAKE_CURRENT_SOURCE_DIR}/allredmany.std
- ${CMAKE_CURRENT_SOURCE_DIR}/allred.std
- ${CMAKE_CURRENT_SOURCE_DIR}/allredf.std
- ${CMAKE_CURRENT_SOURCE_DIR}/coll13.std
- ${CMAKE_CURRENT_SOURCE_DIR}/scatterv.std
- PARENT_SCOPE
- )
+++ /dev/null
-c
-c This test looks at sending some data with a count of zero.
-c
- program testmpi
- integer mnprocs, lcwk1
- parameter ( mnprocs = 2, lcwk1 = 6 )
- integer comm, rc, myid, nprocs, ierr, i,
- & recvts(0:mnprocs-1), displs(0:mnprocs-1)
- double precision wrkbuf(3), cwk1(lcwk1)
- include 'mpif.h'
-c
- call MPI_INIT( ierr )
- comm = MPI_COMM_WORLD
- call MPI_COMM_RANK( comm, myid, ierr )
- call MPI_COMM_SIZE( comm, nprocs, ierr )
-c
- do i = 1, lcwk1
- cwk1(i) = -10
- end do
- do i=1,3
- wrkbuf(i) = myid
- end do
- do i = 0, mnprocs-1
- recvts(i) = 3
- displs(i) = 3 * i
- end do
- recvts(mnprocs-1) = 0
- displs(mnprocs-1) = 0
-c
- call MPI_ALLGATHERV( wrkbuf, recvts(myid),
- & MPI_DOUBLE_PRECISION, cwk1, recvts,
- & displs, MPI_DOUBLE_PRECISION, comm, ierr )
-c
- do i = 1, lcwk1
- print *, myid, i, cwk1(i)
- end do
-c
- call MPI_FINALIZE(rc)
-c
- end
-c
+++ /dev/null
-
-#include <math.h>
-#include "mpi.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include "test.h"
-#include "../pt2pt/gcomm.h"
-
-int verbose = 1;
-int main( int argc, char **argv )
-{
-int count, errcnt = 0, gerr = 0, toterr, size, rank;
-MPI_Comm comm;
-
-int world_rank;
-
-MPI_Init( &argc, &argv );
-MPI_Comm_rank( MPI_COMM_WORLD, &world_rank );
-
-/* First tests */
-//MakeComms( comms, 10, &ncomm, 0 );
-//for (ii=0; ii<ncomm; ii++) {
-comm = MPI_COMM_WORLD;
-
-
-MPI_Comm_size( comm, &size );
-MPI_Comm_rank( comm, &rank );
-count = 10;
-
-/* Test sum */
-if (world_rank == 0 && verbose) printf( "Testing MPI_SUM...\n" );
-
-
-
-{
-int *in, *out, *sol;
-int i, fnderr=0;
-in = (int *)malloc( count * sizeof(int) );
-out = (int *)malloc( count * sizeof(int) );
-sol = (int *)malloc( count * sizeof(int) );
-for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_INT, MPI_SUM, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_INT and op MPI_SUM\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-long *in, *out, *sol;
-int i, fnderr=0;
-in = (long *)malloc( count * sizeof(long) );
-out = (long *)malloc( count * sizeof(long) );
-sol = (long *)malloc( count * sizeof(long) );
-for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_LONG, MPI_SUM, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_LONG and op MPI_SUM\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-short *in, *out, *sol;
-int i, fnderr=0;
-in = (short *)malloc( count * sizeof(short) );
-out = (short *)malloc( count * sizeof(short) );
-sol = (short *)malloc( count * sizeof(short) );
-for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_SHORT, MPI_SUM, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_SHORT and op MPI_SUM\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned short *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned short *)malloc( count * sizeof(unsigned short) );
-out = (unsigned short *)malloc( count * sizeof(unsigned short) );
-sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
-for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_SUM, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_SUM\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned *)malloc( count * sizeof(unsigned) );
-out = (unsigned *)malloc( count * sizeof(unsigned) );
-sol = (unsigned *)malloc( count * sizeof(unsigned) );
-for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_SUM, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED and op MPI_SUM\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned long *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned long *)malloc( count * sizeof(unsigned long) );
-out = (unsigned long *)malloc( count * sizeof(unsigned long) );
-sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
-for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_SUM, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_SUM\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-float *in, *out, *sol;
-int i, fnderr=0;
-in = (float *)malloc( count * sizeof(float) );
-out = (float *)malloc( count * sizeof(float) );
-sol = (float *)malloc( count * sizeof(float) );
-for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_FLOAT, MPI_SUM, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_FLOAT and op MPI_SUM\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-double *in, *out, *sol;
-int i, fnderr=0;
-in = (double *)malloc( count * sizeof(double) );
-out = (double *)malloc( count * sizeof(double) );
-sol = (double *)malloc( count * sizeof(double) );
-for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_DOUBLE, MPI_SUM, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_DOUBLE and op MPI_SUM\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-gerr += errcnt;
-if (errcnt > 0)
- printf( "Found %d errors on %d for MPI_SUM\n", errcnt, rank );
-errcnt = 0;
-
-/* Test product */
-if (world_rank == 0 && verbose) printf( "Testing MPI_PROD...\n" );
-
-{
-int *in, *out, *sol;
-int i, fnderr=0;
-in = (int *)malloc( count * sizeof(int) );
-out = (int *)malloc( count * sizeof(int) );
-sol = (int *)malloc( count * sizeof(int) );
-for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_INT, MPI_PROD, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_INT and op MPI_PROD\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-long *in, *out, *sol;
-int i, fnderr=0;
-in = (long *)malloc( count * sizeof(long) );
-out = (long *)malloc( count * sizeof(long) );
-sol = (long *)malloc( count * sizeof(long) );
-for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_LONG, MPI_PROD, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_LONG and op MPI_PROD\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-short *in, *out, *sol;
-int i, fnderr=0;
-in = (short *)malloc( count * sizeof(short) );
-out = (short *)malloc( count * sizeof(short) );
-sol = (short *)malloc( count * sizeof(short) );
-for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_SHORT, MPI_PROD, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_SHORT and op MPI_PROD\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned short *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned short *)malloc( count * sizeof(unsigned short) );
-out = (unsigned short *)malloc( count * sizeof(unsigned short) );
-sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
-for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_PROD, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_PROD\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned *)malloc( count * sizeof(unsigned) );
-out = (unsigned *)malloc( count * sizeof(unsigned) );
-sol = (unsigned *)malloc( count * sizeof(unsigned) );
-for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_PROD, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED and op MPI_PROD\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned long *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned long *)malloc( count * sizeof(unsigned long) );
-out = (unsigned long *)malloc( count * sizeof(unsigned long) );
-sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
-for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_PROD, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_PROD\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-float *in, *out, *sol;
-int i, fnderr=0;
-in = (float *)malloc( count * sizeof(float) );
-out = (float *)malloc( count * sizeof(float) );
-sol = (float *)malloc( count * sizeof(float) );
-for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_FLOAT, MPI_PROD, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_FLOAT and op MPI_PROD\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-double *in, *out, *sol;
-int i, fnderr=0;
-in = (double *)malloc( count * sizeof(double) );
-out = (double *)malloc( count * sizeof(double) );
-sol = (double *)malloc( count * sizeof(double) );
-for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_DOUBLE, MPI_PROD, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_DOUBLE and op MPI_PROD\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-gerr += errcnt;
-if (errcnt > 0)
- printf( "Found %d errors on %d for MPI_PROD\n", errcnt, rank );
-errcnt = 0;
-
-/* Test max */
-if (world_rank == 0 && verbose) printf( "Testing MPI_MAX...\n" );
-
-{
-int *in, *out, *sol;
-int i, fnderr=0;
-in = (int *)malloc( count * sizeof(int) );
-out = (int *)malloc( count * sizeof(int) );
-sol = (int *)malloc( count * sizeof(int) );
-for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_INT, MPI_MAX, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_INT and op MPI_MAX\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-long *in, *out, *sol;
-int i, fnderr=0;
-in = (long *)malloc( count * sizeof(long) );
-out = (long *)malloc( count * sizeof(long) );
-sol = (long *)malloc( count * sizeof(long) );
-for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_LONG, MPI_MAX, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_LONG and op MPI_MAX\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-short *in, *out, *sol;
-int i, fnderr=0;
-in = (short *)malloc( count * sizeof(short) );
-out = (short *)malloc( count * sizeof(short) );
-sol = (short *)malloc( count * sizeof(short) );
-for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_SHORT, MPI_MAX, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_SHORT and op MPI_MAX\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned short *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned short *)malloc( count * sizeof(unsigned short) );
-out = (unsigned short *)malloc( count * sizeof(unsigned short) );
-sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
-for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_MAX, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_MAX\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned *)malloc( count * sizeof(unsigned) );
-out = (unsigned *)malloc( count * sizeof(unsigned) );
-sol = (unsigned *)malloc( count * sizeof(unsigned) );
-for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_MAX, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED and op MPI_MAX\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned long *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned long *)malloc( count * sizeof(unsigned long) );
-out = (unsigned long *)malloc( count * sizeof(unsigned long) );
-sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
-for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_MAX, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_MAX\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-float *in, *out, *sol;
-int i, fnderr=0;
-in = (float *)malloc( count * sizeof(float) );
-out = (float *)malloc( count * sizeof(float) );
-sol = (float *)malloc( count * sizeof(float) );
-for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_FLOAT, MPI_MAX, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_FLOAT and op MPI_MAX\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-double *in, *out, *sol;
-int i, fnderr=0;
-in = (double *)malloc( count * sizeof(double) );
-out = (double *)malloc( count * sizeof(double) );
-sol = (double *)malloc( count * sizeof(double) );
-for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_DOUBLE, MPI_MAX, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_DOUBLE and op MPI_MAX\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-gerr += errcnt;
-if (errcnt > 0)
- printf( "Found %d errors on %d for MPI_MAX\n", errcnt, rank );
-errcnt = 0;
-
-/* Test min */
-if (world_rank == 0 && verbose) printf( "Testing MPI_MIN...\n" );
-
-{
-int *in, *out, *sol;
-int i, fnderr=0;
-in = (int *)malloc( count * sizeof(int) );
-out = (int *)malloc( count * sizeof(int) );
-sol = (int *)malloc( count * sizeof(int) );
-for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_INT, MPI_MIN, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_INT and op MPI_MIN\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-long *in, *out, *sol;
-int i, fnderr=0;
-in = (long *)malloc( count * sizeof(long) );
-out = (long *)malloc( count * sizeof(long) );
-sol = (long *)malloc( count * sizeof(long) );
-for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_LONG, MPI_MIN, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_LONG and op MPI_MIN\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-short *in, *out, *sol;
-int i, fnderr=0;
-in = (short *)malloc( count * sizeof(short) );
-out = (short *)malloc( count * sizeof(short) );
-sol = (short *)malloc( count * sizeof(short) );
-for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_SHORT, MPI_MIN, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_SHORT and op MPI_MIN\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned short *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned short *)malloc( count * sizeof(unsigned short) );
-out = (unsigned short *)malloc( count * sizeof(unsigned short) );
-sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
-for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_MIN, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_MIN\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned *)malloc( count * sizeof(unsigned) );
-out = (unsigned *)malloc( count * sizeof(unsigned) );
-sol = (unsigned *)malloc( count * sizeof(unsigned) );
-for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_MIN, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED and op MPI_MIN\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned long *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned long *)malloc( count * sizeof(unsigned long) );
-out = (unsigned long *)malloc( count * sizeof(unsigned long) );
-sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
-for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_MIN, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_MIN\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-float *in, *out, *sol;
-int i, fnderr=0;
-in = (float *)malloc( count * sizeof(float) );
-out = (float *)malloc( count * sizeof(float) );
-sol = (float *)malloc( count * sizeof(float) );
-for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_FLOAT, MPI_MIN, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_FLOAT and op MPI_MIN\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-double *in, *out, *sol;
-int i, fnderr=0;
-in = (double *)malloc( count * sizeof(double) );
-out = (double *)malloc( count * sizeof(double) );
-sol = (double *)malloc( count * sizeof(double) );
-for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_DOUBLE, MPI_MIN, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_DOUBLE and op MPI_MIN\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-gerr += errcnt;
-if (errcnt > 0)
- printf( "Found %d errors on %d for MPI_MIN\n", errcnt, rank );
-errcnt = 0;
-
-/* Test LOR */
-if (world_rank == 0 && verbose) printf( "Testing MPI_LOR...\n" );
-
-{
-int *in, *out, *sol;
-int i, fnderr=0;
-in = (int *)malloc( count * sizeof(int) );
-out = (int *)malloc( count * sizeof(int) );
-sol = (int *)malloc( count * sizeof(int) );
-for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = (size > 1);
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_INT, MPI_LOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_INT and op MPI_LOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-long *in, *out, *sol;
-int i, fnderr=0;
-in = (long *)malloc( count * sizeof(long) );
-out = (long *)malloc( count * sizeof(long) );
-sol = (long *)malloc( count * sizeof(long) );
-for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = (size > 1);
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_LONG, MPI_LOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_LONG and op MPI_LOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-short *in, *out, *sol;
-int i, fnderr=0;
-in = (short *)malloc( count * sizeof(short) );
-out = (short *)malloc( count * sizeof(short) );
-sol = (short *)malloc( count * sizeof(short) );
-for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = (size > 1);
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_SHORT and op MPI_LOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned short *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned short *)malloc( count * sizeof(unsigned short) );
-out = (unsigned short *)malloc( count * sizeof(unsigned short) );
-sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
-for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = (size > 1);
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned *)malloc( count * sizeof(unsigned) );
-out = (unsigned *)malloc( count * sizeof(unsigned) );
-sol = (unsigned *)malloc( count * sizeof(unsigned) );
-for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = (size > 1);
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED and op MPI_LOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned long *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned long *)malloc( count * sizeof(unsigned long) );
-out = (unsigned long *)malloc( count * sizeof(unsigned long) );
-sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
-for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = (size > 1);
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-gerr += errcnt;
-if (errcnt > 0)
- printf( "Found %d errors on %d for MPI_LOR(1)\n", errcnt, rank );
-errcnt = 0;
-
-
-{
-int *in, *out, *sol;
-int i, fnderr=0;
-in = (int *)malloc( count * sizeof(int) );
-out = (int *)malloc( count * sizeof(int) );
-sol = (int *)malloc( count * sizeof(int) );
-for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_INT, MPI_LOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_INT and op MPI_LOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-long *in, *out, *sol;
-int i, fnderr=0;
-in = (long *)malloc( count * sizeof(long) );
-out = (long *)malloc( count * sizeof(long) );
-sol = (long *)malloc( count * sizeof(long) );
-for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_LONG, MPI_LOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_LONG and op MPI_LOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-short *in, *out, *sol;
-int i, fnderr=0;
-in = (short *)malloc( count * sizeof(short) );
-out = (short *)malloc( count * sizeof(short) );
-sol = (short *)malloc( count * sizeof(short) );
-for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_SHORT and op MPI_LOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned short *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned short *)malloc( count * sizeof(unsigned short) );
-out = (unsigned short *)malloc( count * sizeof(unsigned short) );
-sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
-for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned *)malloc( count * sizeof(unsigned) );
-out = (unsigned *)malloc( count * sizeof(unsigned) );
-sol = (unsigned *)malloc( count * sizeof(unsigned) );
-for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED and op MPI_LOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned long *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned long *)malloc( count * sizeof(unsigned long) );
-out = (unsigned long *)malloc( count * sizeof(unsigned long) );
-sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
-for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-gerr += errcnt;
-if (errcnt > 0)
- printf( "Found %d errors on %d for MPI_LOR(0)\n", errcnt, rank );
-errcnt = 0;
-
-/* Test LXOR */
-if (world_rank == 0 && verbose) printf( "Testing MPI_LXOR...\n" );
-
-{
-int *in, *out, *sol;
-int i, fnderr=0;
-in = (int *)malloc( count * sizeof(int) );
-out = (int *)malloc( count * sizeof(int) );
-sol = (int *)malloc( count * sizeof(int) );
-for (i=0; i<count; i++) { *(in + i) = (rank == 1); *(sol + i) = (size > 1);
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_INT, MPI_LXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_INT and op MPI_LXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-long *in, *out, *sol;
-int i, fnderr=0;
-in = (long *)malloc( count * sizeof(long) );
-out = (long *)malloc( count * sizeof(long) );
-sol = (long *)malloc( count * sizeof(long) );
-for (i=0; i<count; i++) { *(in + i) = (rank == 1); *(sol + i) = (size > 1);
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_LONG, MPI_LXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_LONG and op MPI_LXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-short *in, *out, *sol;
-int i, fnderr=0;
-in = (short *)malloc( count * sizeof(short) );
-out = (short *)malloc( count * sizeof(short) );
-sol = (short *)malloc( count * sizeof(short) );
-for (i=0; i<count; i++) { *(in + i) = (rank == 1); *(sol + i) = (size > 1);
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_SHORT and op MPI_LXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned short *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned short *)malloc( count * sizeof(unsigned short) );
-out = (unsigned short *)malloc( count * sizeof(unsigned short) );
-sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
-for (i=0; i<count; i++) { *(in + i) = (rank == 1); *(sol + i) = (size > 1);
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned *)malloc( count * sizeof(unsigned) );
-out = (unsigned *)malloc( count * sizeof(unsigned) );
-sol = (unsigned *)malloc( count * sizeof(unsigned) );
-for (i=0; i<count; i++) { *(in + i) = (rank == 1); *(sol + i) = (size > 1);
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED and op MPI_LXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned long *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned long *)malloc( count * sizeof(unsigned long) );
-out = (unsigned long *)malloc( count * sizeof(unsigned long) );
-sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
-for (i=0; i<count; i++) { *(in + i) = (rank == 1); *(sol + i) = (size > 1);
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-gerr += errcnt;
-if (errcnt > 0)
- printf( "Found %d errors on %d for MPI_LXOR(1)\n", errcnt, rank );
-errcnt = 0;
-
-
-{
-int *in, *out, *sol;
-int i, fnderr=0;
-in = (int *)malloc( count * sizeof(int) );
-out = (int *)malloc( count * sizeof(int) );
-sol = (int *)malloc( count * sizeof(int) );
-for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_INT, MPI_LXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_INT and op MPI_LXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-long *in, *out, *sol;
-int i, fnderr=0;
-in = (long *)malloc( count * sizeof(long) );
-out = (long *)malloc( count * sizeof(long) );
-sol = (long *)malloc( count * sizeof(long) );
-for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_LONG, MPI_LXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_LONG and op MPI_LXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-short *in, *out, *sol;
-int i, fnderr=0;
-in = (short *)malloc( count * sizeof(short) );
-out = (short *)malloc( count * sizeof(short) );
-sol = (short *)malloc( count * sizeof(short) );
-for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_SHORT and op MPI_LXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned short *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned short *)malloc( count * sizeof(unsigned short) );
-out = (unsigned short *)malloc( count * sizeof(unsigned short) );
-sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
-for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned *)malloc( count * sizeof(unsigned) );
-out = (unsigned *)malloc( count * sizeof(unsigned) );
-sol = (unsigned *)malloc( count * sizeof(unsigned) );
-for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED and op MPI_LXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned long *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned long *)malloc( count * sizeof(unsigned long) );
-out = (unsigned long *)malloc( count * sizeof(unsigned long) );
-sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
-for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-gerr += errcnt;
-if (errcnt > 0)
- printf( "Found %d errors on %d for MPI_LXOR(0)\n", errcnt, rank );
-errcnt = 0;
-
-
-{
-int *in, *out, *sol;
-int i, fnderr=0;
-in = (int *)malloc( count * sizeof(int) );
-out = (int *)malloc( count * sizeof(int) );
-sol = (int *)malloc( count * sizeof(int) );
-for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_INT, MPI_LXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_INT and op MPI_LXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-long *in, *out, *sol;
-int i, fnderr=0;
-in = (long *)malloc( count * sizeof(long) );
-out = (long *)malloc( count * sizeof(long) );
-sol = (long *)malloc( count * sizeof(long) );
-for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_LONG, MPI_LXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_LONG and op MPI_LXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-short *in, *out, *sol;
-int i, fnderr=0;
-in = (short *)malloc( count * sizeof(short) );
-out = (short *)malloc( count * sizeof(short) );
-sol = (short *)malloc( count * sizeof(short) );
-for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_SHORT and op MPI_LXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned short *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned short *)malloc( count * sizeof(unsigned short) );
-out = (unsigned short *)malloc( count * sizeof(unsigned short) );
-sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
-for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned *)malloc( count * sizeof(unsigned) );
-out = (unsigned *)malloc( count * sizeof(unsigned) );
-sol = (unsigned *)malloc( count * sizeof(unsigned) );
-for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED and op MPI_LXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned long *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned long *)malloc( count * sizeof(unsigned long) );
-out = (unsigned long *)malloc( count * sizeof(unsigned long) );
-sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
-for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-gerr += errcnt;
-if (errcnt > 0)
- printf( "Found %d errors on %d for MPI_LXOR(1-0)\n", errcnt, rank );
-errcnt = 0;
-
-/* Test LAND */
-if (world_rank == 0 && verbose) printf( "Testing MPI_LAND...\n" );
-
-{
-int *in, *out, *sol;
-int i, fnderr=0;
-in = (int *)malloc( count * sizeof(int) );
-out = (int *)malloc( count * sizeof(int) );
-sol = (int *)malloc( count * sizeof(int) );
-for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_INT, MPI_LAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_INT and op MPI_LAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-long *in, *out, *sol;
-int i, fnderr=0;
-in = (long *)malloc( count * sizeof(long) );
-out = (long *)malloc( count * sizeof(long) );
-sol = (long *)malloc( count * sizeof(long) );
-for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_LONG, MPI_LAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_LONG and op MPI_LAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-short *in, *out, *sol;
-int i, fnderr=0;
-in = (short *)malloc( count * sizeof(short) );
-out = (short *)malloc( count * sizeof(short) );
-sol = (short *)malloc( count * sizeof(short) );
-for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_SHORT and op MPI_LAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned short *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned short *)malloc( count * sizeof(unsigned short) );
-out = (unsigned short *)malloc( count * sizeof(unsigned short) );
-sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
-for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned *)malloc( count * sizeof(unsigned) );
-out = (unsigned *)malloc( count * sizeof(unsigned) );
-sol = (unsigned *)malloc( count * sizeof(unsigned) );
-for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED and op MPI_LAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned long *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned long *)malloc( count * sizeof(unsigned long) );
-out = (unsigned long *)malloc( count * sizeof(unsigned long) );
-sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
-for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-gerr += errcnt;
-if (errcnt > 0)
- printf( "Found %d errors on %d for MPI_LAND(0)\n", errcnt, rank );
-errcnt = 0;
-
-
-{
-int *in, *out, *sol;
-int i, fnderr=0;
-in = (int *)malloc( count * sizeof(int) );
-out = (int *)malloc( count * sizeof(int) );
-sol = (int *)malloc( count * sizeof(int) );
-for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 1;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_INT, MPI_LAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_INT and op MPI_LAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-long *in, *out, *sol;
-int i, fnderr=0;
-in = (long *)malloc( count * sizeof(long) );
-out = (long *)malloc( count * sizeof(long) );
-sol = (long *)malloc( count * sizeof(long) );
-for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 1;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_LONG, MPI_LAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_LONG and op MPI_LAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-short *in, *out, *sol;
-int i, fnderr=0;
-in = (short *)malloc( count * sizeof(short) );
-out = (short *)malloc( count * sizeof(short) );
-sol = (short *)malloc( count * sizeof(short) );
-for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 1;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_SHORT and op MPI_LAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned short *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned short *)malloc( count * sizeof(unsigned short) );
-out = (unsigned short *)malloc( count * sizeof(unsigned short) );
-sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
-for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 1;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned *)malloc( count * sizeof(unsigned) );
-out = (unsigned *)malloc( count * sizeof(unsigned) );
-sol = (unsigned *)malloc( count * sizeof(unsigned) );
-for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 1;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED and op MPI_LAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned long *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned long *)malloc( count * sizeof(unsigned long) );
-out = (unsigned long *)malloc( count * sizeof(unsigned long) );
-sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
-for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 1;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-gerr += errcnt;
-if (errcnt > 0)
- printf( "Found %d errors on %d for MPI_LAND(1)\n", errcnt, rank );
-errcnt = 0;
-
-/* Test BOR */
-if (world_rank == 0 && verbose) printf( "Testing MPI_BOR...\n" );
-
-{
-int *in, *out, *sol;
-int i, fnderr=0;
-in = (int *)malloc( count * sizeof(int) );
-out = (int *)malloc( count * sizeof(int) );
-sol = (int *)malloc( count * sizeof(int) );
-for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_INT, MPI_BOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_INT and op MPI_BOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-long *in, *out, *sol;
-int i, fnderr=0;
-in = (long *)malloc( count * sizeof(long) );
-out = (long *)malloc( count * sizeof(long) );
-sol = (long *)malloc( count * sizeof(long) );
-for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_LONG, MPI_BOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_LONG and op MPI_BOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-short *in, *out, *sol;
-int i, fnderr=0;
-in = (short *)malloc( count * sizeof(short) );
-out = (short *)malloc( count * sizeof(short) );
-sol = (short *)malloc( count * sizeof(short) );
-for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_SHORT, MPI_BOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_SHORT and op MPI_BOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned short *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned short *)malloc( count * sizeof(unsigned short) );
-out = (unsigned short *)malloc( count * sizeof(unsigned short) );
-sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
-for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_BOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_BOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned *)malloc( count * sizeof(unsigned) );
-out = (unsigned *)malloc( count * sizeof(unsigned) );
-sol = (unsigned *)malloc( count * sizeof(unsigned) );
-for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_BOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED and op MPI_BOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned long *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned long *)malloc( count * sizeof(unsigned long) );
-out = (unsigned long *)malloc( count * sizeof(unsigned long) );
-sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
-for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_BOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_BOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned char *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned char *)malloc( count * sizeof(unsigned char) );
-out = (unsigned char *)malloc( count * sizeof(unsigned char) );
-sol = (unsigned char *)malloc( count * sizeof(unsigned char) );
-for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_BYTE, MPI_BOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_BYTE and op MPI_BOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-gerr += errcnt;
-if (errcnt > 0)
- printf( "Found %d errors on %d for MPI_BOR(1)\n", errcnt, rank );
-errcnt = 0;
-
-/* Test BAND */
-if (world_rank == 0 && verbose) printf( "Testing MPI_BAND...\n" );
-
-{
-int *in, *out, *sol;
-int i, fnderr=0;
-in = (int *)malloc( count * sizeof(int) );
-out = (int *)malloc( count * sizeof(int) );
-sol = (int *)malloc( count * sizeof(int) );
-for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_INT, MPI_BAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_INT and op MPI_BAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-long *in, *out, *sol;
-int i, fnderr=0;
-in = (long *)malloc( count * sizeof(long) );
-out = (long *)malloc( count * sizeof(long) );
-sol = (long *)malloc( count * sizeof(long) );
-for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_LONG, MPI_BAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_LONG and op MPI_BAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-short *in, *out, *sol;
-int i, fnderr=0;
-in = (short *)malloc( count * sizeof(short) );
-out = (short *)malloc( count * sizeof(short) );
-sol = (short *)malloc( count * sizeof(short) );
-for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_SHORT, MPI_BAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_SHORT and op MPI_BAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned short *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned short *)malloc( count * sizeof(unsigned short) );
-out = (unsigned short *)malloc( count * sizeof(unsigned short) );
-sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
-for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_BAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_BAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned *)malloc( count * sizeof(unsigned) );
-out = (unsigned *)malloc( count * sizeof(unsigned) );
-sol = (unsigned *)malloc( count * sizeof(unsigned) );
-for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_BAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED and op MPI_BAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned long *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned long *)malloc( count * sizeof(unsigned long) );
-out = (unsigned long *)malloc( count * sizeof(unsigned long) );
-sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
-for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_BAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_BAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned char *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned char *)malloc( count * sizeof(unsigned char) );
-out = (unsigned char *)malloc( count * sizeof(unsigned char) );
-sol = (unsigned char *)malloc( count * sizeof(unsigned char) );
-for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_BYTE, MPI_BAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_BYTE and op MPI_BAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-gerr += errcnt;
-if (errcnt > 0)
- printf( "Found %d errors on %d for MPI_BAND(1)\n", errcnt, rank );
-errcnt = 0;
-
-
-{
-int *in, *out, *sol;
-int i, fnderr=0;
-in = (int *)malloc( count * sizeof(int) );
-out = (int *)malloc( count * sizeof(int) );
-sol = (int *)malloc( count * sizeof(int) );
-for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : 0); *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_INT, MPI_BAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_INT and op MPI_BAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-long *in, *out, *sol;
-int i, fnderr=0;
-in = (long *)malloc( count * sizeof(long) );
-out = (long *)malloc( count * sizeof(long) );
-sol = (long *)malloc( count * sizeof(long) );
-for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : 0); *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_LONG, MPI_BAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_LONG and op MPI_BAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-short *in, *out, *sol;
-int i, fnderr=0;
-in = (short *)malloc( count * sizeof(short) );
-out = (short *)malloc( count * sizeof(short) );
-sol = (short *)malloc( count * sizeof(short) );
-for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : 0); *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_SHORT, MPI_BAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_SHORT and op MPI_BAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned short *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned short *)malloc( count * sizeof(unsigned short) );
-out = (unsigned short *)malloc( count * sizeof(unsigned short) );
-sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
-for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : 0); *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_BAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_BAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned *)malloc( count * sizeof(unsigned) );
-out = (unsigned *)malloc( count * sizeof(unsigned) );
-sol = (unsigned *)malloc( count * sizeof(unsigned) );
-for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : 0); *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_BAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED and op MPI_BAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned long *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned long *)malloc( count * sizeof(unsigned long) );
-out = (unsigned long *)malloc( count * sizeof(unsigned long) );
-sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
-for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : 0); *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_BAND, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_BAND\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-gerr += errcnt;
-if (errcnt > 0)
- printf( "Found %d errors on %d for MPI_BAND(0)\n", errcnt, rank );
-errcnt = 0;
-
-/* Test BXOR */
-if (world_rank == 0 && verbose) printf( "Testing MPI_BXOR...\n" );
-
-{
-int *in, *out, *sol;
-int i, fnderr=0;
-in = (int *)malloc( count * sizeof(int) );
-out = (int *)malloc( count * sizeof(int) );
-sol = (int *)malloc( count * sizeof(int) );
-for (i=0; i<count; i++) { *(in + i) = (rank == 1)*0xf0 ; *(sol + i) = (size > 1)*0xf0 ;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_INT, MPI_BXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_INT and op MPI_BXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-long *in, *out, *sol;
-int i, fnderr=0;
-in = (long *)malloc( count * sizeof(long) );
-out = (long *)malloc( count * sizeof(long) );
-sol = (long *)malloc( count * sizeof(long) );
-for (i=0; i<count; i++) { *(in + i) = (rank == 1)*0xf0 ; *(sol + i) = (size > 1)*0xf0 ;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_LONG, MPI_BXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_LONG and op MPI_BXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-short *in, *out, *sol;
-int i, fnderr=0;
-in = (short *)malloc( count * sizeof(short) );
-out = (short *)malloc( count * sizeof(short) );
-sol = (short *)malloc( count * sizeof(short) );
-for (i=0; i<count; i++) { *(in + i) = (rank == 1)*0xf0 ; *(sol + i) = (size > 1)*0xf0 ;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_SHORT, MPI_BXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_SHORT and op MPI_BXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned short *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned short *)malloc( count * sizeof(unsigned short) );
-out = (unsigned short *)malloc( count * sizeof(unsigned short) );
-sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
-for (i=0; i<count; i++) { *(in + i) = (rank == 1)*0xf0 ; *(sol + i) = (size > 1)*0xf0 ;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_BXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_BXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned *)malloc( count * sizeof(unsigned) );
-out = (unsigned *)malloc( count * sizeof(unsigned) );
-sol = (unsigned *)malloc( count * sizeof(unsigned) );
-for (i=0; i<count; i++) { *(in + i) = (rank == 1)*0xf0 ; *(sol + i) = (size > 1)*0xf0 ;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_BXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED and op MPI_BXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned long *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned long *)malloc( count * sizeof(unsigned long) );
-out = (unsigned long *)malloc( count * sizeof(unsigned long) );
-sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
-for (i=0; i<count; i++) { *(in + i) = (rank == 1)*0xf0 ; *(sol + i) = (size > 1)*0xf0 ;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_BXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_BXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-gerr += errcnt;
-if (errcnt > 0)
- printf( "Found %d errors on %d for MPI_BXOR(1)\n", errcnt, rank );
-errcnt = 0;
-
-
-{
-int *in, *out, *sol;
-int i, fnderr=0;
-in = (int *)malloc( count * sizeof(int) );
-out = (int *)malloc( count * sizeof(int) );
-sol = (int *)malloc( count * sizeof(int) );
-for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_INT, MPI_BXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_INT and op MPI_BXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-long *in, *out, *sol;
-int i, fnderr=0;
-in = (long *)malloc( count * sizeof(long) );
-out = (long *)malloc( count * sizeof(long) );
-sol = (long *)malloc( count * sizeof(long) );
-for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_LONG, MPI_BXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_LONG and op MPI_BXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-short *in, *out, *sol;
-int i, fnderr=0;
-in = (short *)malloc( count * sizeof(short) );
-out = (short *)malloc( count * sizeof(short) );
-sol = (short *)malloc( count * sizeof(short) );
-for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_SHORT, MPI_BXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_SHORT and op MPI_BXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned short *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned short *)malloc( count * sizeof(unsigned short) );
-out = (unsigned short *)malloc( count * sizeof(unsigned short) );
-sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
-for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_BXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_BXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned *)malloc( count * sizeof(unsigned) );
-out = (unsigned *)malloc( count * sizeof(unsigned) );
-sol = (unsigned *)malloc( count * sizeof(unsigned) );
-for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_BXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED and op MPI_BXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned long *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned long *)malloc( count * sizeof(unsigned long) );
-out = (unsigned long *)malloc( count * sizeof(unsigned long) );
-sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
-for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_BXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_BXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-gerr += errcnt;
-if (errcnt > 0)
- printf( "Found %d errors on %d for MPI_BXOR(0)\n", errcnt, rank );
-errcnt = 0;
-
-
-{
-int *in, *out, *sol;
-int i, fnderr=0;
-in = (int *)malloc( count * sizeof(int) );
-out = (int *)malloc( count * sizeof(int) );
-sol = (int *)malloc( count * sizeof(int) );
-for (i=0; i<count; i++) { *(in + i) = ~0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_INT, MPI_BXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_INT and op MPI_BXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-long *in, *out, *sol;
-int i, fnderr=0;
-in = (long *)malloc( count * sizeof(long) );
-out = (long *)malloc( count * sizeof(long) );
-sol = (long *)malloc( count * sizeof(long) );
-for (i=0; i<count; i++) { *(in + i) = ~0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_LONG, MPI_BXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_LONG and op MPI_BXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-short *in, *out, *sol;
-int i, fnderr=0;
-in = (short *)malloc( count * sizeof(short) );
-out = (short *)malloc( count * sizeof(short) );
-sol = (short *)malloc( count * sizeof(short) );
-for (i=0; i<count; i++) { *(in + i) = ~0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_SHORT, MPI_BXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_SHORT and op MPI_BXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned short *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned short *)malloc( count * sizeof(unsigned short) );
-out = (unsigned short *)malloc( count * sizeof(unsigned short) );
-sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
-for (i=0; i<count; i++) { *(in + i) = ~0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_BXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_BXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned *)malloc( count * sizeof(unsigned) );
-out = (unsigned *)malloc( count * sizeof(unsigned) );
-sol = (unsigned *)malloc( count * sizeof(unsigned) );
-for (i=0; i<count; i++) { *(in + i) = ~0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_BXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED and op MPI_BXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-unsigned long *in, *out, *sol;
-int i, fnderr=0;
-in = (unsigned long *)malloc( count * sizeof(unsigned long) );
-out = (unsigned long *)malloc( count * sizeof(unsigned long) );
-sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
-for (i=0; i<count; i++) { *(in + i) = ~0; *(sol + i) = 0;
- *(out + i) = 0; }
-MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_BXOR, comm );
-for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_BXOR\n", world_rank );
-free( in );
-free( out );
-free( sol );
-}
-
-
-gerr += errcnt;
-if (errcnt > 0)
- printf( "Found %d errors on %d for MPI_BXOR(1-0)\n", errcnt, rank );
-errcnt = 0;
-
-/* Test Maxloc */
-if (world_rank == 0 && verbose) printf( "Testing MPI_MAXLOC...\n" );
-
-{
-struct int_test { int a; int b; } *in, *out, *sol;
-int i,fnderr=0;
-in = (struct int_test *)malloc( count * sizeof(struct int_test) );
-out = (struct int_test *)malloc( count * sizeof(struct int_test) );
-sol = (struct int_test *)malloc( count * sizeof(struct int_test) );
-for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
- (sol + i)->a = (size - 1 + i); (sol + i)->b = (size-1);
- (out + i)->a = 0; (out + i)->b = -1; }
-MPI_Allreduce( in, out, count, MPI_2INT, MPI_MAXLOC, comm );
-for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
- (out + i)->b != (sol + i)->b) {
- errcnt++; fnderr++;
- fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
- (int)((sol + i)->a),
- (sol+i)->b, (int)((out+i)->a), (out+i)->b );
-}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_2INT and op MPI_MAXLOC (%d of %d wrong)\n",
- world_rank, fnderr, count );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-struct long_test { long a; int b; } *in, *out, *sol;
-int i,fnderr=0;
-in = (struct long_test *)malloc( count * sizeof(struct long_test) );
-out = (struct long_test *)malloc( count * sizeof(struct long_test) );
-sol = (struct long_test *)malloc( count * sizeof(struct long_test) );
-for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
- (sol + i)->a = (size - 1 + i); (sol + i)->b = (size-1);
- (out + i)->a = 0; (out + i)->b = -1; }
-MPI_Allreduce( in, out, count, MPI_LONG_INT, MPI_MAXLOC, comm );
-for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
- (out + i)->b != (sol + i)->b) {
- errcnt++; fnderr++;
- fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
- (int)((sol + i)->a),
- (sol+i)->b, (int)((out+i)->a), (out+i)->b );
-}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_LONG_INT and op MPI_MAXLOC (%d of %d wrong)\n",
- world_rank, fnderr, count );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-struct short_test { short a; int b; } *in, *out, *sol;
-int i,fnderr=0;
-in = (struct short_test *)malloc( count * sizeof(struct short_test) );
-out = (struct short_test *)malloc( count * sizeof(struct short_test) );
-sol = (struct short_test *)malloc( count * sizeof(struct short_test) );
-for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
- (sol + i)->a = (size - 1 + i); (sol + i)->b = (size-1);
- (out + i)->a = 0; (out + i)->b = -1; }
-MPI_Allreduce( in, out, count, MPI_SHORT_INT, MPI_MAXLOC, comm );
-for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
- (out + i)->b != (sol + i)->b) {
- errcnt++; fnderr++;
- fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
- (int)((sol + i)->a),
- (sol+i)->b, (int)((out+i)->a), (out+i)->b );
-}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_SHORT_INT and op MPI_MAXLOC (%d of %d wrong)\n",
- world_rank, fnderr, count );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-struct float_test { float a; int b; } *in, *out, *sol;
-int i,fnderr=0;
-in = (struct float_test *)malloc( count * sizeof(struct float_test) );
-out = (struct float_test *)malloc( count * sizeof(struct float_test) );
-sol = (struct float_test *)malloc( count * sizeof(struct float_test) );
-for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
- (sol + i)->a = (size - 1 + i); (sol + i)->b = (size-1);
- (out + i)->a = 0; (out + i)->b = -1; }
-MPI_Allreduce( in, out, count, MPI_FLOAT_INT, MPI_MAXLOC, comm );
-for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
- (out + i)->b != (sol + i)->b) {
- errcnt++; fnderr++;
- fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
- (int)((sol + i)->a),
- (sol+i)->b, (int)((out+i)->a), (out+i)->b );
-}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_FLOAT_INT and op MPI_MAXLOC (%d of %d wrong)\n",
- world_rank, fnderr, count );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-struct double_test { double a; int b; } *in, *out, *sol;
-int i,fnderr=0;
-in = (struct double_test *)malloc( count * sizeof(struct double_test) );
-out = (struct double_test *)malloc( count * sizeof(struct double_test) );
-sol = (struct double_test *)malloc( count * sizeof(struct double_test) );
-for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
- (sol + i)->a = (size - 1 + i); (sol + i)->b = (size-1);
- (out + i)->a = 0; (out + i)->b = -1; }
-MPI_Allreduce( in, out, count, MPI_DOUBLE_INT, MPI_MAXLOC, comm );
-for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
- (out + i)->b != (sol + i)->b) {
- errcnt++; fnderr++;
- fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
- (int)((sol + i)->a),
- (sol+i)->b, (int)((out+i)->a), (out+i)->b );
-}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_DOUBLE_INT and op MPI_MAXLOC (%d of %d wrong)\n",
- world_rank, fnderr, count );
-free( in );
-free( out );
-free( sol );
-}
-
-
-gerr += errcnt;
-if (errcnt > 0)
- printf( "Found %d errors on %d for MPI_MAXLOC\n", errcnt, rank );
-errcnt = 0;
-
-/* Test minloc */
-if (world_rank == 0 && verbose) printf( "Testing MPI_MINLOC...\n" );
-
-
-{
-struct int_test { int a; int b; } *in, *out, *sol;
-int i,fnderr=0;
-in = (struct int_test *)malloc( count * sizeof(struct int_test) );
-out = (struct int_test *)malloc( count * sizeof(struct int_test) );
-sol = (struct int_test *)malloc( count * sizeof(struct int_test) );
-for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
- (sol + i)->a = i; (sol + i)->b = 0;
- (out + i)->a = 0; (out + i)->b = -1; }
-MPI_Allreduce( in, out, count, MPI_2INT, MPI_MINLOC, comm );
-for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
- (out + i)->b != (sol + i)->b) {
- errcnt++; fnderr++;
- fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
- (int)((sol + i)->a),
- (sol+i)->b, (int)((out+i)->a), (out+i)->b );
-}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_2INT and op MPI_MINLOC (%d of %d wrong)\n",
- world_rank, fnderr, count );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-struct long_test { long a; int b; } *in, *out, *sol;
-int i,fnderr=0;
-in = (struct long_test *)malloc( count * sizeof(struct long_test) );
-out = (struct long_test *)malloc( count * sizeof(struct long_test) );
-sol = (struct long_test *)malloc( count * sizeof(struct long_test) );
-for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
- (sol + i)->a = i; (sol + i)->b = 0;
- (out + i)->a = 0; (out + i)->b = -1; }
-MPI_Allreduce( in, out, count, MPI_LONG_INT, MPI_MINLOC, comm );
-for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
- (out + i)->b != (sol + i)->b) {
- errcnt++; fnderr++;
- fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
- (int)((sol + i)->a),
- (sol+i)->b, (int)((out+i)->a), (out+i)->b );
-}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_LONG_INT and op MPI_MINLOC (%d of %d wrong)\n",
- world_rank, fnderr, count );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-struct short_test { short a; int b; } *in, *out, *sol;
-int i,fnderr=0;
-in = (struct short_test *)malloc( count * sizeof(struct short_test) );
-out = (struct short_test *)malloc( count * sizeof(struct short_test) );
-sol = (struct short_test *)malloc( count * sizeof(struct short_test) );
-for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
- (sol + i)->a = i; (sol + i)->b = 0;
- (out + i)->a = 0; (out + i)->b = -1; }
-MPI_Allreduce( in, out, count, MPI_SHORT_INT, MPI_MINLOC, comm );
-for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
- (out + i)->b != (sol + i)->b) {
- errcnt++; fnderr++;
- fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
- (int)((sol + i)->a),
- (sol+i)->b, (int)((out+i)->a), (out+i)->b );
-}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_SHORT_INT and op MPI_MINLOC (%d of %d wrong)\n",
- world_rank, fnderr, count );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-struct float_test { float a; int b; } *in, *out, *sol;
-int i,fnderr=0;
-in = (struct float_test *)malloc( count * sizeof(struct float_test) );
-out = (struct float_test *)malloc( count * sizeof(struct float_test) );
-sol = (struct float_test *)malloc( count * sizeof(struct float_test) );
-for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
- (sol + i)->a = i; (sol + i)->b = 0;
- (out + i)->a = 0; (out + i)->b = -1; }
-MPI_Allreduce( in, out, count, MPI_FLOAT_INT, MPI_MINLOC, comm );
-for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
- (out + i)->b != (sol + i)->b) {
- errcnt++; fnderr++;
- fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
- (int)((sol + i)->a),
- (sol+i)->b, (int)((out+i)->a), (out+i)->b );
-}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_FLOAT_INT and op MPI_MINLOC (%d of %d wrong)\n",
- world_rank, fnderr, count );
-free( in );
-free( out );
-free( sol );
-}
-
-
-{
-struct double_test { double a; int b; } *in, *out, *sol;
-int i,fnderr=0;
-in = (struct double_test *)malloc( count * sizeof(struct double_test) );
-out = (struct double_test *)malloc( count * sizeof(struct double_test) );
-sol = (struct double_test *)malloc( count * sizeof(struct double_test) );
-for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
- (sol + i)->a = i; (sol + i)->b = 0;
- (out + i)->a = 0; (out + i)->b = -1; }
-MPI_Allreduce( in, out, count, MPI_DOUBLE_INT, MPI_MINLOC, comm );
-for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
- (out + i)->b != (sol + i)->b) {
- errcnt++; fnderr++;
- fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
- (int)((sol + i)->a),
- (sol+i)->b, (int)((out+i)->a), (out+i)->b );
-}}
-if (fnderr) fprintf( stderr,
- "(%d) Error for type MPI_DOUBLE_INT and op MPI_MINLOC (%d of %d wrong)\n",
- world_rank, fnderr, count );
-free( in );
-free( out );
-free( sol );
-//}
-
-
-gerr += errcnt;
-if (errcnt > 0)
- printf( "Found %d errors on %d for MPI_MINLOC\n", errcnt, rank );
-errcnt = 0;
-
-}
-if (gerr > 0) {
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- printf( "Found %d errors overall on %d\n", gerr, rank );
- }
-MPI_Allreduce( &gerr, &toterr, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
- if (world_rank == 0) {
- if (toterr == 0) {
- printf( " No Errors\n" );
- }
- else {
- printf (" Found %d errors\n", toterr );
- }
- }
-//FreeComms( comms, ncomm );
-MPI_Finalize( );
-return 0;
-}
+++ /dev/null
-Testing MPI_SUM...
-Testing MPI_PROD...
-Testing MPI_MAX...
-Testing MPI_MIN...
-Testing MPI_LOR...
-Testing MPI_LXOR...
-Testing MPI_LAND...
-Testing MPI_BOR...
-Testing MPI_BAND...
-Testing MPI_BXOR...
-Testing MPI_MAXLOC...
-Testing MPI_MINLOC...
- No Errors
+++ /dev/null
-/*
- This test checks for possible interference between
- successive calls to MPI_Allreduce. Some users, on some MPI implementations
- and platforms, have had to add MPI_Barrier before MPI_Allreduce calls.
- */
-#include "mpi.h"
-#include <stdio.h>
-
-#define MAX_LOOP 1000
-
-int main( int argc, char *argv[] )
-{
- int i, in_val, out_val;
- int rank, size;
- int errs = 0, toterrs;
-
- MPI_Init( &argc, &argv );
-
- MPI_Comm_size( MPI_COMM_WORLD, &size );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- for (i=0; i<MAX_LOOP; i++) {
- in_val = (i & 0x1) ? 10 : -10;
- MPI_Allreduce( &in_val, &out_val, 1, MPI_INT, MPI_SUM,
- MPI_COMM_WORLD );
- if (i & 0x1) {
- if (out_val != 10 * size) {
- errs++;
- printf( "[%d] Error in out_val = %d\n", rank, out_val );
- }
- }
- else {
- if (-out_val != 10 * size) {
- errs++;
- printf( "[%d] Error in out_val = %d\n", rank, out_val );
- }
- }
- }
- MPI_Barrier( MPI_COMM_WORLD );
- MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
-
- if (rank == 0) {
- if (toterrs)
- printf( " Found %d errors\n", toterrs );
- else
- printf( " No Errors\n" );
- }
-
- MPI_Finalize( );
- return 0;
-}
+++ /dev/null
-
- program main
- include 'mpif.h'
- integer count, errcnt, size, rank, ierr, i
- integer comm
- logical fnderr
- integer max_size
- integer world_rank
- parameter (max_size=100)
- integer intin(max_size), intout(max_size), intsol(max_size)
- real realin(max_size), realout(max_size), realsol(max_size)
- double precision dblein(max_size), dbleout(max_size),
- * dblesol(max_size)
- complex cplxin(max_size), cplxout(max_size), cplxsol(max_size)
- logical login(max_size), logout(max_size), logsol(max_size)
-C
-C
-C
-C Declare work areas
-C
- call MPI_INIT( ierr )
-
- errcnt = 0
- comm = MPI_COMM_WORLD
- call MPI_COMM_RANK( comm, rank, ierr )
- world_rank = rank
- call MPI_COMM_SIZE( comm, size, ierr )
- count = 10
-
-C Test sum
- if (world_rank .eq. 0) print *, ' MPI_SUM'
-
- fnderr = .false.
- do 23000 i=1,count
- intin(i) = i
- intsol(i) = i*size
- intout(i) = 0
-23000 continue
- call MPI_Allreduce( intin, intout, count,
- * MPI_INTEGER, MPI_SUM, comm, ierr )
- do 23001 i=1,count
- if (intout(i).ne.intsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23001 continue
- if (fnderr) then
- print *, 'Error for type MPI_INTEGER and op MPI_SUM'
- endif
-
-
- fnderr = .false.
- do 23002 i=1,count
- realin(i) = i
- realsol(i) = i*size
- realout(i) = 0
-23002 continue
- call MPI_Allreduce( realin, realout, count,
- * MPI_REAL, MPI_SUM, comm, ierr )
- do 23003 i=1,count
- if (realout(i).ne.realsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23003 continue
- if (fnderr) then
- print *, 'Error for type MPI_REAL and op MPI_SUM'
- endif
-
-
- fnderr = .false.
- do 23004 i=1,count
- dblein(i) = i
- dblesol(i) = i*size
- dbleout(i) = 0
-23004 continue
- call MPI_Allreduce( dblein, dbleout, count,
- * MPI_DOUBLE_PRECISION, MPI_SUM, comm, ierr )
- do 23005 i=1,count
- if (dbleout(i).ne.dblesol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23005 continue
- if (fnderr) then
- print *, 'Error for type MPI_DOUBLE_PRECISION and op MPI_SUM'
- endif
-
-
- fnderr = .false.
- do 23006 i=1,count
- cplxin(i) = i
- cplxsol(i) = i*size
- cplxout(i) = 0
-23006 continue
- call MPI_Allreduce( cplxin, cplxout, count,
- * MPI_COMPLEX, MPI_SUM, comm, ierr )
- do 23007 i=1,count
- if (cplxout(i).ne.cplxsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23007 continue
- if (fnderr) then
- print *, 'Error for type MPI_COMPLEX and op MPI_SUM'
- endif
-
-
- if (errcnt .gt. 0) then
- print *, 'Found ', errcnt, ' errors on ', rank, ' for MPI_SUM'
- endif
- errcnt = 0
-
-C Test product
- if (world_rank .eq. 0) print *, ' MPI_PROD'
-
- fnderr = .false.
- do 23008 i=1,count
- intin(i) = i
- intsol(i) = (i)**(size)
- intout(i) = 0
-23008 continue
- call MPI_Allreduce( intin, intout, count,
- * MPI_INTEGER, MPI_PROD, comm, ierr )
- do 23009 i=1,count
- if (intout(i).ne.intsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23009 continue
- if (fnderr) then
- print *, 'Error for type MPI_INTEGER and op MPI_PROD'
- endif
-
-
- fnderr = .false.
- do 23010 i=1,count
- realin(i) = i
- realsol(i) = (i)**(size)
- realout(i) = 0
-23010 continue
- call MPI_Allreduce( realin, realout, count,
- * MPI_REAL, MPI_PROD, comm, ierr )
- do 23011 i=1,count
- if (realout(i).ne.realsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23011 continue
- if (fnderr) then
- print *, 'Error for type MPI_REAL and op MPI_PROD'
- endif
-
-
- fnderr = .false.
- do 23012 i=1,count
- dblein(i) = i
- dblesol(i) = (i)**(size)
- dbleout(i) = 0
-23012 continue
- call MPI_Allreduce( dblein, dbleout, count,
- * MPI_DOUBLE_PRECISION, MPI_PROD, comm, ierr )
- do 23013 i=1,count
- if (dbleout(i).ne.dblesol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23013 continue
- if (fnderr) then
- print *, 'Error for type MPI_DOUBLE_PRECISION and op MPI_PROD'
- endif
-
-
- fnderr = .false.
- do 23014 i=1,count
- cplxin(i) = i
- cplxsol(i) = (i)**(size)
- cplxout(i) = 0
-23014 continue
- call MPI_Allreduce( cplxin, cplxout, count,
- * MPI_COMPLEX, MPI_PROD, comm, ierr )
- do 23015 i=1,count
- if (cplxout(i).ne.cplxsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23015 continue
- if (fnderr) then
- print *, 'Error for type MPI_COMPLEX and op MPI_PROD'
- endif
-
-
- if (errcnt .gt. 0) then
- print *, 'Found ', errcnt, ' errors on ', rank, ' for MPI_PROD'
- endif
- errcnt = 0
-
-C Test max
- if (world_rank .eq. 0) print *, ' MPI_MAX'
-
- fnderr = .false.
- do 23016 i=1,count
- intin(i) = (rank + i)
- intsol(i) = (size - 1 + i)
- intout(i) = 0
-23016 continue
- call MPI_Allreduce( intin, intout, count,
- * MPI_INTEGER, MPI_MAX, comm, ierr )
- do 23017 i=1,count
- if (intout(i).ne.intsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23017 continue
- if (fnderr) then
- print *, 'Error for type MPI_INTEGER and op MPI_MAX'
- endif
-
-
- fnderr = .false.
- do 23018 i=1,count
- realin(i) = (rank + i)
- realsol(i) = (size - 1 + i)
- realout(i) = 0
-23018 continue
- call MPI_Allreduce( realin, realout, count,
- * MPI_REAL, MPI_MAX, comm, ierr )
- do 23019 i=1,count
- if (realout(i).ne.realsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23019 continue
- if (fnderr) then
- print *, 'Error for type MPI_REAL and op MPI_MAX'
- endif
-
-
- fnderr = .false.
- do 23020 i=1,count
- dblein(i) = (rank + i)
- dblesol(i) = (size - 1 + i)
- dbleout(i) = 0
-23020 continue
- call MPI_Allreduce( dblein, dbleout, count,
- * MPI_DOUBLE_PRECISION, MPI_MAX, comm, ierr )
- do 23021 i=1,count
- if (dbleout(i).ne.dblesol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23021 continue
- if (fnderr) then
- print *, 'Error for type MPI_DOUBLE_PRECISION and op MPI_MAX'
- endif
-
-
- if (errcnt .gt. 0) then
- print *, 'Found ', errcnt, ' errors on ', rank, ' for MPI_MAX'
- endif
- errcnt = 0
-
-C Test min
- if (world_rank .eq. 0) print *, ' MPI_MIN'
-
- fnderr = .false.
- do 23022 i=1,count
- intin(i) = (rank + i)
- intsol(i) = i
- intout(i) = 0
-23022 continue
- call MPI_Allreduce( intin, intout, count,
- * MPI_INTEGER, MPI_MIN, comm, ierr )
- do 23023 i=1,count
- if (intout(i).ne.intsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23023 continue
- if (fnderr) then
- print *, 'Error for type MPI_INTEGER and op MPI_MIN'
- endif
-
-
- fnderr = .false.
- do 23024 i=1,count
- realin(i) = (rank + i)
- realsol(i) = i
- realout(i) = 0
-23024 continue
- call MPI_Allreduce( realin, realout, count,
- * MPI_REAL, MPI_MIN, comm, ierr )
- do 23025 i=1,count
- if (realout(i).ne.realsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23025 continue
- if (fnderr) then
- print *, 'Error for type MPI_REAL and op MPI_MIN'
- endif
-
-
- fnderr = .false.
- do 23026 i=1,count
- dblein(i) = (rank + i)
- dblesol(i) = i
- dbleout(i) = 0
-23026 continue
- call MPI_Allreduce( dblein, dbleout, count,
- * MPI_DOUBLE_PRECISION, MPI_MIN, comm, ierr )
- do 23027 i=1,count
- if (dbleout(i).ne.dblesol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23027 continue
- if (fnderr) then
- print *, 'Error for type MPI_DOUBLE_PRECISION and op MPI_MIN'
- endif
-
-
- if (errcnt .gt. 0) then
- print *, 'Found ', errcnt, ' errors on ', rank, ' for MPI_MIN'
- endif
- errcnt = 0
-
-C Test LOR
- if (world_rank .eq. 0) print *, ' MPI_LOR'
-
- fnderr = .false.
- do 23028 i=1,count
- login(i) = (mod(rank,2) .eq. 1)
- logsol(i) = (size .gt. 1)
- logout(i) = .FALSE.
-23028 continue
- call MPI_Allreduce( login, logout, count,
- * MPI_LOGICAL, MPI_LOR, comm, ierr )
- do 23029 i=1,count
- if (logout(i).neqv.logsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23029 continue
- if (fnderr) then
- print *, 'Error for type MPI_LOGICAL and op MPI_LOR'
- endif
-
-
- if (errcnt .gt. 0) then
- print *, 'Found ', errcnt, ' errors on ', rank,
- * ' for MPI_LOR(0)'
- endif
- errcnt = 0
-
-
-
- fnderr = .false.
- do 23030 i=1,count
- login(i) = .false.
- logsol(i) = .false.
- logout(i) = .FALSE.
-23030 continue
- call MPI_Allreduce( login, logout, count,
- * MPI_LOGICAL, MPI_LOR, comm, ierr )
- do 23031 i=1,count
- if (logout(i).neqv.logsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23031 continue
- if (fnderr) then
- print *, 'Error for type MPI_LOGICAL and op MPI_LOR'
- endif
-
-
- if (errcnt .gt. 0) then
- print *, 'Found ', errcnt, ' errors on ', rank,
- * ' for MPI_LOR(1)'
- endif
- errcnt = 0
-
-C Test LXOR
- if (world_rank .eq. 0) print *, ' MPI_LXOR'
-
- fnderr = .false.
- do 23032 i=1,count
- login(i) = (rank .eq. 1)
- logsol(i) = (size .gt. 1)
- logout(i) = .FALSE.
-23032 continue
- call MPI_Allreduce( login, logout, count,
- * MPI_LOGICAL, MPI_LXOR, comm, ierr )
- do 23033 i=1,count
- if (logout(i).neqv.logsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23033 continue
- if (fnderr) then
- print *, 'Error for type MPI_LOGICAL and op MPI_LXOR'
- endif
-
-
- if (errcnt .gt. 0) then
- print *, 'Found ',errcnt,' errors on ', rank, ' for MPI_LXOR'
- endif
- errcnt = 0
-
-
- fnderr = .false.
- do 23034 i=1,count
- login(i) = .false.
- logsol(i) = .false.
- logout(i) = .FALSE.
-23034 continue
- call MPI_Allreduce( login, logout, count,
- * MPI_LOGICAL, MPI_LXOR, comm, ierr )
- do 23035 i=1,count
- if (logout(i).neqv.logsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23035 continue
- if (fnderr) then
- print *, 'Error for type MPI_LOGICAL and op MPI_LXOR'
- endif
-
-
- if (errcnt .gt. 0) then
- print *, 'Found ',errcnt,' errors on ',rank,' for MPI_LXOR(0)'
- endif
- errcnt = 0
-
-
- fnderr = .false.
- do 23036 i=1,count
- login(i) = .true.
- logsol(i) = mod(size,2) .ne. 0
- logout(i) = .FALSE.
-23036 continue
- call MPI_Allreduce( login, logout, count,
- * MPI_LOGICAL, MPI_LXOR, comm, ierr )
- do 23037 i=1,count
- if (logout(i).neqv.logsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23037 continue
- if (fnderr) then
- print *, 'Error for type MPI_LOGICAL and op MPI_LXOR'
- endif
-
-
- if (errcnt .gt. 0) then
- print *, 'Found ',errcnt,' errors on ',rank,' for MPI_LXOR(1-0)'
- endif
- errcnt = 0
-
-C Test LAND
- if (world_rank .eq. 0) print *, ' MPI_LAND'
-
- fnderr = .false.
- do 23038 i=1,count
- login(i) = (mod(rank,2) .eq. 1)
- logsol(i) = .false.
- logout(i) = .FALSE.
-23038 continue
- call MPI_Allreduce( login, logout, count,
- * MPI_LOGICAL, MPI_LAND, comm, ierr )
- do 23039 i=1,count
- if (logout(i).neqv.logsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23039 continue
- if (fnderr) then
- print *, 'Error for type MPI_LOGICAL and op MPI_LAND'
- endif
-
-
- if (errcnt .gt. 0) then
- print *, 'Found ', errcnt, ' errors on ', rank, ' for MPI_LAND'
- endif
- errcnt = 0
-
-
-
-
- fnderr = .false.
- do 23040 i=1,count
- login(i) = .true.
- logsol(i) = .true.
- logout(i) = .FALSE.
-23040 continue
- call MPI_Allreduce( login, logout, count,
- * MPI_LOGICAL, MPI_LAND, comm, ierr )
- do 23041 i=1,count
- if (logout(i).neqv.logsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23041 continue
- if (fnderr) then
- print *, 'Error for type MPI_LOGICAL and op MPI_LAND'
- endif
-
-
- if (errcnt .gt. 0) then
- print *, 'Found ',errcnt,' errors on ',rank,
- * ' for MPI_LAND(true)'
- endif
- errcnt = 0
-
-C Test BOR
- if (world_rank .eq. 0) print *, ' MPI_BOR'
- if (size .lt. 3) then
-
- fnderr = .false.
- do 23042 i=1,count
- intin(i) = mod(rank,4)
- intsol(i) = size - 1
- intout(i) = 0
-23042 continue
- call MPI_Allreduce( intin, intout, count,
- * MPI_INTEGER, MPI_BOR, comm, ierr )
- do 23043 i=1,count
- if (intout(i).ne.intsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23043 continue
- if (fnderr) then
- print *, 'Error for type MPI_INTEGER and op MPI_BOR'
- endif
-
- else
-
- fnderr = .false.
- do 23044 i=1,count
- intin(i) = mod(rank,4)
- intsol(i) = 3
- intout(i) = 0
-23044 continue
- call MPI_Allreduce( intin, intout, count,
- * MPI_INTEGER, MPI_BOR, comm, ierr )
- do 23045 i=1,count
- if (intout(i).ne.intsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23045 continue
- if (fnderr) then
- print *, 'Error for type MPI_INTEGER and op MPI_BOR'
- endif
-
- endif
- if (errcnt .gt. 0) then
- print *, 'Found ', errcnt, ' errors on ', rank,
- * ' for MPI_BOR(1)'
- endif
- errcnt = 0
-
-C Test BAND
- if (world_rank .eq. 0) print *, ' MPI_BAND'
-C See bottom for function definitions
-
- fnderr = .false.
- do 23046 i=1,count
- intin(i) = ibxandval(rank,size,i)
- intsol(i) = i
- intout(i) = 0
-23046 continue
- call MPI_Allreduce( intin, intout, count,
- * MPI_INTEGER, MPI_BAND, comm, ierr )
- do 23047 i=1,count
- if (intout(i).ne.intsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23047 continue
- if (fnderr) then
- print *, 'Error for type MPI_INTEGER and op MPI_BAND'
- endif
-
-
- if (errcnt .gt. 0) then
- print *, 'Found ', errcnt, ' errors on ', rank,
- * ' for MPI_BAND(1)'
- endif
- errcnt = 0
-
-
- fnderr = .false.
- do 23048 i=1,count
- intin(i) = ibxandval1(rank,size,i)
- intsol(i) = 0
- intout(i) = 0
-23048 continue
- call MPI_Allreduce( intin, intout, count,
- * MPI_INTEGER, MPI_BAND, comm, ierr )
- do 23049 i=1,count
- if (intout(i).ne.intsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23049 continue
- if (fnderr) then
- print *, 'Error for type MPI_INTEGER and op MPI_BAND'
- endif
-
-
- if (errcnt .gt. 0) then
- print *, 'Found ', errcnt, ' errors on ', rank,
- * ' for MPI_BAND(0)'
- endif
- errcnt = 0
-
-C Test BXOR
- if (world_rank .eq. 0) print *, ' MPI_BXOR'
-C See below for function definitions
-
- fnderr = .false.
- do 23050 i=1,count
- intin(i) = ibxorval1(rank)
- intsol(i) = ibxorsol1(size)
- intout(i) = 0
-23050 continue
- call MPI_Allreduce( intin, intout, count,
- * MPI_INTEGER, MPI_BXOR, comm, ierr )
- do 23051 i=1,count
- if (intout(i).ne.intsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23051 continue
- if (fnderr) then
- print *, 'Error for type MPI_INTEGER and op MPI_BXOR'
- endif
-
-
- if (errcnt .gt. 0) then
- print *, 'Found ', errcnt, ' errors on ', rank,
- * ' for MPI_BXOR(1)'
- endif
- errcnt = 0
-
-
- fnderr = .false.
- do 23052 i=1,count
- intin(i) = 0
- intsol(i) = 0
- intout(i) = 0
-23052 continue
- call MPI_Allreduce( intin, intout, count,
- * MPI_INTEGER, MPI_BXOR, comm, ierr )
- do 23053 i=1,count
- if (intout(i).ne.intsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23053 continue
- if (fnderr) then
- print *, 'Error for type MPI_INTEGER and op MPI_BXOR'
- endif
-
-
- if (errcnt .gt. 0) then
- print *, 'Found ', errcnt, ' errors on ', rank,
- * ' for MPI_BXOR(0)'
- endif
- errcnt = 0
-
-C Assumes -1 == all bits set
-
- fnderr = .false.
- do 23054 i=1,count
- intin(i) = (-1)
- if (mod(size,2) .eq. 0) then
- intsol(i) = 0
- else
- intsol(i) = -1
- endif
- intout(i) = 0
-23054 continue
- call MPI_Allreduce( intin, intout, count,
- * MPI_INTEGER, MPI_BXOR, comm, ierr )
- do 23055 i=1,count
- if (intout(i).ne.intsol(i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23055 continue
- if (fnderr) then
- print *, 'Error for type MPI_INTEGER and op MPI_BXOR'
- endif
-
-
- if (errcnt .gt. 0) then
- print *, 'Found ', errcnt, ' errors on ', rank,
- * ' for MPI_BXOR(1-0)'
- endif
- errcnt = 0
-
-C Test Maxloc
- if (world_rank .eq. 0) print *, ' MPI_MAXLOC'
-
- fnderr = .false.
- do 23056 i=1, count
- intin(2*i-1) = (rank + i)
- intin(2*i) = rank
- intsol(2*i-1) = (size - 1 + i)
- intsol(2*i) = (size-1)
- intout(2*i-1) = 0
- intout(2*i) = 0
-23056 continue
- call MPI_Allreduce( intin, intout, count,
- * MPI_2INTEGER, MPI_MAXLOC, comm, ierr )
- do 23057 i=1, count
- if (intout(2*i-1) .ne. intsol(2*i-1) .or.
- * intout(2*i) .ne. intsol(2*i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23057 continue
- if (fnderr) then
- print *, 'Error for type MPI_2INTEGER and op MPI_MAXLOC'
- endif
-
-
- fnderr = .false.
- do 23058 i=1, count
- realin(2*i-1) = (rank + i)
- realin(2*i) = rank
- realsol(2*i-1) = (size - 1 + i)
- realsol(2*i) = (size-1)
- realout(2*i-1) = 0
- realout(2*i) = 0
-23058 continue
- call MPI_Allreduce( realin, realout, count,
- * MPI_2REAL, MPI_MAXLOC, comm, ierr )
- do 23059 i=1, count
- if (realout(2*i-1) .ne. realsol(2*i-1) .or.
- * realout(2*i) .ne. realsol(2*i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23059 continue
- if (fnderr) then
- print *, 'Error for type MPI_2REAL and op MPI_MAXLOC'
- endif
-
-
-! fnderr = .false.
-! do 23060 i=1, count
-! dblein(2*i-1) = (rank + i)
-! dblein(2*i) = rank
-! dblesol(2*i-1) = (size - 1 + i)
-! dblesol(2*i) = (size-1)
-! dbleout(2*i-1) = 0
-! dbleout(2*i) = 0
-!23060 continue
-! call MPI_Allreduce( dblein, dbleout, count,
-! * MPI_2DOUBLE_PRECISION, MPI_MAXLOC, comm, ierr )
-! do 23061 i=1, count
-! if (dbleout(2*i-1) .ne. dblesol(2*i-1) .or.
-! * dbleout(2*i) .ne. dblesol(2*i)) then
-! errcnt = errcnt + 1
-! fnderr = .true.
-! endif
-!23061 continue
-! if (fnderr) then
-! print *,
-! * 'Error for type MPI_2DOUBLE_PRECISION and op MPI_MAXLOC'
-
-! endif
-
-
- if (errcnt .gt. 0) then
- print *, 'Found ', errcnt, ' errors on ', rank,
- * ' for MPI_MAXLOC'
- endif
- errcnt = 0
-
-C Test minloc
- if (world_rank .eq. 0) print *, ' MPI_MINLOC'
-
-
- fnderr = .false.
- do 23062 i=1, count
- intin(2*i-1) = (rank + i)
- intin(2*i) = rank
- intsol(2*i-1) = i
- intsol(2*i) = 0
- intout(2*i-1) = 0
- intout(2*i) = 0
-23062 continue
- call MPI_Allreduce( intin, intout, count,
- * MPI_2INTEGER, MPI_MINLOC, comm, ierr )
- do 23063 i=1, count
- if (intout(2*i-1) .ne. intsol(2*i-1) .or.
- * intout(2*i) .ne. intsol(2*i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23063 continue
- if (fnderr) then
- print *, 'Error for type MPI_2INTEGER and op MPI_MINLOC'
- endif
-
-
- fnderr = .false.
- do 23064 i=1, count
- realin(2*i-1) = (rank + i)
- realin(2*i) = rank
- realsol(2*i-1) = i
- realsol(2*i) = 0
- realout(2*i-1) = 0
- realout(2*i) = 0
-23064 continue
- call MPI_Allreduce( realin, realout, count,
- * MPI_2REAL, MPI_MINLOC, comm, ierr )
- do 23065 i=1, count
- if (realout(2*i-1) .ne. realsol(2*i-1) .or.
- * realout(2*i) .ne. realsol(2*i)) then
- errcnt = errcnt + 1
- fnderr = .true.
- endif
-23065 continue
- if (fnderr) then
- print *, 'Error for type MPI_2REAL and op MPI_MINLOC'
- endif
-
-
-! fnderr = .false.
-! do 23066 i=1, count
-! dblein(2*i-1) = (rank + i)
-! dblein(2*i) = rank
-! dblesol(2*i-1) = i
-! dblesol(2*i) = 0
-! dbleout(2*i-1) = 0
-! dbleout(2*i) = 0
-!23066 continue
-! call MPI_Allreduce( dblein, dbleout, count,
-! * MPI_2DOUBLE_PRECISION, MPI_MINLOC, comm, ierr )
-! do 23067 i=1, count
-! if (dbleout(2*i-1) .ne. dblesol(2*i-1) .or.
-! * dbleout(2*i) .ne. dblesol(2*i)) then
-! errcnt = errcnt + 1
-! fnderr = .true.
-! endif
-!23067 continue
-! if (fnderr) then
-! print *,
-! * 'Error for type MPI_2DOUBLE_PRECISION and op MPI_MINLOC'
-! endif
-
-
- if (errcnt .gt. 0) then
- print *, 'Found ', errcnt, ' errors on ', rank,
- * ' for MPI_MINLOC'
- endif
- errcnt = 0
-
- call MPI_Finalize( ierr )
- end
-
- integer function ibxorval1( ir )
- ibxorval1 = 0
- if (ir .eq. 1) ibxorval1 = 16+32+64+128
- return
- end
-
- integer function ibxorsol1( is )
- ibxorsol1 = 0
- if (is .gt. 1) ibxorsol1 = 16+32+64+128
- return
- end
-
-C
-C Assumes -1 == all bits set
- integer function ibxandval( ir, is, i )
- integer ir, is, i
- ibxandval = -1
- if (ir .eq. is - 1) ibxandval = i
- return
- end
-C
- integer function ibxandval1( ir, is, i )
- integer ir, is, i
- ibxandval1 = 0
- if (ir .eq. is - 1) ibxandval1 = i
- return
- end
+++ /dev/null
- MPI_SUM
- MPI_PROD
- MPI_MAX
- MPI_MIN
- MPI_LOR
- MPI_LXOR
- MPI_LAND
- MPI_BOR
- MPI_BAND
- MPI_BXOR
- MPI_MAXLOC
- MPI_MINLOC
+++ /dev/null
-#include <stdio.h>
-#include "mpi.h"
-#include "test.h"
-
-/*
- * This example should be run with 2 processes and tests the ability of the
- * implementation to handle a flood of one-way messages.
- */
-
-int main( int argc, char **argv )
-{
- double wscale = 10.0, scale;
- int numprocs, myid,i,namelen;
- char processor_name[MPI_MAX_PROCESSOR_NAME];
-
- MPI_Init(&argc,&argv);
- MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
- MPI_Comm_rank(MPI_COMM_WORLD,&myid);
- MPI_Get_processor_name(processor_name,&namelen);
-
- /* fprintf(stderr,"Process %d on %s\n",
- myid, processor_name); */
- for ( i=0; i<10000; i++) {
- MPI_Allreduce(&wscale,&scale,1,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD);
- }
- MPI_Finalize();
- return 0;
-}
+++ /dev/null
-*** allredmany ***
-*** allredmany run 0 ***
-*** allredmany run 1 ***
-*** allredmany run 2 ***
-*** allredmany run 3 ***
-*** allredmany run 4 ***
-*** allredmany run 5 ***
-*** allredmany run 6 ***
-*** allredmany run 7 ***
-*** allredmany run 8 ***
-*** allredmany run 9 ***
-*** allredmany run 10 ***
-*** allredmany run 11 ***
-*** allredmany run 12 ***
-*** allredmany run 13 ***
-*** allredmany run 14 ***
-*** allredmany run 15 ***
-*** allredmany run 16 ***
-*** allredmany run 17 ***
-*** allredmany run 18 ***
-*** allredmany run 19 ***
-*** allredmany ***
+++ /dev/null
-#include "mpi.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include "test.h"
-
-/*
- This program tests MPI_Alltoallv by having processor i send different
- amounts of data to each processor.
-
- Because there are separate send and receive types to alltoallv,
- there need to be tests to rearrange data on the fly. Not done yet.
-
- The first test sends i items to processor i from all processors.
-
- Currently, the test uses only MPI_INT; this is adequate for testing systems
- that use point-to-point operations
- */
-
-int main( int argc, char **argv )
-{
-
- MPI_Comm comm;
- int *sbuf, *rbuf;
- int rank, size;
- int *sendcounts, *recvcounts, *rdispls, *sdispls;
- int i, j, *p, err, toterr;
-
- MPI_Init( &argc, &argv );
- err = 0;
-
- comm = MPI_COMM_WORLD;
-
- /* Create the buffer */
- MPI_Comm_size( comm, &size );
- MPI_Comm_rank( comm, &rank );
- sbuf = (int *)malloc( size * size * sizeof(int) );
- rbuf = (int *)malloc( size * size * sizeof(int) );
- if (!sbuf || !rbuf) {
- fprintf( stderr, "Could not allocated buffers!\n" );
- MPI_Abort( comm, 1 );
- }
-
- /* Load up the buffers */
- for (i=0; i<size*size; i++) {
- sbuf[i] = i + 100*rank;
- rbuf[i] = -i;
- }
-
- /* Create and load the arguments to alltoallv */
- sendcounts = (int *)malloc( size * sizeof(int) );
- recvcounts = (int *)malloc( size * sizeof(int) );
- rdispls = (int *)malloc( size * sizeof(int) );
- sdispls = (int *)malloc( size * sizeof(int) );
- if (!sendcounts || !recvcounts || !rdispls || !sdispls) {
- fprintf( stderr, "Could not allocate arg items!\n" );
- MPI_Abort( comm, 1 );
- }
- for (i=0; i<size; i++) {
- sendcounts[i] = i;
- recvcounts[i] = rank;
- rdispls[i] = i * rank;
- sdispls[i] = (i * (i+1))/2;
- }
- MPI_Alltoallv( sbuf, sendcounts, sdispls, MPI_INT,
- rbuf, recvcounts, rdispls, MPI_INT, comm );
-
- /* Check rbuf */
- for (i=0; i<size; i++) {
- p = rbuf + rdispls[i];
- for (j=0; j<rank; j++) {
- if (p[j] != i * 100 + (rank*(rank+1))/2 + j) {
- fprintf( stderr, "[%d] got %d expected %d for %dth\n",
- rank, p[j],(i*(i+1))/2 + j, j );
- err++;
- }
- }
- }
-
- free( sdispls );
- free( rdispls );
- free( recvcounts );
- free( sendcounts );
- free( rbuf );
- free( sbuf );
-
- MPI_Allreduce( &err, &toterr, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- if (rank == 0) {
- if (toterr > 0)
- fprintf( stderr, "Test FAILED with %d errors\n", toterr );
- else
- fprintf( stderr, " No Errors\n" );
- }
-
- MPI_Finalize();
- return 0;
-}
+++ /dev/null
-C
-C Thanks to zollweg@tc.cornell.edu (John A. Zollweg) for this test
-C which detected a problem in one version of the IBM product
-C implementation of MPI. The source of the problem in that implementation
-C was assuming that floating point arithmetic was associative (it isn't
-C even commutative on IBM hardware).
-C
-C This program was designed for IEEE and may be uninteresting on other
-C systems. Note that since it is testing that the same VALUE is
-C delivered at each system, it will run correctly on all systems.
-C
- PROGRAM ALLREDUCE
- include 'mpif.h'
- real*8 myval(4), sum, recvbuf(4)
- integer ier, me, size, tsize, dtype, i, errors, toterr
- data myval /-12830196119319614d0,9154042893114674d0,
- &2371516219785616d0,1304637006419324.8d0/
- call MPI_INIT(ier)
- call MPI_COMM_SIZE(MPI_COMM_WORLD,size,ier)
- if (size.ne.4) then
- print *,"This test case must be run as a four-way job"
- call MPI_FINALIZE(ier)
- stop
- end if
- call MPI_TYPE_SIZE( MPI_REAL, tsize, ier )
- if (tsize .eq. 8) then
- dtype = MPI_REAL
- else
- call MPI_TYPE_SIZE( MPI_DOUBLE_PRECISION, tsize, ier )
- if (tsize .ne. 8) then
- print *, " Can not test allreduce without an 8 byte"
- print *, " floating double type."
- call MPI_FINALIZE(ier)
- stop
- endif
- dtype = MPI_DOUBLE_PRECISION
- endif
- call MPI_COMM_RANK(MPI_COMM_WORLD,me,ier)
- call MPI_ALLREDUCE(myval(me+1),sum,1,dtype,MPI_SUM,
- &MPI_COMM_WORLD,ier)
-C
-C collect the values and make sure that they are all the same BITWISE
-C We could use Gather, but this gives us an added test.
-C
- do 5 i=1,4
- recvbuf(i) = i
- 5 continue
- call MPI_ALLGATHER( sum, 1, dtype, recvbuf, 1, dtype,
- & MPI_COMM_WORLD, ier )
- errors = 0
- do 10 i=2,4
-C print *, "recvbuf(",i,") = ", recvbuf(i), " on ", me
- if (recvbuf(1) .ne. recvbuf(i)) then
- errors = errors + 1
- print *, "Inconsistent values for ", i, "th entry on ",
- & me
- print *, recvbuf(1), " not equal to ", recvbuf(i)
- endif
- 10 continue
- call MPI_ALLREDUCE( errors, toterr, 1, MPI_INTEGER, MPI_SUM,
- & MPI_COMM_WORLD, ier )
- if (me .eq. 0) then
- if (toterr .gt. 0) then
- print *, " FAILED with ", toterr, " errors."
- else
- print *, " No Errors"
- endif
- endif
-C print *," The value of the sum on node ",me,"is",sum
- call MPI_FINALIZE(ier)
-C Calling stop can generate unwanted noise on some systems, and is not
-C required.
- end
+++ /dev/null
-/* This program provides some simple verification of the MPI_Barrier
- * program. All of the clients send a message to indicate that they
- * are alive (a simple character string) and then the all of the
- * clients enter an MPI_Barrier. The server then Iprobes for a while
- * to make sure that none of the "through barrier" messages that the
- * clients send after leaving the barrier arive before the server enters
- * the barrier. The server then enters the barrier, and upon leaving,
- * waits for a message from each client.
- */
-
-#include "test.h"
-#include "mpi.h"
-
-#define WAIT_TIMES 500
-
-int
-main( int argc, char **argv)
-{
- int rank, size, i, recv_flag, ret, passed;
- MPI_Status Status;
- char message[17];
- MPI_Init(&argc, &argv);
- MPI_Comm_rank(MPI_COMM_WORLD, &rank);
- MPI_Comm_size(MPI_COMM_WORLD, &size);
-
- if (rank == 0) {
- Test_Init("barrier", rank);
- /* Receive the startup messages from each of the
- other clients */
- for (i = 0; i < size - 1; i++) {
- MPI_Recv(message, 17, MPI_CHAR, MPI_ANY_SOURCE, 2000,
- MPI_COMM_WORLD, &Status);
- }
-
- /* Now use Iprobe to make sure no more messages arive for a
- while */
- passed = 1;
- for (i = 0; i < WAIT_TIMES; i++){
- recv_flag = 0;
- MPI_Iprobe(MPI_ANY_SOURCE, 2000, MPI_COMM_WORLD,
- &recv_flag, &Status);
- if (recv_flag)
- passed = 0;
- }
-
- if (passed)
- Test_Passed("Barrier Test 1");
- else
- Test_Failed("Barrier Test 1");
-
- /* Now go into the barrier myself */
- MPI_Barrier(MPI_COMM_WORLD);
-
- /* And get everyones message who came out */
- for (i = 0; i < size - 1; i++) {
- MPI_Recv(message, 13, MPI_CHAR, MPI_ANY_SOURCE, 2000,
- MPI_COMM_WORLD, &Status);
- }
-
- /* Now use Iprobe to make sure no more messages arive for a
- while */
- passed = 1;
- for (i = 0; i < WAIT_TIMES; i++){
- recv_flag = 0;
- MPI_Iprobe(MPI_ANY_SOURCE, 2000, MPI_COMM_WORLD,
- &recv_flag, &Status);
- if (recv_flag)
- passed = 0;
- }
- if (passed)
- Test_Passed("Barrier Test 2");
- else
- Test_Failed("Barrier Test 2");
-
- Test_Waitforall( );
- ret = Summarize_Test_Results();
- Test_Finalize();
- MPI_Finalize();
- return ret;
- } else {
- MPI_Send((char*)"Entering Barrier", 17, MPI_CHAR, 0, 2000, MPI_COMM_WORLD);
- MPI_Barrier(MPI_COMM_WORLD);
- MPI_Send((char*)"Past Barrier", 13, MPI_CHAR, 0, 2000, MPI_COMM_WORLD);
- Test_Waitforall( );
- MPI_Finalize();
- return 0;
- }
-}
+++ /dev/null
-/*
- * This program performs some simple tests of the MPI_Bcast broadcast
- * functionality.
- */
-
-#include "test.h"
-#include "mpi.h"
-#include <stdlib.h>
-
-int
-main( int argc, char **argv)
-{
- int rank, size, ret, passed, i, *test_array;
-
- /* Set up MPI */
- MPI_Init(&argc, &argv);
- MPI_Comm_rank(MPI_COMM_WORLD, &rank);
- MPI_Comm_size(MPI_COMM_WORLD, &size);
-
- /* Setup the tests */
- Test_Init("bcast", rank);
- test_array = (int *)malloc(size*sizeof(int));
-
- /* Perform the test - this operation should really be done
- with an allgather, but it makes a good test... */
- passed = 1;
- for (i=0; i < size; i++) {
- if (i == rank)
- test_array[i] = i;
- MPI_Bcast(test_array, size, MPI_INT, i, MPI_COMM_WORLD);
- if (test_array[i] != i)
- passed = 0;
- }
- if (!passed)
- Test_Failed("Simple Broadcast test");
- else {
- if (rank == 0)
- Test_Passed("Simple Broadcast test");
- }
-
- /* Close down the tests */
- free(test_array);
- if (rank == 0)
- ret = Summarize_Test_Results();
- else
- ret = 0;
- Test_Finalize();
-
- /* Close down MPI */
- Test_Waitforall( );
- MPI_Finalize();
- return ret;
-}
+++ /dev/null
- program test
-C
-C This program hangs when run with the version of MPICH (1.1.2) distributed
-C by Myricom using their ch_gm device. I've added it to our collection
-C on general principle; note that it hasn't been put into a form usable
-C by our tests yet
-C
- include 'mpif.h'
- integer comm_size,comm_rank,status(mpi_status_size)
- integer at_number,chunk
- double precision T0,D
- at_number=0
- chunk=0
- T0=3D3048.48883
- D=3D3877.4888
- call mpi_init(ierror)
- call mpi_comm_size(mpi_comm_world,comm_size,ierror)
- call mpi_comm_rank(mpi_comm_world,comm_rank,ierror)
- CALL MPI_BCAST(at_number,1,mpi_integer,0,mpi_comm_world,ierr)
- CALL MPI_BCAST(chunk,1,mpi_integer,0,mpi_comm_world,ierr)
- CALL MPI_BCAST(T0,1,mpi_double_precision,0,mpi_comm_world,ierr)
- CALL MPI_BCAST(D,1,mpi_double_precision,0,mpi_comm_world,ierr)
-
- write(6,*) 'Rank=3D',comm_rank,' finished bcast'
- do i=3D1,99999
- T0=3Di*1.0d0
- d=3Dt0**.987
- do j=3D1,100
- a=3Dj**.2
- enddo
- enddo
- write(6,*) 'Rank=3D',comm_rank,' finished calculations'
- call mpi_finalize(ierror)
- end
-C
-C Run with mpirun -np 16 test
+++ /dev/null
-#include "mpi.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include "test.h"
-
-int main( int argc, char **argv )
-{
- char *buf;
- int rank, size, i;
- MPI_Request req[10];
- MPI_Status stat[10];
- MPI_Status status;
-
- buf = (char *)malloc(32*1024);
- MPI_Init(&argc, &argv);
- MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
- MPI_Comm_size ( MPI_COMM_WORLD, &size );
-
- if (size > 10) return 1;
-
- if (rank == 0) {
- for ( i = 1; i < size; i++ )
- MPI_Isend(buf,1024,MPI_BYTE,i,0,MPI_COMM_WORLD,&req[i]);
- MPI_Waitall(size-1, &req[1], &stat[1]); /* Core dumps here! */
- }
- else
- MPI_Recv(buf,1024,MPI_BYTE,0,0,MPI_COMM_WORLD,&status);
-
- Test_Waitforall( );
- MPI_Finalize();
- return 0;
-}
-
-#if 0
-int MPIND_Waitall(count, array_of_requests, array_of_statuses )
-int count;
-MPI_Request array_of_requests[];
-MPI_Status array_of_statuses[];
-{
- int i;
- MPIR_BOOL completed;
-
- for (i = 0; i < count; i++) {
- if (!array_of_requests[i]) continue;
- MPID_complete_send(&array_of_requests[i]->shandle,
- &(array_of_statuses[i]) );
-
- MPIND_Request_free( &array_of_requests[i] ); /* Core dumps here! */
- array_of_requests[i] = NULL;
- }
- return MPI_SUCCESS;
-}
-
-
-#define MPID_ND_free_send_handle( a ) if ((a)->buffer) {FREE((a)->buffer);}
-
-int MPIND_Request_free( request )
-MPI_Request *request;
-{
- int errno = MPI_SUCCESS;
-
- printf("Should be core dumping here (buffer = %d)...\n",
- (&((*request)->shandle.dev_shandle))->buffer);
- MPID_ND_free_send_handle(&((*request)->shandle.dev_shandle));
- printf("and not reaching here!\n");
- SBfree( MPIR_shandles, *request );
-
- return MPI_SUCCESS;
-}
-#endif
+++ /dev/null
-#include "mpi.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include "test.h"
-
-int main( int argc, char **argv)
-{
- char *buf;
- int i, iam;
- MPI_Init(&argc, &argv);
- MPI_Barrier(MPI_COMM_WORLD);
- buf = (char *)malloc(32*1024);
- MPI_Comm_rank(MPI_COMM_WORLD, &iam);
- for(i=1; i<=32; i++){
- if (iam == 0){
- *buf=i;
- printf("Broadcasting %d bytes\n", i*64);
- }
- MPI_Bcast(buf, i*64, MPI_BYTE, 0, MPI_COMM_WORLD);
- if (*buf != i) printf("Sanity check error on node %d\n", iam);
-/* gsync();
-*/
- MPI_Barrier(MPI_COMM_WORLD);
- }
- Test_Waitforall( );
- MPI_Finalize();
-
- return 0;
-}
+++ /dev/null
- program main
-c test bcast of logical
-c works on suns, needs mpich fix and heterogeneous test on alpha with PC
- include 'mpif.h'
- integer myid, numprocs, rc, ierr
- integer errs, toterrs
- logical boo
-
- call MPI_INIT( ierr )
- call MPI_COMM_RANK( MPI_COMM_WORLD, myid, ierr )
- call MPI_COMM_SIZE( MPI_COMM_WORLD, numprocs, ierr )
-C
- errs = 0
- boo = .true.
- call MPI_BCAST(boo,1,MPI_LOGICAL,0,MPI_COMM_WORLD,ierr)
- if (boo .neqv. .true.) then
- print *, 'Did not broadcast Fortran logical (true)'
- errs = errs + 1
- endif
-C
- boo = .false.
- call MPI_BCAST(boo,1,MPI_LOGICAL,0,MPI_COMM_WORLD,ierr)
- if (boo .neqv. .false.) then
- print *, 'Did not broadcast Fortran logical (false)'
- errs = errs + 1
- endif
- call MPI_Reduce( errs, toterrs, 1, MPI_INTEGER, MPI_SUM,
- $ 0, MPI_COMM_WORLD, ierr )
- if (myid .eq. 0) then
- if (toterrs .eq. 0) then
- print *, ' No Errors'
- else
- print *, ' Found ', toterrs, ' errors'
- endif
- endif
- call MPI_FINALIZE(rc)
-C stop
-C do not use stop with smpi, it causes errors, as does exit
- end
+++ /dev/null
-/*
- * This program performs some simple tests of the MPI_Bcast broadcast
- * functionality.
- *
- * It checks the handling of different datatypes by different participants
- * (with matching type signatures, of course), as well as different
- * roots and communicators.
- */
-
-#include "test.h"
-#include "mpi.h"
-#include <stdlib.h>
-
-int main( int argc, char **argv )
-{
- int rank, size, ret, passed, i, *test_array;
- int stride, count, root;
- MPI_Datatype newtype;
- MPI_Comm comm = MPI_COMM_WORLD;
-
- /* Set up MPI */
- MPI_Init(&argc, &argv);
- MPI_Comm_rank(comm, &rank);
-
- /* Setup the tests */
- Test_Init("bcastvec", rank);
-
- /* Allow for additional communicators */
- MPI_Comm_size(comm, &size);
- /* MPI_Comm_rank(comm, &rank); */
- stride = (rank + 1);
- test_array = (int *)malloc(size*stride*sizeof(int));
-
- /* Create the vector datatype EXCEPT for process 0 (vector of
- stride 1 is contiguous) */
- if (rank > 0) {
- count = 1;
- MPI_Type_vector( size, 1, stride, MPI_INT, &newtype);
- MPI_Type_commit( &newtype );
- }
- else {
- count = size;
- newtype = MPI_INT;
- }
-
- /* Perform the test. Each process in turn becomes the root.
- After each operation, check that nothing has gone wrong */
- passed = 1;
- for (root = 0; root < size; root++) {
- /* Fill the array with -1 for unset, rank + i * size for set */
- for (i=0; i<size*stride; i++) test_array[i] = -1;
- if (rank == root)
- for (i=0; i<size; i++) test_array[i*stride] = rank + i * size;
- MPI_Bcast( test_array, count, newtype, root, comm );
- for (i=0; i<size; i++) {
- if (test_array[i*stride] != root + i * size) {
- passed = 0;
- }
- }
- }
- free(test_array);
- if (rank != 0) MPI_Type_free( &newtype );
-
- if (!passed)
- Test_Failed("Simple Broadcast test with datatypes");
- else {
- if (rank == 0)
- Test_Passed("Simple Broadcast test with datatypes");
- }
-
- /* Close down the tests */
- if (rank == 0)
- ret = Summarize_Test_Results();
- else {
- ret = 0;
- }
- Test_Finalize();
-
- /* Close down MPI */
- Test_Waitforall( );
- MPI_Finalize();
- return ret;
-}
+++ /dev/null
-#include "mpi.h"
-#include "test.h"
-#include <stdlib.h>
-#include <stdio.h>
-
-int main( int argc, char **argv )
-{
- int rank, size, i;
- int *table;
- int errors=0;
- MPI_Aint address;
- MPI_Datatype type, newtype;
- int lens;
-
- MPI_Init( &argc, &argv );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- MPI_Comm_size( MPI_COMM_WORLD, &size );
-
- /* Make data table */
- table = (int *) calloc (size, sizeof(int));
- table[rank] = rank + 1;
-
- MPI_Barrier ( MPI_COMM_WORLD );
- /* Broadcast the data */
- for ( i=0; i<size; i++ )
- MPI_Bcast( &table[i], 1, MPI_INT, i, MPI_COMM_WORLD );
-
- /* See if we have the correct answers */
- for ( i=0; i<size; i++ )
- if (table[i] != i+1) errors++;
-
- MPI_Barrier ( MPI_COMM_WORLD );
-
- /* Try the same thing, but with a derived datatype */
- for ( i=0; i<size; i++ )
- table[i] = 0;
- table[rank] = rank + 1;
- for ( i=0; i<size; i++ ) {
- //MPI_Address( &table[i], &address );
- address=0;
- type = MPI_INT;
- lens = 1;
- MPI_Type_struct( 1, &lens, &address, &type, &newtype );
- MPI_Type_commit( &newtype );
- MPI_Bcast( &table[i], 1, newtype, i, MPI_COMM_WORLD );
- MPI_Type_free( &newtype );
- }
- /* See if we have the correct answers */
- for ( i=0; i<size; i++ )
- if (table[i] != i+1) errors++;
-
- MPI_Barrier ( MPI_COMM_WORLD );
-
- Test_Waitforall( );
- MPI_Finalize();
- if (errors)
- printf( "[%d] done with ERRORS!\n", rank );
- return errors;
-}
-
-
+++ /dev/null
-#include "mpi.h"
-#include <stdio.h>
-#include "test.h"
-#define BAD_ANSWER 100000
-
-int assoc ( int *, int *, int *, MPI_Datatype * );
-
-/*
- The operation is inoutvec[i] = invec[i] op inoutvec[i]
- (see 4.9.4). The order is important.
-
- Note that the computation is in process rank (in the communicator)
- order, independant of the root.
- */
-int assoc(invec, inoutvec, len, dtype)
-int *invec, *inoutvec, *len;
-MPI_Datatype *dtype;
-{
- int i;
- for ( i=0; i<*len; i++ ) {
- if (inoutvec[i] <= invec[i] ) {
- int rank;
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- fprintf( stderr, "[%d] inout[0] = %d, in[0] = %d\n",
- rank, inoutvec[0], invec[0] );
- inoutvec[i] = BAD_ANSWER;
- }
- else
- inoutvec[i] = invec[i];
- }
- return (1);
-}
-
-int main( int argc, char **argv )
-{
- int rank, size;
- int data;
- int errors=0;
- int result = -100;
- MPI_Op op;
-
- MPI_Init( &argc, &argv );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- MPI_Comm_size( MPI_COMM_WORLD, &size );
-
- data = rank;
-
- MPI_Op_create( (MPI_User_function*)assoc, 0, &op );
- MPI_Reduce ( &data, &result, 1, MPI_INT, op, size-1, MPI_COMM_WORLD );
- MPI_Bcast ( &result, 1, MPI_INT, size-1, MPI_COMM_WORLD );
- MPI_Op_free( &op );
- if (result == BAD_ANSWER) errors++;
-
- if (errors)
- printf( "[%d] done with ERRORS(%d)!\n", rank, errors );
- Test_Waitforall( );
- MPI_Finalize();
-
- return errors;
-}
+++ /dev/null
-#include "mpi.h"
-#include <stdio.h>
-#include "test.h"
-
-void addem ( int *, int *, int *, MPI_Datatype * );
-void assoc ( int *, int *, int *, MPI_Datatype * );
-
-void addem(invec, inoutvec, len, dtype)
-int *invec, *inoutvec, *len;
-MPI_Datatype *dtype;
-{
- int i;
- for ( i=0; i<*len; i++ )
- inoutvec[i] += invec[i];
-}
-
-#define BAD_ANSWER 100000
-
-/*
- The operation is inoutvec[i] = invec[i] op inoutvec[i]
- (see 4.9.4). The order is important.
-
- Note that the computation is in process rank (in the communicator)
- order, independant of the root.
- */
-void assoc(invec, inoutvec, len, dtype)
-int *invec, *inoutvec, *len;
-MPI_Datatype *dtype;
-{
- int i;
- for ( i=0; i<*len; i++ ) {
- if (inoutvec[i] <= invec[i] ) {
- int rank;
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- fprintf( stderr, "[%d] inout[0] = %d, in[0] = %d\n",
- rank, inoutvec[0], invec[0] );
- inoutvec[i] = BAD_ANSWER;
- }
- else
- inoutvec[i] = invec[i];
- }
-}
-
-int main( int argc, char **argv )
-{
- int rank, size, i;
- int data;
- int errors=0;
- int result = -100;
- int correct_result;
- MPI_Op op_assoc, op_addem;
-
- MPI_Init( &argc, &argv );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- MPI_Comm_size( MPI_COMM_WORLD, &size );
-
- data = rank;
-
- correct_result = 0;
- for (i=0;i<=rank;i++)
- correct_result += i;
-
- MPI_Scan ( &data, &result, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
- if (result != correct_result) {
- fprintf( stderr, "[%d] Error suming ints with scan\n", rank );
- errors++;
- }
-
- MPI_Scan ( &data, &result, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
- if (result != correct_result) {
- fprintf( stderr, "[%d] Error summing ints with scan (2)\n", rank );
- errors++;
- }
-
- data = rank;
- result = -100;
- MPI_Op_create( (MPI_User_function *)assoc, 0, &op_assoc );
- MPI_Op_create( (MPI_User_function *)addem, 1, &op_addem );
- MPI_Scan ( &data, &result, 1, MPI_INT, op_addem, MPI_COMM_WORLD );
- if (result != correct_result) {
- fprintf( stderr, "[%d] Error summing ints with scan (userop)\n",
- rank );
- errors++;
- }
-
- MPI_Scan ( &data, &result, 1, MPI_INT, op_addem, MPI_COMM_WORLD );
- if (result != correct_result) {
- fprintf( stderr, "[%d] Error summing ints with scan (userop2)\n",
- rank );
- errors++;
- }
- /*result = -100;
- data = rank;
- MPI_Scan ( &data, &result, 1, MPI_INT, op_assoc, MPI_COMM_WORLD );
- if (result == BAD_ANSWER) {
- fprintf( stderr, "[%d] Error scanning with non-commutative op\n",
- rank );
- errors++;
- }*/
-
- MPI_Op_free( &op_assoc );
- MPI_Op_free( &op_addem );
-
- if (errors)
- printf( "[%d] done with ERRORS(%d)!\n", rank, errors );
-
- Test_Waitforall( );
- MPI_Finalize();
- return errors;
-}
+++ /dev/null
-
-#include <stdio.h>
-#include "mpi.h"
-#include "test.h"
-
-#define TABLE_SIZE 2
-
-int main( int argc, char **argv )
-{
- int rank, size;
- double a[TABLE_SIZE];
- struct { double a; int b; } in[TABLE_SIZE], out[TABLE_SIZE];
- int i;
- int errors = 0, toterrors;
-
- /* Initialize the environment and some variables */
- MPI_Init( &argc, &argv );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- MPI_Comm_size( MPI_COMM_WORLD, &size );
-
- /* Initialize the maxloc data */
- for ( i=0; i<TABLE_SIZE; i++ ) a[i] = 0;
- for ( i=rank; i<TABLE_SIZE; i++ ) a[i] = (double)rank + 1.0;
-
- /* Copy data to the "in" buffer */
- for (i=0; i<TABLE_SIZE; i++) {
- in[i].a = a[i];
- in[i].b = rank;
- }
-
- /* Reduce it! */
- MPI_Reduce( in, out, TABLE_SIZE, MPI_DOUBLE_INT, MPI_MAXLOC, 0, MPI_COMM_WORLD );
- MPI_Bcast ( out, TABLE_SIZE, MPI_DOUBLE_INT, 0, MPI_COMM_WORLD );
-
- /* Check to see that we got the right answers */
- for (i=0; i<TABLE_SIZE; i++)
- if (i % size == rank)
- if (out[i].b != rank) {
- printf("MAX (ranks[%d] = %d != %d\n", i, out[i].b, rank );
- errors++;
- }
-
- /* Initialize the minloc data */
- for ( i=0; i<TABLE_SIZE; i++ ) a[i] = 0;
- for ( i=rank; i<TABLE_SIZE; i++ ) a[i] = -(double)rank - 1.0;
-
- /* Copy data to the "in" buffer */
- for (i=0; i<TABLE_SIZE; i++) {
- in[i].a = a[i];
- in[i].b = rank;
- }
-
- /* Reduce it! */
- MPI_Allreduce( in, out, TABLE_SIZE, MPI_DOUBLE_INT, MPI_MINLOC, MPI_COMM_WORLD );
-
- /* Check to see that we got the right answers */
- for (i=0; i<TABLE_SIZE; i++)
- if (i % size == rank)
- if (out[i].b != rank) {
- printf("MIN (ranks[%d] = %d != %d\n", i, out[i].b, rank );
- errors++;
- }
-
- /* Finish up! */
- MPI_Allreduce( &errors, &toterrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
- if (toterrors) {
- if (errors)
- printf( "[%d] done with ERRORS(%d)!\n", rank, errors );
- }
- else {
- if (rank == 0) printf( " No Errors\n" );
- }
-
- MPI_Finalize();
- return errors;
-}
+++ /dev/null
-#include "mpi.h"
-#include "test.h"
-
-/*
-From: hook@nas.nasa.gov (Edward C. Hook)
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <string.h>
-#include <errno.h>
-#ifndef EXIT_SUCCESS
-#define EXIT_SUCCESS 0
-#define EXIT_FAILURE 1
-#endif
-
-int main( int argc, char *argv[] )
-{
- int rank, size;
- int i,j;
- int *sb;
- int *rb;
- int status, gstatus, endstatus;
- endstatus=0;
- MPI_Init(&argc,&argv);
- MPI_Comm_rank(MPI_COMM_WORLD,&rank);
- MPI_Comm_size(MPI_COMM_WORLD,&size);
-
- for ( i=1 ; i < argc ; ++i ) {
- if ( argv[i][0] != '-' )
- continue;
- switch(argv[i][1]) {
- default:
- fprintf(stderr,"Unrecognized argument %s\n",
- argv[i]);
- MPI_Abort(MPI_COMM_WORLD,EXIT_FAILURE);
- }
- }
-
-
- /*
- SMPI addition: we want to test all three alltoall algorithms, thus we use
- three different sizes. This is the code that handles these cases:
-
- if (sendsize < 200 && size > 12) {
- retval =
- smpi_coll_tuned_alltoall_bruck(sendbuf, sendcount, sendtype,
- recvbuf, recvcount, recvtype,
- comm);
- } else if (sendsize < 3000) {
- retval =
- smpi_coll_tuned_alltoall_basic_linear(sendbuf, sendcount,
- sendtype, recvbuf,
- recvcount, recvtype, comm);
- } else {
- retval =
- smpi_coll_tuned_alltoall_pairwise(sendbuf, sendcount, sendtype,
- recvbuf, recvcount, recvtype,
- comm);
- }
- */
-
-
- int sizes [3] ={ 4096, 64, 32};
- for ( j=0 ; j < 3 ; j++ ) {
- sb = (int *)malloc(size*sizes[j]*sizeof(int));
- if ( !sb ) {
- perror( "can't allocate send buffer" );
- MPI_Abort(MPI_COMM_WORLD,EXIT_FAILURE);
- }
- rb = (int *)malloc(size*sizes[j]*sizeof(int));
- if ( !rb ) {
- perror( "can't allocate recv buffer");
- free(sb);
- MPI_Abort(MPI_COMM_WORLD,EXIT_FAILURE);
- }
- for ( i=0 ; i < size*sizes[j] ; ++i ) {
- sb[i] = rank + 1;
- rb[i] = 0;
- }
-
- /* fputs("Before MPI_Alltoall\n",stdout); */
- MPI_Barrier(MPI_COMM_WORLD );
- /* This should really send MPI_CHAR, but since sb and rb were allocated
- as chunk*size*sizeof(int), the buffers are large enough */
- status = MPI_Alltoall(sb,sizes[j],MPI_INT,rb,sizes[j],MPI_INT,
- MPI_COMM_WORLD);
-
- /* fputs("Before MPI_Allreduce\n",stdout); */
- MPI_Allreduce( &status, &gstatus, 1, MPI_INT, MPI_SUM,
- MPI_COMM_WORLD );
-
- MPI_Barrier(MPI_COMM_WORLD );
- /* fputs("After MPI_Allreduce\n",stdout); */
- if (rank == 0 && gstatus != 0) endstatus ++;
-
- free(sb);
- free(rb);
- }
-
- if (rank == 0) {
- if (endstatus == 0) printf( " No Errors\n" );
- else
- printf("all_to_all returned %d erros\n",endstatus);
- }
- MPI_Finalize();
-
- return(EXIT_SUCCESS);
-}
-
+++ /dev/null
-You requested to use 14 processes, but there is only 5 processes in your hostfile...
- No Errors
+++ /dev/null
-#include "mpi.h"
-#include <stdio.h>
-#include "test.h"
-
-#define MAX_PROCESSES 10
-
-int main( int argc, char **argv )
-{
- int rank, size, i,j;
- int table[MAX_PROCESSES][MAX_PROCESSES];
- int errors=0;
- int participants;
- MPI_Comm testcomm;
-
- MPI_Init( &argc, &argv );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- MPI_Comm_size( MPI_COMM_WORLD, &size );
-
- /* A maximum of MAX_PROCESSES processes can participate */
- if ( size > MAX_PROCESSES ) participants = MAX_PROCESSES;
- else participants = size;
- /* Set the particpants so that it divides the MAX_PROCESSES */
- while (MAX_PROCESSES % participants) participants--;
- /* Create the communicator */
- MPI_Comm_split( MPI_COMM_WORLD, rank < participants, rank, &testcomm );
-
- if (MAX_PROCESSES % participants) {
- fprintf( stderr, "Number of processors must divide %d\n",
- MAX_PROCESSES );
- MPI_Abort( MPI_COMM_WORLD, 1 );
- }
- if ( (rank < participants) ) {
-
- /* Determine what rows are my responsibility */
- int block_size = MAX_PROCESSES / participants;
- int begin_row = rank * block_size;
- int end_row = (rank+1) * block_size;
- int send_count = block_size * MAX_PROCESSES;
- int recv_count = send_count;
-
- /* Paint my rows my color */
- for (i=begin_row; i<end_row ;i++)
- for (j=0; j<MAX_PROCESSES; j++)
- table[i][j] = rank + 10;
-
- /* Gather everybody's result together - sort of like an */
- /* inefficient allgather */
- for (i=0; i<participants; i++)
- MPI_Gather(&table[begin_row][0], send_count, MPI_INT,
- &table[0][0], recv_count, MPI_INT, i,
- testcomm );
-
- /* Everybody should have the same table now, */
- /* This test does not in any way guarantee there are no errors */
- /* Print out a table or devise a smart test to make sure it's correct */
- for (i=0; i<MAX_PROCESSES;i++) {
- if ( (table[i][0] - table[i][MAX_PROCESSES-1] !=0) )
- errors++;
- }
- }
-
- MPI_Comm_free( &testcomm );
- Test_Waitforall( );
- MPI_Finalize();
- if (errors)
- printf( "[%d] done with ERRORS(%d)!\n", rank, errors );
- return errors;
-}
+++ /dev/null
-#include "mpi.h"
-#include <stdio.h>
-#include "test.h"
-
-#define MAX_PROCESSES 10
-
-int main( int argc, char **argv )
-{
- int rank, size, i,j;
- int table[MAX_PROCESSES][MAX_PROCESSES];
- int errors=0;
- int participants;
- int displs[MAX_PROCESSES];
- int recv_counts[MAX_PROCESSES];
-
- MPI_Init( &argc, &argv );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- MPI_Comm_size( MPI_COMM_WORLD, &size );
-
- /* A maximum of MAX_PROCESSES processes can participate */
- if ( size > MAX_PROCESSES ) participants = MAX_PROCESSES;
- else participants = size;
- /* while (MAX_PROCESSES % participants) participants--; */
- if (MAX_PROCESSES % participants) {
- fprintf( stderr, "Number of processors must divide %d\n",
- MAX_PROCESSES );
- MPI_Abort( MPI_COMM_WORLD, 1 );
- }
- if ( (rank < participants) ) {
-
- /* Determine what rows are my responsibility */
- int block_size = MAX_PROCESSES / participants;
- int begin_row = rank * block_size;
- int end_row = (rank+1) * block_size;
- int send_count = block_size * MAX_PROCESSES;
-
- /* Fill in the displacements and recv_counts */
- for (i=0; i<participants; i++) {
- displs[i] = i * block_size * MAX_PROCESSES;
- recv_counts[i] = send_count;
- }
-
- /* Paint my rows my color */
- for (i=begin_row; i<end_row ;i++)
- for (j=0; j<MAX_PROCESSES; j++)
- table[i][j] = rank + 10;
-
- /* Gather everybody's result together - sort of like an */
- /* inefficient allgather */
- for (i=0; i<participants; i++) {
- MPI_Gatherv(&table[begin_row][0], send_count, MPI_INT,
- &table[0][0], recv_counts, displs, MPI_INT,
- i, MPI_COMM_WORLD);
- }
-
-
- /* Everybody should have the same table now.
-
- The entries are:
- Table[i][j] = (i/block_size) + 10;
- */
- for (i=0; i<MAX_PROCESSES;i++)
- if ( (table[i][0] - table[i][MAX_PROCESSES-1] !=0) )
- errors++;
- for (i=0; i<MAX_PROCESSES;i++) {
- for (j=0; j<MAX_PROCESSES;j++) {
- if (table[i][j] != (i/block_size) + 10) errors++;
- }
- }
- if (errors) {
- /* Print out table if there are any errors */
- for (i=0; i<MAX_PROCESSES;i++) {
- printf("\n");
- for (j=0; j<MAX_PROCESSES; j++)
- printf(" %d",table[i][j]);
- }
- printf("\n");
- }
- }
-
- Test_Waitforall( );
- MPI_Finalize();
- if (errors)
- printf( "[%d] done with ERRORS(%d)!\n", rank, errors );
- return errors;
-}
+++ /dev/null
-#include "mpi.h"
-#include <stdio.h>
-#include "test.h"
-
-#define MAX_PROCESSES 10
-
-int main( int argc, char **argv )
-{
- int rank, size, i,j;
- int table[MAX_PROCESSES][MAX_PROCESSES];
- int row[MAX_PROCESSES];
- int errors=0;
- int participants;
-
- MPI_Init( &argc, &argv );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- MPI_Comm_size( MPI_COMM_WORLD, &size );
-
- /* A maximum of MAX_PROCESSES processes can participate */
- if ( size > MAX_PROCESSES ) participants = MAX_PROCESSES;
- else participants = size;
- if ( (rank < participants) ) {
- int send_count = MAX_PROCESSES;
- int recv_count = MAX_PROCESSES;
-
- /* If I'm the root (process 0), then fill out the big table */
- if (rank == 0)
- for ( i=0; i<participants; i++)
- for ( j=0; j<MAX_PROCESSES; j++ )
- table[i][j] = i+j;
-
- /* Scatter the big table to everybody's little table */
- MPI_Scatter(&table[0][0], send_count, MPI_INT,
- &row[0] , recv_count, MPI_INT, 0, MPI_COMM_WORLD);
-
- /* Now see if our row looks right */
- for (i=0; i<MAX_PROCESSES; i++)
- if ( row[i] != i+rank ) errors++;
- }
-
- Test_Waitforall( );
- MPI_Finalize();
- if (errors)
- printf( "[%d] done with ERRORS(%d)!\n", rank, errors );
- return errors;
-}
+++ /dev/null
-#include "mpi.h"
-#include <stdio.h>
-#include "test.h"
-
-#define MAX_PROCESSES 10
-
-int main( int argc, char **argv )
-{
- int rank, size, i,j;
- int table[MAX_PROCESSES][MAX_PROCESSES];
- int row[MAX_PROCESSES];
- int errors=0;
- int participants;
- int displs[MAX_PROCESSES];
- int send_counts[MAX_PROCESSES];
-
- MPI_Init( &argc, &argv );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- MPI_Comm_size( MPI_COMM_WORLD, &size );
-
- /* A maximum of MAX_PROCESSES processes can participate */
- if ( size > MAX_PROCESSES ) participants = MAX_PROCESSES;
- else participants = size;
- if ( (rank < participants) ) {
- int recv_count = MAX_PROCESSES;
-
- /* If I'm the root (process 0), then fill out the big table */
- /* and setup send_counts and displs arrays */
- if (rank == 0)
- for ( i=0; i<participants; i++) {
- send_counts[i] = recv_count;
- displs[i] = i * MAX_PROCESSES;
- for ( j=0; j<MAX_PROCESSES; j++ )
- table[i][j] = i+j;
- }
-
- /* Scatter the big table to everybody's little table */
- MPI_Scatterv(&table[0][0], send_counts, displs, MPI_INT,
- &row[0] , recv_count, MPI_INT, 0, MPI_COMM_WORLD);
-
- /* Now see if our row looks right */
- for (i=0; i<MAX_PROCESSES; i++)
- if ( row[i] != i+rank ) errors++;
- }
-
- Test_Waitforall( );
- MPI_Finalize();
- if (errors)
- printf( "[%d] done with ERRORS(%d)!\n", rank, errors );
- return errors;
-}
+++ /dev/null
-#include "mpi.h"
-#include <stdio.h>
-#include "test.h"
-
-#define MAX_PROCESSES 10
-
-int main( int argc, char **argv )
-{
- int rank, size, i,j;
- int table[MAX_PROCESSES][MAX_PROCESSES];
- int errors=0;
- int participants;
- int displs[MAX_PROCESSES];
- int recv_counts[MAX_PROCESSES];
-
- MPI_Init( &argc, &argv );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- MPI_Comm_size( MPI_COMM_WORLD, &size );
-
- /* A maximum of MAX_PROCESSES processes can participate */
- if ( size > MAX_PROCESSES ) participants = MAX_PROCESSES;
- else participants = size;
- /* while (MAX_PROCESSES % participants) participants--; */
- if (MAX_PROCESSES % participants) {
- fprintf( stderr, "Number of processors must divide %d\n",
- MAX_PROCESSES );
- MPI_Abort( MPI_COMM_WORLD, 1 );
- }
- if ( (rank < participants) ) {
-
- /* Determine what rows are my responsibility */
- int block_size = MAX_PROCESSES / participants;
- int begin_row = rank * block_size;
- int end_row = (rank+1) * block_size;
- int send_count = block_size * MAX_PROCESSES;
-
- /* Fill in the displacements and recv_counts */
- for (i=0; i<participants; i++) {
- displs[i] = i * block_size * MAX_PROCESSES;
- recv_counts[i] = send_count;
- }
-
- /* Paint my rows my color */
- for (i=begin_row; i<end_row ;i++)
- for (j=0; j<MAX_PROCESSES; j++)
- table[i][j] = rank + 10;
-
- /* Everybody gets the gathered data */
- MPI_Allgatherv(&table[begin_row][0], send_count, MPI_INT,
- &table[0][0], recv_counts, displs,
- MPI_INT, MPI_COMM_WORLD);
-
- /* Everybody should have the same table now.
-
- The entries are:
- Table[i][j] = (i/block_size) + 10;
- */
- for (i=0; i<MAX_PROCESSES;i++)
- if ( (table[i][0] - table[i][MAX_PROCESSES-1] !=0) )
- errors++;
- for (i=0; i<MAX_PROCESSES;i++) {
- for (j=0; j<MAX_PROCESSES;j++) {
- if (table[i][j] != (i/block_size) + 10) errors++;
- }
- }
- if (errors) {
- /* Print out table if there are any errors */
- for (i=0; i<MAX_PROCESSES;i++) {
- printf("\n");
- for (j=0; j<MAX_PROCESSES; j++)
- printf(" %d",table[i][j]);
- }
- printf("\n");
- }
- }
-
- Test_Waitforall( );
- MPI_Finalize();
- if (errors)
- printf( "[%d] done with ERRORS(%d)!\n", rank, errors );
- return errors;
-}
+++ /dev/null
-#include "mpi.h"
-#include <stdio.h>
-#include "test.h"
-
-#define MAX_PROCESSES 10
-
-int main( int argc, char **argv )
-{
- int rank, size, i,j;
- int table[MAX_PROCESSES][MAX_PROCESSES];
- int errors=0;
- int participants;
-
- MPI_Init( &argc, &argv );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- MPI_Comm_size( MPI_COMM_WORLD, &size );
-
- /* A maximum of MAX_PROCESSES processes can participate */
- if ( size > MAX_PROCESSES ) participants = MAX_PROCESSES;
- else participants = size;
- if (MAX_PROCESSES % participants) {
- fprintf( stderr, "Number of processors must divide %d\n",
- MAX_PROCESSES );
- MPI_Abort( MPI_COMM_WORLD, 1 );
- }
- /* while (MAX_PROCESSES % participants) participants--; */
- if ( (rank < participants) ) {
-
- /* Determine what rows are my responsibility */
- int block_size = MAX_PROCESSES / participants;
- int begin_row = rank * block_size;
- int end_row = (rank+1) * block_size;
- int send_count = block_size * MAX_PROCESSES;
- int recv_count = send_count;
-
- /* Paint my rows my color */
- for (i=begin_row; i<end_row ;i++)
- for (j=0; j<MAX_PROCESSES; j++)
- table[i][j] = rank + 10;
-
- /* Everybody gets the gathered table */
- MPI_Allgather(&table[begin_row][0], send_count, MPI_INT,
- &table[0][0], recv_count, MPI_INT, MPI_COMM_WORLD);
-
- /* Everybody should have the same table now, */
- /* This test does not in any way guarantee there are no errors */
- /* Print out a table or devise a smart test to make sure it's correct */
- for (i=0; i<MAX_PROCESSES;i++) {
- if ( (table[i][0] - table[i][MAX_PROCESSES-1] !=0) )
- errors++;
- }
- }
-
- Test_Waitforall( );
- MPI_Finalize();
- if (errors)
- printf( "[%d] done with ERRORS(%d)!\n", rank, errors );
- return errors;
-}
+++ /dev/null
-#include "mpi.h"
-#include <stdio.h>
-#include "test.h"
-
-int main( int argc, char **argv )
-{
- int rank, size, i;
- int data;
- int errors=0;
- int result = -100;
- int correct_result;
-
- MPI_Init( &argc, &argv );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- MPI_Comm_size( MPI_COMM_WORLD, &size );
-
- data = rank;
-
- MPI_Reduce ( &data, &result, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD );
- MPI_Bcast ( &result, 1, MPI_INT, 0, MPI_COMM_WORLD );
- correct_result = 0;
- for(i=0;i<size;i++)
- correct_result += i;
- if (result != correct_result) errors++;
-
- MPI_Reduce ( &data, &result, 1, MPI_INT, MPI_MIN, 0, MPI_COMM_WORLD );
- MPI_Bcast ( &result, 1, MPI_INT, 0, MPI_COMM_WORLD );
- if (result != 0) errors++;
-
- MPI_Reduce ( &data, &result, 1, MPI_INT, MPI_MAX, 0, MPI_COMM_WORLD );
- MPI_Bcast ( &result, 1, MPI_INT, 0, MPI_COMM_WORLD );
- if (result != (size-1)) errors++;
-
- Test_Waitforall( );
- MPI_Finalize();
- if (errors)
- printf( "[%d] done with ERRORS(%d)!\n", rank, errors );
- return errors;
-}
+++ /dev/null
-#include "mpi.h"
-#include <stdio.h>
-#include "test.h"
-
-void addem ( int *, int *, int *, MPI_Datatype * );
-
-void addem(invec, inoutvec, len, dtype)
-int *invec, *inoutvec, *len;
-MPI_Datatype *dtype;
-{
- int i;
- for ( i=0; i<*len; i++ )
- inoutvec[i] += invec[i];
-}
-
-int main( int argc, char **argv )
-{
- int rank, size, i;
- int data;
- int errors=0;
- int result = -100;
- int correct_result;
- MPI_Op op;
-
- MPI_Init( &argc, &argv );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- MPI_Comm_size( MPI_COMM_WORLD, &size );
-
- data = rank;
- MPI_Op_create( (MPI_User_function *)addem, 1, &op );
- MPI_Reduce ( &data, &result, 1, MPI_INT, op, 0, MPI_COMM_WORLD );
- MPI_Bcast ( &result, 1, MPI_INT, 0, MPI_COMM_WORLD );
- MPI_Op_free( &op );
- correct_result = 0;
- for(i=0;i<size;i++)
- correct_result += i;
- if (result != correct_result) errors++;
-
- Test_Waitforall( );
- MPI_Finalize();
- if (errors)
- printf( "[%d] done with ERRORS(%d)!\n", rank, errors );
- return errors;
-}
+++ /dev/null
-/* $Id: grouptest.c,v 1.2 1998/11/28 04:04:56 gropp Exp $ */
-
-#include "mpi.h"
-#include <stdio.h>
-#include "test.h"
-
-int main( int argc, char **argv )
-{
- int rank, size, i;
- MPI_Group group1, group2, group3, groupall, groupunion, newgroup;
- MPI_Comm newcomm;
- int ranks1[100], ranks2[100], ranks3[100];
- int nranks1=0, nranks2=0, nranks3=0;
-
- MPI_Init( &argc, &argv );
- MPI_Barrier( MPI_COMM_WORLD );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- MPI_Comm_size( MPI_COMM_WORLD, &size );
- MPI_Comm_group( MPI_COMM_WORLD, &groupall );
-
- /* Divide groups */
- for (i=0; i<size; i++)
- if ( (i%3)==0 )
- ranks1[nranks1++] = i;
- else if ( (i%3)==1 )
- ranks2[nranks2++] = i;
- else
- ranks3[nranks3++] = i;
-
- MPI_Group_incl ( groupall, nranks1, ranks1, &group1 );
- MPI_Group_incl ( groupall, nranks2, ranks2, &group2 );
- MPI_Group_incl ( groupall, nranks3, ranks3, &group3 );
-
- MPI_Group_difference ( groupall, group2, &groupunion );
-
- MPI_Comm_create ( MPI_COMM_WORLD, group3, &newcomm );
- newgroup = MPI_GROUP_NULL;
- if (newcomm != MPI_COMM_NULL)
- {
- /* If we don't belong to group3, this would fail */
- MPI_Comm_group ( newcomm, &newgroup );
- }
-
- /* Free the groups */
- /* MPI_Group_free( &groupall );
- MPI_Group_free( &group1 );
- MPI_Group_free( &group2 );
- MPI_Group_free( &group3 );
- MPI_Group_free( &groupunion );*/
- if (newgroup != MPI_GROUP_NULL)
- {
- //MPI_Group_free( &newgroup );
- }
-
- /* Free the communicator */
- //if (newcomm != MPI_COMM_NULL)
- //MPI_Comm_free( &newcomm );
- Test_Waitforall( );
- MPI_Finalize();
- return 0;
-}
+++ /dev/null
-#include "mpi.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include "test.h"
-
-int add ( double *, double *, int *, MPI_Datatype * );
-/*
- * User-defined operation on a long value (tests proper handling of
- * possible pipelining in the implementation of reductions with user-defined
- * operations).
- */
-int add( invec, inoutvec, len, dtype )
-double *invec, *inoutvec;
-int *len;
-MPI_Datatype *dtype;
-{
- int i, n = *len;
- for (i=0; i<n; i++) {
- inoutvec[i] = invec[i] + inoutvec[i];
- }
- return 0;
-}
-
-int main( int argc, char **argv )
-{
- MPI_Op op;
- int i, rank, size, bufsize, errcnt = 0, toterr;
- double *inbuf, *outbuf, value;
-
- MPI_Init( &argc, &argv );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- MPI_Comm_size( MPI_COMM_WORLD, &size );
- MPI_Op_create( (MPI_User_function *)add, 1, &op );
-
- bufsize = 1;
- while (bufsize < 100000) {
- inbuf = (double *)malloc( bufsize * sizeof(double) );
- outbuf = (double *)malloc( bufsize * sizeof(double) );
- if (! inbuf || ! outbuf) {
- fprintf( stderr, "Could not allocate buffers for size %d\n",
- bufsize );
- errcnt++;
- break;
- }
-
- value = (rank & 0x1) ? 1.0 : -1.0;
- for (i=0; i<bufsize; i++) {
- inbuf[i] = value;
- outbuf[i] = 100.0;
- }
- MPI_Allreduce( inbuf, outbuf, bufsize, MPI_DOUBLE, op,
- MPI_COMM_WORLD );
- /* Check values */
- value = (size & 0x1) ? -1.0 : 0.0;
- for (i=0; i<bufsize; i++) {
- if (outbuf[i] != value) {
- if (errcnt < 10)
- printf( "outbuf[%d] = %f, should = %f\n", i, outbuf[i],
- value );
- errcnt ++;
- }
- }
- free( inbuf );
- free( outbuf );
- bufsize *= 2;
- }
-
- MPI_Allreduce( &errcnt, &toterr, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- if (rank == 0) {
- if (toterr == 0)
- printf( " No Errors\n" );
- else
- printf( "*! %d errors!\n", toterr );
- }
-
- MPI_Op_free( &op );
- MPI_Finalize( );
- return 0;
-}
-
+++ /dev/null
-#include "mpi.h"
-#include <stdio.h>
-
-int main( int argc, char *argv[] )
-{
- int rank, size;
- MPI_Comm local_comm;
- MPI_Request r;
- MPI_Status status;
- double t0;
-
-
- MPI_Init( &argc, &argv );
- MPI_Comm_size( MPI_COMM_WORLD, &size );
- if (size < 3) {
- fprintf( stderr, "Need at least 3 processors\n" );
- MPI_Abort( MPI_COMM_WORLD, 1 );
- }
-
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- MPI_Comm_split( MPI_COMM_WORLD, rank < 2, rank, &local_comm );
-
- MPI_Barrier( MPI_COMM_WORLD );
- if (rank == 0) {
- /* First, ensure ssend works */
- t0 = MPI_Wtime();
- MPI_Ssend( MPI_BOTTOM, 0, MPI_INT, 1, 1, MPI_COMM_WORLD );
- t0 = MPI_Wtime() - t0;
- if (t0 < 1.0) {
- fprintf( stderr, "Ssend does not wait for recv!\n" );
- fflush( stderr );
- MPI_Abort( MPI_COMM_WORLD, 1 );
- }
- MPI_Barrier( MPI_COMM_WORLD );
- /* Start the ssend after process 1 is well into its barrier */
- t0 = MPI_Wtime();
- while (MPI_Wtime() - t0 < 1.0) ;
- MPI_Ssend( MPI_BOTTOM, 0, MPI_INT, 1, 0, MPI_COMM_WORLD );
- MPI_Barrier( local_comm );
- /* Send process 2 an alls well */
- MPI_Send( MPI_BOTTOM, 0, MPI_INT, 2, 0, MPI_COMM_WORLD );
- }
- else if (rank == 1) {
- t0 = MPI_Wtime();
- while (MPI_Wtime() - t0 < 2.0) ;
- MPI_Recv( MPI_BOTTOM, 0, MPI_INT, 0, 1, MPI_COMM_WORLD, &status );
- MPI_Barrier( MPI_COMM_WORLD );
- MPI_Irecv( MPI_BOTTOM, 0, MPI_INT, 0, 0, MPI_COMM_WORLD, &r );
- MPI_Barrier( local_comm );
- MPI_Wait( &r, &status );
- }
- else if (rank == 2) {
- int flag;
-
- MPI_Barrier( MPI_COMM_WORLD );
- MPI_Irecv( MPI_BOTTOM, 0, MPI_INT, 0, 0, MPI_COMM_WORLD, &r );
- t0 = MPI_Wtime();
- while (MPI_Wtime() - t0 < 3.0) ;
- MPI_Test( &r, &flag, &status );
- if (!flag) {
- fprintf( stderr, "Test failed!\n" );
- fflush( stderr );
- MPI_Abort( MPI_COMM_WORLD, 1 );
- }
- else
- fprintf( stderr, "Test succeeded\n" );
- }
- else {
- MPI_Barrier( MPI_COMM_WORLD );
- }
-
- MPI_Comm_free( &local_comm );
- MPI_Finalize();
- return 0;
-}
+++ /dev/null
-/*
- * Test of reduce scatter.
- *
- * Each processor contributes its rank + the index to the reduction,
- * then receives the ith sum
- *
- * Can be called with any number of processors.
- */
-
-#include "mpi.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include "test.h"
-
-int main( int argc, char **argv )
-{
- int err = 0, toterr;
- int *sendbuf, *recvbuf, *recvcounts;
- int size, rank, i, sumval;
- MPI_Comm comm;
-
-
- MPI_Init( &argc, &argv );
- comm = MPI_COMM_WORLD;
-
- MPI_Comm_size( comm, &size );
- MPI_Comm_rank( comm, &rank );
- sendbuf = (int *) malloc( size * sizeof(int) );
- for (i=0; i<size; i++)
- sendbuf[i] = rank + i;
- recvcounts = (int *)malloc( size * sizeof(int) );
- recvbuf = (int *)malloc( size * sizeof(int) );
- for (i=0; i<size; i++)
- recvcounts[i] = 1;
- MPI_Reduce_scatter( sendbuf, recvbuf, recvcounts, MPI_INT, MPI_SUM, comm );
- sumval = size * rank + ((size - 1) * size)/2;
-/* recvbuf should be size * (rank + i) */
- if (recvbuf[0] != sumval) {
- err++;
- fprintf( stdout, "Did not get expected value for reduce scatter\n" );
- fprintf( stdout, "[%d] Got %d expected %d\n", rank, recvbuf[0], sumval );
- }
-
- MPI_Allreduce( &err, &toterr, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
- if (rank == 0 && toterr == 0) {
- printf( " No Errors\n" );
- }
- MPI_Finalize( );
-
- return toterr;
-}
+++ /dev/null
-#include "mpi.h"
-#include <stdio.h>
-#include "test.h"
-
-int main( int argc, char **argv )
-{
- int rank, value, result;
-
- MPI_Init (&argc, &argv);
- MPI_Comm_rank (MPI_COMM_WORLD, &rank);
-
- value = (rank == 0) ? 3 : 6;
- MPI_Allreduce (&value, &result, 1, MPI_INT, MPI_BOR, MPI_COMM_WORLD);
- if (rank == 0) printf ("Result of 3 BOR 6 is %d, result of 3|6 is %d\n",
- result, 3|6);
-
- Test_Waitforall( );
- MPI_Finalize ();
-
- return 0;
-}
+++ /dev/null
-#! /bin/sh
-# This version puts the output from each program into a separate file.
-# -mvhome is needed for the ANL SP, and is ignored by others
-args=
-device=
-MPICH_VERSION=
-STOPFILE=${MPITEST_STOPTEST:-"$HOME/.stopmpichtests"}
-
-MAKE="make --no-print-directory"
-MPIRUNMVBACK=''
-#
-
-# Set mpirun to the name/path of the mpirun program
-#FindMPIRUN
-#
-runtests=1
-makeeach=0
-writesummaryfile=no
-have_fortran=0
-have_selector="no"
-quiet=0
-MAKE="make --no-print-directory"
-for arg in "$@" ; do
- case $arg in
- -basedir=* )
- basedir=`echo $arg | sed 's/-basedir=//'`
- ;;
- -srcdir=* )
- srcdir=`echo $arg | sed 's/-srcdir=//'`
- ;;
- -fort=* )
- have_fortran=`echo $arg | sed 's/-fort=//'`
- ;;
- -selector=* )
- have_selector=`echo $arg | sed 's/-selector=//'`
- ;;
- -checkonly )
- runtests=0
- ;;
- -margs=*)
- margs=`echo $arg | sed 's/-margs=//'`
- args="$args $margs"
- ;;
- -small)
- shift
- makeeach=1
- ;;
- -summaryfile=*)
- writesummaryfile=yes
- summaryfile=`echo A$arg | sed 's/A-summaryfile=//'`
- ;;
- -quiet)
- shift
- quiet=1
- ;;
- -help|-u)
- echo "runtests [-checkonly] [-margs='...']"
- echo "run tests in this directory. If -checkonly set, just run"
- echo "the differences check (do NO rerun the test programs)."
- echo "If -margs is used, these options are passed to mpirun."
- echo "If -small is used, the examples are built, run, and deleted."
- exit 1
- ;;
- *)
- if test -n "$arg" ; then
- echo "runtests: Unknown argument ($arg)"
- exit 1
- fi
- ;;
- esac
-done
-# Load basic procedures
-. ${srcdir}/../runbase
-#
-# If the programs are not available, run make.
-if [ ! -x coll1 -a $makeeach = 0 -a $runtests = 1 ] ; then
- $MAKE
-fi
-
-selector=${have_selector:+--cfg=smpi/coll_selector:$have_selector}
-
-mpirun=" ${basedir}/bin/smpirun -platform ${srcdir}/../../../../examples/msg/small_platform_with_routers.xml -hostfile ${srcdir}/../../hostfile --log=root.thres:critical $selector "
-testfiles=""
-if [ $runtests = 1 ] ; then
-echo '**** Testing MPI Collective routines ****'
-
-RunTest barrier 4 "*** Barrier Test ***" "" "barrier-0.out"
-
-RunTest bcast_mpich 4 "*** Broadcast Test ***" "" "bcast-0.out bcast-1.out bcast-2.out bcast-3.out"
-
-RunTest bcastvec 4 "*** Broadcast Datatype Test ***" "" "bcastvec-0.out bcastvec-1.out bcastvec-2.out bcastvec-3.out"
-
-
-#TODO : handle MPI_BOTTOM to allow som operations to use absolute addresses
-RunTest coll1 4
-
-RunTest coll2 5
-
-RunTest coll3 5
-
-RunTest coll4 4
-
-RunTest coll5 4
-
-RunTest coll6 5
-
-RunTest coll7 5
-
-RunTest coll8 4
-
-RunTest coll9 4
-
-RunTest coll10 4
-
-RunTest coll11 4
-
-#weird manipulations of ranks in split, and comms -> deadlock, removed
-#RunTest scantst 4
-
-RunTest coll12 4
-
-# coll13 is very picky about arguments
-RunTest coll13 14
-
-RunTest longuser 4
-
-# Some implementations (e.g., IBM's) forget to handle the np = 1 case.
-#RunTest longuser 1 "*** longuser (np == 1) ***"
-MakeExe longuser
-cp longuser longuser1
-RunTest longuser1 1 '*** longuser (np == 1) ***'
-rm -f longuser1
-
-#OutTime
-#testfiles="$testfiles allredmany.out"
-#rm -f allredmany.out
-#MakeExe allredmany
-#echo '**** allredmany ****'
-#echo '*** allredmany ***' >> allredmany.out
-#cnt=0
-## Run several times to try and catch timing/race conditions in managing
-## the flood of one-way messages.
-#while [ $cnt -lt 20 ] ; do
-# echo "*** allredmany run $cnt ***" >> allredmany.out
-# $mpirun -np 2 $args allredmany >> allredmany.out 2>&1
-# cnt=`expr $cnt + 1`
-#done
-#echo '*** allredmany ***' >> allredmany.out
-#CleanExe allredmany
-
-RunTest grouptest 4
-
-RunTest allred 4 "*** Allred ***"
-
-RunTest allred2 4 "*** Allred2 ***"
-#uses MPI_Dims_create, MPI_Cart_create ... removed
-#RunTest scatterv 4 "*** Scatterv ***"
-
-RunTest scattern 4 "*** Scattern ***"
-
-RunTest redscat 4 "*** Reduce_scatter ***"
-
-RunTest alltoallv_mpich 4 "*** Alltoallv ***"
-echo "runtests: fortran ($have_fortran)"
-#
-# Run Fortran tests ONLY if Fortran available
-if [ $have_fortran -eq "1" ] ; then
- echo "FORTRAN TESTS"
-
- RunTest allredf 4 "*** Testing allreduce from Fortran ***"
-
- RunTest assocf 4 "*** Testing allreduce from Fortran (2) ***"
-
- RunTest bcastlog 4 "*** Testing logical datatype in BCAST ***"
- #buggy test, not available in original test, removed
- #RunTest allgatherf 2 "*** Testing allgather from Fortran ***"
- echo "END OF FORTRAN TESTS"
-fi
-
-else
- # Just run checks
- testfiles=`echo *.out`
- if test "$testfiles" = "*.out" ; then
- echo "No output files remain from previous test!"
- exit 1
- fi
-fi
-
-echo '*** Checking for differences from expected output ***'
-CheckAllOutput coll.diff
-exit 0
+++ /dev/null
-#include "mpi.h"
-#include <stdio.h>
-#include "test.h"
-
-MPI_Comm GetNextComm( void );
-void addem ( int *, int *, int *, MPI_Datatype * );
-void assoc ( int *, int *, int *, MPI_Datatype * );
-
-void addem( int *invec, int *inoutvec, int *len, MPI_Datatype *dtype)
-{
- int i;
- for ( i=0; i<*len; i++ )
- inoutvec[i] += invec[i];
-}
-
-#define BAD_ANSWER 100000
-
-/*
- The operation is inoutvec[i] = invec[i] op inoutvec[i]
- (see 4.9.4). The order is important.
-
- Note that the computation is in process rank (in the communicator)
- order, independant of the root.
- */
-void assoc( int *invec, int *inoutvec, int *len, MPI_Datatype *dtype)
-{
- int i;
- for ( i=0; i<*len; i++ ) {
- if (inoutvec[i] <= invec[i] ) {
- int rank;
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- fprintf( stderr, "[%d] inout[0] = %d, in[0] = %d\n",
- rank, inoutvec[0], invec[0] );
- inoutvec[i] = BAD_ANSWER;
- }
- else
- inoutvec[i] = invec[i];
- }
-}
-
-MPI_Comm GetNextComm( void )
-{
- MPI_Comm comm = MPI_COMM_NULL;
- static int idx = 0;
- int size, rank;
- MPI_Comm_size( MPI_COMM_WORLD, &size );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
-
- switch (idx) {
- case 0:
- MPI_Comm_dup( MPI_COMM_WORLD, &comm );
- break;
- case 1:
- /* invert the rank order */
- MPI_Comm_split( MPI_COMM_WORLD, 0, size - rank, &comm );
- break;
- case 2:
- /* Divide into subsets */
- MPI_Comm_split( MPI_COMM_WORLD, rank < (size/2), rank, &comm );
- break;
- case 3:
- /* Another division */
- MPI_Comm_split( MPI_COMM_WORLD, rank < (size/3), size-rank, &comm );
- break;
- case 4:
- /* odd and even */
- MPI_Comm_split( MPI_COMM_WORLD, (rank % 2) == 0, rank, &comm );
- break;
- case 5:
- /* Last case: startover */
- idx = -1;
- break;
- }
- idx++;
- return comm;
-}
-
-int main( int argc, char **argv )
-{
- int rank, size, i;
- int data;
- int errors=0;
- int result = -100;
- int correct_result;
- MPI_Op op_assoc, op_addem;
- MPI_Comm comm;
-
- MPI_Init( &argc, &argv );
- MPI_Op_create( (MPI_User_function *)assoc, 0, &op_assoc );
- MPI_Op_create( (MPI_User_function *)addem, 1, &op_addem );
-
- /* Run this for a variety of communicator sizes */
- while ((comm = GetNextComm()) != MPI_COMM_NULL) {
- MPI_Comm_rank( comm, &rank );
- MPI_Comm_size( comm, &size );
-
- data = rank;
-
- correct_result = 0;
- for (i=0;i<=rank;i++)
- correct_result += i;
-
- MPI_Scan ( &data, &result, 1, MPI_INT, MPI_SUM, comm );
- if (result != correct_result) {
- fprintf( stderr, "[%d] Error suming ints with scan\n", rank );
- errors++;
- }
-
- MPI_Scan ( &data, &result, 1, MPI_INT, MPI_SUM, comm );
- if (result != correct_result) {
- fprintf( stderr, "[%d] Error summing ints with scan (2)\n", rank );
- errors++;
- }
-
- data = rank;
- result = -100;
- MPI_Scan ( &data, &result, 1, MPI_INT, op_addem, comm );
- if (result != correct_result) {
- fprintf( stderr, "[%d] Error summing ints with scan (userop)\n",
- rank );
- errors++;
- }
-
- MPI_Scan ( &data, &result, 1, MPI_INT, op_addem, comm );
- if (result != correct_result) {
- fprintf( stderr, "[%d] Error summing ints with scan (userop2)\n",
- rank );
- errors++;
- }
-/* result = -100;*/
-/* data = rank;*/
-/* MPI_Scan ( &data, &result, 1, MPI_INT, op_assoc, comm );*/
-/* if (result == BAD_ANSWER) {*/
-/* fprintf( stderr, "[%d] Error scanning with non-commutative op\n",*/
-/* rank );*/
-/* errors++;*/
-/* }*/
- MPI_Comm_free( &comm );
- }
-
- MPI_Op_free( &op_assoc );
- MPI_Op_free( &op_addem );
-
- if (errors) {
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- printf( "[%d] done with ERRORS(%d)!\n", rank, errors );
- }
-
- Test_Waitforall( );
- MPI_Finalize();
- return errors;
-}
+++ /dev/null
-#include "mpi.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include "test.h"
-
-/* This example sends a vector and receives individual elements */
-
-int main( int argc, char **argv )
-{
- MPI_Datatype vec;
- double *vecin, *vecout, ivalue;
- int root, i, n, stride, err = 0;
- int rank, size;
-
- MPI_Init( &argc, &argv );
-
- MPI_Comm_size( MPI_COMM_WORLD, &size );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
-
- n = 12;
- stride = 10;
- vecin = (double *)malloc( n * stride * size * sizeof(double) );
- vecout = (double *)malloc( n * sizeof(double) );
-
- MPI_Type_vector( n, 1, stride, MPI_DOUBLE, &vec );
- MPI_Type_commit( &vec );
-
- for (i=0; i<n*stride*size; i++) vecin[i] = (double)i;
- for (root=0; root<size; root++) {
- for (i=0; i<n; i++) vecout[i] = -1.0;
- MPI_Scatter( vecin, 1, vec, vecout, n, MPI_DOUBLE, root,
- MPI_COMM_WORLD );
- ivalue = rank * ((n-1) * stride + 1);
- for (i=0; i<n; i++) {
- if (vecout[i] != ivalue) {
- printf( "Expected %f but found %f\n",
- ivalue, vecout[i] );
- err++;
- }
- ivalue += stride;
- }
- }
- i = err;
- MPI_Allreduce( &i, &err, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
- if (rank == 0) {
- if (err > 0) printf( "Found %d errors!\n", err );
- else printf( " No Errors\n" );
- }
- MPI_Type_free( &vec );
- MPI_Finalize();
- return 0;
-
-}
-
+++ /dev/null
-#include "mpi.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include "test.h"
-
-/* Prototypes for picky compilers */
-void SetData ( double *, double *, int, int, int, int, int, int );
-int CheckData ( double *, int, int, int, int, int );
-/*
- This is an example of using scatterv to send a matrix from one
- process to all others, with the matrix stored in Fortran order.
- Note the use of an explicit UB to enable the sources to overlap.
-
- This tests scatterv to make sure that it uses the datatype size
- and extent correctly. It requires number of processors that
- can be split with MPI_Dims_create.
-
- */
-
-void SetData( sendbuf, recvbuf, nx, ny, myrow, mycol, nrow, ncol )
-double *sendbuf, *recvbuf;
-int nx, ny, myrow, mycol, nrow, ncol;
-{
-int coldim, i, j, m, k;
-double *p;
-
-if (myrow == 0 && mycol == 0) {
- coldim = nx * nrow;
- for (j=0; j<ncol; j++)
- for (i=0; i<nrow; i++) {
- p = sendbuf + i * nx + j * (ny * coldim);
- for (m=0; m<ny; m++) {
- for (k=0; k<nx; k++) {
- p[k] = 1000 * j + 100 * i + m * nx + k;
- }
- p += coldim;
- }
- }
- }
-for (i=0; i<nx*ny; i++)
- recvbuf[i] = -1.0;
-}
-
-int CheckData( recvbuf, nx, ny, myrow, mycol, nrow )
-double *recvbuf;
-int nx, ny, myrow, mycol, nrow;
-{
-int coldim, m, k;
-double *p, val;
-int errs = 0;
-
-coldim = nx;
-p = recvbuf;
-for (m=0; m<ny; m++) {
- for (k=0; k<nx; k++) {
- val = 1000 * mycol + 100 * myrow + m * nx + k;
- if (p[k] != val) {
- errs++;
- if (errs < 10) {
- printf(
- "Error in (%d,%d) [%d,%d] location, got %f expected %f\n",
- m, k, myrow, mycol, p[k], val );
- }
- else if (errs == 10) {
- printf( "Too many errors; suppressing printing\n" );
- }
- }
- }
- p += coldim;
- }
-return errs;
-}
-
-int main( int argc, char **argv )
-{
- int rank, size, myrow, mycol, nx, ny, stride, cnt, i, j, errs, tot_errs;
- double *sendbuf, *recvbuf;
- MPI_Datatype vec, block, types[2];
- MPI_Aint displs[2];
- int *scdispls;
- int blens[2];
- MPI_Comm comm2d;
- int dims[2], periods[2], coords[2], lcoords[2];
- int *sendcounts;
-
-
- MPI_Init( &argc, &argv );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- MPI_Comm_size( MPI_COMM_WORLD, &size );
-
- /* Get a 2-d decomposition of the processes */
- dims[0] = 0; dims[1] = 0;
- MPI_Dims_create( size, 2, dims );
- periods[0] = 0; periods[1] = 0;
- MPI_Cart_create( MPI_COMM_WORLD, 2, dims, periods, 0, &comm2d );
- MPI_Cart_get( comm2d, 2, dims, periods, coords );
- myrow = coords[0];
- mycol = coords[1];
- if (rank == 0)
- printf( "Decomposition is [%d x %d]\n", dims[0], dims[1] );
-
- /* Get the size of the matrix */
- nx = 10;
- ny = 8;
- stride = nx * dims[0];
-
- recvbuf = (double *)malloc( nx * ny * sizeof(double) );
- if (!recvbuf) {
- MPI_Abort( MPI_COMM_WORLD, 1 );
- }
- sendbuf = 0;
- if (myrow == 0 && mycol == 0) {
- sendbuf = (double *)malloc( nx * ny * size * sizeof(double) );
- if (!sendbuf) {
- MPI_Abort( MPI_COMM_WORLD, 1 );
- }
- }
- sendcounts = (int *) malloc( size * sizeof(int) );
- scdispls = (int *)malloc( size * sizeof(int) );
-
- MPI_Type_vector( ny, nx, stride, MPI_DOUBLE, &vec );
- blens[0] = 1; blens[1] = 1;
- types[0] = vec; types[1] = MPI_UB;
- displs[0] = 0; displs[1] = nx * sizeof(double);
-
- MPI_Type_struct( 2, blens, displs, types, &block );
- MPI_Type_free( &vec );
- MPI_Type_commit( &block );
-
- /* Set up the transfer */
- cnt = 0;
- for (i=0; i<dims[1]; i++) {
- for (j=0; j<dims[0]; j++) {
- sendcounts[cnt] = 1;
- /* Using Cart_coords makes sure that ranks (used by
- sendrecv) matches the cartesian coordinates (used to
- set data in the matrix) */
- MPI_Cart_coords( comm2d, cnt, 2, lcoords );
- scdispls[cnt++] = lcoords[0] + lcoords[1] * (dims[0] * ny);
- }
- }
-
- SetData( sendbuf, recvbuf, nx, ny, myrow, mycol, dims[0], dims[1] );
- MPI_Scatterv( sendbuf, sendcounts, scdispls, block,
- recvbuf, nx * ny, MPI_DOUBLE, 0, comm2d );
- if((errs = CheckData( recvbuf, nx, ny, myrow, mycol, dims[0] ))) {
- fprintf( stdout, "Failed to transfer data\n" );
- }
- MPI_Allreduce( &errs, &tot_errs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
- if (rank == 0) {
- if (tot_errs == 0)
- printf( "No errors\n" );
- else
- printf( "%d errors in use of MPI_SCATTERV\n", tot_errs );
- }
-
- if (sendbuf) free( sendbuf );
- free( recvbuf );
- free( sendcounts );
- free( scdispls );
- MPI_Type_free( &block );
- MPI_Comm_free( &comm2d );
- MPI_Finalize();
- return errs;
-}
-
-
+++ /dev/null
-*** Scatterv ***
-Decomposition is [2 x 2]
-No errors
-*** Scatterv ***
+++ /dev/null
-#include "mpi.h"
-#include <stdio.h>
-typedef struct { short a; int b } s1;
-
-main( int argc, char **argv )
-{
-s1 s[10], sout[10];
-int i, rank;
-MPI_Status status;
-
-MPI_Init( &argc, &argv );
-MPI_Comm_rank( MPI_COMM_WORLD, &rank );
-for (i=0; i<10; i++) {
- s[i].a = rank + i;
- s[i].b = rank;
- sout[i].a = -1;
- sout[i].b = -1;
- }
-/* MPI_Allreduce( s, sout, 10, MPI_SHORT_INT, MPI_MINLOC, MPI_COMM_WORLD ); */
-/* if (rank == 1)
- for (i=0; i<10; i++)
- sout[i] = s[i];
- */
-MPI_Reduce( s, sout, 10, MPI_SHORT_INT, MPI_MINLOC, 1, MPI_COMM_WORLD );
-if (rank == 1)
-for (i=0; i<10; i++) {
- printf( "[%d] (%x,%x)\n", rank, (int)sout[i].a, sout[i].b );
- }
-if (rank == 1)
- MPI_Send( sout, 10, MPI_SHORT_INT, 0, 0, MPI_COMM_WORLD );
-else if (rank == 0)
- MPI_Recv( sout, 10, MPI_SHORT_INT, 1, 0, MPI_COMM_WORLD, &status );
-/* MPI_Bcast( sout, 10, MPI_SHORT_INT, 1, MPI_COMM_WORLD ); */
-for (i=0; i<10; i++) {
- printf( "[%d] (%x,%x)\n", rank, (int)sout[i].a, sout[i].b );
- }
-MPI_Finalize();
-return 0;
-}
+++ /dev/null
-#!/bin/sh
-# This version puts the output from each program into a separate file.
-# -mvhome is needed for the ANL SP, and is ignored by others
-args="-pg -mvhome"
-#
-runtests=1
-makeeach=0
-for arg in "$@" ; do
- case $arg in
- -checkonly )
- runtests=0
- ;;
- -margs=*)
- margs=`echo $arg | sed 's/-margs=//'`
- args="$args $margs"
- ;;
- -small)
- makeeach=1
- ;;
- -help|-u)
- echo "runtests [-checkonly] [-margs='...']"
- echo "run tests in this directory. If -checkonly set, just run"
- echo "the differences check (do NO rerun the test programs)."
- echo "If -margs is used, these options are passed to mpirun."
- echo "If -small is used, the examples are built, run, and deleted."
- exit 1
- ;;
- *)
- if test -n "$arg" ; then
- echo "runtests: Unknown argument ($arg)"
- exit 1
- fi
- ;;
- esac
-done
-
-MakeExe() {
- if [ $makeeach = 1 -o ! -x $1 ] ; then
- make $1
- fi
-}
-CleanExe() {
- if [ $makeeach = 1 ] ; then
- /bin/rm -f $1 $1.o
- fi
-}
-
-# If the programs are not available, run make.
-if [ ! -x coll1 -a $makeeach = 0 ] ; then
- make
-fi
-
-testfiles=""
-if [ $runtests = 1 ] ; then
-echo '**** Testing MPI Collective routines ****'
-
-testfiles="$testfiles barrier.out"
-/bin/rm -f barrier.out barrier-0.out
-MakeExe barrier
-echo '*** Barrier Test ***' >> barrier.out
-echo '**** Barrier Test ****'
-mpirun $args -np 4 -mvback "barrier-0.out" barrier $* >> barrier.out
-cat barrier-0.out >> barrier.out
-/bin/rm -f barrier-[01234].out
-echo '*** Barrier Test ***' >> barrier.out
-CleanExe barrier
-
-testfiles="$testfiles bcast.out"
-/bin/rm -f bcast.out bcast-[0-3].out
-MakeExe bcast
-echo '**** Broadcast Test ****'
-echo '*** Broadcast Test ***' >> bcast.out
-mpirun $args -np 4 \
- -mvback "bcast-0.out bcast-1.out bcast-2.out bcast-3.out" \
- bcast $* >> bcast.out
-cat bcast-[0123].out >> bcast.out
-/bin/rm -f bcast-[0123].out
-echo '*** Broadcast Test ***' >> bcast.out
-CleanExe bcast
-
-testfiles="$testfiles coll1.out"
-/bin/rm -f coll1.out
-MakeExe coll1
-echo '**** coll1 ****'
-echo '*** coll1 ***' >> coll1.out
-mpirun $args -np 4 coll1 $* >> coll1.out
-echo '*** coll1 ***' >> coll1.out
-CleanExe coll1
-
-testfiles="$testfiles coll2.out"
-/bin/rm -f coll2.out
-MakeExe coll2
-echo '**** coll2 ****'
-echo '*** coll2 ***' >> coll2.out
-# mpirun $args -np 5 coll2 $* >> coll2.out
-echo '*** coll2 ***' >> coll2.out
-CleanExe coll2
-
-testfiles="$testfiles coll3.out"
-/bin/rm -f coll3.out
-MakeExe coll3
-echo '**** coll3 ****'
-echo '*** coll3 ***' >> coll3.out
-mpirun $args -np 5 coll3 $* >> coll3.out
-echo '*** coll3 ***' >> coll3.out
-CleanExe coll3
-
-testfiles="$testfiles coll4.out"
-/bin/rm -f coll4.out
-MakeExe coll4
-echo '**** coll4 ****'
-echo '*** coll4 ***' >> coll4.out
-mpirun $args -np 4 coll4 $* >> coll4.out
-echo '*** coll4 ***' >> coll4.out
-CleanExe coll4
-
-testfiles="$testfiles coll5.out"
-/bin/rm -f coll5.out
-MakeExe coll5
-echo '**** coll5 ****'
-echo '*** coll5 ***' >> coll5.out
-mpirun $args -np 4 coll5 $* >> coll5.out
-echo '*** coll5 ***' >> coll5.out
-CleanExe coll5
-
-testfiles="$testfiles coll6.out"
-/bin/rm -f coll6.out
-MakeExe coll6
-echo '**** coll6 ****'
-echo '*** coll6 ***' >> coll6.out
-mpirun $args -np 5 coll6 $* >> coll6.out
-echo '*** coll6 ***' >> coll6.out
-CleanExe coll6
-
-testfiles="$testfiles coll7.out"
-/bin/rm -f coll7.out
-MakeExe coll7
-echo '**** coll7 ****'
-echo '*** coll7 ***' >> coll7.out
-mpirun $args -np 5 coll7 $* >> coll7.out
-echo '*** coll7 ***' >> coll7.out
-CleanExe coll7
-
-testfiles="$testfiles coll8.out"
-/bin/rm -f coll8.out
-MakeExe coll8
-echo '**** coll8 ****'
-echo '*** coll8 ***' >> coll8.out
-mpirun $args -np 4 coll8 $* >> coll8.out
-echo '*** coll8 ***' >> coll8.out
-CleanExe coll8
-
-testfiles="$testfiles coll9.out"
-/bin/rm -f coll9.out
-MakeExe coll9
-echo '**** coll9 ****'
-echo '*** coll9 ***' >> coll9.out
-mpirun $args -np 4 coll9 $* >> coll9.out
-echo '*** coll9 ***' >> coll9.out
-CleanExe coll9
-
-testfiles="$testfiles coll10.out"
-/bin/rm -f coll10.out
-MakeExe coll10
-echo '**** coll10 ****'
-echo '*** coll10 ***' >> coll10.out
-mpirun -np 4 $args coll10 $* >> coll10.out
-echo '*** coll10 ***' >> coll10.out
-CleanExe coll10
-
-testfiles="$testfiles coll11.out"
-/bin/rm -f coll11.out
-MakeExe coll11
-echo '**** coll11 ****'
-echo '*** coll11 ***' >> coll11.out
-mpirun -np 4 $args coll11 $* >> coll11.out
-echo '*** coll11 ***' >> coll11.out
-CleanExe coll11
-
-testfiles="$testfiles coll12.out"
-/bin/rm -f coll12.out
-MakeExe coll12
-echo '**** coll12 ****'
-echo '*** coll12 ***' >> coll12.out
-mpirun -np 4 $args coll12 $* >> coll12.out
-echo '*** coll12 ***' >> coll12.out
-CleanExe coll12
-
-testfiles="$testfiles coll13.out"
-/bin/rm -f coll13.out
-MakeExe coll13
-echo '**** coll13 ****'
-echo '*** coll13 ***' >> coll13.out
-mpirun -np 4 $args coll13 $* >> coll13.out
-echo '*** coll13 ***' >> coll13.out
-CleanExe coll13
-
-testfiles="$testfiles grouptest.out"
-/bin/rm -f grouptest.out
-MakeExe grouptest
-echo '*** Grouptest ***'
-echo '*** grouptest ***' >> grouptest.out
-mpirun $args -np 4 grouptest $* >> grouptest.out
-echo '*** grouptest ***' >> grouptest.out
-CleanExe grouptest
-
-testfiles="$testfiles allred.out"
-/bin/rm -f allred.out
-MakeExe allred
-echo '*** Allred ***'
-echo '*** Allred ***' >> allred.out
-mpirun $args -np 4 allred $* >> allred.out
-echo '*** Allred ***' >> allred.out
-CleanExe allred
-
-testfiles="$testfiles scatterv.out"
-/bin/rm -f scatterv.out
-MakeExe scatterv
-echo '*** Scatterv ***'
-echo '*** Scatterv ***' >> scatterv.out
-mpirun $args -np 4 scatterv $* >> scatterv.out
-echo '*** Scatterv ***' >> scatterv.out
-CleanExe scatterv
-
-#
-# Run Fortran tests ONLY if Fortran available
-if [ 1 = 1 ] ; then
- echo "FORTRAN TESTS"
- #
- testfiles="$testfiles allredf.out"
- /bin/rm -f allredf.out
- MakeExe allredf
- echo '*** Testing allreduce from Fortran ***'
- echo '*** Testing allreduce from Fortran ***' >> allredf.out
- mpirun $args -np 4 allredf "$@" >> allredf.out
- echo '*** Testing allreduce from Fortran ***' >> allredf.out
- CleanExe allredf
- #
- echo "END OF FORTRAN TESTS"
-fi
-
-else
- # Just run checks
- testfiles=`echo *.out`
- if test "$testfiles" = "*.out" ; then
- echo "No output files remain from previous test!"
- exit 1
- fi
-fi
-
-echo '*** Differences from expected output ***'
-/bin/rm -f coll.diff
-for file in $testfiles ; do
- stdfile=`basename $file .out`.std
- if [ -s $stdfile ] ; then
- if diff -b $file `basename $file .out`.std > /dev/null ; then
- true
- else
- echo "Differences in `basename $file .out`" >> coll.diff
- diff -b $file `basename $file .out`.std >> coll.diff
- fi
- else
- echo "Can not find file $stdfile to compare against for test `basename $file .out`"
- fi
-done
-if [ -s coll.diff ] ; then
- cat coll.diff
-fi
-exit 0
+++ /dev/null
-/* Procedures for recording and printing test results */
-
-#include <stdio.h>
-#include <string.h>
-#include "test.h"
-#include "mpi.h"
-
-static int tests_passed = 0;
-static int tests_failed = 0;
-static char failed_tests[255][81];
-static char suite_name[255];
-FILE *fileout = NULL;
-
-void Test_Init( const char *suite, int rank)
-{
- char filename[512];
-
- sprintf(filename, "%s-%d.out", suite, rank);
- strncpy(suite_name, suite, 255);
- fileout = fopen(filename, "w");
- if (!fileout) {
- fprintf( stderr, "Could not open %s on node %d\n", filename, rank );
- MPI_Abort( MPI_COMM_WORLD, 1 );
- }
-}
-
-void Test_Message( const char *mess)
-{
- fprintf(fileout, "[%s]: %s\n", suite_name, mess);
- if(fileout)fflush(fileout);
-}
-
-void Test_Failed(const char *test)
-{
- fprintf(fileout, "[%s]: *** Test '%s' Failed! ***\n", suite_name, test);
- strncpy(failed_tests[tests_failed], test, 81);
- if(fileout)fflush(fileout);
- tests_failed++;
-}
-
-void Test_Passed(const char *test)
-{
-#ifdef VERBOSE
- fprintf(fileout, "[%s]: Test '%s' Passed.\n", suite_name, test);
- if(fileout)fflush(fileout);
-#endif
- tests_passed++;
-}
-
-int Summarize_Test_Results(void)
-{
-#ifdef VERBOSE
- fprintf(fileout, "For test suite '%s':\n", suite_name);
-#else
- if (tests_failed > 0)
-#endif
- {
- fprintf(fileout, "Of %d attempted tests, %d passed, %d failed.\n",
- tests_passed + tests_failed, tests_passed, tests_failed);
- }
- if (tests_failed > 0) {
- int i;
-
- fprintf(fileout, "*** Tests Failed:\n");
- for (i = 0; i < tests_failed; i++)
- fprintf(fileout, "*** %s\n", failed_tests[i]);
- }
- return tests_failed;
-}
-
-void Test_Finalize(void)
-{
- if(fileout)fflush(fileout);
- //fclose(fileout);
-}
-
-#include "mpi.h"
-/* Wait for every process to pass through this point. This test is used
- to make sure that all processes complete, and that a test "passes" because
- it executed, not because some process failed.
- */
-void Test_Waitforall(void)
-{
- int m, one, myrank, n;
-
- MPI_Comm_rank( MPI_COMM_WORLD, &myrank );
- MPI_Comm_size( MPI_COMM_WORLD, &n );
- one = 1;
- MPI_Allreduce( &one, &m, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
-
- if (m != n) {
- printf( "[%d] Expected %d processes to wait at end, got %d\n", myrank,
- n, m );
- }
- if (myrank == 0)
- printf( " No Errors\n" );
-}
+++ /dev/null
-/* Header for testing procedures */
-
-#ifndef _INCLUDED_TEST_H_
-#define _INCLUDED_TEST_H_
-
-#if defined(NEEDS_STDLIB_PROTOTYPES)
-#include "protofix.h"
-#endif
-
-void Test_Init (const char *, int);
-void Test_Message (const char *);
-void Test_Failed (const char *);
-void Test_Passed (const char *);
-int Summarize_Test_Results (void);
-void Test_Finalize (void);
-void Test_Waitforall (void);
-
-#endif
+++ /dev/null
-cmake_minimum_required(VERSION 2.6)
-
-if(enable_smpi)
-
- if(WIN32)
- set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h")
- else()
- set(CMAKE_C_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc")
- set(CMAKE_Fortran_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff")
- set(CMAKE_Fortran_LINKER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc")
- endif()
-
- set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
- set(MPICH_FLAGS "-DHAVE_STDLIB_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STRING_H=1 -DUSE_STDARG=1 -DHAVE_LONG_DOUBLE=1 -DHAVE_PROTOTYPES=1 -DHAVE_SIGNAL_H=1 -DHAVE_SIGACTION=1 -DHAVE_SLEEP=1 -DHAVE_SYSCONF=1")
-
- include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi")
-
- add_executable(attrerr attrerr.c test.c)
- # add_executable(attrt attrt.c test.c)
- # add_executable(commnames commnames.c)
- add_executable(groupcreate groupcreate.c)
- add_executable(grouptest_mpich grouptest.c)
- add_executable(icdup icdup.c)
- add_executable(ictest ictest.c )
- add_executable(ictest2 ictest2.c)
- add_executable(ictest3 ictest3.c)
-
- if(SMPI_F2C)
- #add_executable(attrtest_f attrtest.f)
- #add_executable(commnames_f commnamesf.f)
- endif()
-
- target_link_libraries(attrerr simgrid)
- # target_link_libraries(attrt simgrid)
- # target_link_libraries(commnames simgrid)
- target_link_libraries(groupcreate simgrid)
- target_link_libraries(grouptest_mpich simgrid)
- target_link_libraries(icdup simgrid)
- target_link_libraries(ictest simgrid)
- target_link_libraries(ictest2 simgrid)
- target_link_libraries(ictest3 simgrid)
-
- if(SMPI_F2C)
- #target_link_libraries(attrtest_f simgrid f2c)
- #target_link_libraries(commnames_f simgrid f2c)
- endif()
-
- set_target_properties(attrerr PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- # set_target_properties(attrt PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- # set_target_properties(commnames PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(groupcreate PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(grouptest_mpich PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(icdup PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(ictest PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(ictest2 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
- set_target_properties(ictest3 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
-
-
- if(SMPI_F2C)
- #set_target_properties(commnames_f PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}" )
- #set_target_properties(attrtest_f PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}" )
- endif()
-
-endif()
-
-set(tesh_files
- ${tesh_files}
- PARENT_SCOPE
- )
-set(xml_files
- ${xml_files}
- PARENT_SCOPE
- )
-set(examples_src
- ${examples_src}
- ${CMAKE_CURRENT_SOURCE_DIR}/test.c
- ${CMAKE_CURRENT_SOURCE_DIR}/attrerr.c
- # ${CMAKE_CURRENT_SOURCE_DIR}/attrt.c
- # ${CMAKE_CURRENT_SOURCE_DIR}/commnames.c
- ${CMAKE_CURRENT_SOURCE_DIR}/groupcreate.c
- ${CMAKE_CURRENT_SOURCE_DIR}/grouptest.c
- ${CMAKE_CURRENT_SOURCE_DIR}/icdup.c
- ${CMAKE_CURRENT_SOURCE_DIR}/ictest.c
- ${CMAKE_CURRENT_SOURCE_DIR}/ictest2.c
- ${CMAKE_CURRENT_SOURCE_DIR}/ictest3.c
- ${CMAKE_CURRENT_SOURCE_DIR}/attrtest.f
- ${CMAKE_CURRENT_SOURCE_DIR}/commnamesf.f
- ${CMAKE_CURRENT_SOURCE_DIR}/test.h
- PARENT_SCOPE
- )
-set(bin_files
- ${bin_files}
- PARENT_SCOPE
- )
-set(txt_files
- ${txt_files}
- ${CMAKE_CURRENT_SOURCE_DIR}/runtests
- ${CMAKE_CURRENT_SOURCE_DIR}/attrt.std
- ${CMAKE_CURRENT_SOURCE_DIR}/attrerr.std
- ${CMAKE_CURRENT_SOURCE_DIR}/context.std
- ${CMAKE_CURRENT_SOURCE_DIR}/commnames.std
- PARENT_SCOPE
- )
+++ /dev/null
-/*
-
- Exercise attribute routines.
- This version checks for correct behavior of the copy and delete functions
- on an attribute, particularly the correct behavior when the routine returns
- failure.
-
- */
-#include <stdio.h>
-#include "mpi.h"
-#include "test.h"
-
-int test_communicators ( void );
-void abort_msg ( const char *, int );
-int copybomb_fn ( MPI_Comm, int, void *, void *, void *, int * );
-int deletebomb_fn ( MPI_Comm, int, void *, void * );
-
-int main( int argc, char **argv )
-{
- MPI_Init( &argc, &argv );
- test_communicators();
- Test_Waitforall( );
- MPI_Finalize();
- return 0;
-}
-
-/*
- * MPI 1.2 Clarification: Clarification of Error Behavior of
- * Attribute Callback Functions
- * Any return value other than MPI_SUCCESS is erroneous. The specific value
- * returned to the user is undefined (other than it can't be MPI_SUCCESS).
- * Proposals to specify particular values (e.g., user's value) failed.
- */
-/* Return an error as the value */
-int copybomb_fn( MPI_Comm oldcomm, int keyval, void *extra_state,
- void *attribute_val_in, void *attribute_val_out, int *flag)
-{
-/* Note that if (sizeof(int) < sizeof(void *), just setting the int
- part of attribute_val_out may leave some dirty bits
- */
- *flag = 1;
- return MPI_ERR_OTHER;
-}
-
-/* Set delete flag to 1 to allow the attribute to be deleted */
-static int delete_flag = 0;
-int deletebomb_fn( MPI_Comm comm, int keyval, void *attribute_val,
- void *extra_state)
-{
- if (delete_flag) return MPI_SUCCESS;
- return MPI_ERR_OTHER;
-}
-
-void abort_msg( const char *str, int code )
-{
- fprintf( stderr, "%s, err = %d\n", str, code );
- MPI_Abort( MPI_COMM_WORLD, code );
-}
-
-int test_communicators( void )
-{
- MPI_Comm dup_comm_world, d2;
- ptrdiff_t world_rank;
- int world_size, key_1;
- int err;
- MPI_Aint value;
- int rank;
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- world_rank=rank;
- MPI_Comm_size( MPI_COMM_WORLD, &world_size );
- if (world_rank == 0) {
- printf( "*** Attribute copy/delete return codes ***\n" );
- }
-
- MPI_Comm_dup( MPI_COMM_WORLD, &dup_comm_world );
- MPI_Barrier( dup_comm_world );
-
- MPI_Errhandler_set( dup_comm_world, MPI_ERRORS_RETURN );
-
- value = - 11;
- if ((err=MPI_Keyval_create( copybomb_fn, deletebomb_fn, &key_1, &value )))
- abort_msg( "Keyval_create", err );
-
- err = MPI_Attr_put( dup_comm_world, key_1, (void *)world_rank );
- if (err) {
- printf( "Error with first put\n" );
- }
-
- err = MPI_Attr_put( dup_comm_world, key_1, (void *)(2*world_rank) );
- if (err == MPI_SUCCESS) {
- printf( "delete function return code was MPI_SUCCESS in put\n" );
- }
-
- /* Because the attribute delete function should fail, the attribute
- should *not be removed* */
- err = MPI_Attr_delete( dup_comm_world, key_1 );
- if (err == MPI_SUCCESS) {
- printf( "delete function return code was MPI_SUCCESS in delete\n" );
- }
-
- err = MPI_Comm_dup( dup_comm_world, &d2 );
- if (err == MPI_SUCCESS) {
- printf( "copy function return code was MPI_SUCCESS in dup\n" );
- }
- if (err && d2 != MPI_COMM_NULL) {
- printf( "dup did not return MPI_COMM_NULL on error\n" );
- }
-
- delete_flag = 1;
- MPI_Comm_free( &dup_comm_world );
-
- return 0;
-}
-
+++ /dev/null
-*** Testing attributes (2) ***
-*** Attribute copy/delete return codes ***
-All processes completed test
-*** Testing attributes (2) ***
+++ /dev/null
-/*
-
- Exercise communicator routines.
-
- This C version derived from a Fortran test program from ....
-
- */
-#include <stdio.h>
-#include "mpi.h"
-#include "test.h"
-
-int test_communicators ( void );
-int copy_fn ( MPI_Comm, int, void *, void *, void *, int * );
-int delete_fn ( MPI_Comm, int, void *, void * );
-
-int main( int argc, char **argv )
-{
- MPI_Init( &argc, &argv );
- test_communicators();
- Test_Waitforall( );
- MPI_Finalize();
- return 0;
-}
-
-int copy_fn( MPI_Comm oldcomm, int keyval, void *extra_state,
- void *attribute_val_in, void *attribute_val_out,
- int *flag)
-{
-/* Note that if (sizeof(int) < sizeof(void *), just setting the int
- part of attribute_val_out may leave some dirty bits
- */
-*(MPI_Aint *)attribute_val_out = (MPI_Aint)attribute_val_in;
-*flag = 1;
-return MPI_SUCCESS;
-}
-
-int delete_fn( MPI_Comm comm, int keyval, void *attribute_val,
- void *extra_state)
-{
-int world_rank;
-MPI_Comm_rank( MPI_COMM_WORLD, &world_rank );
-if ((MPI_Aint)attribute_val != (MPI_Aint)world_rank) {
- printf( "incorrect attribute value %d\n", *(int*)attribute_val );
- MPI_Abort(MPI_COMM_WORLD, 1005 );
- }
-return MPI_SUCCESS;
-}
-
-int test_communicators( void )
-{
-MPI_Comm dup_comm_world, lo_comm, rev_comm, dup_comm, split_comm, world_comm;
-MPI_Group world_group, lo_group, rev_group;
-void *vvalue;
-int ranges[1][3];
-int flag, world_rank, world_size, rank, size, n, key_1, key_3;
-int color, key, result;
-/* integer n, ,
- . key_2
-
- */
-MPI_Aint value;
-
-MPI_Comm_rank( MPI_COMM_WORLD, &world_rank );
-MPI_Comm_size( MPI_COMM_WORLD, &world_size );
-if (world_rank == 0) {
- printf( "*** Communicators ***\n" );
- }
-
-MPI_Comm_dup( MPI_COMM_WORLD, &dup_comm_world );
-
-/*
- Exercise Comm_create by creating an equivalent to dup_comm_world
- (sans attributes) and a half-world communicator.
- */
-
-if (world_rank == 0)
- printf( " Comm_create\n" );
-
-MPI_Comm_group( dup_comm_world, &world_group );
-MPI_Comm_create( dup_comm_world, world_group, &world_comm );
-MPI_Comm_rank( world_comm, &rank );
-if (rank != world_rank) {
- printf( "incorrect rank in world comm: %d\n", rank );
- MPI_Abort(MPI_COMM_WORLD, 3001 );
- }
-
-n = world_size / 2;
-
-ranges[0][0] = 0;
-ranges[0][1] = (world_size - n) - 1;
-ranges[0][2] = 1;
-
-MPI_Group_range_incl(world_group, 1, ranges, &lo_group );
-MPI_Comm_create(world_comm, lo_group, &lo_comm );
-MPI_Group_free( &lo_group );
-
-if (world_rank < (world_size - n)) {
- MPI_Comm_rank(lo_comm, &rank );
- if (rank == MPI_UNDEFINED) {
- printf( "incorrect lo group rank: %d\n", rank );
- MPI_Abort(MPI_COMM_WORLD, 3002 );
- }
- else {
- MPI_Barrier(lo_comm );
- }
- }
-else {
- if (lo_comm != MPI_COMM_NULL) {
- printf( "incorrect lo comm:\n" );
- MPI_Abort(MPI_COMM_WORLD, 3003 );
- }
- }
-
-MPI_Barrier(world_comm);
-/*
- Check Comm_dup by adding attributes to lo_comm & duplicating
- */
-if (world_rank == 0)
- printf( " Comm_dup\n" );
-
-if (lo_comm != MPI_COMM_NULL) {
- value = 9;
- MPI_Keyval_create(copy_fn, delete_fn, &key_1, &value );
- value = 8;
-/* MPI_Keyval_create(MPI_DUP_FN, MPI_NULL_DELETE_FN,
- &key_2, &value ); */
- value = 7;
- MPI_Keyval_create(MPI_NULL_COPY_FN, MPI_NULL_DELETE_FN,
- &key_3, &value );
-
- /* This may generate a compilation warning; it is, however, an
- easy way to cache a value instead of a pointer */
- MPI_Attr_put(lo_comm, key_1, (void *)world_rank );
-/* MPI_Attr_put(lo_comm, key_2, world_size ) */
- MPI_Attr_put(lo_comm, key_3, (void *)0 );
-
- MPI_Comm_dup(lo_comm, &dup_comm );
-
- /* Note that if sizeof(int) < sizeof(void *), we can't use
- (void **)&value to get the value we passed into Attr_put. To avoid
- problems (e.g., alignment errors), we recover the value into
- a (void *) and cast to int. Note that this may generate warning
- messages from the compiler. */
- MPI_Attr_get(dup_comm, key_1, (void **)&vvalue, &flag );
- value = (MPI_Aint)vvalue;
-
- if (! flag) {
- printf( "dup_comm key_1 not found on %d\n", world_rank );
- MPI_Abort(MPI_COMM_WORLD, 3004 );
- }
-
- if (value != world_rank) {
- printf( "dup_comm key_1 value incorrect: %ld\n", (long)value );
- MPI_Abort(MPI_COMM_WORLD, 3005 );
- }
-
-/* MPI_Attr_get(dup_comm, key_2, (int *)&value, &flag ); */
-/*
- if (! flag) {
- printf( "dup_comm key_2 not found\n" );
- MPI_Abort(MPI_COMM_WORLD, 3006 );
- }
-
- if (value != world_size) {
- printf( "dup_comm key_2 value incorrect: %d\n", value );
- MPI_Abort(MPI_COMM_WORLD, 3007 );
- }
- */
- MPI_Attr_get(dup_comm, key_3, (void **)&vvalue, &flag );
- value = (int)vvalue;
- if (flag) {
- printf( "dup_comm key_3 found!\n" );
- MPI_Abort(MPI_COMM_WORLD, 3008 );
- }
- MPI_Keyval_free(&key_1 );
-/*
-c MPI_Keyval_free(&key_2 )
- */
- MPI_Keyval_free(&key_3 );
- }
-/*
- Split the world into even & odd communicators with reversed ranks.
- */
- if (world_rank == 0)
- printf( " Comm_split\n" );
-
- color = world_rank % 2;
- key = world_size - world_rank;
-
- MPI_Comm_split(dup_comm_world, color, key, &split_comm );
- MPI_Comm_size(split_comm, &size );
- MPI_Comm_rank(split_comm, &rank );
- if (rank != ((size - world_rank/2) - 1)) {
- printf( "incorrect split rank: %d\n", rank );
- MPI_Abort(MPI_COMM_WORLD, 3009 );
- }
-
- MPI_Barrier(split_comm );
-/*
- Test each possible Comm_compare result
- */
- if (world_rank == 0)
- printf( " Comm_compare\n" );
-
- MPI_Comm_compare(world_comm, world_comm, &result );
- if (result != MPI_IDENT) {
- printf( "incorrect ident result: %d\n", result );
- MPI_Abort(MPI_COMM_WORLD, 3010 );
- }
-
- if (lo_comm != MPI_COMM_NULL) {
- MPI_Comm_compare(lo_comm, dup_comm, &result );
- if (result != MPI_CONGRUENT) {
- printf( "incorrect congruent result: %d\n", result );
- MPI_Abort(MPI_COMM_WORLD, 3011 );
- }
- }
-
- ranges[0][0] = world_size - 1;
- ranges[0][1] = 0;
- ranges[0][2] = -1;
-
- MPI_Group_range_incl(world_group, 1, ranges, &rev_group );
- MPI_Comm_create(world_comm, rev_group, &rev_comm );
- MPI_Comm_compare(world_comm, rev_comm, &result );
- if (result != MPI_SIMILAR) {
- printf( "incorrect similar result: %d\n", result );
- MPI_Abort(MPI_COMM_WORLD, 3012 );
- }
-
- if (lo_comm != MPI_COMM_NULL) {
- MPI_Comm_compare(world_comm, lo_comm, &result );
- if (result != MPI_UNEQUAL) {
- printf( "incorrect unequal result: %d\n", result );
- MPI_Abort(MPI_COMM_WORLD, 3013 );
- }
- }
-/*
- Free all communicators created
- */
- if (world_rank == 0)
- printf( " Comm_free\n" );
-
- MPI_Comm_free( &world_comm );
- MPI_Comm_free( &dup_comm_world );
-
- MPI_Comm_free( &rev_comm );
- MPI_Comm_free( &split_comm );
-
- MPI_Group_free( &world_group );
- MPI_Group_free( &rev_group );
-
- if (lo_comm != MPI_COMM_NULL) {
- MPI_Comm_free( &lo_comm );
- MPI_Comm_free( &dup_comm );
- }
-
- return 0;
-}
-
+++ /dev/null
-*** Testing attributes ***
-*** Communicators ***
- Comm_create
- Comm_dup
- Comm_split
- Comm_compare
- Comm_free
-All processes completed test
-*** Testing attributes ***
+++ /dev/null
- PROGRAM MAIN
-
- include 'mpif.h'
-
-C. Data layout
-C. Number of tests
- integer PM_GLOBAL_ERROR, PM_NUM_NODES
- integer PM_MAX_TESTS
- parameter (PM_MAX_TESTS=3)
-C. Test data
- integer PM_TEST_INTEGER, fuzzy, Error, FazAttr
- integer PM_RANK_SELF
- integer Faz_World, FazTag
- integer errs
- parameter (PM_TEST_INTEGER=12345)
- logical FazFlag
- external FazCreate, FazDelete
-C
-C. Initialize MPI
- errs = 0
- call MPI_INIT(PM_GLOBAL_ERROR)
-
- PM_GLOBAL_ERROR = MPI_SUCCESS
-C. Find out the number of processes
- call MPI_COMM_SIZE (MPI_COMM_WORLD,PM_NUM_NODES,PM_GLOBAL_ERROR)
- call MPI_COMM_RANK (MPI_COMM_WORLD,PM_RANK_SELF,PM_GLOBAL_ERROR)
-
-
- call MPI_keyval_create ( FazCreate, FazDelete, FazTag,
- & fuzzy, Error )
-
-C. Make sure that we can get an attribute that hasn't been set yet (flag
-C. is false)
- call MPI_attr_get (MPI_COMM_WORLD, FazTag, FazAttr,
- & FazFlag, Error)
-
- if (FazFlag) then
- errs = errs + 1
- print *, 'Did not get flag==false when attr_get of key that'
- print *, 'had not had a value set with attr_put'
- endif
-
- FazAttr = 120
- call MPI_attr_put (MPI_COMM_WORLD, FazTag, FazAttr, Error)
-
-C. Check that the put worked
- call MPI_attr_get (MPI_COMM_WORLD, FazTag, FazAttr,
- & FazFlag, Error)
-
- if (FazAttr .ne. 120) then
- errs = errs + 1
- print 1, ' Proc=',PM_Rank_self, ' ATTR=', FazAttr
- endif
-C. Duplicate the Communicator and it's cached attributes
-
- call MPI_Comm_Dup (MPI_COMM_WORLD, Faz_WORLD, Error)
-
-
- call MPI_Attr_Get ( Faz_WORLD, FazTag, FazAttr,
- & FazFlag, Error)
-
- if (FazFlag) then
- if (FazAttr .ne. 121) then
- errs = errs + 1
- print 1, ' T-Flag, Proc=',PM_Rank_self,' ATTR=', FazAttr
- endif
- else
- errs = errs + 1
- print 1, ' F-Flag, Proc=',PM_Rank_self,' ATTR=',FazAttr
- end if
- 1 format( a, i5, a, i5 )
-
-C. Clean up MPI
- if (PM_Rank_self .eq. 0) then
- if (errs .eq. 0) then
- print *, ' No Errors'
- else
- print *, ' Found ', errs, ' errors'
- endif
- endif
- call MPI_Comm_free( Faz_WORLD, Error )
- call MPI_FINALIZE (PM_GLOBAL_ERROR)
-
- end
-C
-C MPI 1.1 changed these from functions to subroutines.
-C
- SUBROUTINE FazCreate (comm, keyval, fuzzy,
- & attr_in, attr_out, flag, ierr )
- INTEGER comm, keyval, fuzzy, attr_in, attr_out
- LOGICAL flag
- include 'mpif.h'
- attr_out = attr_in + 1
- flag = .true.
- ierr = MPI_SUCCESS
- END
-
- SUBROUTINE FazDelete (comm, keyval, attr, extra, ierr )
- INTEGER comm, keyval, attr, extra, ierr
- include 'mpif.h'
- ierr = MPI_SUCCESS
- if (keyval .ne. MPI_KEYVAL_INVALID)then
- attr = attr - 1
- end if
- END
+++ /dev/null
-/*
- * Check that we can put names on communicators and get them back.
- */
-
-#include <stdio.h>
-
-#include "mpi.h"
-
-#if defined(NEEDS_STDLIB_PROTOTYPES)
-#include "protofix.h"
-#endif
-
-int main( int argc, char **argv )
-{
- char commName [MPI_MAX_NAME_STRING+1];
- int namelen;
-
- MPI_Init( &argc, &argv );
-
- if (MPI_Comm_get_name(MPI_COMM_WORLD, commName, &namelen) != MPI_SUCCESS)
- {
- printf("Failed to get a name from COMM_WORLD\n");
- MPI_Abort(MPI_COMM_WORLD, -1);
- }
-
- if (strcmp("MPI_COMM_WORLD", commName))
- {
- printf("Name on MPI_COMM_WORLD is \"%s\" should be \"MPI_COMM_WORLD\"\n", commName);
- MPI_Abort(MPI_COMM_WORLD, -1);
- }
-
- if (namelen != strlen (commName))
- {
- printf("Length of name on MPI_COMM_WORLD is %d should be %d\n",
- namelen, (int) strlen(commName));
- MPI_Abort(MPI_COMM_WORLD, -1);
- }
-
- /* Check that we can replace it */
- if (MPI_Comm_set_name(MPI_COMM_WORLD,"foobar") != MPI_SUCCESS)
- {
- printf("Failed to put a name onto COMM_WORLD\n");
- MPI_Abort(MPI_COMM_WORLD, -1);
- }
-
- if (MPI_Comm_get_name(MPI_COMM_WORLD, commName, &namelen) != MPI_SUCCESS)
- {
- printf("Failed to get a name from COMM_WORLD after changing it\n");
- MPI_Abort(MPI_COMM_WORLD, -1);
- }
-
- if (strcmp("foobar", commName))
- {
- printf("Name on MPI_COMM_WORLD is \"%s\" should be \"foobar\"\n",
- commName );
- MPI_Abort(MPI_COMM_WORLD, -1);
- }
-
- printf("Name tests OK\n");
- MPI_Finalize();
- return 0;
-}
+++ /dev/null
-*** Testing Communicator Names ***
-Name tests OK
-Name tests OK
-*** Testing Communicator Names ***
+++ /dev/null
-C
-C Check the communicator naming functions from Fortran
-C
-
- include 'mpif.h'
-
- integer error, namelen
- integer errcnt, rank
- character*40 the_name
- character*40 other_name
-
- call mpi_init (error)
-
- errcnt = 0
- call xify(the_name)
-
- call mpi_comm_get_name (MPI_COMM_WORLD, the_name, namelen, error)
- if (error .ne. mpi_success) then
- errcnt = errcnt + 1
- print *,'Failed to get the name from MPI_COMM_WORLD'
- call MPI_Abort( MPI_COMM_WORLD, 1, error )
- end if
-
- if (the_name .ne. 'MPI_COMM_WORLD') then
- errcnt = errcnt + 1
- print *,'The name on MPI_COMM_WORLD is not "MPI_COMM_WORLD"'
- call MPI_Abort( MPI_COMM_WORLD, 1, error )
- end if
-
- other_name = 'foobarH'
- call mpi_comm_set_name(MPI_COMM_WORLD, other_name(1:6), error)
-
- if (error .ne. mpi_success) then
- errcnt = errcnt + 1
- print *,'Failed to put a name onto MPI_COMM_WORLD'
- call MPI_Abort( MPI_COMM_WORLD, 1, error )
- end if
-
- call xify(the_name)
-
- call mpi_comm_get_name (MPI_COMM_WORLD, the_name, namelen, error)
- if (error .ne. mpi_success) then
- errcnt = errcnt + 1
- print *,'Failed to get the name from MPI_COMM_WORLD ',
- $ 'after setting it'
- call MPI_Abort( MPI_COMM_WORLD, 1, error )
- end if
-
- if (the_name .ne. 'foobar') then
- errcnt = errcnt + 1
- print *,'The name on MPI_COMM_WORLD is not "foobar"'
- print *, 'Got ', the_name
- call MPI_Abort( MPI_COMM_WORLD, 1, error )
- end if
-
- call mpi_comm_rank( MPI_COMM_WORLD, rank, error )
- if (errcnt .eq. 0 .and. rank .eq. 0) then
- print *, ' No Errors'
- endif
- call mpi_finalize(error)
- end
-
-
- subroutine xify( string )
- character*(*) string
-
- integer i
-
- do i = 1,len(string)
- string(i:i) = 'X'
- end do
-
- end
-
-
+++ /dev/null
-FORTRAN TESTS
-*** attrtest ***
-END OF FORTRAN TESTS
+++ /dev/null
-#include "mpi.h"
-#include <stdio.h>
-/* stdlib.h Needed for malloc declaration */
-#include <stdlib.h>
-#include "test.h"
-
-int main( int argc, char **argv )
-{
- int i, n, n_goal = 2048, n_all, rc, n_ranks, *ranks, rank, size, len;
- MPI_Group *group_array, world_group;
- char msg[MPI_MAX_ERROR_STRING];
-
- MPI_Init( &argc, &argv );
- MPI_Errhandler_set( MPI_COMM_WORLD, MPI_ERRORS_RETURN );
- MPI_Comm_size( MPI_COMM_WORLD, &size );
- MPI_Comm_rank( MPI_COMM_WORLD, &rank );
- n = n_goal;
-
- group_array = (MPI_Group *)malloc( n * sizeof(MPI_Group) );
-
- MPI_Comm_group( MPI_COMM_WORLD, &world_group );
-
- n_ranks = size;
- ranks = (int *)malloc( size * sizeof(int) );
- for (i=0; i<size; i++) ranks[i] = i;
-
- for (i=0; i<n; i++) {
- rc = MPI_Group_incl( world_group, n_ranks, ranks, group_array + i );
- if (rc) {
- fprintf( stderr, "Error when creating group number %d\n", i );
- MPI_Error_string( rc, msg, &len );
- fprintf( stderr, "%s\n", msg );
- n = i + 1;
- break;
- }
-
- }
-
- for (i=0; i<n; i++) {
- rc = MPI_Group_free( group_array + i );
- if (rc) {
- fprintf( stderr, "Error when freeing group number %d\n", i );
- MPI_Error_string( rc, msg, &len );
- fprintf( stderr, "%s\n", msg );
- break;
- }
- }
-
- MPI_Group_free( &world_group );
-
- MPI_Reduce( &n, &n_all, 1, MPI_INT, MPI_MIN, 0, MPI_COMM_WORLD );
- if (rank == 0) {
- /* printf( "Completed test of %d type creations\n", n_all ); */
- if (n_all != n_goal) {
- printf (
-"This MPI implementation limits the number of groups that can be created\n\
-This is allowed by the standard and is not a bug, but is a limit on the\n\
-implementation\n" );
- }
- else {
- printf( " No Errors\n" );
- }
- }
-
- MPI_Finalize( );
- return 0;
-}
+++ /dev/null
-/*
- Test the group routines
- (some tested elsewere)
-
-MPI_Group_compare
-MPI_Group_excl
-MPI_Group_intersection
-MPI_Group_range_excl
-MPI_Group_rank
-MPI_Group_size
-MPI_Group_translate_ranks
-MPI_Group_union
-MPI_Group_range_incl
-MPI_Group_incl
-
- */
-#include "mpi.h"
-#include <stdio.h>
-/* stdlib.h Needed for malloc declaration */
-#include <stdlib.h>
-#include "test.h"
-
-int main( int argc, char **argv )
-{
- int errs=0, toterr;
- MPI_Group basegroup;
- MPI_Group g1, g2, g3, g4, g5, g6, g7, g8, g9, g10, g11, g12;
- MPI_Comm comm, newcomm, splitcomm, dupcomm;
- int i, grp_rank, rank, grp_size, size, result;
- int nranks, *ranks, *ranks_out;
- int range[2][3];
- int worldrank;
-
- MPI_Init( &argc, &argv );
- MPI_Comm_rank( MPI_COMM_WORLD, &worldrank );
-
- comm = MPI_COMM_WORLD;
-
- MPI_Comm_group( comm, &basegroup );
-
-/* Get the basic information on this group */
- MPI_Group_rank( basegroup, &grp_rank );
- MPI_Comm_rank( comm, &rank );
- if (grp_rank != rank) {
- errs++;
- fprintf( stdout, "group rank %d != comm rank %d\n", grp_rank, rank );
- }
-
- MPI_Group_size( basegroup, &grp_size );
- MPI_Comm_size( comm, &size );
- if (grp_size != size) {
- errs++;
- fprintf( stdout, "group size %d != comm size %d\n", grp_size, size );
- }
-
-
-/* Form a new communicator with inverted ranking */
- MPI_Comm_split( comm, 0, size - rank, &newcomm );
- MPI_Comm_group( newcomm, &g1 );
- ranks = (int *)malloc( size * sizeof(int) );
- ranks_out = (int *)malloc( size * sizeof(int) );
- for (i=0; i<size; i++) ranks[i] = i;
- nranks = size;
- MPI_Group_translate_ranks( g1, nranks, ranks, basegroup, ranks_out );
- for (i=0; i<size; i++) {
- if (ranks_out[i] != (size - 1) - i) {
- errs++;
- fprintf( stdout, "Translate ranks got %d expected %d\n",
- ranks_out[i], (size - 1) - i );
- }
- }
-
-/* Check Compare */
- MPI_Group_compare( basegroup, g1, &result );
- if (result != MPI_SIMILAR) {
- errs++;
- fprintf( stdout, "Group compare should have been similar, was %d\n",
- result );
- }
- MPI_Comm_dup( comm, &dupcomm );
- MPI_Comm_group( dupcomm, &g2 );
- MPI_Group_compare( basegroup, g2, &result );
- if (result != MPI_IDENT) {
- errs++;
- fprintf( stdout, "Group compare should have been ident, was %d\n",
- result );
- }
- MPI_Comm_split( comm, rank < size/2, rank, &splitcomm );
- MPI_Comm_group( splitcomm, &g3 );
- MPI_Group_compare( basegroup, g3, &result );
- if (result != MPI_UNEQUAL) {
- errs++;
- fprintf( stdout, "Group compare should have been unequal, was %d\n",
- result );
- }
-MPI_Barrier(MPI_COMM_WORLD);
-/* Build two new groups by excluding members; use Union to put them
- together again */
-
-/* Exclude 0 */
- MPI_Group_excl( basegroup, 1, ranks, &g4 );
-/* Exclude 1-(size-1) */
- MPI_Group_excl( basegroup, size-1, ranks+1, &g5 );
- MPI_Group_union( g5, g4, &g6 );
- MPI_Group_compare( basegroup, g6, &result );
- if (result != MPI_IDENT) {
- errs++;
- /* See ordering requirements on union */
- fprintf( stdout, "Group excl and union did not give ident groups\n" );
- }
- MPI_Group_union( basegroup, g4, &g7 );
- MPI_Group_compare( basegroup, g7, &result );
- if (result != MPI_IDENT) {
- errs++;
- fprintf( stdout, "Group union of overlapping groups failed\n" );
- }
-
-/* Use range_excl instead of ranks */
- range[0][0] = 1;
- range[0][1] = size-1;
- range[0][2] = 1;
- MPI_Group_range_excl( basegroup, 1, range, &g8 );
- MPI_Group_compare( g5, g8, &result );
- if (result != MPI_IDENT) {
- errs++;
- fprintf( stdout, "Group range excl did not give ident groups\n" );
- }
-
- MPI_Group_intersection(g4, basegroup, &g9 );
- MPI_Group_compare( g9, g4, &result );
- if (result != MPI_IDENT) {
- errs++;
- fprintf( stdout, "Group intersection did not give ident groups\n" );
- }
-
- MPI_Group_intersection(basegroup, g4 , &g9 );
- MPI_Group_compare( g9, g4, &result );
- if (result != MPI_IDENT) {
- errs++;
- fprintf( stdout, "Group intersection 2 did not give ident groups\n" );
- }
-
- MPI_Group_intersection(basegroup, basegroup, &g9 );
- MPI_Group_compare( g9, basegroup, &result );
- if (result != MPI_IDENT) {
- errs++;
- fprintf( stdout, "Group intersection 3 did not give ident groups\n" );
- }
-
-/* Exclude EVERYTHING and check against MPI_GROUP_EMPTY */
- range[0][0] = 0;
- range[0][1] = size-1;
- range[0][2] = 1;
- MPI_Group_range_excl( basegroup, 1, range, &g10 );
- MPI_Group_compare( g10, MPI_GROUP_EMPTY, &result );
- if (result != MPI_IDENT) {
- errs++;
- fprintf( stdout,
- "MPI_GROUP_EMPTY didn't compare against empty group\n");
- }
-
-/* Grouptest usually runs with 4 processes. Pick a range that specifies
- 1, size-1, but where "last" is size. This checks for an
- error case that MPICH2 got wrong */
- range[0][0] = 1;
- range[0][1] = size ;
- range[0][2] = size - 2;
- MPI_Group_range_incl( basegroup, 1, range, &g11 );
- ranks[0] = 1;
- ranks[1] = size-1;
- MPI_Group_incl( basegroup, 2, ranks, &g12 );
- MPI_Group_compare( g11, g12, &result );
- if (result != MPI_IDENT) {
- errs++;
- fprintf( stderr,
- "MPI_Group_range_incl didn't compare against MPI_Group_incl\n" );
- }
-
- MPI_Group_free( &basegroup );
- MPI_Group_free( &g1 );
- MPI_Group_free( &g2 );
- MPI_Group_free( &g3 );
- MPI_Group_free( &g4 );
- MPI_Group_free( &g5 );
- MPI_Group_free( &g6 );
- MPI_Group_free( &g7 );
- MPI_Group_free( &g8 );
- MPI_Group_free( &g9 );
- MPI_Group_free( &g10 );
- MPI_Group_free( &g11 );
- MPI_Group_free( &g12 );
- MPI_Comm_free( &dupcomm );
- MPI_Comm_free( &splitcomm );
- MPI_Comm_free( &newcomm );
-
- MPI_Allreduce( &errs, &toterr, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
- if (worldrank == 0) {
- if (toterr == 0)
- printf( " No Errors\n" );
- else
- printf( "Found %d errors in MPI Group routines\n", toterr );
- }
-
- MPI_Finalize();
- return toterr;
-}
+++ /dev/null
-#include "mpi.h"
-#include <stdio.h>
-
-/*
- * intended to be run with at least 3 procs
- */
-int main(int argc, char ** argv)
-{
- MPI_Comm new_intercomm;
- MPI_Comm new_comm;
- int my_rank, my_size;
- int rrank;
- int procA, procB;
-
- MPI_Init(&argc, &argv);
- MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
- MPI_Comm_size( MPI_COMM_WORLD, &my_size );
-
- if (my_size < 3) {
- printf( "This test requires at least 3 processes: only %d provided\n",
- my_size );
- MPI_Abort( MPI_COMM_WORLD, 1 );
- }
-#ifdef DBG
- printf("%d: Entering main()\n", my_rank); fflush(stdout);
-#endif
- /* pick one of the following two settings for procA,procB */
-
- /* uncomment these and program will work */
- /* procA = 0; procB = 2; */
-
- /* uncomment these and program will hang */
- procA = 1; procB = 2;
- /* The SGI implementation of MPI fails this test */
- if (my_rank == procA || my_rank == procB)
- {
- if (my_rank == procA)
- {
- rrank = procB;
- }
- else
- {
- rrank = procA;
- }
-#ifdef DBG
- printf("%d: Calling MPI_Intercomm_create()\n", my_rank); fflush(stdout);
-#endif
- MPI_Intercomm_create(MPI_COMM_SELF, 0,
- MPI_COMM_WORLD, rrank,
- 0, &new_intercomm);
-
-#ifdef DBG
- printf("%d: Calling MPI_Comm_dup()\n", my_rank); fflush(stdout);
-#endif
- MPI_Comm_dup(new_intercomm, &new_comm);
-
- /* Free these new communicators */
- MPI_Comm_free( &new_comm );
- MPI_Comm_free( &new_intercomm );
- }
-
- MPI_Barrier( MPI_COMM_WORLD );
- if (my_rank == 0) {
- printf( " No Errors\n" );
- }
-#ifdef DBG
- printf("%d: Calling MPI_Finalize()\n", my_rank); fflush(stdout);
-#endif
- MPI_Finalize();
- return 0;
-}
+++ /dev/null
-/* -*- Mode: C; c-basic-offset:4 ; -*- */
-/* ictest.c */
-#include <stdio.h>
-#include "mpi.h"
-#include "test.h"
-
-int verbose = 0;
-
-int main( int argc, char **argv )
-{
- int size, rank, key, his_key, lrank, result;
- MPI_Comm myComm;
- MPI_Comm myFirstComm;
- MPI_Comm mySecondComm;
- int errors = 0, sum_errors;
- MPI_Status status;
-
- /* Initialization */
- MPI_Init ( &argc, &argv );
- MPI_Comm_rank ( MPI_COMM_WORLD, &rank);
- MPI_Comm_size ( MPI_COMM_WORLD, &size);
-
- /* Only works for 2 or more processes */
- if (size >= 2) {
- MPI_Comm merge1, merge2, merge3, merge4;
-
- /* Generate membership key in the range [0,1] */
- key = rank % 2;
-
- MPI_Comm_split ( MPI_COMM_WORLD, key, rank, &myComm );
- /* This creates an intercomm that is the size of comm world
- but has processes grouped by even and odd */
- MPI_Intercomm_create (myComm, 0, MPI_COMM_WORLD, (key+1)%2, 1,
- &myFirstComm );
- /* Dup an intercomm */
- MPI_Comm_dup ( myFirstComm, &mySecondComm );
- MPI_Comm_rank( mySecondComm, &lrank );
- his_key = -1;
-
- /* Leaders communicate with each other */
- if (lrank == 0) {
- MPI_Sendrecv (&key, 1, MPI_INT, 0, 0,
- &his_key, 1, MPI_INT, 0, 0, mySecondComm, &status);
- if (key != (his_key+1)%2) {
- printf( "Received %d but expected %d\n", his_key, (his_key+1)%2 );
- errors++;
- }
- }
-
- if (errors)
- printf("[%d] Failed!\n",rank);
-
- if (verbose) printf( "About to merge intercommunicators\n" );
- MPI_Intercomm_merge ( mySecondComm, key, &merge1 );
- MPI_Intercomm_merge ( mySecondComm, (key+1)%2, &merge2 );
- MPI_Intercomm_merge ( mySecondComm, 0, &merge3 );
- MPI_Intercomm_merge ( mySecondComm, 1, &merge4 );
-
- /* We should check that these are correct! An easy test is that
- the merged comms are all MPI_SIMILAR (unless 2 processes used,
- in which case MPI_CONGRUENT is ok */
- MPI_Comm_compare( merge1, MPI_COMM_WORLD, &result );
- if ((size > 2 && result != MPI_SIMILAR) ||
- (size == 2 && result != MPI_CONGRUENT)) {
- errors ++;
- printf( "merge1 is not the same size as comm world\n" );
- }
- /* merge 2 isn't ordered the same way as the others, even for 2 processes */
- MPI_Comm_compare( merge2, MPI_COMM_WORLD, &result );
- if (result != MPI_SIMILAR) {
- errors ++;
- printf( "merge2 is not the same size as comm world\n" );
- }
- MPI_Comm_compare( merge3, MPI_COMM_WORLD, &result );
- if ((size > 2 && result != MPI_SIMILAR) ||
- (size == 2 && result != MPI_CONGRUENT)) {
- errors ++;
- printf( "merge3 is not the same size as comm world\n" );
- }
- MPI_Comm_compare( merge4, MPI_COMM_WORLD, &result );
- if ((size > 2 && result != MPI_SIMILAR) ||
- (size == 2 && result != MPI_CONGRUENT)) {
- errors ++;
- printf( "merge4 is not the same size as comm world\n" );
- }
-
- /* Free communicators */
- if (verbose) printf( "About to free communicators\n" );
- MPI_Comm_free( &myComm );
- MPI_Comm_free( &myFirstComm );
- MPI_Comm_free( &mySecondComm );
- MPI_Comm_free( &merge1 );
- MPI_Comm_free( &merge2 );
- MPI_Comm_free( &merge3 );
- MPI_Comm_free( &merge4 );
- }
- else {
- errors ++;
- printf("[%d] Failed - at least 2 nodes must be used\n",rank);
- }
-
- MPI_Barrier( MPI_COMM_WORLD );
- MPI_Allreduce( &errors, &sum_errors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
- if (sum_errors > 0) {
- printf( "%d errors on process %d\n", errors, rank );
- }
- else if (rank == 0) {
- printf( " No Errors\n" );
- }
- /* Finalize and end! */
-
- MPI_Finalize();
- return 0;
-}
-
-
-
-
-
-
-
-
-
-
+++ /dev/null
-/* -*- Mode: C; c-basic-offset:4 ; -*- */
-/* ictest2.c
- This is like ictest.c, but it creates communictors that are valid only
- at the "leaders"; other members of the local communicator are NOT
- in the remote communicator. This is done by creating two communicators:
- 0, + odd rank and even rank. Only 0 is in in both communicators.
-
- This test originally tested the part of the standard that allowed the
- leader to be in both groups. This has been disallowed. This test was
- recently changed to operate correctly under the new definition.
-
- Note that it generates unordered printf output, and is not suitable for
- automated testing.
- */
-#include "mpi.h"
-#include <stdio.h>
-#include "test.h"
-
-int verbose = 0;
-
-int main( int argc, char **argv )
-{
- int size, rank, key, lrank, rsize, result, remLeader = 0;
- MPI_Comm myComm;
- MPI_Comm myFirstComm;
- MPI_Comm mySecondComm;
- MPI_Comm evenComm, oddComm, remComm;
- int errors = 0, sum_errors;
- MPI_Status status;
-
- /* Initialization */
- MPI_Init ( &argc, &argv );
- MPI_Comm_rank ( MPI_COMM_WORLD, &rank);
- MPI_Comm_size ( MPI_COMM_WORLD, &size);
-
- /* Only works for 2 or more processes */
- if (size >= 2) {
- MPI_Comm merge1, merge2, merge3, merge4;
-
- /* Generate membership key in the range [0,1] */
- key = rank % 2;
- /* Create the even communicator */
- MPI_Comm_split ( MPI_COMM_WORLD, key, rank, &evenComm );
- if (key == 1) {
- /* Odd rank communicator discarded */
- MPI_Comm_free( &evenComm );
- }
-
- /* Create the odd communicator */
- MPI_Comm_split ( MPI_COMM_WORLD, key, rank, &oddComm );
- if (key == 0) {
- /* Even rank communicator discarded */
- MPI_Comm_free( &oddComm );
- }
-
- /* Create the odd + 0 communicator */
- if (rank == 0) key = 1;
- MPI_Comm_split( MPI_COMM_WORLD, key, rank, &remComm );
- if (key == 0) {
- /* Even rank communicator discarded */
- MPI_Comm_free( &remComm );
- }
- else {
- MPI_Comm_rank( remComm, &lrank );
- if (verbose) {
- printf( "[%d] lrank in remComm is %d (color = %d, key=%d)\n",
- rank, lrank, rank, key );
- }
- remLeader = (lrank == 0) ? 1 : 0;
- }
- /* Now, choose the local and remote communicators */
- if (rank % 2) {
- /* Odd */
- myComm = oddComm;
- }
- else {
- myComm = evenComm;
- }
-
- /* Check that the leader is who we think he is */
- MPI_Comm_rank( myComm, &lrank );
- if (verbose) {
- printf( "[%d] local rank is %d\n", rank, lrank );
- }
- if (rank == 0) {
- int trank;
- MPI_Comm_rank( myComm, &trank );
- if (trank != 0) {
- printf( "[%d] Comm split improperly ordered group (myComm)\n",
- rank );
- fflush(stdout);
- errors++;
- }
- MPI_Comm_rank( remComm, &trank );
- if (trank != 0) {
- printf( "[%d] Comm split improperly ordered group (remComm)\n",
- rank );
- fflush(stdout);
- errors++;
- }
- }
- /* Perform the intercomm create and test it */
- /* local leader is first process in local_comm, i.e., has rank 0 */
- /* remote leader is process 0 (if odd) or 1 (if even) in remComm */
- MPI_Intercomm_create (myComm, 0, remComm, remLeader, 1, &myFirstComm );
-/* temp */
- if (verbose) {
- printf( "[%d] through intercom create\n", rank );
- fflush( stdout );
- }
- MPI_Barrier( MPI_COMM_WORLD );
- if (verbose) {
- printf( "[%d] through barrier at end of intercom create\n", rank );
- fflush( stdout );
- }
-/* temp */
-
- /* Try to dup this communicator */
- MPI_Comm_dup ( myFirstComm, &mySecondComm );
-
-/* temp */
- if (verbose) {
- printf( "[%d] through comm dup\n", rank );
- fflush( stdout );
- }
- MPI_Barrier( MPI_COMM_WORLD );
- if (verbose) {
- printf( "[%d] through barrier at end of comm dup\n", rank );
- fflush( stdout );
- }
-/* temp */
-
- /* Each member shares data with his "partner". Note that process 0 in
- MPI_COMM_WORLD is sending to itself, since it is process 0 in both
- remote groups */
- MPI_Comm_rank( mySecondComm, &lrank );
- MPI_Comm_remote_size( mySecondComm, &rsize );
-
- if (verbose) {
- printf( "[%d] lrank in secondcomm is %d and remote size is %d\n",
- rank, lrank, rsize );
- fflush( stdout );
- }
-
- /* Send key * size + rank in communicator */
- if (lrank < rsize) {
- int myval, hisval;
- key = rank % 2;
- myval = key * size + lrank;
- hisval = -1;
- if (verbose) {
- printf( "[%d] exchanging %d with %d in intercomm\n",
- rank, myval, lrank );
- fflush( stdout );
- }
- MPI_Sendrecv (&myval, 1, MPI_INT, lrank, 0,
- &hisval, 1, MPI_INT, lrank, 0, mySecondComm, &status);
- if (hisval != (lrank + (!key)*size)) {
- printf( "[%d] expected %d but got %d\n", rank, lrank + (!key)*size,
- hisval );
- errors++;
- }
- }
-
- if (errors) {
- printf("[%d] Failed!\n",rank);
- fflush(stdout);
- }
-
- /* Key is 1 for oddComm, 0 for evenComm (note both contain 0 in WORLD) */
- MPI_Intercomm_merge ( mySecondComm, key, &merge1 );
- MPI_Intercomm_merge ( mySecondComm, (key+1)%2, &merge2 );
- MPI_Intercomm_merge ( mySecondComm, 0, &merge3 );
- MPI_Intercomm_merge ( mySecondComm, 1, &merge4 );
-
- MPI_Comm_compare( merge1, MPI_COMM_WORLD, &result );
- if (result != MPI_SIMILAR && size > 2) {
- printf( "[%d] comparision with merge1 failed\n", rank );
- errors++;
- }
-
- /* Free communicators */
- MPI_Comm_free( &myComm );
- /* remComm may have been freed above */
- if (remComm != MPI_COMM_NULL)
- MPI_Comm_free( &remComm );
- MPI_Comm_free( &myFirstComm );
- MPI_Comm_free( &mySecondComm );
- MPI_Comm_free( &merge1 );
- MPI_Comm_free( &merge2 );
- MPI_Comm_free( &merge3 );
- MPI_Comm_free( &merge4 );
- }
- else {
- printf("[%d] Failed - at least 2 nodes must be used\n",rank);
- }
-
- MPI_Barrier( MPI_COMM_WORLD );
- MPI_Allreduce( &errors, &sum_errors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
- if (sum_errors > 0) {
- printf( "%d errors on process %d\n", errors, rank );
- }
- else if (rank == 0) {
- printf( " No Errors\n" );
- }
-
- MPI_Finalize();
- return 0;
-}
+++ /dev/null
-/* ictest3.c
- This is like ictest2.c, but it creates communictors that are valid only
- at the "leaders"; other members of the local communicator are NOT
- in the remote communicator. A peer communicator is constructed that
- contains both leaders.
-
-
- */
-#include "mpi.h"
-#include <stdio.h>
-#include "test.h"
-
-/* #define DEBUG */
-
-int verbose = 0;
-
-int main( int argc, char **argv )
-{
- int size, rank, key, lrank, rsize, result;
- MPI_Comm myFirstComm;
- MPI_Comm mySecondComm;
- MPI_Comm newComm, peerComm;
- MPI_Group rgroup, lgroup, igroup;
- int errors = 0, sum_errors;
- int flag;
- MPI_Status status;
-
- /* Initialization */
- MPI_Init ( &argc, &argv );
- MPI_Comm_rank ( MPI_COMM_WORLD, &rank);
- MPI_Comm_size ( MPI_COMM_WORLD, &size);
-
- /* Only works for 2 or more processes */
- /*
- We create an even and odd communicator, then create an
- intercommunicator out of them. For this purpose, we use a
- "peer" communicator valid only at one member of each of the odd and
- even communicators.
- */
- if (size >= 2) {
- MPI_Comm merge1, merge2, merge3, merge4;
-
- /* Generate membership key in the range [0,1] */
- key = rank % 2;
- /* Create the even communicator and odd communicators */
- MPI_Comm_split ( MPI_COMM_WORLD, key, rank, &newComm );
-
- MPI_Comm_test_inter( newComm, &flag );
- if (flag) {
- errors++;
- printf( "[%d] got test_inter gave true for intra comm\n", rank );
- }
-
- /* Create the "peer" communicator */
- key = 0;
- if (rank < 2) key = 1;
- MPI_Comm_split( MPI_COMM_WORLD, key, rank, &peerComm );
- if (key == 0) {
- MPI_Comm_free( &peerComm );
- }
-#ifdef DEBUG
- else {
- MPI_Comm_rank( peerComm, &lrank );
- printf( "[%d] lrank in peerComm is %d (color = %d, key=%d)\n",
- rank, lrank, key, rank );
- }
-#endif
-
- /* Check that the leader is who we think he is */
- MPI_Comm_rank( newComm, &lrank );
- /* printf( "[%d] local rank is %d\n", rank, lrank );
- fflush(stdout); */
- /* Perform the intercomm create and test it */
- /* Local leader is always the one at rank 0. */
- /* If even, the remote leader is rank 1, if odd, the remote leader
- is rank 0 in the peercomm */
- MPI_Intercomm_create (newComm, 0, peerComm, !(rank % 2), 1, &myFirstComm );
-#ifdef DEBUG
- printf( "[%d] through intercom create\n", rank );
- fflush( stdout );
- MPI_Barrier( MPI_COMM_WORLD );
- printf( "[%d] through barrier at end of intercom create\n", rank );
-#endif
- MPI_Comm_test_inter( myFirstComm, &flag );
- if (!flag) {
- errors++;
- printf( "[%d] got test_inter gave false for inter comm\n", rank );
- }
-
- /* Try to dup this communicator */
- MPI_Comm_dup ( myFirstComm, &mySecondComm );
- MPI_Comm_test_inter( mySecondComm, &flag );
- if (!flag) {
- errors++;
- printf( "[%d] got test_inter gave false for dup of inter comm\n",
- rank );
- }
-
-#ifdef DEBUG
- printf( "[%d] through comm dup\n", rank );
- fflush( stdout );
- MPI_Barrier( MPI_COMM_WORLD );
- printf( "[%d] through barrier at end of comm dup\n", rank );
-#endif
-
- /* Each member shares data with his "partner". */
- MPI_Comm_rank( mySecondComm, &lrank );
- MPI_Comm_remote_size( mySecondComm, &rsize );
-
-#ifdef DEBUG
- printf( "[%d] lrank in secondcomm is %d and remote size is %d\n",
- rank, lrank, rsize );
- fflush( stdout );
-#endif
-
- /* Check that the remote group is what we think */
- MPI_Comm_remote_group( mySecondComm, &rgroup );
- MPI_Comm_group( newComm, &lgroup );
- MPI_Group_intersection( rgroup, lgroup, &igroup );
- MPI_Group_compare( igroup, MPI_GROUP_EMPTY, &flag );
- if (flag != MPI_IDENT) {
- errors++;
- printf( "[%d] intersection of remote and local group is not empty\n",
- rank );
- }
- MPI_Group_free( &rgroup );
- MPI_Group_free( &lgroup );
- MPI_Group_free( &igroup );
-
- /* Send key * size + rank in communicator */
- if (lrank < rsize) {
- int myval, hisval;
- key = rank % 2;
- myval = key * size + lrank;
- hisval = -1;
-#ifdef DEBUG
- printf( "[%d] exchanging %d with %d in intercomm\n",
- rank, myval, lrank );
- fflush( stdout );
-#endif
- MPI_Sendrecv (&myval, 1, MPI_INT, lrank, 0,
- &hisval, 1, MPI_INT, lrank, 0, mySecondComm, &status);
- if (hisval != (lrank + (!key)*size)) {
- printf( "[%d] expected %d but got %d\n", rank, lrank + (!key)*size,
- hisval );
- errors++;
- }
- }
-
- if (errors)
- printf("[%d] Failed!\n",rank);
-
- /* Key is 1 for oddComm, 0 for evenComm (note both contain 0 in WORLD) */
-#ifdef DEBUG
- printf( "[%d] starting intercom merge\n", rank );
- fflush( stdout );
-#endif
- MPI_Intercomm_merge ( mySecondComm, key, &merge1 );
- MPI_Intercomm_merge ( mySecondComm, (key+1)%2, &merge2 );
- MPI_Intercomm_merge ( mySecondComm, 0, &merge3 );
- MPI_Intercomm_merge ( mySecondComm, 1, &merge4 );
-
- MPI_Comm_compare( merge1, MPI_COMM_WORLD, &result );
- if (result != MPI_SIMILAR && size > 2) {
- printf( "[%d] comparision with merge1 failed\n", rank );
- errors++;
- }
-
- /* Free communicators */
- if (verbose) printf( "about to free communicators\n" );
- MPI_Comm_free( &newComm );
- if (peerComm != MPI_COMM_NULL) MPI_Comm_free( &peerComm );
- MPI_Comm_free( &myFirstComm );
- MPI_Comm_free( &mySecondComm );
- MPI_Comm_free( &merge1 );
- MPI_Comm_free( &merge2 );
- MPI_Comm_free( &merge3 );
- MPI_Comm_free( &merge4 );
- }
- else
- printf("[%d] Failed - at least 2 nodes must be used\n",rank);
-
- MPI_Barrier( MPI_COMM_WORLD );
- MPI_Allreduce( &errors, &sum_errors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
- if (sum_errors > 0) {
- printf( "%d errors on process %d\n", errors, rank );
- }
- else if (rank == 0) {
- printf( " No Errors\n" );
- }
- /* Finalize and end! */
-
- MPI_Finalize();
- return 0;
-}
+++ /dev/null
-#! /bin/sh
-#
-# Run some of the tests. If any arguments are provided, pass them to the
-# test programs.
-#
-# -mvhome is needed for the ANL SP, and is ignored by others
-args=
-device=
-MPICH_VERSION=
-STOPFILE=${MPITEST_STOPTEST:-"$HOME/.stopmpichtests"}
-MAKE="make --no-print-directory"
-
-#
-# Set mpirun to the name/path of the mpirun program
-#FindMPIRUN
-#
-#
-test_mpi2=1
-runtests=1
-quiet=0
-makeeach=0
-have_fortran=0
-writesummaryfile=no
-MAKE="make --no-print-directory"
-for arg in "$@" ; do
- case $arg in
- -basedir=* )
- basedir=`echo $arg | sed 's/-basedir=//'`
- ;;
- -srcdir=* )
- srcdir=`echo $arg | sed 's/-srcdir=//'`
- ;;
- -fort=* )
- have_fortran=`echo $arg | sed 's/-fort=//'`
- ;;
- -checkonly )
- runtests=0
- ;;
- -margs=*)
- margs=`echo $arg | sed 's/-margs=//'`
- args="$args $margs"
- ;;
- -summaryfile=*)
- writesummaryfile=yes
- summaryfile=`echo A$arg | sed 's/A-summaryfile=//'`
- ;;
- -small)
- makeeach=1
- ;;
- -quiet)
- shift
- quiet=1
- ;;
- -help|-u)
- echo "runtests [-checkonly] [-margs='...']"
- echo "run tests in this directory. If -checkonly set, just run"
- echo "the differences check (do NO rerun the test programs)."
- echo "If -margs is used, these options are passed to mpirun."
- echo "If -small is used, the examples are built, run, and deleted."
- exit 1
- ;;
- *)
- if test -n "$arg" ; then
- echo "runtests: Unknown argument ($arg)"
- exit 1
- fi
- ;;
- esac
-done
-
-#
-# Load basic procedures
-. ${srcdir}/../runbase
-
-# If the programs are not available, run make.
-if [ ! -x attrerr -a $makeeach = 0 -a $runtests = 1 ] ; then
- $MAKE
-fi
-mpirun=" ${basedir}/bin/smpirun -platform ${srcdir}/../../../../examples/msg/small_platform_with_routers.xml -hostfile ${srcdir}/../../hostfile --log=root.thres:critical"
-testfiles=""
-if [ $runtests = 1 ] ; then
-
-#
-# Run Fortran tests ONLY if Fortran available
-#no fortran tests compile with smpi at this time
-#if [ $have_fortran -eq "1" ] ; then
-# #RunTest attrtest 2 "*** Testing attributes from Fortran ***"
-
-# if [ $test_mpi2 = 1 ] ; then
-# RunTest commnamesf 1 "*** Testing Communicator Names from Fortran ***"
-# fi
-#fi
-#uses attr, not implemented
-#RunTest attrt 2 "*** Testing attributes ***"
-#fails, uses MPI_Attr_get, et MPI_Attr_put
-#RunTest attrerr 1 "*** Testing attributes (2) ***"
-
-RunTest grouptest_mpich 4 "*** Testing Groups ***"
-
-RunTest groupcreate 4 "*** Testing Group creation ***"
-
-#uses MPI_Intercomm_create
-#RunTest ictest 4 "*** Testing Intercommunicators ***"
-
-RunTest icdup 3 "*** Testing dup of an intercommunicator ***"
-
-#
-# ictest2 relies on a inconsistency in the standard, to wit, that the
-# leader in both groups can be the same process. This seems to be
-# essential in a dynamic setting, since the only process both groups can
-# access may be the single parent process (other than using client/server
-# intercommunicator creating routines, with the parent providing the common
-# information).
-#
-#testfiles="$testfiles ictest2.out"
-#rm -f ictest2.out
-#MakeExe ictest2
-#echo '*** Testing Intercommunicators (2) ***'
-#echo '*** Testing Intercommunicators (2) ***' >> ictest2.out
-#$mpirun $args -np 4 ictest2 $* >> ictest2.out 2>&1
-#echo '*** Testing Intercommunicators (2) ***' >> ictest2.out
-#CleanExe ictest2
-#uses MPI_Comm_test_inter and MPI_Intercomm_create
-#RunTest ictest3 4 "*** Testing Intercommunicators (3) ***"
-
-#if [ $have_fortran -eq "1" ] ; then
-# RunTest commnamesf 2 "*** Testing Communicator Names ***"
-#fi
-#else
- # Just run checks
-# testfiles=`echo *.out`
-fi
-
-echo '*** Checking for differences from expected output ***'
-CheckAllOutput context.diff
-exit 0
+++ /dev/null
-/* Procedures for recording and printing test results */
-
-#include <stdio.h>
-#include <string.h>
-#include "test.h"
-#include "mpi.h"
-
-static int tests_passed = 0;
-static int tests_failed = 0;
-static char failed_tests[255][81];
-static char suite_name[255];
-FILE *fileout = NULL;
-
-void Test_Init(suite, rank)
-const char *suite;
-int rank;
-{
- char filename[512];
-
- sprintf(filename, "%s-%d.out", suite, rank);
- strncpy(suite_name, suite, 255);
- fileout = fopen(filename, "w");
- if (!fileout) {
- fprintf( stderr, "Could not open %s on node %d\n", filename, rank );
- MPI_Abort( MPI_COMM_WORLD, 1 );
- }
-}
-
-void Test_Message(mess)
-const char *mess;
-{
- fprintf(fileout, "[%s]: %s\n", suite_name, mess);
- fflush(fileout);
-}
-
-void Test_Failed(test)
-const char *test;
-{
- fprintf(fileout, "[%s]: *** Test '%s' Failed! ***\n", suite_name, test);
- strncpy(failed_tests[tests_failed], test, 81);
- fflush(fileout);
- tests_failed++;
-}
-
-void Test_Passed(test)
-const char *test;
-{
- fprintf(fileout, "[%s]: Test '%s' Passed.\n", suite_name, test);
- fflush(fileout);
- tests_passed++;
-}
-
-int Summarize_Test_Results()
-{
- fprintf(fileout, "For test suite '%s':\n", suite_name);
- fprintf(fileout, "Of %d attempted tests, %d passed, %d failed.\n",
- tests_passed + tests_failed, tests_passed, tests_failed);
- if (tests_failed > 0) {
- int i;
-
- fprintf(fileout, "*** Tests Failed:\n");
- for (i = 0; i < tests_failed; i++)
- fprintf(fileout, "*** %s\n", failed_tests[i]);
- }
- return tests_failed;
-}
-
-void Test_Finalize()
-{
- fflush(fileout);
- fclose(fileout);
-}
-
-#include "mpi.h"
-/* Wait for every process to pass through this point. This test is used
- to make sure that all processes complete, and that a test "passes" because
- it executed, not because it some process failed.
- */
-void Test_Waitforall( )
-{
-int m, one, myrank, n;
-
-MPI_Comm_rank( MPI_COMM_WORLD, &myrank );
-MPI_Comm_size( MPI_COMM_WORLD, &n );
-one = 1;
-MPI_Allreduce( &one, &m, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
-
-if (m != n) {
- printf( "[%d] Expected %d processes to wait at end, got %d\n", myrank,
- n, m );
- }
-if (myrank == 0)
- printf( "All processes completed test\n" );
-}
+++ /dev/null
-/* Header for testing procedures */
-
-#ifndef _INCLUDED_TEST_H_
-#define _INCLUDED_TEST_H_
-
-#if defined(NEEDS_STDLIB_PROTOTYPES)
-#include "protofix.h"
-#endif
-
-void Test_Init (const char *, int);
-#ifdef USE_STDARG
-void Test_Printf (const char *, ...);
-#else
-/* No prototype */
-void Test_Printf();
-#endif
-void Test_Message (const char *);
-void Test_Failed (const char *);
-void Test_Passed (const char *);
-int Summarize_Test_Results (void);
-void Test_Finalize (void);
-void Test_Waitforall (void);
-
-#endif
+++ /dev/null
-cmake_minimum_required(VERSION 2.6)
-
-if(enable_smpi)
- if(WIN32)
- set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h")
- else()
- set(CMAKE_C_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc")
- set(CMAKE_Fortran_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff")
- endif()
-
- set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
- set(MPICH_FLAGS "-DHAVE_STDLIB_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STRING_H=1 -DUSE_STDARG=1 -DHAVE_LONG_DOUBLE=1 -DHAVE_PROTOTYPES=1 -DHAVE_SIGNAL_H=1 -DHAVE_SIGACTION=1 -DHAVE_SLEEP=1 -DHAVE_SYSCONF=1")
-
- include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi")
-
- add_executable(init init.c )
- add_executable(timers timers.c test.c)
- add_executable(timertest timertest.c test.c)
- add_executable(baseattr baseattr.c test.c)
- add_executable(gtime gtime.c test.c)
- add_executable(errhand errhand.c test.c)
- if(NOT WIN32)
- add_executable(sigchk sigchk.c test.c)
- endif()
- add_executable(aborttest aborttest.c)
- add_executable(testerr testerr.c)
- add_executable(getproc getproc.c)
- if(SMPI_F2C)
-# add_executable(baseattrf baseattrf.f)
-# add_executable(errhandf errhandf.f)
-# add_executable(errstringsf errstringsf.f)
-