macOS

Homebrew

To install CLI tools and libraries on macOS while retaining basic sanity, it is strongly recommended to use the Homebrew package manager. If you have not already installed it, it can be done like this:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

This will also prompt you to install the “Xcode command line tools” if you have not done so already. You will need those to build any software, including Rust software, so that’s a good thing.

CLI tools and libraries

Now that the basics are covered, we can install all needed packages as follows:

brew install curl hdf5 hwloc pkgconf unzip util-linux

You may get a warning stating that pkgconf can’t be installed because pkg-config is installed. This is harmless: they are two compatible implementations of the same functionality.

Rust

To compile Rust code, you need a Rust toolchain. But in this course, we are going to use experimental SIMD standard library features that are not yet stabilized. This means that we will more specifically need to use a specific nightly release of the Rust compiler, and those are best installed using the official rustup toolchain management system.

Please select the tab below which best describes your intent:

If you have already installed a Rust toolchain via rustup for a previous project, which you can quickly check via the following command…

# Should print a rustup version, followed by a Rust toolchain version
rustup --version

…then you do not need to do anything special and can proceed with the next steps.

As this course uses a rust-toolchain file, the rustup-provided version of cargo will automatically download and install the right nightly compiler version on your first attempt to build this course’s Rust projects. It will then proceed to use this nightly compiler release for that project. Meanwhile any other Rust projects will be unaffected and will keep using the same toolchain version.

That being said, if your Internet connexion is slow or only intermittently available, you can force the toolchain installation process to occur ahead of time by running the following command:

rustup toolchain install nightly-2025-04-25

HDF5-to-PNG renderer

Throughout the second part of the course, we will be producing HDF5 files which contain time series of tabulated chemical concentrations. For quick and dirty debugging, it is convenient to render those tabulated concentrations into colorful PNG images.

To this end, you can use the data-to-pics program which was developed as part of a previous version of this course.

You can easily build this program and install it next to other rustup-managed binaries (typically in ~/.cargo/bin) by running the following command:

cargo install --git https://github.com/HadrienG2/grayscott.git data-to-pics

Environment test

Your Rust development environment should now be ready for this course’s practical work. I highly advise testing it by running the following shell script:

curl -LO https://gitlab.in2p3.fr/grasland/numerical-rust-cpu/-/archive/solution/numerical-rust-cpu-solution.zip  \
&& unzip numerical-rust-cpu-solution.zip  \
&& rm numerical-rust-cpu-solution.zip  \
&& cd numerical-rust-cpu-solution/exercises  \
&& cargo run -- -n3  \
&& mkdir pics  \
&& data-to-pics -o pics/  \
&& cd ../..  \
&& rm -rf numerical-rust-cpu-solution  \
&& echo "Your Rust development environment seems to be working"

It downloads, builds and runs the expected source code at the end of the last chapter of this course, then renders the associated images, and finally cleans up after itself by deleting everything. If this all goes well, it should exit with a message saying that your development environment seems to be working.