Commit dc81a88f authored by Keichi Takahashi's avatar Keichi Takahashi
Browse files

Fix unaligned memory access in SSC engine

parent ddaeeb07
...@@ -96,8 +96,8 @@ void SscReader::GetDeferredCommon(Variable<T> &variable, T *data) ...@@ -96,8 +96,8 @@ void SscReader::GetDeferredCommon(Variable<T> &variable, T *data)
b.shape.size() == 1 and b.start[0] == 0 and b.shape.size() == 1 and b.start[0] == 0 and
b.count[0] == 1 and b.shape[0] == 1) b.count[0] == 1 and b.shape[0] == 1)
{ {
data[0] = reinterpret_cast<T *>(m_Buffer.data() + std::memcpy(data, m_Buffer.data() + b.bufferStart,
b.bufferStart)[0]; sizeof(T));
} }
else else
{ {
......
...@@ -56,11 +56,13 @@ void MpiHandshake::Test() ...@@ -56,11 +56,13 @@ void MpiHandshake::Test()
size_t offset = PlaceInBuffer(stream, rank); size_t offset = PlaceInBuffer(stream, rank);
char mode = m_Buffer[offset]; char mode = m_Buffer[offset];
offset += sizeof(char); offset += sizeof(char);
int appMasterRank = int appMasterRank;
reinterpret_cast<int *>(m_Buffer.data() + offset)[0]; std::memcpy(&appMasterRank, m_Buffer.data() + offset,
sizeof(appMasterRank));
offset += sizeof(int); offset += sizeof(int);
int appSize = int appSize;
reinterpret_cast<int *>(m_Buffer.data() + offset)[0]; std::memcpy(&appSize, m_Buffer.data() + offset,
sizeof(appSize));
offset += sizeof(int); offset += sizeof(int);
std::string filename = m_Buffer.data() + offset; std::string filename = m_Buffer.data() + offset;
m_AppsSize[appMasterRank] = appSize; 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