We recommend the following steps to install Salvus on Apple Silicon macOS systems. This page contains a general process -- however some steps have a deeper dive under the advanced topics accessed via the sidebar menu.
If your computer is equipped with one of the latest M-series / Apple Silicon chips (M1 and later), we will install and run Salvus using Intel emulation, via a Apple-distributed software called Rosetta. Note that this doesn't noticeably impact performance, and any M-series processor system is much faster than the previous Intel-based systems.
The first step to install Salvus, regardless of system, is to figure out where every component of it will run. The most common case is to have a full installation locally and additionally install a version of SalvusCompute on a larger workstation or cluster. Details on where to run Salvus for different scenarios can be found on the relevant page.
Rosetta is a translation layer provided by Apple for applications written for Intel chips that enables the M-series chip to run them as well. It allows us to run
and binaries that are compiled for Intel systems to also run on Apple Silicon macOS systems.To install Rosetta, open a shell and type:
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
Navigate to your /Applications
folder and right click on your preferred
Terminal Application (The default Mac Terminal is located in /Applications/Utilities
)
then select Get Info
. In the window that opens, select Open with Rosetta
as shown
in this picture:
Reopen the shell.
If you want to keep your original Terminal (the specific app) running without
Rosetta, consider using iTerm. Once installed,
right-click on your iTerm application and select Duplicate
. Now rename the
duplicated iTerm application to something specific like iTerm (Rosetta)
.
Apply the procedure shown in the picture above to use Rosetta by default on
this duplicated terminal and proceed with the following steps.
Salvus runs a great deal of its functionality through Python (SalvusFlow, SalvusMesh, SalvusOpt, all contained within SalvusPy). For it to be able to do that, it needs a compatible version of Python and dependencies. We ensure this compatibility by using conda-based package managers, then installing preset versions of Python and dependent packages.
On Apple Silicon macOS systems, we recommend to use the Miniforge distribution together with Mamba as package manager. First, install Miniforge from Miniforge's GitHub. After installation, this program can be accessed from your shell by simply running it as:
mamba --version
The default configuration installs a Python executable into something called a "Conda environment". Such an environment is a way to install different version of Python and dependencies without them interfering. Most shells indicate that you are inside an environment by prepending the shell prompt with the environment name. Restarting your shell after a typical Miniforge installation will show you the default activated environment:
(base) > ...
This default environment will not be further used by SalvusPy.
After setting up a way for you to run the command Mamba (or Conda if you opted for a different distribution), you need to download the list of Python dependencies, i.e. the 'specs' or 'specifications', and use this to create a new Conda environment. Conda and Mamba can directly read this file to install the appropriate Python version and external versions packages (of exact versions) required by SalvusPy.
On Apple Silicon macOS systems, this file is easily obtained by running the program curl:
curl -O https://mondaic.com/environment-py311.yml
which will download it to the current directory in which you have your shell opened. You can also navigate to the file in your browser to download it to your downloads folder.
What's left is to use the downloaded spec file to create a new Conda environment. To do this, run this in your shell:
# Create a new environment with all required dependencies.
mamba env create -n salvus -f environment.yml
This creates a new Python environment with the name `salvus`. You are free to change the name of the environment in your command, just ensure you note down for yourself what you name it.
To use this environment for the next steps of the installation process, and to use Salvus at all, make sure to activate this environment in your shell:
# Activate the created environment.
mamba activate salvus
The next step is to obtain two sets of files:
Since both of these files require to be compiled on a per-platform basis, you need to obtain them specifically for Apple Silicon macOS. Selecting the right set of files to download is mostly automated through the Salvus Downloader, with full details available here.
To run this helper program on Apple Silicon macOS and obtain the relevant files, run the following:
bash -c "$(curl -sSL https://get.mondaic.com)"
After evaluating the end-user license agreement, ensuring the user has a license, a few system configuration steps are run through. The Salvus downloader is smart enough to select the correct microarchitecture and platform automatically. After this, you can select your release version.
Finally, the installer allows one to select which files exactly are downloaded:
One can navigate with the keyboard arrows and (de)select files using space.
The last part of this step is to install SalvusPy into the Python environment created before. This is done by running the pip program (available via the Conda environment) on the just-downloaded Python wheel of Salvus. In the following two commands ensure that you update the environment name to match the name you gave and you update the path to the Python wheel to match what you entered:
# Ensure you update the environment name if necessary.
mamba activate salvus
# Ensure you update the download path if necessary.
pip install ~/Salvus/python_packages/salvus-*.whl
The final step in this process is to set up a computational site for SalvusCompute to run on. A site determines how the computational part of Salvus is run, and what resources it is allocated. The functionality that orchestrates the dispatching of simulations, the allocation of resources and the retrieval of results is collected in SalvusFlow, A detailed explanation on what these sites are can be found on the page on SalvusFlow Configurations
To streamline this process, the command line interface to salvus (aptly named `salvus-cli`) allows one to interactively create a new site from your shell:
# Update the conda environment name if necessary
mamba activate salvus
salvus-cli add-site
The default and maximum ranks relate to the parallelism allowed on your systems. Higher values up to the maximum your system is capable of will typically result in the better performance. We found that the optimal on Apple Silicon macOS can be found by running the following:
# macOS command to get physical CPU details
sysctl hw.perflevel0.physicalcpu
Specifically, the optimal on any system is the number of performant physical cores. On Apple Silicon macOS, this is not the total number of cores, as some of the cores on your system will be lower power cores. Using those for parallelism will slow down all cores to their speeds. The command above will only return the number of performance cores.
Salvus should be all ready by now so time to learn how to use it. We recommend to start with the getting started tutorial series.