diff --git a/.github/workflows/dependencies/gcc-openmpi.sh b/.github/workflows/dependencies/gcc-openmpi.sh index 8416283b4..ba4d53717 100755 --- a/.github/workflows/dependencies/gcc-openmpi.sh +++ b/.github/workflows/dependencies/gcc-openmpi.sh @@ -26,3 +26,5 @@ python3 -m pip install -U pip setuptools wheel python3 -m pip install -U cmake pytest python3 -m pip install -r requirements_mpi.txt python3 -m pip install -r examples/requirements.txt + +python3 -m pip install -U openPMD-validator diff --git a/.github/workflows/dependencies/gcc.sh b/.github/workflows/dependencies/gcc.sh index 8ebe694fe..ba32efd1f 100755 --- a/.github/workflows/dependencies/gcc.sh +++ b/.github/workflows/dependencies/gcc.sh @@ -24,3 +24,5 @@ sudo apt-get install -y \ python3 -m pip install -U pip setuptools wheel python3 -m pip install -U cmake pytest python3 -m pip install -r examples/requirements.txt + +python3 -m pip install -U openPMD-validator diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 72c342211..5c9f92e24 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -54,6 +54,7 @@ jobs: python3 -m pip install --upgrade pytest python3 -m pip install -r requirements_mpi.txt python3 -m pip install -r examples/requirements.txt + python3 -m pip install --upgrade openPMD-validator set -e - name: CCache Cache uses: actions/cache@v3 @@ -93,3 +94,6 @@ jobs: { cat Backtrace.0.0; exit 1; } impactx.MPI.OMP.DP.OPMD examples/fodo/input_fodo.in algo.particle_shape = 3 || \ { cat Backtrace.0.0; exit 1; } + + - name: validate created openPMD files + run: find build -name *.h5 | xargs -n1 -I{} openPMD_check_h5 -i {} diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index de2a1c934..7dc20b7e3 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -66,6 +66,9 @@ jobs: python3 examples/fodo/run_fodo.py + - name: validate created openPMD files + run: find build -name *.h5 | xargs -n1 -I{} openPMD_check_h5 -i {} + build_gcc_python: name: GCC w/o MPI w/ Python runs-on: ubuntu-20.04 @@ -125,3 +128,6 @@ jobs: cmake --build build --target pip_install python3 examples/fodo/run_fodo.py + + - name: validate created openPMD files + run: find build -name *.h5 | xargs -n1 -I{} openPMD_check_h5 -i {} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 939717242..3c1c15e8d 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -55,6 +55,7 @@ jobs: python3 -m pip install -U pip setuptools wheel pytest python3 -m pip install -r requirements.txt python3 -m pip install -r examples/requirements.txt + python3 -m pip install -U openPMD-validator - name: Build run: | $env:HDF5_DIR = "C:/Program Files/HDF_Group/HDF5/1.12.2/cmake/" @@ -81,6 +82,8 @@ jobs: if(!$?) { Exit $LASTEXITCODE } cmake --build build --config RelWithDebInfo --target pip_install if(!$?) { Exit $LASTEXITCODE } + - name: validate created openPMD files + run: Get-ChildItem -Path build -Recurse -Filter *.h5 | %{openPMD_check_h5 -i $_} build_win_clang: name: Clang w/ OMP w/o MPI @@ -137,6 +140,7 @@ jobs: python3 -m pip install -U pip setuptools wheel pytest python3 -m pip install -r requirements.txt python3 -m pip install -r examples/requirements.txt + python3 -m pip install -U openPMD-validator - name: Build shell: cmd run: | @@ -175,3 +179,6 @@ jobs: # if errorlevel 1 exit 1 # cmake --build build --target pip_install # if errorlevel 1 exit 1 + + - name: validate created openPMD files + run: Get-ChildItem -Path build -Recurse -Filter *.h5 | %{openPMD_check_h5 -i $_} diff --git a/src/particles/elements/diagnostics/openPMD.H b/src/particles/elements/diagnostics/openPMD.H index 7307c3d5b..0dad78094 100644 --- a/src/particles/elements/diagnostics/openPMD.H +++ b/src/particles/elements/diagnostics/openPMD.H @@ -83,11 +83,13 @@ namespace detail /** Prepare entering the element before starting push logic. * - * @param[in] pc particle container. + * @param[in] pc particle container + * @param[in] ref_part reference particle * @param[in] step global step for diagnostics */ void prepare ( PinnedContainer & pc, + RefPart const & ref_part, int step ); diff --git a/src/particles/elements/diagnostics/openPMD.cpp b/src/particles/elements/diagnostics/openPMD.cpp index 310fae05d..27efade83 100644 --- a/src/particles/elements/diagnostics/openPMD.cpp +++ b/src/particles/elements/diagnostics/openPMD.cpp @@ -211,6 +211,7 @@ namespace detail void BeamMonitor::prepare ( PinnedContainer & pc, + RefPart const & ref_part, int step ) { #ifdef ImpactX_USE_OPENPMD @@ -253,6 +254,17 @@ namespace detail getComponentRecord(component_name).resetDataset(d_fl); } } + + // openPMD coarse position + { + beam["positionOffset"]["x"].resetDataset(d_fl); + beam["positionOffset"]["x"].makeConstant(ref_part.x); + beam["positionOffset"]["y"].resetDataset(d_fl); + beam["positionOffset"]["y"].makeConstant(ref_part.y); + beam["positionOffset"]["ct"].resetDataset(d_fl); + beam["positionOffset"]["ct"].makeConstant(ref_part.t); + } + // AoS: Int beam["id"][scalar].resetDataset(d_ui); @@ -298,7 +310,7 @@ namespace detail */ // prepare element access - this->prepare(pinned_pc, step); + this->prepare(pinned_pc, ref_part, step); // loop over refinement levels int const nLevel = pinned_pc.finestLevel(); @@ -320,6 +332,8 @@ namespace detail auto series = std::any_cast(m_series); io::WriteIterations iterations = series.writeIterations(); io::Iteration iteration = iterations[m_step]; + + // close iteration iteration.close(); }