Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix InSituMPI crash on big-endian platforms #2026

Merged
merged 1 commit into from
Mar 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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