mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-16 10:01:47 +00:00
Refactor the examples after move from FairRoot
This commit is contained in:
committed by
Mohammad Al-Turany
parent
31cba0515e
commit
bab7e13737
@@ -179,10 +179,8 @@ endif()
|
||||
###################
|
||||
# configure files #
|
||||
###################
|
||||
configure_file(${CMAKE_SOURCE_DIR}/fairmq/run/startMQBenchmark.sh.in ${CMAKE_BINARY_DIR}/bin/startMQBenchmark.sh)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/fairmq/run/benchmark.json ${CMAKE_BINARY_DIR}/bin/config/benchmark.json)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/fairmq/options/startConfigExample.sh.in
|
||||
${CMAKE_BINARY_DIR}/bin/startConfigExample.sh)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run/startMQBenchmark.sh.in ${CMAKE_CURRENT_BINARY_DIR}/startMQBenchmark.sh)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/options/startConfigExample.sh.in ${CMAKE_CURRENT_BINARY_DIR}/startConfigExample.sh)
|
||||
|
||||
|
||||
#################################
|
||||
|
@@ -6,10 +6,7 @@
|
||||
* copied verbatim in the file "LICENSE" *
|
||||
********************************************************************************/
|
||||
|
||||
#include <FairMQSocket.h>
|
||||
#include <FairMQDevice.h>
|
||||
#include <FairMQLogger.h>
|
||||
#include <options/FairMQProgOptions.h>
|
||||
|
||||
#include <fairmq/Tools.h>
|
||||
#include <fairmq/Transports.h>
|
||||
|
@@ -18,6 +18,8 @@
|
||||
#include <FairMQMessage.h>
|
||||
#include <FairMQParts.h>
|
||||
#include <FairMQUnmanagedRegion.h>
|
||||
#include <FairMQLogger.h>
|
||||
#include <options/FairMQProgOptions.h>
|
||||
|
||||
#include <vector>
|
||||
#include <memory> // unique_ptr
|
||||
|
@@ -31,8 +31,8 @@ FairMQMap ptreeToMQMap(const boost::property_tree::ptree& pt, const string& id,
|
||||
{
|
||||
// Create fair mq map
|
||||
FairMQMap channelMap;
|
||||
//Helper::PrintPropertyTree(pt);
|
||||
//Helper::PrintDeviceList(pt.get_child(rootNode));
|
||||
// boost::property_tree::json_parser::write_json(std::cout, pt);
|
||||
// Helper::PrintDeviceList(pt.get_child(rootNode));
|
||||
// Extract value from boost::property_tree
|
||||
Helper::DeviceParser(pt.get_child(rootNode), channelMap, id);
|
||||
|
||||
@@ -93,8 +93,6 @@ void DeviceParser(const boost::property_tree::ptree& tree, FairMQMap& channelMap
|
||||
{
|
||||
string deviceIdKey;
|
||||
|
||||
LOG(debug) << "Looking for '" << deviceId << "' id/key in the provided config file...";
|
||||
|
||||
// For each node in fairMQOptions
|
||||
for (const auto& p : tree)
|
||||
{
|
||||
@@ -122,7 +120,7 @@ void DeviceParser(const boost::property_tree::ptree& tree, FairMQMap& channelMap
|
||||
continue;
|
||||
}
|
||||
|
||||
LOG(debug) << "Found with following channels:";
|
||||
LOG(debug) << "Found following channels for device ID '" << deviceId << "' :";
|
||||
|
||||
ChannelParser(q.second, channelMap);
|
||||
}
|
||||
@@ -260,14 +258,6 @@ void SocketParser(const boost::property_tree::ptree& tree, vector<FairMQChannel>
|
||||
}
|
||||
}
|
||||
|
||||
void PrintPropertyTree(const boost::property_tree::ptree& tree, int level)
|
||||
{
|
||||
for (const auto& p : tree) {
|
||||
cout << setw(level+1) << level << ": " << p.first << " " << p.second.get_value<string>() << endl;
|
||||
PrintPropertyTree(p.second.get_child(""), level + 1);
|
||||
}
|
||||
}
|
||||
|
||||
} // Helper namespace
|
||||
|
||||
} // namespace parser
|
||||
|
@@ -41,7 +41,6 @@ void PrintDeviceList(const boost::property_tree::ptree& tree);
|
||||
void DeviceParser(const boost::property_tree::ptree& tree, FairMQMap& channelMap, const std::string& deviceId);
|
||||
void ChannelParser(const boost::property_tree::ptree& tree, FairMQMap& channelMap);
|
||||
void SocketParser(const boost::property_tree::ptree& tree, std::vector<FairMQChannel>& channelList, const std::string& channelName, const FairMQChannel& commonChannel);
|
||||
void PrintPropertyTree(const boost::property_tree::ptree& tree, int level = 0);
|
||||
|
||||
} // Helper namespace
|
||||
|
||||
|
@@ -240,7 +240,7 @@ void FairMQProgOptions::InitOptionDescription()
|
||||
("port-range-max", po::value<int >()->default_value(32000), "End of the port range for dynamic initialization.")
|
||||
("print-channels", po::value<bool >()->implicit_value(true), "Print registered channel endpoints in a machine-readable format (<channel name>:<min num subchannels>:<max num subchannels>)")
|
||||
("shm-segment-size", po::value<size_t>()->default_value(2000000000), "Shared memory: size of the shared memory segment (in bytes).")
|
||||
("shm-monitor", po::value<bool >()->default_value(false), "Shared memory: run monitor daemon.")
|
||||
("shm-monitor", po::value<bool >()->default_value(true), "Shared memory: run monitor daemon.")
|
||||
("rate", po::value<float >()->default_value(0.), "Rate for conditional run loop (Hz).")
|
||||
("session", po::value<string>()->default_value("default"), "Session name.")
|
||||
;
|
||||
|
@@ -44,7 +44,6 @@ FairMQMap SUBOPT::UserParser(const vector<string>& channelConfig, const string&
|
||||
ptree channelProperties;
|
||||
|
||||
ptree socketsArray;
|
||||
ptree socketProperties;
|
||||
|
||||
string argString(token);
|
||||
char* subopts = &argString[0];
|
||||
@@ -57,6 +56,12 @@ FairMQMap SUBOPT::UserParser(const vector<string>& channelConfig, const string&
|
||||
channelName = value;
|
||||
channelProperties.put("name", channelName);
|
||||
}
|
||||
else if (subopt == ADDRESS)
|
||||
{
|
||||
ptree socketProperties;
|
||||
socketProperties.put(channelOptionKeys[subopt], value);
|
||||
socketsArray.push_back(make_pair("", socketProperties));
|
||||
}
|
||||
else if (subopt >= 0 && value != nullptr)
|
||||
{
|
||||
channelProperties.put(channelOptionKeys[subopt], value);
|
||||
@@ -65,7 +70,6 @@ FairMQMap SUBOPT::UserParser(const vector<string>& channelConfig, const string&
|
||||
|
||||
if (channelName != "")
|
||||
{
|
||||
socketsArray.push_back(make_pair("", socketProperties));
|
||||
channelProperties.add_child("sockets", socketsArray);
|
||||
}
|
||||
else
|
||||
|
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"fairMQOptions": {
|
||||
"devices": [
|
||||
{
|
||||
"id": "bsampler1",
|
||||
"channels": [
|
||||
{
|
||||
"name": "data",
|
||||
"sockets": [
|
||||
{
|
||||
"type": "push",
|
||||
"method": "bind",
|
||||
"address": "tcp://127.0.0.1:5555",
|
||||
"sndBufSize": 1000,
|
||||
"rcvBufSize": 1000,
|
||||
"rateLogging": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "sink1",
|
||||
"channels": [
|
||||
{
|
||||
"name": "data",
|
||||
"sockets": [
|
||||
{
|
||||
"type": "pull",
|
||||
"method": "connect",
|
||||
"address": "tcp://127.0.0.1:5555",
|
||||
"sndBufSize": 1000,
|
||||
"rcvBufSize": 1000,
|
||||
"rateLogging": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@@ -70,10 +70,10 @@ SAMPLER+=" --msg-size $msgSize"
|
||||
SAMPLER+=" --same-msg $sameMsg"
|
||||
# SAMPLER+=" --msg-rate 1000"
|
||||
SAMPLER+=" --max-iterations $maxIterations"
|
||||
SAMPLER+=" --mq-config @CMAKE_BINARY_DIR@/bin/config/benchmark.json"
|
||||
xterm -geometry 90x50+0+0 -hold -e $affinitySamp @CMAKE_BINARY_DIR@/bin/$SAMPLER &
|
||||
SAMPLER+=" --channel-config name=data,type=push,method=bind,address=tcp://127.0.01:5555"
|
||||
xterm -geometry 90x50+0+0 -hold -e $affinitySamp @CMAKE_CURRENT_BINARY_DIR@/$SAMPLER &
|
||||
echo ""
|
||||
echo "started: xterm -geometry 90x50+0+0 -hold -e $affinitySamp @CMAKE_BINARY_DIR@/bin/$SAMPLER"
|
||||
echo "started: xterm -geometry 90x50+0+0 -hold -e $affinitySamp @CMAKE_CURRENT_BINARY_DIR@/$SAMPLER"
|
||||
echo "pid: $!"
|
||||
|
||||
SINK="sink"
|
||||
@@ -83,9 +83,9 @@ SINK+=" --id sink1"
|
||||
SINK+=" --transport $transport"
|
||||
SINK+=" --severity debug"
|
||||
SINK+=" --max-iterations $maxIterations"
|
||||
SINK+=" --mq-config @CMAKE_BINARY_DIR@/bin/config/benchmark.json"
|
||||
xterm -geometry 90x50+550+0 -hold -e $affinitySink @CMAKE_BINARY_DIR@/bin/$SINK &
|
||||
SINK+=" --channel-config name=data,type=pull,method=connect,address=tcp://127.0.01:5555"
|
||||
xterm -geometry 90x50+550+0 -hold -e $affinitySink @CMAKE_CURRENT_BINARY_DIR@/$SINK &
|
||||
echo ""
|
||||
echo "started: xterm -geometry 90x50+550+0 -hold -e $affinitySink @CMAKE_BINARY_DIR@/bin/$SINK"
|
||||
echo "started: xterm -geometry 90x50+550+0 -hold -e $affinitySink @CMAKE_CURRENT_BINARY_DIR@/$SINK"
|
||||
echo "pid: $!"
|
||||
echo ""
|
||||
|
Reference in New Issue
Block a user