diff --git a/source/adios2/engine/bp5/BP5Reader.cpp b/source/adios2/engine/bp5/BP5Reader.cpp index fd2f4c33db..79c32fd0c2 100644 --- a/source/adios2/engine/bp5/BP5Reader.cpp +++ b/source/adios2/engine/bp5/BP5Reader.cpp @@ -467,13 +467,15 @@ void BP5Reader::Init() // This isn't how we'll trigger remote ops in the end, but a temporary // solution + bool RowMajorOrdering = (m_IO.m_ArrayOrder == ArrayOrdering::RowMajor); if (!m_Parameters.RemoteDataPath.empty()) { - m_Remote.Open("localhost", 26200, m_Parameters.RemoteDataPath, m_OpenMode); + m_Remote.Open("localhost", 26200, m_Parameters.RemoteDataPath, m_OpenMode, + RowMajorOrdering); } else if (getenv("DoRemote")) { - m_Remote.Open("localhost", 26200, m_Name, m_OpenMode); + m_Remote.Open("localhost", 26200, m_Name, m_OpenMode, RowMajorOrdering); } } diff --git a/source/adios2/toolkit/remote/Remote.cpp b/source/adios2/toolkit/remote/Remote.cpp index 9f8937e1aa..13f46dbdc7 100644 --- a/source/adios2/toolkit/remote/Remote.cpp +++ b/source/adios2/toolkit/remote/Remote.cpp @@ -72,7 +72,7 @@ void Remote::InitCMData() } void Remote::Open(const std::string hostname, const int32_t port, const std::string filename, - const Mode mode) + const Mode mode, bool RowMajorOrdering) { RemoteCommon::_OpenFileMsg open_msg; @@ -102,6 +102,7 @@ void Remote::Open(const std::string hostname, const int32_t port, const std::str break; } open_msg.OpenResponseCondition = CMCondition_get(ev_state.cm, m_conn); + open_msg.RowMajorOrder = RowMajorOrdering; CMCondition_set_client_data(ev_state.cm, open_msg.OpenResponseCondition, (void *)this); CMwrite(m_conn, ev_state.OpenFileFormat, &open_msg); CMCondition_wait(ev_state.cm, open_msg.OpenResponseCondition); @@ -171,7 +172,7 @@ bool Remote::WaitForGet(GetHandle handle) { return CMCondition_wait(ev_state.cm, #else void Remote::Open(const std::string hostname, const int32_t port, const std::string filename, - const Mode mode){}; + const Mode mode, bool RowMajorOrdering){}; void Remote::OpenSimpleFile(const std::string hostname, const int32_t port, const std::string filename){}; diff --git a/source/adios2/toolkit/remote/Remote.h b/source/adios2/toolkit/remote/Remote.h index 0858f0654d..f6b16bd304 100644 --- a/source/adios2/toolkit/remote/Remote.h +++ b/source/adios2/toolkit/remote/Remote.h @@ -38,7 +38,7 @@ class Remote explicit operator bool() const { return m_Active; } void Open(const std::string hostname, const int32_t port, const std::string filename, - const Mode mode); + const Mode mode, bool RowMajorOrdering); void OpenSimpleFile(const std::string hostname, const int32_t port, const std::string filename); diff --git a/source/adios2/toolkit/remote/remote_common.cpp b/source/adios2/toolkit/remote/remote_common.cpp index 9bb15a55c7..8e69f4df69 100644 --- a/source/adios2/toolkit/remote/remote_common.cpp +++ b/source/adios2/toolkit/remote/remote_common.cpp @@ -6,11 +6,13 @@ namespace adios2 namespace RemoteCommon { -FMField OpenFileList[] = {{"OpenResponseCondition", "integer", sizeof(long), - FMOffset(OpenFileMsg, OpenResponseCondition)}, - {"FileName", "string", sizeof(char *), FMOffset(OpenFileMsg, FileName)}, - {"Mode", "integer", sizeof(RemoteFileMode), FMOffset(OpenFileMsg, Mode)}, - {NULL, NULL, 0, 0}}; +FMField OpenFileList[] = { + {"OpenResponseCondition", "integer", sizeof(long), + FMOffset(OpenFileMsg, OpenResponseCondition)}, + {"FileName", "string", sizeof(char *), FMOffset(OpenFileMsg, FileName)}, + {"Mode", "integer", sizeof(RemoteFileMode), FMOffset(OpenFileMsg, Mode)}, + {"RowMajorOrder", "integer", sizeof(RemoteFileMode), FMOffset(OpenFileMsg, RowMajorOrder)}, + {NULL, NULL, 0, 0}}; FMStructDescRec OpenFileStructs[] = {{"OpenFile", OpenFileList, sizeof(struct _OpenFileMsg), NULL}, {NULL, NULL, 0, NULL}}; diff --git a/source/adios2/toolkit/remote/remote_common.h b/source/adios2/toolkit/remote/remote_common.h index 81d303f490..48102e7b2d 100644 --- a/source/adios2/toolkit/remote/remote_common.h +++ b/source/adios2/toolkit/remote/remote_common.h @@ -18,6 +18,7 @@ typedef struct _OpenFileMsg int OpenResponseCondition; char *FileName; RemoteFileMode Mode; + int RowMajorOrder; } *OpenFileMsg; typedef struct _OpenResponseMsg diff --git a/source/adios2/toolkit/remote/remote_server.cpp b/source/adios2/toolkit/remote/remote_server.cpp index 9d640017f4..27a070a43a 100644 --- a/source/adios2/toolkit/remote/remote_server.cpp +++ b/source/adios2/toolkit/remote/remote_server.cpp @@ -74,12 +74,14 @@ class AnonADIOSFile size_t m_BytesSent = 0; size_t m_OperationCount = 0; RemoteFileMode m_mode = RemoteCommon::RemoteFileMode::RemoteOpen; - AnonADIOSFile(std::string FileName, RemoteCommon::RemoteFileMode mode) + AnonADIOSFile(std::string FileName, RemoteCommon::RemoteFileMode mode, bool RowMajorArrays) { Mode adios_read_mode = adios2::Mode::Read; m_FileName = FileName; m_IOname = lf_random_string(); - m_io = &adios.DeclareIO(m_IOname); + ArrayOrdering ArrayOrder = + RowMajorArrays ? ArrayOrdering::RowMajor : ArrayOrdering::ColumnMajor; + m_io = &adios.DeclareIO(m_IOname, ArrayOrder); m_mode = mode; if (m_mode == RemoteOpenRandomAccess) adios_read_mode = adios2::Mode::ReadRandomAccess; @@ -163,7 +165,8 @@ static void OpenHandler(CManager cm, CMConnection conn, void *vevent, void *clie struct Remote_evpath_state *ev_state = static_cast(client_data); _OpenResponseMsg open_response_msg; std::cout << "Got an open request for file " << open_msg->FileName << std::endl; - AnonADIOSFile *f = new AnonADIOSFile(open_msg->FileName, open_msg->Mode); + AnonADIOSFile *f = + new AnonADIOSFile(open_msg->FileName, open_msg->Mode, open_msg->RowMajorOrder); memset(&open_response_msg, 0, sizeof(open_response_msg)); open_response_msg.FileHandle = f->m_ID; open_response_msg.OpenResponseCondition = open_msg->OpenResponseCondition;