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

Finished DataMan Transport Manager refactoring but full functionality still pending on Read API #270

Merged
merged 7 commits into from
Sep 21, 2017

Conversation

JasonRuonanWang
Copy link
Member

No description provided.

@JasonRuonanWang
Copy link
Member Author

@chuckatkins I got this continuous-integration failed but haven't got any idea what it is about. Could you have a look at your convenience? Thanks.

@chuckatkins
Copy link
Contributor

Check the cdash link in the status for the build results. you should be able to see the build failures on Windows from the.

Copy link
Contributor

@williamfgc williamfgc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job, overall! Just minor stuff to be compliant with the coding standard. Thanks!

@@ -40,15 +40,21 @@ void DataManWriter::DoWriteCommon(Variable<T> &variable, const T *values)
variable.m_Start.assign(variable.m_Count.size(), 0);
}

json jmsg;
std::cout << "DoWriteCommon begin" << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, put all std::cout inside some sort of if(rank == 0)

std::accumulate(variable.m_Shape.begin(), variable.m_Shape.end(),
sizeof(T), std::multiplies<size_t>());

std::cout << "DoWriteCommon end" << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, inside rank zero.

@@ -51,7 +56,8 @@ void WANZmq::Open(const std::string &name, const OpenMode openMode)

m_Socket = zmq_socket(m_Context, ZMQ_REQ);
const std::string fullIP("tcp://" + m_IPAddress + ":" + m_Port);
zmq_connect(m_Socket, fullIP.c_str());
std::cout << "full IP = " << fullIP << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cout in rank zero

@@ -78,6 +84,7 @@ void WANZmq::Open(const std::string &name, const OpenMode openMode)

m_Socket = zmq_socket(m_Context, ZMQ_REP);
const std::string fullIP("tcp://" + m_IPAddress + ":" + m_Port);
std::cout << "full IP = " << fullIP << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cout in rank 0


const std::string trans(
GetParameter("transport", parameters, true, m_DebugMode, ""));

const std::string ipAddress(
GetParameter("ipaddress", parameters, true, m_DebugMode, ""));

std::string port(
std::string port_control(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's avoid _ in names. Let's use only one style: camelCase....e.g portControl. C libraries use that, so if we see this we know it's coming from an external C library (e.g. MPI)

para[i]["name"] = "stream";
para[i]["ipaddress"] = "127.0.0.1";
}
m_Man.OpenWANTransports("zmq", adios2::OpenMode::Read, para, true);

std::string method_type;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

para[i]["name"] = "stream";
para[i]["ipaddress"] = "127.0.0.1";
}
m_Man.OpenWANTransports("zmq", adios2::OpenMode::Read, para, true);

std::string method_type;
int num_channels = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

numChannels

// }
// }
// jmsg["stream_mode"] = "sender";
// m_Man.add_stream(jmsg);

int n_Transports = 1;
std::vector<Params> para(n_Transports);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just do std::vector<Params>parameters (1); I usually use plural names (e.g. parameters) for containers, so in a for range loop we can do something like this:

for( const auto& parameter : parameters )
{
}

std::cout << j.first << " " << j.second << std::endl;
}
}

m_Man.OpenWANTransports("zmq", adios2::OpenMode::Write, para, true);

std::string method_type;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

methodType

// m_Man.put(values, jmsg);
jmsg["bytes"] =
std::accumulate(variable.m_Shape.begin(), variable.m_Shape.end(),
sizeof(T), std::multiplies<size_t>());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice use of STL numeric!

)
target_link_libraries(adios2 PRIVATE ZeroMQ::ZMQ)
endif()

if(ADIOS2_HAVE_DataMan)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is DataMan still optional? if not then the conditional check should be removed and just always add it.

if(ADIOS2_HAVE_DataMan)
target_sources(adios2 PRIVATE
engine/dataman/DataManReader.cpp
engine/dataman/DataManWriter.cpp
)
target_link_libraries(adios2 PRIVATE dataman)
target_link_libraries(adios2 PRIVATE NLohmannJson)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build error is from the JSON library only being included if DataMan was enabled, which is off by default on Windows.

@@ -39,6 +39,9 @@
/* CMake Option: ADIOS_USE_HDF5=ON */
#cmakedefine ADIOS2_HAVE_HDF5

/* CMake Option: ADIOS_USE_ZeroMQ=ON */
#cmakedefine ADIOS2_HAVE_ZEROMQ

/* CMake Option: ADIOS_USE_DataMan=ON */
#cmakedefine ADIOS2_HAVE_DATAMAN
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove if DataMan is no longer optional

@@ -22,7 +23,7 @@ WANZmq::WANZmq(const std::string ipAddress, const std::string port,
: Transport("wan", "zmq", mpiComm, debugMode), m_IPAddress(ipAddress),
m_Port(port)
{

m_Context = zmq_ctx_new();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be checked for validity in case it fails or will it always be guaranteed to succeed?

@@ -51,7 +56,7 @@ void WANZmq::Open(const std::string &name, const OpenMode openMode)

m_Socket = zmq_socket(m_Context, ZMQ_REQ);
const std::string fullIP("tcp://" + m_IPAddress + ":" + m_Port);
zmq_connect(m_Socket, fullIP.c_str());
int err = zmq_connect(m_Socket, fullIP.c_str());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does err need to be checked? What happens if zmq_connect fails?

Copy link
Contributor

@williamfgc williamfgc Sep 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JasonRuonanWang @chuckatkins makes a good point. Let's address this with a runtime exception check that is always on. On a side note, this is what I mean by avoiding the underscore, just by looking at zmq_connect I know it's coming from a library, it's not from us.

Copy link
Contributor

@chuckatkins chuckatkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With DataMan integrated into core adios now, it seems it's no longer optional. There are a few places that DataMan things are always added and a few that are conditionally added. It should be one or the other, and I expect it's just always on now right? That should address your json.hpp build failure.

Also a few places are missing error handling.

Other than that, looks great!

@JasonRuonanWang JasonRuonanWang merged commit 57a8b1f into ornladios:master Sep 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants