Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f5f3aa0
Split Series into write and read
franzpoeschel Jun 20, 2025
f8533c3
Run checkpoint concurrently with restart
franzpoeschel Jun 20, 2025
fc019c2
In-Situ restart working for a single step
franzpoeschel Jun 20, 2025
fc16e53
Reopen stream: Now load balancing works multiple times
franzpoeschel Jun 20, 2025
69842bb
Some error safety in thread synchronization
franzpoeschel Jun 20, 2025
19a9966
Check for MPI_THREAD_MULTIPLE
franzpoeschel Jun 23, 2025
3e275d4
Couple of fixes
franzpoeschel Jun 23, 2025
27d394a
Extract particle patches writing
franzpoeschel Jun 23, 2025
30e597d
Extract writeParticlesByChunks
franzpoeschel Jun 24, 2025
3eb341e
Reimplement simplified particles writing
franzpoeschel Jun 24, 2025
de07f2a
Dump every single supercell
franzpoeschel Jun 24, 2025
a2d556a
Basic version of particle patches
franzpoeschel Jun 30, 2025
9174181
Little fix for parallel flushing
franzpoeschel Jun 30, 2025
a98c36a
Fix some indexing details
franzpoeschel Jun 30, 2025
8648110
Select particle patches more finely when restarting
franzpoeschel Jun 30, 2025
5344a5f
Restart from multiple patches
franzpoeschel Jul 1, 2025
3be5959
Fix for empty datasets
franzpoeschel Jul 2, 2025
8b48fea
WIP: Filter partial patches
franzpoeschel Sep 10, 2025
99040dc
Prefilter loaded partial patches
franzpoeschel Sep 11, 2025
991d777
This does not really work, but "fix" loading of idProvider states
franzpoeschel Sep 12, 2025
abe167e
Actually redistribute the filtered particles
franzpoeschel Sep 12, 2025
b6bbaa5
Filter particles on GPU
franzpoeschel Sep 12, 2025
ff40558
wip: redistribute on gpu
franzpoeschel Sep 12, 2025
73b945a
Remap also on GPU
franzpoeschel Sep 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions include/picongpu/plugins/Checkpoint.x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,37 @@ namespace picongpu
void checkpoint(uint32_t currentStep, std::string const checkpointDirectory) override
{
auto cBackend = ioBackends.find(checkpointBackendName);
if(cBackend != ioBackends.end())
if(cBackend == ioBackends.end())
{
cBackend->second->dumpCheckpoint(currentStep, checkpointDirectory, checkpointFilename);
return;
}

int mpiInitialized;
MPI_CHECK(MPI_Query_thread(&mpiInitialized));

if(mpiInitialized < MPI_THREAD_MULTIPLE)
{
cBackend->second->dumpCheckpoint(currentStep, checkpointDirectory, checkpointFilename, std::nullopt);
}
else
{
std::atomic<signed int> synchronization = 0;

// need to copy the plugin temporarily to avoid race conditions
auto restartFuture = std::async(
std::launch::async,
[this, copiedBackend = cBackend, currentStep, &checkpointDirectory, &synchronization]()
{
copiedBackend->second->doRestart(
currentStep,
checkpointDirectory,
this->checkpointFilename,
this->restartChunkSize,
{&synchronization});
});
cBackend->second
->dumpCheckpoint(currentStep, checkpointDirectory, checkpointFilename, {&synchronization});
restartFuture.wait();
}
}

Expand All @@ -134,7 +162,8 @@ namespace picongpu
auto rBackend = ioBackends.find(restartBackendName);
if(rBackend != ioBackends.end())
{
rBackend->second->doRestart(restartStep, restartDirectory, restartFilename, restartChunkSize);
rBackend->second
->doRestart(restartStep, restartDirectory, restartFilename, restartChunkSize, std::nullopt);
}
}

Expand Down
9 changes: 5 additions & 4 deletions include/picongpu/plugins/openPMD/NDScalars.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace picongpu
localDomainOffset[d] = Environment<simDim>::get().GridController().getPosition()[d];
}

::openPMD::Series& series = *params.openPMDSeries;
::openPMD::Series& series = *params.writeOpenPMDSeries;
::openPMD::MeshRecordComponent mrc
= series.writeIterations()[currentStep].meshes[baseName + "_" + group][dataset];

Expand Down Expand Up @@ -125,7 +125,7 @@ namespace picongpu
std::make_shared<T_Scalar>(value),
std::move(std::get<1>(tuple)),
std::move(std::get<2>(tuple)));
params.openPMDSeries->flush(PreferredFlushTarget::Buffer);
std::get<0>(tuple).seriesFlush(PreferredFlushTarget::Buffer);
}

private:
Expand Down Expand Up @@ -162,7 +162,7 @@ namespace picongpu


auto datasetName = baseName + "/" + group + "/" + dataset;
::openPMD::Series& series = *params.openPMDSeries;
::openPMD::Series& series = *params.readOpenPMDSeries;
::openPMD::MeshRecordComponent mrc
= series.iterations[currentStep].open().meshes[baseName + "_" + group][dataset];
auto ndim = mrc.getDimensionality();
Expand All @@ -174,11 +174,12 @@ namespace picongpu
DataSpace<simDim> gridPos = Environment<simDim>::get().GridController().getPosition();
::openPMD::Offset start;
::openPMD::Extent count;
::openPMD::Extent extent = mrc.getExtent();
start.reserve(ndim);
count.reserve(ndim);
for(int d = 0; d < ndim; ++d)
{
start.push_back(gridPos.revert()[d]);
start.push_back(gridPos.revert()[d] % extent[d]); // well well well, TODO fix this but how
count.push_back(1);
}

Expand Down
1,010 changes: 789 additions & 221 deletions include/picongpu/plugins/openPMD/WriteSpecies.hpp

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions include/picongpu/plugins/openPMD/openPMDWriter.def
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ namespace picongpu
struct ThreadParams : PluginParameters
{
#if (ENABLE_OPENPMD == 1)
std::unique_ptr<::openPMD::Series> openPMDSeries; /* is null iff there is no series currently open */
// might be needed at the same time for load balancing purposes
std::optional<::openPMD::Series> writeOpenPMDSeries; /* is null iff there is no series currently open */
std::optional<::openPMD::Series> readOpenPMDSeries; /* is null iff there is no series currently open */
#endif
/** current dump is a checkpoint */
bool isCheckpoint;
Expand Down Expand Up @@ -161,7 +163,7 @@ namespace picongpu
#endif
};

void closeSeries();
void closeSeries(::openPMD::Access);

/*
* If file is empty, read from command line parameters.
Expand Down
Loading