/** * Notifies registered output classes. * * This function is called automatically. * * @param currentStep simulation step */ virtual void dumpOneStep(uint32_t currentStep) { Environment<DIM>::get().DataConnector().invalidate(); /* trigger notification */ Environment<DIM>::get().PluginConnector().notifyPlugins(currentStep); /* trigger checkpoint notification */ if (checkpointPeriod && (currentStep % checkpointPeriod == 0)) { /* create directory containing checkpoints */ if (numCheckpoints == 0) { Environment<DIM>::get().Filesystem().createDirectoryWithPermissions(checkpointDirectory); } Environment<DIM>::get().PluginConnector().checkpointPlugins(currentStep, checkpointDirectory); GridController<DIM> &gc = Environment<DIM>::get().GridController(); MPI_CHECK(MPI_Barrier(gc.getCommunicator().getMPIComm())); if (gc.getGlobalRank() == 0) { writeCheckpointStep(currentStep); } numCheckpoints++; } }
/** * Notifies registered output classes. * * This function is called automatically. * * @param currentStep simulation step */ virtual void dumpOneStep(uint32_t currentStep) { /* trigger notification */ Environment<DIM>::get().PluginConnector().notifyPlugins(currentStep); /* trigger checkpoint notification */ if( !checkpointPeriod.empty() && pluginSystem::containsStep( seqCheckpointPeriod, currentStep ) ) { /* first synchronize: if something failed, we can spare the time * for the checkpoint writing */ CUDA_CHECK(cudaDeviceSynchronize()); CUDA_CHECK(cudaGetLastError()); // avoid deadlock between not finished PMacc tasks and MPI_Barrier __getTransactionEvent().waitForFinished(); GridController<DIM> &gc = Environment<DIM>::get().GridController(); /* can be spared for better scalings, but allows to spare the * time for checkpointing if some ranks died */ MPI_CHECK(MPI_Barrier(gc.getCommunicator().getMPIComm())); /* create directory containing checkpoints */ if (numCheckpoints == 0) { Environment<DIM>::get().Filesystem().createDirectoryWithPermissions(checkpointDirectory); } Environment<DIM>::get().PluginConnector().checkpointPlugins(currentStep, checkpointDirectory); /* important synchronize: only if no errors occured until this * point guarantees that a checkpoint is usable */ CUDA_CHECK(cudaDeviceSynchronize()); CUDA_CHECK(cudaGetLastError()); /* avoid deadlock between not finished PMacc tasks and MPI_Barrier */ __getTransactionEvent().waitForFinished(); /* \todo in an ideal world with MPI-3, this would be an * MPI_Ibarrier call and this function would return a MPI_Request * that could be checked */ MPI_CHECK(MPI_Barrier(gc.getCommunicator().getMPIComm())); if (gc.getGlobalRank() == 0) { writeCheckpointStep(currentStep); } numCheckpoints++; } }