Skip to content

Commit

Permalink
Merge pull request #2026 from keichi/insitumpi-bigendian
Browse files Browse the repository at this point in the history
Fix InSituMPI crash on big-endian platforms
  • Loading branch information
pnorbert authored Mar 10, 2020
2 parents 3720581 + d08c1dd commit bf5e7d6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions source/adios2/engine/insitumpi/InSituMPISchedules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,16 @@ WriteScheduleMap DeserializeReadSchedule(
LocalReadScheduleMap
DeserializeReadSchedule(const std::vector<char> &buffer) noexcept
{
const bool isLittleEndian = helper::IsLittleEndian();
LocalReadScheduleMap map;
size_t pos = 0;
int nVars = helper::ReadValue<int>(buffer, pos);
int nVars = helper::ReadValue<int>(buffer, pos, isLittleEndian);
for (int i = 0; i < nVars; i++)
{
int nameLen = helper::ReadValue<int>(buffer, pos);
int nameLen = helper::ReadValue<int>(buffer, pos, isLittleEndian);
std::vector<char> name(nameLen + 1, '\0');
helper::CopyFromBuffer(buffer, pos, name.data(), nameLen);
int nSubFileInfos = helper::ReadValue<int>(buffer, pos);
int nSubFileInfos = helper::ReadValue<int>(buffer, pos, isLittleEndian);
std::vector<helper::SubFileInfo> sfis;
sfis.reserve(nSubFileInfos);
for (int j = 0; j < nSubFileInfos; j++)
Expand All @@ -240,8 +241,9 @@ helper::SubFileInfo DeserializeSubFileInfo(const std::vector<char> &buffer,
Box<Dims> DeserializeBoxDims(const std::vector<char> &buffer,
size_t &position) noexcept
{
const bool isLittleEndian = helper::IsLittleEndian();
Box<Dims> box;
int nDims = helper::ReadValue<int>(buffer, position);
int nDims = helper::ReadValue<int>(buffer, position, isLittleEndian);
std::vector<size_t> start(nDims);
std::vector<size_t> count(nDims);
helper::CopyFromBuffer(buffer, position, start.data(), nDims);
Expand Down

0 comments on commit bf5e7d6

Please sign in to comment.