Unverified Commit c066f19e authored by Wang, Ruonan's avatar Wang, Ruonan Committed by GitHub
Browse files

Merge pull request #2025 from keichi/fix-unaligned-access

Fix unaligned memory access in SSC engine
parents ddaeeb07 dc81a88f
......@@ -96,8 +96,8 @@ void SscReader::GetDeferredCommon(Variable<T> &variable, T *data)
b.shape.size() == 1 and b.start[0] == 0 and
b.count[0] == 1 and b.shape[0] == 1)
{
data[0] = reinterpret_cast<T *>(m_Buffer.data() +
b.bufferStart)[0];
std::memcpy(data, m_Buffer.data() + b.bufferStart,
sizeof(T));
}
else
{
......
......@@ -56,11 +56,13 @@ void MpiHandshake::Test()
size_t offset = PlaceInBuffer(stream, rank);
char mode = m_Buffer[offset];
offset += sizeof(char);
int appMasterRank =
reinterpret_cast<int *>(m_Buffer.data() + offset)[0];
int appMasterRank;
std::memcpy(&appMasterRank, m_Buffer.data() + offset,
sizeof(appMasterRank));
offset += sizeof(int);
int appSize =
reinterpret_cast<int *>(m_Buffer.data() + offset)[0];
int appSize;
std::memcpy(&appSize, m_Buffer.data() + offset,
sizeof(appSize));
offset += sizeof(int);
std::string filename = m_Buffer.data() + offset;
m_AppsSize[appMasterRank] = appSize;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment