Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[smpi] Allow zero-sized custom datatypes with MPI_Type_contiguous()
authorGabriel Corona <gabriel.corona@loria.fr>
Tue, 2 Sep 2014 11:29:28 +0000 (13:29 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Tue, 2 Sep 2014 11:43:18 +0000 (13:43 +0200)
MPI_Type_contiguous(0, oldtype, newtype) is valid in MPI but SMPI does
not accept it as the resulting datatype is considered invalid: SMPI
does not accept datatypes with size of 0. Fix the datatype validation
function in order to accept this.

This type of datatype is used in bcastzerotype.

bcast-NTSL is fixed as well (division by zero).

src/smpi/colls/bcast-NTSL.c
src/smpi/smpi_mpi_dt.c

index 7b8ede0..c9df1a7 100644 (file)
@@ -34,7 +34,7 @@ int smpi_coll_tuned_bcast_NTSL(void *buf, int count, MPI_Datatype datatype,
   int from = (rank + size - 1) % size;
 
   /* segment is segment size in number of elements (not bytes) */
-  int segment = bcast_NTSL_segment_size_in_byte / extent;
+  int segment = extent == 0 ? 1 : (bcast_NTSL_segment_size_in_byte / extent);
   segment =  segment == 0 ? 1 :segment; 
   /* pipeline length */
   int pipe_length = count / segment;
index bedd205..4cd5f64 100644 (file)
@@ -151,7 +151,7 @@ CREATE_MPI_DATATYPE(MPI_PTR, void*);
 int is_datatype_valid(MPI_Datatype datatype) {
     return datatype != MPI_DATATYPE_NULL
         && (datatype->flags & DT_FLAG_COMMITED)
-        && (smpi_datatype_size(datatype)>0);
+        && (smpi_datatype_size(datatype)>=0);
 }
 
 size_t smpi_datatype_size(MPI_Datatype datatype)