Prysma
Documentation / InfrastructureView source

Compilation and Benchmarks (Ephemeral Docker)

This container allows compiling Prysma and running the performance test suite in an isolated manner on the server.

The execution of this container is fully automated by the GitHub Actions workflow described in github_action.md. The commands below are documented for reference purposes for administration and debugging on the server.

1. Image Build

The image build must be launched from the ~/prysma folder on the server:

docker build --target benchmark -t prysma-compiler -f docker/compiler/Dockerfile .

2. Manual Execution (Debugging on the Server)

The command must be launched from the ~/prysma folder on the server:

docker run --rm --cap-add=SYS_ADMIN --cpuset-cpus="1-3" \
  -v "$HOME/prysma":/prysma \
  -v "$(pwd)":/workspace \
  prysma-compiler <branch_name>
  • --rm: Removes the container at the end of execution.
  • --cap-add=SYS_ADMIN: Grants the capability to access the host processor's hardware performance counters (PMU) without granting full system privileges.
  • --cpuset-cpus="1-3": Assigns execution to the cores stabilized and isolated by Laboratory Mode.
  • -v "$HOME/prysma":/prysma: Mounts the host folder where the branch repository to be tested will be temporarily cloned.
  • -v "$(pwd)":/workspace: Mounts the current working directory (e.g. the build workspace) to retrieve the generated perf_run_data.json file.
  • <branch_name>: The argument passed to the container indicates the Git branch to clone and test (e.g. main).

3. Results Recording

Once the perf_run_data.json report is generated by the container, the recording script is launched directly from the dashboard folder (~/dashboard-prysma) to update the production database by providing the path to the results file:

cd ~/dashboard-prysma
python3 save_perf_results.py ../prysma/prysma/perf_run_data.json

4. Hardware Counters (PMU) and Local Unlocking

The container is executed with --cap-add=SYS_ADMIN to access host hardware performance counters (cycles, L1/L2/L3 cache misses, branch misses). The --cpuset-cpus="1-3" parameter assigns execution to the cores stabilized by Laboratory Mode.

In production, these parameters are automatically applied by the GitHub Actions workflow and Laboratory Mode manages the temporary kernel unlocking on the server itself.

Manual Unlocking for Development/Debugging (Without Container)

If you wish to run the benchmark script directly on the server outside of the Docker container, the Linux kernel will block access to hardware counters by default.

To temporarily unlock access:

sudo sysctl -w kernel.perf_event_paranoid=-1
sudo sysctl -w kernel.kptr_restrict=0

Once this command is executed, you can run the tests directly on the host from the subfolder:

cd ~/prysma/prysma/tests
python3 run_perf_tests.py