Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
forgot to push test for write_at_all and read_at_all
authorAugustin Degomme <adegomme@users.noreply.github.com>
Wed, 1 May 2019 12:44:50 +0000 (14:44 +0200)
committerAugustin Degomme <adegomme@users.noreply.github.com>
Wed, 1 May 2019 12:44:50 +0000 (14:44 +0200)
teshsuite/smpi/CMakeLists.txt
teshsuite/smpi/io-all-at/io-all-at.c [new file with mode: 0644]
teshsuite/smpi/io-all-at/io-all-at.tesh [new file with mode: 0644]

index bd47739..d208718 100644 (file)
@@ -9,7 +9,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 privatization 
   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 
-            io-simple io-simple-at io-all io-shared io-ordered)
+            io-simple io-simple-at io-all io-all-at 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})
     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})
@@ -38,7 +38,7 @@ foreach(x coll-allgather coll-allgatherv coll-allreduce coll-alltoall coll-allto
     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
     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
-    io-simple io-simple-at io-all io-shared io-ordered)
+    io-simple io-simple-at io-all io-all-at 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()
   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()
@@ -66,7 +66,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
 
   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 io-simple io-simple-at io-all io-shared io-ordered)
+           type-hvector type-indexed type-struct type-vector bug-17132 timers io-simple io-simple-at io-all io-all-at 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()
 
     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-at/io-all-at.c b/teshsuite/smpi/io-all-at/io-all-at.c
