diff --git a/examples/readout/fairmq-start-ex-readout-processing.sh.in b/examples/readout/fairmq-start-ex-readout-processing.sh.in index 7cfbda3d..9f8a69cb 100755 --- a/examples/readout/fairmq-start-ex-readout-processing.sh.in +++ b/examples/readout/fairmq-start-ex-readout-processing.sh.in @@ -31,10 +31,12 @@ SENDER="fairmq-ex-readout-sender" SENDER+=" --id sender1" SENDER+=" --input-name ps" SENDER+=" --channel-config name=ps,type=pair,method=bind,address=tcp://localhost:7779,transport=shmem" -SENDER+=" name=sr,type=pair,method=connect,address=tcp://localhost:7780,transport=ofi" +#SENDER+=" name=sr,type=pair,method=connect,address=tcp://localhost:7780,transport=ofi" +SENDER+=" name=sr,type=pair,method=connect,address=tcp://localhost:7780,transport=zeromq" xterm -geometry 80x23+1000+0 -hold -e @EX_BIN_DIR@/$SENDER & RECEIVER="fairmq-ex-readout-receiver" RECEIVER+=" --id receiver1" -RECEIVER+=" --channel-config name=sr,type=pair,method=bind,address=tcp://localhost:7780,transport=ofi" +#RECEIVER+=" --channel-config name=sr,type=pair,method=bind,address=tcp://localhost:7780,transport=ofi" +RECEIVER+=" --channel-config name=sr,type=pair,method=bind,address=tcp://localhost:7780,transport=zeromq" xterm -geometry 80x23+1500+0 -hold -e @EX_BIN_DIR@/$RECEIVER & diff --git a/examples/readout/fairmq-start-ex-readout.sh.in b/examples/readout/fairmq-start-ex-readout.sh.in index 3f895ad6..01d605cf 100755 --- a/examples/readout/fairmq-start-ex-readout.sh.in +++ b/examples/readout/fairmq-start-ex-readout.sh.in @@ -25,10 +25,12 @@ SENDER="fairmq-ex-readout-sender" SENDER+=" --id sender1" SENDER+=" --input-name bs" SENDER+=" --channel-config name=bs,type=pair,method=bind,address=tcp://localhost:7778,transport=shmem" -SENDER+=" name=sr,type=pair,method=connect,address=tcp://localhost:7779,transport=ofi" +# SENDER+=" name=sr,type=pair,method=connect,address=tcp://localhost:7779,transport=ofi" +SENDER+=" name=sr,type=pair,method=connect,address=tcp://localhost:7779,transport=zeromq" xterm -geometry 80x23+1000+0 -hold -e @EX_BIN_DIR@/$SENDER & RECEIVER="fairmq-ex-readout-receiver" RECEIVER+=" --id receiver1" -RECEIVER+=" --channel-config name=sr,type=pair,method=bind,address=tcp://localhost:7779,transport=ofi" +# RECEIVER+=" --channel-config name=sr,type=pair,method=bind,address=tcp://localhost:7779,transport=ofi" +RECEIVER+=" --channel-config name=sr,type=pair,method=bind,address=tcp://localhost:7779,transport=zeromq" xterm -geometry 80x23+1500+0 -hold -e @EX_BIN_DIR@/$RECEIVER & diff --git a/fairmq/shmem/Manager.cxx b/fairmq/shmem/Manager.cxx index a1652a31..b2870251 100644 --- a/fairmq/shmem/Manager.cxx +++ b/fairmq/shmem/Manager.cxx @@ -132,9 +132,10 @@ bipc::mapped_region* Manager::CreateRegion(const size_t size, const uint64_t id, { bipc::scoped_lock lock(fShmMtx); VoidAlloc voidAlloc(fManagementSegment.get_segment_manager()); - Uint64RegionInfoMap* m = fManagementSegment.find_or_construct(bipc::unique_instance)(voidAlloc); - m->emplace(id, RegionInfo(path.c_str(), flags, voidAlloc)); + Uint64RegionInfoMap* infoMap = fManagementSegment.find_or_construct(bipc::unique_instance)(voidAlloc); + infoMap->emplace(id, RegionInfo(path.c_str(), flags, voidAlloc)); } + // LOG(debug) << "Created region with id '" << id << "', path: '" << path << "', flags: '" << flags << "'"; auto r = fRegions.emplace(id, fair::mq::tools::make_unique(*this, id, size, false, callback, path, flags)); @@ -158,13 +159,16 @@ Region* Manager::GetRemoteRegion(const uint64_t id) // get region info { bipc::scoped_lock lock(fShmMtx); - VoidAlloc voidAlloc(fSegment.get_segment_manager()); - Uint64RegionInfoMap* m = fManagementSegment.find(bipc::unique_instance).first; - RegionInfo ri = m->at(id); - path = ri.fPath.c_str(); - flags = ri.fFlags; - // LOG(debug) << "path: " << path << ", flags: " << flags; + Uint64RegionInfoMap* infoMap = fManagementSegment.find(bipc::unique_instance).first; + if (infoMap == nullptr) { + LOG(error) << "Unable to locate the region info"; + throw SharedMemoryError("Unable to locate remote region info"); + } + RegionInfo regionInfo = infoMap->at(id); + path = regionInfo.fPath.c_str(); + flags = regionInfo.fFlags; } + // LOG(debug) << "Located remote region with id '" << id << "', path: '" << path << "', flags: '" << flags << "'"; auto r = fRegions.emplace(id, fair::mq::tools::make_unique(*this, id, 0, true, nullptr, path, flags)); return r.first->second.get(); diff --git a/fairmq/shmem/Manager.h b/fairmq/shmem/Manager.h index a7c66317..7c068bfc 100644 --- a/fairmq/shmem/Manager.h +++ b/fairmq/shmem/Manager.h @@ -28,6 +28,7 @@ #include #include +#include namespace fair { @@ -36,6 +37,8 @@ namespace mq namespace shmem { +struct SharedMemoryError : std::runtime_error { using std::runtime_error::runtime_error; }; + class Manager { friend struct Region;