MCPcopy Create free account
hub / github.com/RenderKit/ospray / allocateHandle

Method allocateHandle

modules/mpi/ospray/MPIDistributedDevice.cpp:584–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

582}
583
584ObjectHandle MPIDistributedDevice::allocateHandle()
585{
586 mpicommon::barrier(mpicommon::worker.comm).wait();
587 ObjectHandle handle = ObjectHandle::allocateLocalHandle();
588
589 // For debugging check that all ranks did in fact allocate the same handle.
590 // Typically we assume this is the case, as the app should be creating
591 // distributed objects in lock-step, even if their local objects differ.
592 if (logLevel == OSP_LOG_DEBUG) {
593 int maxID = handle.i32.ID;
594 int minID = handle.i32.ID;
595
596 auto reduceMax = mpicommon::reduce(
597 &handle.i32.ID, &maxID, 1, MPI_INT, MPI_MAX, 0, mpicommon::worker.comm);
598 auto reduceMin = mpicommon::reduce(
599 &handle.i32.ID, &minID, 1, MPI_INT, MPI_MIN, 0, mpicommon::worker.comm);
600 reduceMax.wait();
601 reduceMin.wait();
602
603 if (maxID != minID) {
604 // Log it, but this is a fatal error
605 postStatusMsg(
606 "Error allocating distributed handles: Ranks do not all have the same handle!");
607 throw std::runtime_error(
608 "Error allocating distributed handles: Ranks do not all have the same handle!");
609 }
610 }
611
612 return handle;
613}
614
615} // namespace mpi
616} // namespace ospray

Callers

nothing calls this directly

Calls 2

postStatusMsgFunction · 0.85
waitMethod · 0.45

Tested by

no test coverage detected