new file mode 100644 (file)
index 0000000..3c2963b
--- /dev/null
@@ -0,0 +1,76 @@
+#include "mpi.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <memory.h>
+
+/* Test reading and writing zero bytes (set status correctly) */
+
+int main( int argc, char *argv[] )
+{
+    int errs = 0;
+    int size;
+    int rank;
+    int i;
+    int* buf;
+    int count;
+    MPI_File fh;
+    MPI_Comm comm;
+    MPI_Status status;
+    MPI_Init( &argc, &argv );
+    comm = MPI_COMM_WORLD;
+    MPI_File_open( comm, (char*)"/scratch/testfile", 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 * 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_write_at_all( fh, sizeof(int)*rank, 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_at_all( fh, 0, 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_all( fh, 0, 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<size; i++) buf[i] = -1;
+    MPI_File_read_at_all( fh, sizeof(int)*rank, buf, 10, MPI_INT, &status );
+    // if (buf[0] != rank) {
+        // errs++;
+        // fprintf( stderr, "%d: buf = %d\n", rank, buf[0] );fflush(stderr);
+    // }
+    free( buf );
+    MPI_File_close( &fh );
+    MPI_Finalize();
+    return errs;
+}
diff --git a/teshsuite/smpi/io-all-at/io-all-at.tesh b/teshsuite/smpi/io-all-at/io-all-at.tesh
new file mode 100644 (file)
index 0000000..67a7278
--- /dev/null
@@ -0,0 +1,60 @@
+# Test for MPI_File_read and MPI_File_write
+! output sort
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_io -platform ../../../examples/platforms/storage/remote_io.xml -np 4 --log=xbt_cfg.thres:critical --log=smpi_kernel.thres:warning --log=smpi_mpi.thres:error --log=smpi_io.thres:verbose "--log=root.fmt:(%P@%h)%e%m%n" --cfg=smpi/simulate-computation:0 ${bindir:=.}/io-all-at
+> 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@bob) Seeking in MPI_File /scratch/testfile, setting offset 0
+> (2@bob) Seeking in MPI_File /scratch/testfile, setting offset 8
+> (3@carl) Seeking in MPI_File /scratch/testfile, setting offset 12
+> (1@carl) Seeking in MPI_File /scratch/testfile, setting offset 4
+> (3@carl) Write in MPI_File /scratch/testfile, 4 bytes written, readsize 4 bytes, movesize 4
+> (3@carl) Position after write in MPI_File /scratch/testfile : 16
+> (3@carl) Seeking in MPI_File /scratch/testfile, setting offset 12
+> (1@carl) Write in MPI_File /scratch/testfile, 4 bytes written, readsize 4 bytes, movesize 4
+> (1@carl) Position after write in MPI_File /scratch/testfile : 8
+> (1@carl) Seeking in MPI_File /scratch/testfile, setting offset 4
+> (2@bob) Write in MPI_File /scratch/testfile, 4 bytes written, readsize 4 bytes, movesize 4
+> (2@bob) Position after write in MPI_File /scratch/testfile : 12
+> (2@bob) Seeking in MPI_File /scratch/testfile, setting offset 8
+> (0@bob) Write in MPI_File /scratch/testfile, 4 bytes written, readsize 4 bytes, movesize 4
+> (0@bob) Position after write in MPI_File /scratch/testfile : 4
+> (0@bob) Seeking in MPI_File /scratch/testfile, setting offset 0
+> (3@carl) Seeking in MPI_File /scratch/testfile, setting offset 39
+> (2@bob) Seeking in MPI_File /scratch/testfile, setting offset 26
+> (0@bob) Seeking in MPI_File /scratch/testfile, setting offset 0
+> (1@carl) Seeking in MPI_File /scratch/testfile, setting offset 13
+> (3@carl) Write in MPI_File /scratch/testfile, 12 bytes written, readsize 12 bytes, movesize 12
+> (3@carl) Position after write in MPI_File /scratch/testfile : 51
+> (1@carl) Write in MPI_File /scratch/testfile, 12 bytes written, readsize 12 bytes, movesize 12
+> (1@carl) Position after write in MPI_File /scratch/testfile : 25
+> (0@bob) Write in MPI_File /scratch/testfile, 12 bytes written, readsize 12 bytes, movesize 12
+> (0@bob) Position after write in MPI_File /scratch/testfile : 12
+> (2@bob) Write in MPI_File /scratch/testfile, 12 bytes written, readsize 12 bytes, movesize 12
+> (2@bob) Position after write in MPI_File /scratch/testfile : 38
+> (3@carl) Seeking in MPI_File /scratch/testfile, setting offset 0
+> (1@carl) Seeking in MPI_File /scratch/testfile, setting offset 0
+> (2@bob) Seeking in MPI_File /scratch/testfile, setting offset 0
+> (0@bob) Seeking in MPI_File /scratch/testfile, setting offset 0
+> (3@carl) Seeking in MPI_File /scratch/testfile, setting offset 0
+> (2@bob) Seeking in MPI_File /scratch/testfile, setting offset 0
+> (0@bob) Seeking in MPI_File /scratch/testfile, setting offset 0
+> (1@carl) Seeking in MPI_File /scratch/testfile, setting offset 0
+> (0@bob) Seeking in MPI_File /scratch/testfile, setting offset 0
+> (2@bob) Seeking in MPI_File /scratch/testfile, setting offset 8
+> (3@carl) Seeking in MPI_File /scratch/testfile, setting offset 12
+> (1@carl) Seeking in MPI_File /scratch/testfile, setting offset 4
+> (0@bob) Seeking in MPI_File /scratch/testfile, setting offset 0
+> (2@bob) Seeking in MPI_File /scratch/testfile, setting offset 26
+> (3@carl) Seeking in MPI_File /scratch/testfile, setting offset 39
+> (1@carl) Seeking in MPI_File /scratch/testfile, setting offset 13
+> (3@carl) Read in MPI_File /scratch/testfile, 12 bytes read, readsize 12 bytes, movesize 12
+> (3@carl) Position after read in MPI_File /scratch/testfile : 51
+> (1@carl) Read in MPI_File /scratch/testfile, 12 bytes read, readsize 12 bytes, movesize 12
+> (1@carl) Position after read in MPI_File /scratch/testfile : 25
+> (2@bob) Read in MPI_File /scratch/testfile, 12 bytes read, readsize 12 bytes, movesize 12
+> (2@bob) Position after read in MPI_File /scratch/testfile : 38
+> (0@bob) Read in MPI_File /scratch/testfile, 12 bytes read, readsize 12 bytes, movesize 12
+> (0@bob) Position after read in MPI_File /scratch/testfile : 12