### First-time setup: set PIC_PROFILE and install dependencies Source: https://picongpu.readthedocs.io/en/latest/_sources/install/profiles/perlmutter-nersc/README.md.txt First-time setup: set the PIC_PROFILE environment variable to the gpu.profile path, then install missing dependencies from source on a login node. ```bash export PIC_PROFILE=/path/to/gpu.profile ``` ```bash source dependencies_autoinstall.sh ``` -------------------------------- ### CMake out-of-source build example Source: https://picongpu.readthedocs.io/en/latest/_sources/install/instructions.rst.txt Shows the typical out-of-source build workflow with CMake: configure with -DCMAKE_INSTALL_PREFIX, then make and make install. Options can be passed with -DOPTION=VALUE or modified interactively with ccmake. Use make -j to parallelize compilation, and prefix make install with sudo if installing to a system directory. ```bash # go to an empty, temporary build directory cd $HOME/build rm -rf ../build/* # configurate, build and install into $HOME/lib/project cmake -DCMAKE_INSTALL_PREFIX=$HOME/lib/project $HOME/src/project_to_compile make make install ``` -------------------------------- ### Expected output of ls -lah $SCRATCH Source: https://picongpu.readthedocs.io/en/latest/tutorials/hemeraIn5min.html Example output showing a successful setup: the directory exists and is accessible. ```bash total 0 drwxr-xr-x 2 fwt 40 Nov 12 10:09 . drwxrwxrwt 17 root root 400 Nov 12 10:09 .. ``` -------------------------------- ### Autotools in-source build example Source: https://picongpu.readthedocs.io/en/latest/_sources/install/instructions.rst.txt Shows the typical in-source build workflow with autotools: configure with --prefix, then make and make install. Options can be passed with --with-something=VALUE or --enable-thing, and see configure --help for available options. ```bash # go to the source directory of the project cd $HOME/src/project_to_compile # configurate, build and install into $HOME/lib/project configure --prefix=$HOME/lib/project make make install ``` -------------------------------- ### Configure multiple PNG slices via command line Source: https://picongpu.readthedocs.io/en/latest/_sources/usage/plugins/png.rst.txt Command-line example showing how to specify two different slices for electrons using the --e_png.* flags. The order of flags is important; each setup must be given in sequence. No default values exist; if flags are not set, no PNGs are created. ```bash picongpu [more args] # first --e_png.period 100 --e_png.axis xy --e_png.slicePoint 0.5 --e_png.folder pngElectronsXY # second --e_png.period 100 --e_png.axis xz --e_png.slicePoint 0.5 --e_png.folder pngElectronsXZ ``` -------------------------------- ### Install Git Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Commands to install Git on various platforms. ```bash sudo apt-get install git sudo pacman --sync git spack install git ``` -------------------------------- ### Compile all examples with compile script Source: https://picongpu.readthedocs.io/en/latest/_sources/dev/docs/COMMIT.md.txt Run the compile script with the -l option to compile all examples in the examples/ directory. Assumes repo and tmpPath variables are set. ```bash $repo/compile -l $repo/examples/ $tmpPath ``` -------------------------------- ### Install openPMD-api from source Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Commands to clone, build, and install the openPMD-api library from source. ```bash mkdir -p ~/src ~/lib git clone -b 0.15.0 https://github.com/openPMD/openPMD-api.git ~/src/openPMD-api cd ~/src/openPMD-api mkdir build && cd build cmake .. -DopenPMD_USE_MPI=ON -DCMAKE_INSTALL_PREFIX=~/lib/openPMD-api make -j $(nproc) install ``` -------------------------------- ### Install MPI Source: https://picongpu.readthedocs.io/en/latest/install/dependencies.html Installation commands for MPI and environment configuration. ```bash sudo apt-get install libopenmpi-dev sudo pacman --sync openmpi spack install openmpi+cuda spack install openmpi export MPI_ROOT= export OMPI_MCA_mpi_leave_pinned=0 ``` -------------------------------- ### Install Boost Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Commands to install Boost on various platforms. ```bash sudo apt-get install libboost-program-options-dev sudo pacman --sync boost spack install boost +program_options ``` -------------------------------- ### Install and Initialize pre-commit Source: https://picongpu.readthedocs.io/en/latest/_sources/dev/docs/COMMIT.md.txt Commands to install the required pre-commit dependencies and initialize the hooks in your local repository clone. ```bash # set up a virtual environment if you prefer, then: $ python3 -m pip install -r requirements_pre-commit.txt # run this inside of your local clone of the repo: $ pre-commit install ``` -------------------------------- ### Install requirements with pip install -r requirements.txt Source: https://picongpu.readthedocs.io/en/latest/pypicongpu/faq.html Install the project dependencies from the repository root. Run this command from the root directory of the repository. ```bash pip install -r requirements.txt ``` -------------------------------- ### Load and analyze phase space data in Python Source: https://picongpu.readthedocs.io/en/latest/_sources/usage/plugins/phaseSpace.rst.txt Python example using PhaseSpaceData to load and interact with phase space data. Shows how to get available iterations and times, load data for a specific iteration or time, and perform unit conversions. ```python from picongpu.extra.plugins.data import PhaseSpaceData import numpy as np ps_data = PhaseSpaceData('/home/axel/runs/lwfa_001') # show available iterations ps_data.get_iterations(ps="xpx", species="e", species_filter='all') # show available simulation times ps_data.get_times(ps="xpx", species="e", species_filter='all') # load data for a given iteration ps, meta = ps_data.get(ps='ypy', species='e', species_filter='all', iteration=2000) # unit conversion from SI mu = 1.e6 # meters to microns e_mc_r = 1. / (9.109e-31 * 2.9979e8) # electrons: kg * m / s to beta * gamma Q_dr_dp = np.abs(ps) * meta.dV # unit: Coulomb extent = meta.extent * [mu, mu, e_mc_r, e_mc_r] # spatial: microns, momentum: beta*gamma # load data for a given time ps, ps_meta = ps_data.get(ps="xpx", species="e", species_filter='all', time=1.3900e-14) # load data for multiple iterations ret = ps_data.get(ps="xpx", species="e", species_filter='all', iteration=[2000, 4000]) ``` -------------------------------- ### Create a Scenario Source: https://picongpu.readthedocs.io/en/latest/_sources/tutorials/hemeraIn5min.rst.txt Create a project directory and copy the LaserWakefield example into it. ```bash mkdir -p ~/picongpu-projects/laser-wakefield-example pic-create $PIC_EXAMPLES/LaserWakefield ~/picongpu-projects/laser-wakefield-example/try01 cd ~/picongpu-projects/laser-wakefield-example/try01 ``` -------------------------------- ### Install Rsync Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Commands to install Rsync on various platforms. ```bash sudo apt-get install rsync sudo pacman --sync rsync spack install rsync ``` -------------------------------- ### Build Boost from Source Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Steps to download, build, and install Boost 1.74.0 from source. ```bash mkdir -p ~/src ~/lib cd ~/src curl -Lo boost_1_74_0.tar.gz https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.gz tar -xzf boost_1_74_0.tar.gz cd boost_1_74_0 ./bootstrap.sh --with-libraries=program_options --prefix=$HOME/lib/boost ./b2 cxxflags="-std=c++20" -j4 && ./b2 install ``` -------------------------------- ### Install documentation dependencies Source: https://picongpu.readthedocs.io/en/latest/dev/sphinx.html Commands to install Doxygen and Python requirements for building the documentation. Run from the docs/ directory. Doxygen is installed externally, e.g., via apt-get. ```bash cd docs/ # doxygen is not shipped via pip, install it externally, # from the homepage, your package manager, Micromamba, etc. # example: sudo apt-get install doxygen # python tools & style theme pip install -r requirements.txt # --user ``` -------------------------------- ### Example Directory Listing Output Source: https://picongpu.readthedocs.io/en/latest/_sources/tutorials/hemeraIn5min.rst.txt Sample output confirming the directory exists and is accessible. ```text total 0 drwxr-xr-x 2 fwt 40 Nov 12 10:09 . drwxrwxrwt 17 root root 400 Nov 12 10:09 .. ``` -------------------------------- ### pic-build internal steps (mkdir, pic-configure, make install) Source: https://picongpu.readthedocs.io/en/latest/_sources/usage/basics.rst.txt Shows what pic-build does internally: it creates a build directory, configures with CMake via pic-configure, and then compiles and installs with make. The make install step copies the resulting binaries to the input set. ```bash # go to an empty build directory mkdir -p .build cd .build # configure with CMake pic-configure $OPTIONS .. # compile PIConGPU with the current input set (e.g. myLWFA) # - "make -j install" runs implicitly "make -j" and then "make install" # - make install copies resulting binaries to input set make -j install ``` -------------------------------- ### Install c-blosc from source Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Commands to clone, build, and install c-blosc from the official repository. ```bash mkdir -p ~/src ~/lib git clone -b v1.21.1 https://github.com/Blosc/c-blosc.git ~/src/c-blosc/ cd ~/src/c-blosc mkdir build && cd build cmake -DCMAKE_INSTALL_PREFIX=$HOME/lib/c-blosc -DPREFER_EXTERNAL_ZLIB=ON .. make install ``` -------------------------------- ### Generate PIConGPU setup from PyPIConGPU simulation Source: https://picongpu.readthedocs.io/en/latest/_sources/usage/picmi/intro.rst.txt Generates a PIConGPU setup from a PyPIConGPU simulation object. The first argument is the path where the setup should be written, and the second is the PyPIConGPU simulation object. This interface can be used stand-alone or after configuring a PICMI simulation, but changes to the PICMI object after generation are not reflected in the PyPIConGPU object. ```python import picongpu picongpu.picmi.Simulation().write_input_file(, pypicongpu_simulation) ``` -------------------------------- ### Install coverage.py Source: https://picongpu.readthedocs.io/en/latest/pypicongpu/misc.html Install the coverage.py package as a prerequisite for measuring test coverage. ```bash pip install coverage ``` -------------------------------- ### Build PIConGPU documentation locally with Sphinx, Doxygen, and Breathe Source: https://picongpu.readthedocs.io/en/latest/_sources/dev/sphinx.rst.txt These bash commands install the required tools (doxygen, Python packages) and build the documentation locally. The first block shows a system-level install with apt and pip; the second shows creating a Micromamba environment; the third runs doxygen, make html, and make latexpdf, then opens the outputs. ```bash cd docs/ # doxygen is not shipped via pip, install it externally, # from the homepage, your package manager, Micromamba, etc. # example: sudo apt-get install doxygen # python tools & style theme pip install -r requirements.txt # --user ``` ```bash cd docs/ # create a bare Micromamba environment containing just all the requirements # for building the picongpu documentation # note: also installs doxygen inside this environment micromamba env create --file picongpu-docs-env.yml # start up the environment as suggested during its creation e.g. micromamba activate picongpu-docs-env # or source activate picongpu-docs-env ``` ```bash # skip this if you are still in docs/ cd docs/ # parse the C++ API documentation, # enjoy the doxygen warnings! doxygen # render the `.rst` files and replace their macros within # enjoy the breathe errors on things it does not understand from doxygen :) make html # open it, e.g. with firefox :) firefox build/html/index.html # now again for the pdf :) make latexpdf # open it, e.g. with okular build/latex/PIConGPU.pdf ``` -------------------------------- ### Install git on Debian/Ubuntu Source: https://picongpu.readthedocs.io/en/latest/_sources/dev/CONTRIBUTING.md.txt Install git on Debian/Ubuntu with apt-get, verify the version is at least 1.7.10, and optionally install GUI tools (gitk, git-gui, qgit, gitg). ```bash sudo apt-get install git ``` ```bash git --version ``` ```bash gitk git-gui qgit gitg ``` -------------------------------- ### Cross-compile PIConGPU for RISC-V with environment setup and pic-build Source: https://picongpu.readthedocs.io/en/latest/usage/crosscompile.html Set up the environment for cross-compiling PIConGPU for RISC-V. First, export linker and compiler flags, including MPI paths and RISC-V architecture flags. Then set the toolchain installation roots for GNU or Clang. Finally, run pic-build with the provided CMake toolchain file and the -DMPI_CXX_WORKS=ON flag to disable CMake MPI detection. ```bash # set MPI_ROOT to the root MPI directory export LDFLAGS="-L$MPI_ROOT/lib -lmpi -lompitrace -lopen-rte -lopen-pal -ldl -lpthread -lutil -lrt" # compile for 64bit RISC-V with double floating point support export CXXFLAGS="-I$MPI_ROOT/include -pthread -march=rv64gc -mabi=lp64d" export CFLAGS=$CXXFLAGS ``` ```bash export RISCV_GNU_INSTALL_ROOT="$(dirname $(which riscv64-unknown-linux-gnu-gcc))/.." export RISCV_CLANG_INSTALL_ROOT="$(dirname $(which clang))/.." ``` ```bash # ``omp2b`` for OpenMP and ``serial`` for serial execution on one core pic-build -b omp2b -c"-DMPI_CXX_WORKS=ON -DCMAKE_TOOLCHAIN_FILE=/cmake/riscv64-gnu.toolchain.cmake" ``` -------------------------------- ### CUDA Installation and Configuration Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Commands for installing CUDA and setting the CMAKE_PREFIX_PATH. ```bash sudo apt-get install nvidia-cuda-toolkit ``` ```bash sudo pacman --sync cuda ``` ```bash spack install cuda ``` ```bash export CMAKE_PREFIX_PATH=:$CMAKE_PREFIX_PATH ``` -------------------------------- ### libpng Installation Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Commands for installing libpng via package managers or from source. ```bash sudo apt-get install libpng-dev ``` ```bash sudo pacman --sync libpng ``` ```bash spack install libpng ``` ```bash mkdir -p ~/src ~/lib cd ~/src curl -Lo libpng-1.6.34.tar.gz ftp://ftp-osl.osuosl.org/pub/libpng/src/libpng16/libpng-1.6.34.tar.gz tar -xf libpng-1.6.34.tar.gz cd libpng-1.6.34 CPPFLAGS=-I$HOME/lib/zlib/include LDFLAGS=-L$HOME/lib/zlib/lib ./configure --enable-static --enable-shared --prefix=$HOME/lib/libpng make make install ``` ```bash export PNG_ROOT=$HOME/lib/libpng export CMAKE_PREFIX_PATH=$PNG_ROOT:$CMAKE_PREFIX_PATH ``` -------------------------------- ### Install CMake Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Commands to install CMake on various platforms. ```bash sudo apt-get install cmake file cmake-curses-gui sudo pacman --sync cmake spack install cmake ``` -------------------------------- ### Install requirements Source: https://picongpu.readthedocs.io/en/latest/_sources/pypicongpu/faq.rst.txt Install Python dependencies from the repository root. ```bash pip install -r requirements.txt ``` -------------------------------- ### Create directories for source, build, and install Source: https://picongpu.readthedocs.io/en/latest/_sources/install/instructions.rst.txt Creates the directories $HOME/src, $HOME/build, and $HOME/lib to store source code, temporary build files, and installation targets. On some supercomputing systems, the install directory may need to be outside the home directory for runtime availability. ```bash # source code mkdir $HOME/src # temporary build directory mkdir $HOME/build # install target for dependencies mkdir $HOME/lib ``` -------------------------------- ### pngwriter Installation Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Commands for installing pngwriter via Spack or from source. ```bash spack install pngwriter ``` ```bash mkdir -p ~/src ~/lib git clone -b 0.7.0 https://github.com/pngwriter/pngwriter.git ~/src/pngwriter/ cd ~/src/pngwriter mkdir build && cd build cmake -DCMAKE_INSTALL_PREFIX=$HOME/lib/pngwriter .. make install ``` ```bash export CMAKE_PREFIX_PATH=$HOME/lib/pngwriter:$CMAKE_PREFIX_PATH ``` -------------------------------- ### Install MPI Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Commands to install MPI on various platforms, including GPU-aware options for Spack. ```bash sudo apt-get install libopenmpi-dev sudo pacman --sync openmpi spack install openmpi+cuda spack install openmpi ``` -------------------------------- ### Example pypicongpu.json configuration dump Source: https://picongpu.readthedocs.io/en/latest/_sources/pypicongpu/translation.rst.txt A sample output of the grid parameters dumped to pypicongpu.json by the Runner. ```json { "grid": { "cell_size": { "x": 1.776e-07, "y": 4.43e-08, "z": 1.776e-07 }, "cell_cnt": { "x": 192, "y": 2048, "z": 12 }, "boundary_condition": { "x": "0", "y": "0", "z": "1" } }, } ``` -------------------------------- ### Compile examples on cluster with parallel jobs Source: https://picongpu.readthedocs.io/en/latest/_sources/dev/docs/COMMIT.md.txt Run the compile script with -l -q -j 60 to compile examples in parallel on a cluster, using a non-home directory for tmpPath. ```bash /compile -l -q -j 60 /examples/ $tmpPath ``` -------------------------------- ### openPMD API Installation Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Command for installing the openPMD API via Spack. ```bash spack install openpmd-api ``` -------------------------------- ### Bypass Constructor Checks for External Setups Source: https://picongpu.readthedocs.io/en/latest/_sources/pypicongpu/running.rst.txt Demonstrates a 'dirty trick' to use an externally prepared setup by bypassing constructor checks and manually setting the setup_dir. ```python from picongpu.pypicongpu.runner import Runner from picongpu.pypicongpu.simulation import Simulation empty_sim = Simulation() # leave all dirs empty, this way no checks will trigger r = Runner(empty_sim) # now overwrite setup dir r.setup_dir = "/other/prepared/setup" # skip r.generate() (which would fail), directly build r.build() r.run() ``` -------------------------------- ### Access Runner directories and re-check setup Source: https://picongpu.readthedocs.io/en/latest/pypicongpu/running.html Use this snippet to verify the Runner's directory checks and to access the generated setup directory. It re-runs the constructor's sanity checks and confirms that `generate()` creates the setup directory. The snippet also shows how to detect whether the setup directory is inside the system temp directory. ```python r = Runner(sim, run_dir="/scratch/mydata/new_run") # re-do some checks already performed inside the Runner import os assert not os.path.exists(r.run_dir) assert not os.path.exists(r.setup_dir) r.generate() assert os.path.isdir(r.setup_dir) import tempfile if r.setup_dir.startswith(tempfile.gettempdir()): print("will build inside tempdir") ``` -------------------------------- ### Source hardware-specific install script Source: https://picongpu.readthedocs.io/en/latest/_sources/install/profiles/bash-devServer-hzdr/README.md.txt Source the appropriate _install.sh script to install picongpu dependencies for the specified hardware. Replace with the correct script variant name (e.g., cpu, gpu_a30, gpu_v100). ```bash source _install.sh ``` -------------------------------- ### Start Interactive Rebase Source: https://picongpu.readthedocs.io/en/latest/_sources/dev/docs/COMMIT.md.txt Initiate an interactive rebase starting from the formatting change commit. ```bash git rebase -i change-formatting ``` -------------------------------- ### Install GCC on Debian/Ubuntu Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Commands to install GCC 10 and configure it as the default compiler using update-alternatives. ```bash sudo apt-get install gcc-10 g++-10 build-essential sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 60 --slave /usr/bin/g++ g++ /usr/bin/g++-10 ``` -------------------------------- ### Copy environment profile Source: https://picongpu.readthedocs.io/en/latest/_sources/tutorials/hemeraIn5min.rst.txt Copy the provided example profile to your home directory to manage dependencies and cluster partition settings. ```bash cp ~/src/picongpu/etc/picongpu/rosi-hzdr/gpu-v100_picongpu.profile.example ~/gpu-v100_picongpu.profile ``` -------------------------------- ### Install GCC on Arch Linux Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Command to install base development tools on Arch Linux. ```bash sudo pacman --sync base-devel ``` -------------------------------- ### Copy the GPU V100 profile example Source: https://picongpu.readthedocs.io/en/latest/tutorials/hemeraIn5min.html Copies the example profile for the RoSi HPC cluster (gpu-v100_picongpu.profile.example) to the home directory as gpu-v100_picongpu.profile. This profile selects the partition and compute devices (NVIDIA Volta V100 GPUs). ```bash cp ~/src/picongpu/etc/picongpu/rosi-hzdr/gpu-v100_picongpu.profile.example ~/gpu-v100_picongpu.profile ``` -------------------------------- ### Compile all CMake presets of a single example Source: https://picongpu.readthedocs.io/en/latest/_sources/dev/docs/COMMIT.md.txt Run the compile script without -l to compile all CMake presets of a single example. ```bash $repo/compile $repo/examples/ $tmpPath ``` -------------------------------- ### Create input set with pic-create and cd Source: https://picongpu.readthedocs.io/en/latest/_sources/usage/basics.rst.txt Clones the LaserWakefield example to the input directory and switches to it. The second line is emphasized in the source. ```bash # clone the LWFA example to $HOME/picInputs/myLWFA pic-create $PIC_EXAMPLES/LaserWakefield $HOME/picInputs/myLWFA # switch to your input directory cd $HOME/picInputs/myLWFA ``` -------------------------------- ### Install FFTW3 from tarball Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Commands to download, configure, and build FFTW3 from a source tarball. ```bash mkdir -p ~/src ~/lib cd ~/src wget -O fftw-3.3.10.tar.gz http://fftw.org/fftw-3.3.10.tar.gz tar -xf fftw-3.3.10.tar.gz cd fftw-3.3.10 ./configure --prefix="$FFTW_ROOT" make make install ``` -------------------------------- ### Source the picongpu.profile environment Source: https://picongpu.readthedocs.io/en/latest/install/profile.html Run 'source $HOME/picongpu.profile' after logging in to set up the PIConGPU environment as configured in the profile. ```bash source $HOME/picongpu.profile ``` -------------------------------- ### Run PIConGPU on a Linux workstation Source: https://picongpu.readthedocs.io/en/latest/_sources/usage/tbg.rst.txt Example command to execute PIConGPU on a local machine using bash as the submit command. ```bash tbg -s bash -t etc/picongpu/bash/mpirun.tpl -c etc/picongpu/1.cfg $SCRATCH/picRuns/001 ``` -------------------------------- ### pic-build --help output Source: https://picongpu.readthedocs.io/en/latest/usage/basics.html Full output of `pic-build --help`. Lists all options including -j, -b/--backend, -c/--cmake, -t, -f, -G, and -h. Must be run inside an input directory; default backend is cuda unless PIC_BACKEND is set. ```text Build new binaries for a PIConGPU input set Creates or updates the binaries in an input set. This step needs to be performed every time a .param file is changed. This tools creates a temporary build directory, configures and compiles current input set in it and installs the resulting binaries. This is just a short-hand tool for switching to a temporary build directory and running 'pic-configure ..' and 'make install' manually. You must run this command inside an input directory. usage: pic-build [OPTIONS] -j [N] - allow N jobs at once; infinite jobs with no arg -b | --backend - set compute backend and optionally the architecture syntax: backend[:architecture] supported backends: cuda, hip, omp2b, serial, tbb, threads (e.g.: "cuda:35;37;52;60" or "omp2b:native" or "omp2b") default: "cuda" if not set via environment variable PIC_BACKEND note: architecture names are compiler dependent -c | --cmake - overwrite options for cmake (e.g.: "-DPIC_VERBOSE=21 -DCMAKE_BUILD_TYPE=Debug") -t - configure this preset from cmakeFlags -f | --force - clear the cmake file cache and scan for new param files -G - select the build system used by CMake, e.g. Ninja, ... -h | --help - show this help message ``` -------------------------------- ### Show available options with picongpu --help Source: https://picongpu.readthedocs.io/en/latest/_sources/usage/basics.rst.txt Displays all available runtime options for the current configuration after a successful pic-build run. The first line is emphasized in the source. ```bash .build/picongpu --help ``` -------------------------------- ### Show available runtime options with pic-build binary Source: https://picongpu.readthedocs.io/en/latest/usage/basics.html Lists all available runtime options for the built configuration. Must be run successfully after `pic-build` to reflect the current build. ```bash .build/picongpu --help ``` -------------------------------- ### Initialize and execute a simulation with Runner Source: https://picongpu.readthedocs.io/en/latest/_sources/pypicongpu/running.rst.txt Demonstrates the standard workflow of initializing a Runner with a simulation object, generating, building, and running the simulation, followed by accessing the output directory. ```python # sim initialized ... from picongpu.pypicongpu.runner import Runner r = Runner(sim, run_dir="/scratch/mydata/new_run") r.generate() r.build() r.run() import os results_dir = os.path.join(r.run_dir, "simOutput") analyze(results_dir) ``` -------------------------------- ### Set project and PIConGPU path in gpu.profile Source: https://picongpu.readthedocs.io/en/latest/_sources/install/profiles/perlmutter-nersc/README.md.txt Set the project number and PIConGPU repository path in the gpu.profile file before installing dependencies. ```bash export proj="m0000" ``` ```bash export PICSRC=$HOME/src/picongpu ``` -------------------------------- ### Multi-plugin command-line example for two calorimeters Source: https://picongpu.readthedocs.io/en/latest/usage/plugins/particleCalorimeter.html Shows how to use the multi plugin feature by specifying the plugin parameters multiple times on the command line. The first instance uses default settings (no logarithmic binning), while the second explicitly enables logarithmic energy binning with minEnergy 1. A unique file suffix is required for each instance to avoid overwriting output files. ```bash --ph_calorimeter.period 128 --ph_calorimeter.file calo1 --ph_calorimeter.filter all --ph_calorimeter.period 1000 --ph_calorimeter.file calo2 --ph_calorimeter.filter all --ph_calorimeter.logScale 1 --ph_calorimeter.minEnergy 1 ``` -------------------------------- ### Define generic kernel buffer with selected domain size Source: https://picongpu.readthedocs.io/en/latest/_sources/prgpatterns/lockstep.rst.txt Example of setting up a generic kernel buffer with a specific domain size. ```C++ struct GenericKernel { static constexpr auto blockDomSize = pmacc::math::CT::Uint32<16>{}; template __device__ void operator()(TWorker& worker) const { pmacc::lockstep::makeForEach(worker, [](auto& worker) { // ... }); } }; ``` -------------------------------- ### Enable OpenMP backend with pic-configure Source: https://picongpu.readthedocs.io/en/latest/_sources/dev/clangtools.rst.txt Creates a build directory and configures PIConGPU with the OpenMP CPU backend. Required before using clang-tidy since the tools only work with CPU backends. ```bash # in an example mkdir build cd build pic-configure -c"-DALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLE=ON" .. ``` -------------------------------- ### Build documentation locally Source: https://picongpu.readthedocs.io/en/latest/dev/sphinx.html Commands to build the documentation: run Doxygen to parse C++ API, then make html and make latexpdf. Open the generated HTML and PDF files. ```bash # skip this if you are still in docs/ cd docs/ # parse the C++ API documentation, # enjoy the doxygen warnings! doxygen # render the `.rst` files and replace their macros within # enjoy the breathe errors on things it does not understand from doxygen :) make html # open it, e.g. with firefox :) firefox build/html/index.html # now again for the pdf :) make latexpdf # open it, e.g. with okular build/latex/PIConGPU.pdf ``` -------------------------------- ### Install c-blosc Source: https://picongpu.readthedocs.io/en/latest/install/dependencies.html Installation commands for c-blosc, an optional compressor for openPMD API with ADIOS2. ```bash sudo apt-get install libblosc-dev ``` ```bash sudo pacman --sync blosc ``` ```bash spack install c-blosc ``` ```bash mkdir -p ~/src ~/lib git clone -b v1.21.1 https://github.com/Blosc/c-blosc.git ~/src/c-blosc/ cd ~/src/c-blosc mkdir build && cd build cmake -DCMAKE_INSTALL_PREFIX=$HOME/lib/c-blosc -DPREFER_EXTERNAL_ZLIB=ON .. make install ``` ```bash export BLOSC_ROOT=$HOME/lib/c-blosc export CMAKE_PREFIX_PATH=$BLOSC_ROOT:$CMAKE_PREFIX_PATH ``` -------------------------------- ### Generate and build only, then manually submit Source: https://picongpu.readthedocs.io/en/latest/pypicongpu/running.html Use this snippet when you only want to generate and build the simulation, and then manually submit the job. This is useful when `run()` (or `tbg`) cannot handle your local job submission system. The setup directory is explicitly set to `/scratch/mysetups/setup01`. ```python r = Runner(sim, setup_dir="/scratch/mysetups/setup01") r.generate() r.build() # ... now manually submit the job from /scratch/mysetups/setup01 ``` -------------------------------- ### Install ISAAC via Spack Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Command to install the ISAAC library using Spack. ```bash spack install isaac ``` -------------------------------- ### Create Micromamba environment for documentation Source: https://picongpu.readthedocs.io/en/latest/dev/sphinx.html Creates a bare Micromamba environment with all requirements for building the PIConGPU documentation, including Doxygen. Then activates the environment. ```bash cd docs/ # create a bare Micromamba environment containing just all the requirements # for building the picongpu documentation # note: also installs doxygen inside this environment micromamba env create --file picongpu-docs-env.yml # start up the environment as suggested during its creation e.g. micromamba activate picongpu-docs-env # or source activate picongpu-docs-env ``` -------------------------------- ### Multi-plugin command-line example for two calorimeters Source: https://picongpu.readthedocs.io/en/latest/_sources/usage/plugins/particleCalorimeter.rst.txt Shows how to create two calorimeter plugins with different periods and settings. The first uses logarithmic energy binning, the second uses the default linear binning. A unique file suffix is required when using the same species and filter. ```bash --ph_calorimeter.period 128 --ph_calorimeter.file calo1 --ph_calorimeter.filter all --ph_calorimeter.period 1000 --ph_calorimeter.file calo2 --ph_calorimeter.filter all --ph_calorimeter.logScale 1 --ph_calorimeter.minEnergy 1 ``` -------------------------------- ### Initialize Runner and Access Directories Source: https://picongpu.readthedocs.io/en/latest/_sources/pypicongpu/running.rst.txt Demonstrates initializing the Runner with a custom run directory and verifying the generated paths. ```python r = Runner(sim, run_dir="/scratch/mydata/new_run") # re-do some checks already performed inside the Runner import os assert not os.path.exists(r.run_dir) assert not os.path.exists(r.setup_dir) r.generate() assert os.path.isdir(r.setup_dir) import tempfile if r.setup_dir.startswith(tempfile.gettempdir()): print("will build inside tempdir") ``` -------------------------------- ### ROCm/HIP Installation and Configuration Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Commands for installing ROCm/HIP dependencies and setting environment variables. ```bash export ROCM_VER=5.5.0 apt install rocm-llvm${ROCM_VER} hip-runtime-amd${ROCM_VER} rocm-dev${ROCM_VER} rocm-utils${ROCM_VER} rocrand-dev${ROCM_VER} rocm-cmake${ROCM_VER} rocm-device-libs${ROCM_VER} rocm-core${ROCM_VER} ``` ```bash apt install hiprand-dev${ROCM_VER} ``` ```bash export CMAKE_PREFIX_PATH=:$CMAKE_PREFIX_PATH export PATH=/llvm/bin:$PATH ``` -------------------------------- ### Create PIConGPU input and output directories Source: https://picongpu.readthedocs.io/en/latest/_sources/usage/basics.rst.txt Creates the directory structure for PIConGPU input files and simulation output. ```bash # PIConGPU input files mkdir $HOME/picInputs # PIConGPU simulation output mkdir $SCRATCH/runs ``` -------------------------------- ### Install PIConGPU Python package with pip in edit mode Source: https://picongpu.readthedocs.io/en/latest/usage/python_utils.html Install the picongpu package with pip using the -e option (edit mode) to manage relative paths correctly. This also installs all required dependencies. ```bash pip install -e $PICSRC/lib/python/ ``` -------------------------------- ### Fork setup: clone, add mainline remote, checkout dev Source: https://picongpu.readthedocs.io/en/latest/_sources/dev/CONTRIBUTING.md.txt Prepare a forked copy of the picongpu repository: clone your fork, add the mainline remote for updates, and switch to the dev branch. ```bash git clone git@github.com:/picongpu.git ``` ```bash git remote add mainline git@github.com:ComputationalRadiationPhysics/picongpu.git ``` ```bash git checkout dev ``` -------------------------------- ### Type Hinting Example Source: https://picongpu.readthedocs.io/en/latest/_sources/pypicongpu/misc.rst.txt Basic example of PEP 484 type annotations in a Python function. ```python def greeting(name: str) -> str: return 'Hello ' + name ``` -------------------------------- ### Install GCC with Spack Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Commands to install a specific GCC version via Spack and configure it as the default. ```bash spack install gcc@12.2.0 ``` -------------------------------- ### Execute Partial Simulation Steps Source: https://picongpu.readthedocs.io/en/latest/_sources/pypicongpu/running.rst.txt Shows how to perform only the generate and build steps, allowing for manual job submission. ```python r = Runner(sim, setup_dir="/scratch/mysetups/setup01") r.generate() r.build() # ... now manually submit the job from /scratch/mysetups/setup01 ``` -------------------------------- ### Install Doxygen and graphviz (Debian/Ubuntu) Source: https://picongpu.readthedocs.io/en/latest/_sources/dev/doxygen.rst.txt Install the required packages for Doxygen and graph generation on Debian/Ubuntu systems. ```bash # install requirements (Debian/Ubuntu) sudo apt-get install doxygen graphviz ``` -------------------------------- ### Check compute node and build scenario with pic-build Source: https://picongpu.readthedocs.io/en/latest/tutorials/hemeraIn5min.html After sourcing your profile, use a compute node, then compile the scenario with pic-build and parallel jobs. ```bash getDevice ``` ```bash # switch to the scenario directory if you haven't already cd ~/picongpu-projects/laser-wakefield-example/try01 pic-build -j 6 ``` -------------------------------- ### Install Java for PlantUML Source: https://picongpu.readthedocs.io/en/latest/_sources/dev/PlantUML.rst.txt Command to install a compatible Java version (openjdk-21-jre-headless) on Debian/Ubuntu systems, as required by PlantUML. ```bash sudo apt update && sudo apt install openjdk-21-jre-headless ``` -------------------------------- ### pic-create --help output Source: https://picongpu.readthedocs.io/en/latest/usage/basics.html Output of `pic-create --help` showing usage and options. The tool copies an existing input set (or a default case) and adds helper files. Requires rsync; use -f to merge into an existing destination. ```text pic-create create a new parameter set for simulation input merge default picongpu parameters and a given example's input usage: pic-create [OPTION] [src_dir] dest_dir If no src_dir is set picongpu a default case is cloned If src_dir is not in the current directory, pic-create will look for it in $PIC_EXAMPLES -f | --force - merge data if destination already exists -h | --help - show this help message Dependencies: rsync ``` -------------------------------- ### Install c-blosc via package managers Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Commands to install the c-blosc library using system package managers or Spack. ```bash sudo apt-get install libblosc-dev ``` ```bash sudo pacman --sync blosc ``` ```bash spack install c-blosc ``` -------------------------------- ### Install clang-tidy-3.9 on Debian/Ubuntu Source: https://picongpu.readthedocs.io/en/latest/_sources/dev/clangtools.rst.txt Installs Clang's clang-tidy tool version 3.9 or newer (with a package suffix) on Debian/Ubuntu systems. Required before using the tools. ```bash sudo apt-get install clang-tidy-3.9 ``` -------------------------------- ### Run phase space visualizer from command line Source: https://picongpu.readthedocs.io/en/latest/_sources/usage/plugins/phaseSpace.rst.txt Runs the phase space visualizer from the command line for a single simulation. Options include -p for the run directory, -i for iteration, -s for species (default 'e'), -f for species filter (default 'all'), and -m for momentum (default 'ypy'). ```bash python phase_space_visualizer.py ``` -------------------------------- ### Run quick and compiling tests Source: https://picongpu.readthedocs.io/en/latest/_sources/pypicongpu/faq.rst.txt Execute the test suite from the test directory. Quick tests run in seconds, compiling tests invoke pic-build and take longer. ```bash cd $PICSRC/test/python/picongpu python -m quick python -m compiling ``` -------------------------------- ### Install picongpu package in editable mode Source: https://picongpu.readthedocs.io/en/latest/_sources/usage/python_utils.rst.txt Use this command to install the picongpu package in edit mode, which is required for the PICMI implementation to manage relative paths correctly. ```shell pip install -e $PICSRC/lib/python/ ``` -------------------------------- ### ADIOS2 Variable-Based Iteration Encoding Example Source: https://picongpu.readthedocs.io/en/latest/usage/plugins/openPMD.html An example of the data structure when using variable-based iteration encoding with ADIOS2, showing how multiple time steps are represented within a single file. ```text float /data/fields/B/x 2*{192, 1024, 192} float /data/fields/B/y 2*{192, 1024, 192} float /data/fields/B/z 2*{192, 1024, 192} float /data/fields/E/x 2*{192, 1024, 192} float /data/fields/E/y 2*{192, 1024, 192} float /data/fields/E/z 2*{192, 1024, 192} float /data/fields/e_all_chargeDensity 2*{192, 1024, 192} float /data/fields/e_all_energyDensity 2*{192, 1024, 192} float /data/particles/e/momentum/x 2*{71811072} float /data/particles/e/momentum/y 2*{71811072} float /data/particles/e/momentum/z 2*{71811072} uint64_t /data/particles/e/particlePatches/extent/x 2*{__} uint64_t /data/particles/e/particlePatches/extent/y 2*{__} uint64_t /data/particles/e/particlePatches/extent/z 2*{__} uint64_t /data/particles/e/particlePatches/numParticles 2*{__} uint64_t /data/particles/e/particlePatches/numParticlesOffset 2*{__} uint64_t /data/particles/e/particlePatches/offset/x 2*{__} uint64_t /data/particles/e/particlePatches/offset/y 2*{__} uint64_t /data/particles/e/particlePatches/offset/z 2*{__} float /data/particles/e/position/x 2*{71811072} float /data/particles/e/position/y 2*{71811072} float /data/particles/e/position/z 2*{71811072} int32_t /data/particles/e/positionOffset/x 2*{71811072} int32_t /data/particles/e/positionOffset/y 2*{71811072} int32_t /data/particles/e/positionOffset/z 2*{71811072} float /data/particles/e/weighting 2*{71811072} ``` -------------------------------- ### Clone and Configure PIConGPU Source Source: https://picongpu.readthedocs.io/en/latest/install/dependencies.html Commands to clone the repository and set up the required environment variables. ```bash git clone https://github.com/ComputationalRadiationPhysics/picongpu.git $HOME/src/picongpu cd $HOME/src/picongpu && git fetch && git pull git branch git checkout export PICSRC=$HOME/src/picongpu export PIC_EXAMPLES=$PICSRC/share/picongpu/examples export PATH=$PATH:$PICSRC export PATH=$PATH:$PICSRC/bin export PATH=$PATH:$PICSRC/src/tools/bin ``` -------------------------------- ### pic-build CPU backend (omp2b:native) Source: https://picongpu.readthedocs.io/en/latest/_sources/usage/basics.rst.txt Builds PIConGPU for CPU execution using the omp2b backend with native architecture. Use this when you want to run on the CPU you are compiling on. ```bash # example for running efficiently on the CPU you are currently compiling on pic-build -b "omp2b:native" ``` -------------------------------- ### Format All Files with clang-format-20 Source: https://picongpu.readthedocs.io/en/latest/_sources/dev/styleguide.rst.txt Run this bash command from the root folder of PIConGPU to format all relevant source files in the working copy. ```bash find include/ share/picongpu/ share/pmacc -iname "*.def" \ -o -iname "*.h" -o -iname "*.cpp" -o -iname "*.cu" \ -o -iname "*.hpp" -o -iname "*.tpp" -o -iname "*.kernel" \ -o -iname "*.loader" -o -iname "*.param" -o -iname "*.unitless" \ | xargs clang-format-20 -i ``` -------------------------------- ### Submit all collision thermalization tests in parallel (bash) Source: https://picongpu.readthedocs.io/en/latest/tests/CollisionsThermalisation/README.html Submits all nine test setups (CASE_N0 to CASE_N8) in parallel. Requires setting BASE_OUTPUT_PATH and adjusting INPUT_PATH if needed. Each setup is compiled with pic-build and submitted with tbg using etc/picongpu/1.cfg. ```bash #!/bin/bash # compile and submit all setups (in parallel) BASE_OUTPUT_PATH= # change it WORKING_DIR=$(pwd) INPUT_PATH=$(mktemp -d -p ~/tmp/) # adjust if needed for i in {0..8} do cd $WORKING_DIR EXAMPLE_PATH=$INPUT_PATH/CASE_N$i mkdir $EXAMPLE_PATH cp -r ./ $EXAMPLE_PATH cd $EXAMPLE_PATH { pic-build -t $i &> compile.log && tbg -s -t -c etc/picongpu/1.cfg $BASE_OUTPUT_PATH/TEST_CASE_N$i; } & done wait ``` -------------------------------- ### Run simulation with sim.step(sim.max_steps) Source: https://picongpu.readthedocs.io/en/latest/pypicongpu/running.html Runs the entire build pipeline. Only all steps at once are supported; any other number of steps raises an error. Without a configured `$SCRATCH` directory, results are saved to the temporary directory (`/tmp`) and a fat warning is printed. ```python # sim init... sim.step(sim.max_steps) ``` -------------------------------- ### Add laser and run or write input file Source: https://picongpu.readthedocs.io/en/latest/usage/picmi/intro.html Adds a laser to the simulation and provides a main block that either runs the simulation or writes the input file based on the MODE variable. The run directory is set to OUTPUT_DIRECTORY_PATH / 'run' and setup directory to OUTPUT_DIRECTORY_PATH / 'setup'. ```python sim.add_laser(laser, None) if __name__ == "__main__": match MODE: case "run": sim.run(setup_dir=OUTPUT_DIRECTORY_PATH / "setup", run_dir=OUTPUT_DIRECTORY_PATH / "run") case "write": sim.write_input_file(OUTPUT_DIRECTORY_PATH / "setup") case _: raise ValueError(f"Unknown {MODE=}.") ``` -------------------------------- ### Bypass Runner checks with empty simulation Source: https://picongpu.readthedocs.io/en/latest/pypicongpu/running.html Use this snippet to bypass the Runner's constructor checks and use an externally prepared setup. Construct the Runner with an empty simulation, then overwrite the setup directory. Skipping `generate()` is intentional because it would fail; this approach is not guaranteed to work. ```python from picongpu.pypicongpu.runner import Runner from picongpu.pypicongpu.simulation import Simulation empty_sim = Simulation() # leave all dirs empty, this way no checks will trigger r = Runner(empty_sim) # now overwrite setup dir r.setup_dir = "/other/prepared/setup" # skip r.generate() (which would fail), directly build r.build() r.run() ``` -------------------------------- ### Run PyPIConGPU tests with python -m quick Source: https://picongpu.readthedocs.io/en/latest/pypicongpu/misc.html Run from the test/python/picongpu directory to execute the tests. For tests with compilation, use `python -m compiling` instead. ```bash python -m quick ``` -------------------------------- ### Configure FFTW3 environment Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Set environment variables to point to the FFTW3 installation. ```bash export FFTW3_ROOT=$HOME/lib/fftw-3.3.10 export LD_LIBRARY_PATH=$FFTW3_ROOT/lib:$LD_LIBRARY_PATH ``` -------------------------------- ### Configure multiple openPMD plugin instances via CLI Source: https://picongpu.readthedocs.io/en/latest/_sources/usage/plugins/openPMD.rst.txt Example of defining two separate plugin instances with different dumping periods, files, and sources using command line parameters. ```bash --openPMD.period 128 --openPMD.file simData1 --openPMD.source 'species_all' --openPMD.period 1000 --openPMD.file simData2 --openPMD.source 'fields_all' --openPMD.ext h5 ``` -------------------------------- ### Configure c-blosc environment Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Set environment variables to point to the c-blosc installation. ```bash export BLOSC_ROOT=$HOME/lib/c-blosc export CMAKE_PREFIX_PATH=$BLOSC_ROOT:$CMAKE_PREFIX_PATH ``` -------------------------------- ### Configure openPMD-api environment Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Set the CMAKE_PREFIX_PATH to include the custom openPMD-api installation. ```bash export CMAKE_PREFIX_PATH="$HOME/lib/openPMD-api:$CMAKE_PREFIX_PATH" ``` -------------------------------- ### View pic-edit help and available parameters Source: https://picongpu.readthedocs.io/en/latest/usage/param.html Run pic-edit with the --help flag to see usage instructions and a list of all available .param files. ```bash Edit compile-time options for a PIConGPU input set Opens .param files in an input set with the default "EDITOR". If a .param file is not yet part of the input set but exists in the defaults, it will be transparently added to the input set. You must run this command inside an input directory. The currently selected editor is: /usr/bin/vim.basic You can change it via the "EDITOR" environment variable. usage: pic-edit Available s: atomicPhysics atomicPhysics_Debug binningSetup collision density dimension fieldAbsorber fieldBackground fieldSolver fileOutput incidentField ionizationEnergies ionizer isaac iterationStart mallocMC memory particle particleCalorimeter particleFilters physicalConstants png pngColorScales precision pusher radiation radiationObserver random shadowgraphy simulation species speciesAttributes speciesConstants speciesDefinition speciesInitialization synchrotron transitionRadiation ``` -------------------------------- ### YeeSolver Serialization Example Source: https://picongpu.readthedocs.io/en/latest/_sources/pypicongpu/translation.rst.txt A valid serialized object that conforms to the YeeSolver schema. ```json {"name": "Yee"} ``` -------------------------------- ### Configure Boost Environment Variables Source: https://picongpu.readthedocs.io/en/latest/_sources/install/dependencies.rst.txt Set the CMAKE_PREFIX_PATH to include the custom Boost installation. ```bash export CMAKE_PREFIX_PATH=$HOME/lib/boost:$CMAKE_PREFIX_PATH ``` -------------------------------- ### Add RandomPosition to InitPipeline Source: https://picongpu.readthedocs.io/en/latest/usage/param/particles/init.html Example of adding the predefined RandomPosition manipulator to the InitPipeline in speciesInitialization.param. ```cpp particles::Manipulate ```