Skip to content

Commit

Permalink
Fix for issue #31
Browse files Browse the repository at this point in the history
Corsair restarts were failing because multi IO units were returning
incorrect byte size for particle arrays.
  • Loading branch information
sandroos committed Jan 27, 2018
1 parent 44eb7c7 commit 6a8f7af
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
3 changes: 0 additions & 3 deletions vlsv_common_mpi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ namespace vlsv {
MPI_Datatype getMPIDatatype(datatype::type dt,uint64_t dataSize) {
switch (dt) {
case datatype::UNKNOWN:
// TEST
cerr << "(VLSV) ERROR: VLSV::getMPIDatatype called with datatype::UNKNOWN datatype, returning MPI_DATATYPE_NULL!" << endl;
// END TEST
return MPI_DATATYPE_NULL;
break;
case datatype::INT:
Expand Down
16 changes: 10 additions & 6 deletions vlsv_reader_parallel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ namespace vlsv {
if (arrayElements == 0) return true;

// Get the byte size of the MPI primitive datatype (MPI_INT etc.) used here:
int datatypeBytesize;
MPI_Type_size(getMPIDatatype(arrayOpen.dataType,arrayOpen.dataSize),&datatypeBytesize);
int datatypeBytesize = arrayOpen.dataSize;

// Calculate the maximum number of array elements written using a single multi-write.
// Note: element = vector of size vectorSize, each vector element has byte size of datatypeBytesize.
Expand All @@ -80,10 +79,15 @@ namespace vlsv {
elements*arrayOpen.vectorSize));
}
} else {
multiReadUnits.push_back(
Multi_IO_Unit(buffer,
getMPIDatatype(arrayOpen.dataType,arrayOpen.dataSize),
arrayElements*arrayOpen.vectorSize));
if ( getMPIDatatype(arrayOpen.dataType,arrayOpen.dataSize) == MPI_DATATYPE_NULL ) {
multiReadUnits.push_back(Multi_IO_Unit(buffer,
MPI_Type<uint8_t>(),
arrayElements*arrayOpen.vectorSize*arrayOpen.dataSize));
} else {
multiReadUnits.push_back(Multi_IO_Unit(buffer,
getMPIDatatype(arrayOpen.dataType,arrayOpen.dataSize),
arrayElements*arrayOpen.vectorSize));
}
}

return success;
Expand Down

0 comments on commit 6a8f7af

Please sign in to comment.