Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
* Distributed under the OSI-approved Apache License, Version 2.0. See
* accompanying file Copyright.txt for details.
*
* DataMan.cpp
*
* Created on: Jun 1, 2017
* Author: Jason Wang wangr1@ornl.gov
*/
#include "DataMan.h"
namespace adios
{
namespace transportman
{
DataMan::DataMan(MPI_Comm mpiComm, const bool debugMode)
: TransportMan(mpiComm, debugMode)
{
}
void DataMan::OpenWANTransports(const std::string &name,
const OpenMode openMode,
const std::vector<Params> ¶metersVector,
const bool profile)
{
auto lf_GetParameter = [](const std::string key, const Params ¶ms,
const bool isMandatory,
const bool debugMode) -> std::string {
std::string value;
auto itParameter = params.find(key);
if (itParameter == params.end())
{
if (debugMode == true && isMandatory == true)
{
throw std::invalid_argument(
"ERROR: wan transport doesn't have mandatory parameter " +
key +
", provide one in IO AddTransport, in call to Open\n");
}
}
else
{
value = itParameter->second;
}
return value;
};
for (const auto ¶meters : parametersVector)
{
std::shared_ptr<Transport> wanTransport;
const std::string type(
lf_GetParameter("transport", parameters, true, m_DebugMode));
const std::string lib(
lf_GetParameter("lib", parameters, true, m_DebugMode));
const std::string ipAddress(
lf_GetParameter("ipaddress", parameters, true, m_DebugMode));
const std::string port(
lf_GetParameter("port", parameters, false, m_DebugMode));
if (port.empty())
{
port = m_DefaultPort;
}
const std::string messageName(
lf_GetParameter("name", parameters, false, m_DebugMode));
if (messageName.empty())
{
messageName = name;
}
if (type == "wan") // need to create directory
{
if (lib == "zmq")
{
#ifdef ADIOS_HAVE_ZMQ
wanTransport = std::make_shared<transport::WANZmq>(
ipAddress, port, m_MPIComm, m_DebugMode);
#else
throw std::invalid_argument(
"ERROR: this version of ADIOS2 didn't compile with "
"ZMQ library, in call to Open\n");
#endif
}
else
{
if (m_DebugMode == true)
{
throw std::invalid_argument("ERROR: wan library " + lib +
" not supported or not "
"provided in IO AddTransport, "
"in call to Open\n");
}
}
}
wanTransport->Open(messageName, openMode);
m_Transports.push_back(std::move(wanTransport));
}
}
} // end namespace transportman
} // end namespace adios