Swap byte-order in binary serializer to support big-endian arch (#5813)
* fixed some endian issues * Use dmlc::ByteSwap() to simplify code * Fix lint check * [CI] Add test for s390x * Download latest CMake on s390x * Fix a bug in my code * Save magic number in dmatrix with byteswap on big-endian machine * Save version in binary with byteswap on big-endian machine * Load scalar with byteswap in MetaInfo * Add a debugging message * Handle arrays correctly when byteswapping * EOF can also be 255 * Handle magic number in MetaInfo carefully * Skip Tree.Load test for big-endian, since the test manually builds little-endian binary model * Handle missing packages in Python tests * Don't use boto3 in model compatibility tests * Add s390 Docker file for local testing * Add model compatibility tests * Add R compatibility test * Revert "Add R compatibility test" This reverts commit c2d2bdcb7dbae133cbb927fcd20f7e83ee2b18a8. Co-authored-by: Qi Zhang <q.zhang@ibm.com> Co-authored-by: Hyunsu Cho <chohyu01@cs.washington.edu>
This commit is contained in:
@@ -49,9 +49,9 @@ Version::TripletT Version::Load(dmlc::Stream* fi) {
|
||||
LOG(FATAL) << msg;
|
||||
}
|
||||
|
||||
CHECK_EQ(fi->Read(&major, sizeof(major)), sizeof(major)) << msg;
|
||||
CHECK_EQ(fi->Read(&minor, sizeof(major)), sizeof(minor)) << msg;
|
||||
CHECK_EQ(fi->Read(&patch, sizeof(major)), sizeof(patch)) << msg;
|
||||
CHECK(fi->Read(&major)) << msg;
|
||||
CHECK(fi->Read(&minor)) << msg;
|
||||
CHECK(fi->Read(&patch)) << msg;
|
||||
|
||||
return std::make_tuple(major, minor, patch);
|
||||
}
|
||||
@@ -69,9 +69,9 @@ void Version::Save(dmlc::Stream* fo) {
|
||||
std::tie(major, minor, patch) = Self();
|
||||
std::string verstr { u8"version:" };
|
||||
fo->Write(&verstr[0], verstr.size());
|
||||
fo->Write(&major, sizeof(major));
|
||||
fo->Write(&minor, sizeof(minor));
|
||||
fo->Write(&patch, sizeof(patch));
|
||||
fo->Write(major);
|
||||
fo->Write(minor);
|
||||
fo->Write(patch);
|
||||
}
|
||||
|
||||
std::string Version::String(TripletT const& version) {
|
||||
|
||||
Reference in New Issue
Block a user