| 205 | } |
| 206 | |
| 207 | void MPIDistributedDevice::commit() |
| 208 | { |
| 209 | Device::commit(); |
| 210 | // MPI Device defaults to not setting affinity |
| 211 | if (threadAffinity == AUTO_DETECT) { |
| 212 | threadAffinity = DEAFFINITIZE; |
| 213 | } |
| 214 | |
| 215 | if (!initialized) { |
| 216 | internalDevice->error_fcn = internalDeviceErrorFunc; |
| 217 | |
| 218 | int _ac = 1; |
| 219 | |
| 220 | const char *_av[] = {"ospray_mpi_distributed_device"}; |
| 221 | |
| 222 | auto *setComm = |
| 223 | static_cast<MPI_Comm *>(getParam<void *>("worldCommunicator", nullptr)); |
| 224 | shouldFinalizeMPI = mpicommon::init(&_ac, _av, setComm == nullptr); |
| 225 | |
| 226 | if (setComm) |
| 227 | mpicommon::worker.setTo(*setComm); |
| 228 | else |
| 229 | mpicommon::worker = mpicommon::world; |
| 230 | |
| 231 | initialized = true; |
| 232 | |
| 233 | auto OSPRAY_FORCE_COMPRESSION = |
| 234 | utility::getEnvVar<int>("OSPRAY_FORCE_COMPRESSION"); |
| 235 | // Turning on the compression past 64 ranks seems to be a good |
| 236 | // balancing point for cost of compressing vs. performance gain |
| 237 | auto enableCompression = OSPRAY_FORCE_COMPRESSION.value_or( |
| 238 | mpicommon::workerSize() >= OSP_MPI_COMPRESSION_THRESHOLD); |
| 239 | |
| 240 | maml::init(enableCompression); |
| 241 | messaging::init(mpicommon::worker); |
| 242 | maml::start(); |
| 243 | |
| 244 | RKCOMMON_IF_TRACING_ENABLED({ |
| 245 | mpicommon::barrier(mpicommon::worker.comm).wait(); |
| 246 | rkcommon::tracing::setMarker("clockSync", "mpiDistributed"); |
| 247 | |
| 248 | char hostname[512] = {0}; |
| 249 | gethostname(hostname, 511); |
| 250 | const std::string worker_log_file = std::string(hostname) + "_" |
| 251 | + std::to_string(mpicommon::workerRank()) + "_worker_proc_status.txt"; |
| 252 | std::ofstream fout(worker_log_file.c_str()); |
| 253 | fout << "Worker on '" << hostname << "' /proc/self/status:\n" |
| 254 | << rkcommon::tracing::getProcStatus() << "\n"; |
| 255 | }); |
| 256 | } |
| 257 | |
| 258 | // Pass down application's GPU selection made via SYCL or L0 (if any) |
| 259 | void *appSyclCtx = getParam<void *>("syclContext", nullptr); |
| 260 | internalDevice->setParam<void *>("syclContext", appSyclCtx); |
| 261 | void *appSyclDevice = getParam<void *>("syclDevice", nullptr); |
| 262 | internalDevice->setParam<void *>("syclDevice", appSyclDevice); |
| 263 | |
| 264 | internalDevice->commit(); |
nothing calls this directly
no test coverage detected