From: Augustin Degomme Date: Thu, 18 Apr 2019 11:40:58 +0000 (+0200) Subject: Add some tests for io. X-Git-Tag: v3.22.2~101^2~3 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/e0e373ee37eda6080ba4621403cc2adaff04d95d Add some tests for io. --- diff --git a/teshsuite/smpi/CMakeLists.txt b/teshsuite/smpi/CMakeLists.txt index 800ae86f93..8dc3a021a0 100644 --- a/teshsuite/smpi/CMakeLists.txt +++ b/teshsuite/smpi/CMakeLists.txt @@ -8,7 +8,8 @@ if(enable_smpi) include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") foreach(x coll-allgather coll-allgatherv coll-allreduce coll-alltoall coll-alltoallv coll-barrier coll-bcast coll-gather coll-reduce coll-reduce-scatter coll-scatter macro-sample pt2pt-dsend pt2pt-pingpong - type-hvector type-indexed type-struct type-vector bug-17132 timers privatization ) + type-hvector type-indexed type-struct type-vector bug-17132 timers privatization + io-simple io-simple-at io-all io-shared io-ordered) add_executable (${x} EXCLUDE_FROM_ALL ${x}/${x}.c) target_link_libraries(${x} simgrid) set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x}) @@ -36,7 +37,8 @@ endif() foreach(x coll-allgather coll-allgatherv coll-allreduce coll-alltoall coll-alltoallv coll-barrier coll-bcast coll-gather coll-reduce coll-reduce-scatter coll-scatter macro-sample pt2pt-dsend pt2pt-pingpong type-hvector type-indexed type-struct type-vector bug-17132 timers privatization - macro-shared macro-partial-shared macro-partial-shared-communication) + macro-shared macro-partial-shared macro-partial-shared-communication + io-simple io-simple-at io-all io-shared io-ordered) set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh) set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c) endforeach() @@ -63,7 +65,7 @@ if(enable_smpi) foreach(x coll-allgather coll-allgatherv coll-allreduce coll-alltoall coll-alltoallv coll-barrier coll-bcast coll-gather coll-reduce coll-reduce-scatter coll-scatter macro-sample pt2pt-dsend pt2pt-pingpong - type-hvector type-indexed type-struct type-vector bug-17132 timers) + type-hvector type-indexed type-struct type-vector bug-17132 timers io-simple io-simple-at io-all io-shared io-ordered) ADD_TESH_FACTORIES(tesh-smpi-${x} "thread;ucontext;raw;boost" --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/${x} --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/${x} ${x}.tesh) endforeach() diff --git a/teshsuite/smpi/io-all/io-all.c b/teshsuite/smpi/io-all/io-all.c new file mode 100644 index 0000000000..56d95b3b27 --- /dev/null +++ b/teshsuite/smpi/io-all/io-all.c @@ -0,0 +1,74 @@ +#include "mpi.h" +#include +#include +#include +#include + +/* Test reading and writing zero bytes (set status correctly) */ + +int main( int argc, char *argv[] ) +{ + int errs = 0; + int size, rank, i, *buf, count; + MPI_File fh; + MPI_Comm comm; + MPI_Status status; + + MPI_Init( &argc, &argv ); + + comm = MPI_COMM_WORLD; + MPI_File_open( comm, (char*)"/scratch/lib/libsimgrid.so.3.6.2", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh ); + MPI_Comm_size( comm, &size ); + MPI_Comm_rank( comm, &rank ); + buf = (int *)malloc( 10+ size * sizeof(int) ); + buf[0] = rank; + + /* Write to file */ + MPI_File_seek( fh, sizeof(int)*rank, MPI_SEEK_SET ); + MPI_File_write_all( fh, buf, 1, MPI_INT, &status ); + MPI_Get_count( &status, MPI_INT, &count ); + if (count != 1) { + errs++; + fprintf( stderr, "Wrong count (%d) on write\n", count );fflush(stderr); + } + /* Write to file, overlapping */ + MPI_File_seek( fh, sizeof(int)*rank, MPI_SEEK_SET ); + MPI_File_write_all( fh, buf, 10, MPI_INT, &status ); + MPI_Get_count( &status, MPI_INT, &count ); + if (count != 10) { + errs++; + fprintf( stderr, "Wrong count (%d) on write\n", count );fflush(stderr); + } + /* Read nothing (check status) */ + memset( &status, 0xff, sizeof(MPI_Status) ); + MPI_File_read_all( fh, buf, 0, MPI_INT, &status ); + MPI_Get_count( &status, MPI_INT, &count ); + if (count != 0) { + errs++; + fprintf( stderr, "Count not zero (%d) on read\n", count );fflush(stderr); + } + + /* Write nothing (check status) */ + memset( &status, 0xff, sizeof(MPI_Status) ); + MPI_File_write_all( fh, buf, 0, MPI_INT, &status ); + if (count != 0) { + errs++; + fprintf( stderr, "Count not zero (%d) on write\n", count );fflush(stderr); + } + + MPI_Barrier( comm ); + + MPI_File_seek( fh, sizeof(int)*rank, MPI_SEEK_SET ); + for (i=0; i You requested to use 4 ranks, but there is only 2 processes in your hostfile... +> [rank 0] -> bob +> [rank 1] -> carl +> [rank 2] -> bob +> [rank 3] -> carl +> [ 0.000282] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.000358] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 +> [ 0.000534] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 +> [ 0.000534] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 +> [ 0.000737] (3@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> [ 0.000737] (3@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 16 +> [ 0.000737] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 +> [ 0.000737] (1@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> [ 0.000737] (1@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 +> [ 0.000737] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 +> [ 0.000838] (2@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> [ 0.000838] (2@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 +> [ 0.000838] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 +> [ 0.000838] (0@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> [ 0.000838] (0@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 +> [ 0.000838] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001040] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 39 +> [ 0.001040] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 26 +> [ 0.001040] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001040] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 13 +> [ 0.001041] (3@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes written, readsize 12 bytes, movesize 12 +> [ 0.001041] (3@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 51 +> [ 0.001041] (1@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes written, readsize 12 bytes, movesize 12 +> [ 0.001041] (1@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 25 +> [ 0.001141] (0@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes written, readsize 12 bytes, movesize 12 +> [ 0.001141] (0@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 +> [ 0.001141] (2@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes written, readsize 12 bytes, movesize 12 +> [ 0.001141] (2@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 38 +> [ 0.001799] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001814] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 +> [ 0.001849] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 +> [ 0.001849] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 +> [ 0.002052] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.002052] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 26 +> [ 0.002052] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 39 +> [ 0.002052] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 13 +> [ 0.002052] (3@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes read, readsize 12 bytes, movesize 12 +> [ 0.002052] (3@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 51 +> [ 0.002052] (1@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes read, readsize 12 bytes, movesize 12 +> [ 0.002052] (1@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 25 +> [ 0.002153] (2@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes read, readsize 12 bytes, movesize 12 +> [ 0.002153] (2@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 38 +> [ 0.002153] (0@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes read, readsize 12 bytes, movesize 12 +> [ 0.002153] (0@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 \ No newline at end of file diff --git a/teshsuite/smpi/io-ordered/io-ordered.c b/teshsuite/smpi/io-ordered/io-ordered.c new file mode 100644 index 0000000000..e5225dfbbd --- /dev/null +++ b/teshsuite/smpi/io-ordered/io-ordered.c @@ -0,0 +1,46 @@ +#include "mpi.h" +#include +#include +#include +#include + +/* Test reading and writing zero bytes (set status correctly) */ + +int main( int argc, char *argv[] ) +{ + int errs = 0; + int size, rank, i, *buf, count; + MPI_File fh; + MPI_Comm comm; + MPI_Status status; + + MPI_Init( &argc, &argv ); + + comm = MPI_COMM_WORLD; + MPI_File_open( comm, (char*)"/scratch/lib/libsimgrid.so.3.6.2", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh ); + MPI_Comm_size( comm, &size ); + MPI_Comm_rank( comm, &rank ); + buf = (int *)malloc( 10+size * sizeof(int) ); + buf[0] = rank; + + /* Write to file */ + MPI_File_write_ordered( fh, buf, 10, MPI_INT, &status ); + MPI_Get_count( &status, MPI_INT, &count ); + if (count != 10) { + errs++; + fprintf( stderr, "Wrong count (%d) on write-ordered\n", count );fflush(stderr); + } + MPI_Barrier( comm ); + MPI_File_seek_shared( fh, 0, MPI_SEEK_SET ); + for (i=0; i You requested to use 4 ranks, but there is only 2 processes in your hostfile... +> [rank 0] -> bob +> [rank 1] -> carl +> [rank 2] -> bob +> [rank 3] -> carl +> [ 0.000282] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.000635] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 80 +> [ 0.000635] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 40 +> [ 0.000635] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 120 +> [ 0.000839] (3@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes written, readsize 40 bytes, movesize 40 +> [ 0.000839] (3@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 160 +> [ 0.000839] (1@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes written, readsize 40 bytes, movesize 40 +> [ 0.000839] (1@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 80 +> [ 0.000940] (2@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes written, readsize 40 bytes, movesize 40 +> [ 0.000940] (2@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 120 +> [ 0.000940] (0@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes written, readsize 40 bytes, movesize 40 +> [ 0.000940] (0@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 40 +> [ 0.001091] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001091] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001106] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001141] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001141] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001242] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 80 +> [ 0.001242] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 40 +> [ 0.001242] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 120 +> [ 0.001446] (3@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 +> [ 0.001446] (3@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 160 +> [ 0.001446] (1@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 +> [ 0.001446] (1@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 80 +> [ 0.001548] (2@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 +> [ 0.001548] (2@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 120 +> [ 0.001548] (0@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 +> [ 0.001548] (0@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 40 +> [ 0.001699] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001714] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001749] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001749] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 \ No newline at end of file diff --git a/teshsuite/smpi/io-shared/io-shared.c b/teshsuite/smpi/io-shared/io-shared.c new file mode 100644 index 0000000000..d83c8baad0 --- /dev/null +++ b/teshsuite/smpi/io-shared/io-shared.c @@ -0,0 +1,66 @@ +#include "mpi.h" +#include +#include +#include +#include + +/* Test reading and writing zero bytes (set status correctly) */ + +int main( int argc, char *argv[] ) +{ + int errs = 0; + int size, rank, i, *buf, count; + MPI_File fh; + MPI_Comm comm; + MPI_Status status; + + MPI_Init( &argc, &argv ); + + comm = MPI_COMM_WORLD; + MPI_File_open( comm, (char*)"/scratch/lib/libsimgrid.so.3.6.2", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh ); + MPI_Comm_size( comm, &size ); + MPI_Comm_rank( comm, &rank ); + buf = (int *)malloc( 10+size * sizeof(int) ); + buf[0] = rank; + + /* Write nothing (check status) */ + memset( &status, 0xff, sizeof(MPI_Status) ); + MPI_File_write( fh, buf, 0, MPI_INT, &status ); + MPI_Get_count( &status, MPI_INT, &count ); + if (count != 0) { + errs++; + fprintf( stderr, "Count not zero (%d) on write\n", count );fflush(stderr); + } + + MPI_Barrier( comm ); + MPI_File_seek_shared( fh, 0, MPI_SEEK_SET ); + for (i=0; i You requested to use 4 ranks, but there is only 2 processes in your hostfile... +> [rank 0] -> bob +> [rank 1] -> carl +> [rank 2] -> bob +> [rank 3] -> carl +> [ 0.000584] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.000584] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.000599] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.000634] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.000634] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.000735] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 80 +> [ 0.000735] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 40 +> [ 0.000735] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 120 +> [ 0.000939] (3@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 +> [ 0.000939] (3@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 160 +> [ 0.000939] (1@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 +> [ 0.000939] (1@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 80 +> [ 0.001041] (2@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 +> [ 0.001041] (2@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 120 +> [ 0.001041] (0@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 +> [ 0.001041] (0@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 40 +> [ 0.001192] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001192] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001292] (0@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> [ 0.001292] (0@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 +> [ 0.001292] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001292] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001292] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001292] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001393] (2@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> [ 0.001393] (2@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 +> [ 0.001393] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 +> [ 0.001393] (3@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> [ 0.001393] (3@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 +> [ 0.001393] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 +> [ 0.001393] (1@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> [ 0.001393] (1@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 +> [ 0.001443] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001443] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001544] (0@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> [ 0.001544] (0@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 +> [ 0.001544] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001544] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001544] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001544] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.001645] (2@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> [ 0.001645] (2@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 +> [ 0.001645] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 +> [ 0.001645] (3@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> [ 0.001645] (3@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 +> [ 0.001645] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 +> [ 0.001645] (1@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> [ 0.001645] (1@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 \ No newline at end of file diff --git a/teshsuite/smpi/io-simple-at/io-simple-at.c b/teshsuite/smpi/io-simple-at/io-simple-at.c new file mode 100644 index 0000000000..6a6e161a3f --- /dev/null +++ b/teshsuite/smpi/io-simple-at/io-simple-at.c @@ -0,0 +1,65 @@ +#include "mpi.h" +#include +#include +#include +#include + +/* Test reading and writing zero bytes (set status correctly) */ + +int main( int argc, char *argv[] ) +{ + int errs = 0; + int size, rank, i, *buf, count; + MPI_File fh; + MPI_Comm comm; + MPI_Status status; + + MPI_Init( &argc, &argv ); + + comm = MPI_COMM_WORLD; + MPI_File_open( comm, (char*)"/scratch/lib/libsimgrid.so.3.6.2", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh ); + MPI_Comm_size( comm, &size ); + MPI_Comm_rank( comm, &rank ); + buf = (int *)malloc( size * sizeof(int) ); + buf[0] = rank; + + /* Write to file */ + MPI_File_write_at( fh, sizeof(int)*rank, buf, 1, MPI_INT, &status ); + MPI_Get_count( &status, MPI_INT, &count ); + if (count != 1) { + errs++; + fprintf( stderr, "Wrong count (%d) on write_at\n", count );fflush(stderr); + } + + /* Read nothing (check status) */ + memset( &status, 0xff, sizeof(MPI_Status) ); + MPI_File_read_at( fh, sizeof(int)*rank, buf, 0, MPI_INT, &status ); + MPI_Get_count( &status, MPI_INT, &count ); + if (count != 0) { + errs++; + fprintf( stderr, "Count not zero (%d) on read\n", count );fflush(stderr); + } + + /* Write nothing (check status) */ + memset( &status, 0xff, sizeof(MPI_Status) ); + MPI_File_write_at( fh, sizeof(int)*rank, buf, 0, MPI_INT, &status ); + if (count != 0) { + errs++; + fprintf( stderr, "Count not zero (%d) on write\n", count );fflush(stderr); + } + + MPI_Barrier( comm ); + + for (i=0; i You requested to use 4 ranks, but there is only 2 processes in your hostfile... +> [rank 0] -> bob +> [rank 1] -> carl +> [rank 2] -> bob +> [rank 3] -> carl +> [ 0.000282] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.000358] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 +> [ 0.000383] (0@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> [ 0.000383] (0@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 +> [ 0.000459] (2@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> [ 0.000459] (2@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 +> [ 0.000534] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 +> [ 0.000534] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 +> [ 0.000534] (3@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> [ 0.000534] (3@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 16 +> [ 0.000534] (1@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> [ 0.000534] (1@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 +> [ 0.000584] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.000599] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 +> [ 0.000634] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 +> [ 0.000634] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 +> [ 0.000634] (3@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> [ 0.000634] (3@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 16 +> [ 0.000634] (1@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> [ 0.000634] (1@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 +> [ 0.000685] (0@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> [ 0.000685] (0@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 +> [ 0.000700] (2@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> [ 0.000700] (2@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 \ No newline at end of file diff --git a/teshsuite/smpi/io-simple/io-simple.c b/teshsuite/smpi/io-simple/io-simple.c new file mode 100644 index 0000000000..33d8ef069e --- /dev/null +++ b/teshsuite/smpi/io-simple/io-simple.c @@ -0,0 +1,67 @@ +#include "mpi.h" +#include +#include +#include +#include + +/* Test reading and writing zero bytes (set status correctly) */ + +int main( int argc, char *argv[] ) +{ + int errs = 0; + int size, rank, i, *buf, count; + MPI_File fh; + MPI_Comm comm; + MPI_Status status; + + MPI_Init( &argc, &argv ); + + comm = MPI_COMM_WORLD; + MPI_File_open( comm, (char*)"/scratch/lib/libsimgrid.so.3.6.2", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh ); + MPI_Comm_size( comm, &size ); + MPI_Comm_rank( comm, &rank ); + buf = (int *)malloc( size * sizeof(int) ); + buf[0] = rank; + + /* Write to file */ + MPI_File_seek( fh, sizeof(int)*rank, MPI_SEEK_SET ); + MPI_File_write( fh, buf, 1, MPI_INT, &status ); + MPI_Get_count( &status, MPI_INT, &count ); + if (count != 1) { + errs++; + fprintf( stderr, "Wrong count (%d) on write\n", count );fflush(stderr); + } + + /* Read nothing (check status) */ + memset( &status, 0xff, sizeof(MPI_Status) ); + MPI_File_read( fh, buf, 0, MPI_INT, &status ); + MPI_Get_count( &status, MPI_INT, &count ); + if (count != 0) { + errs++; + fprintf( stderr, "Count not zero (%d) on read\n", count );fflush(stderr); + } + + /* Write nothing (check status) */ + memset( &status, 0xff, sizeof(MPI_Status) ); + MPI_File_write( fh, buf, 0, MPI_INT, &status ); + if (count != 0) { + errs++; + fprintf( stderr, "Count not zero (%d) on write\n", count );fflush(stderr); + } + + MPI_Barrier( comm ); + + MPI_File_seek( fh, sizeof(int)*rank, MPI_SEEK_SET ); + for (i=0; i You requested to use 4 ranks, but there is only 2 processes in your hostfile... +> [rank 0] -> bob +> [rank 1] -> carl +> [rank 2] -> bob +> [rank 3] -> carl +> [ 0.000282] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.000358] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 +> [ 0.000383] (0@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> [ 0.000383] (0@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 +> [ 0.000459] (2@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> [ 0.000459] (2@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 +> [ 0.000534] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 +> [ 0.000534] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 +> [ 0.000534] (3@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> [ 0.000534] (3@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 16 +> [ 0.000534] (1@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> [ 0.000534] (1@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 +> [ 0.000584] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> [ 0.000599] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 +> [ 0.000634] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 +> [ 0.000634] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 +> [ 0.000634] (3@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> [ 0.000634] (3@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 16 +> [ 0.000634] (1@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> [ 0.000634] (1@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 +> [ 0.000685] (0@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> [ 0.000685] (0@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 +> [ 0.000700] (2@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> [ 0.000700] (2@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 \ No newline at end of file