Guides
A list of more “how to” vs “how to learn” documents
A list of more “how to” vs “how to learn” documents
tl;dr module load spack git clone https://github.com/robertu94/spack_packages robertu94_packages spack repo add ./robertu94_packages What makes this machine special? the team at NERSC works hard to maintain an up to date and customized spack environment. Unless you have a need for something special use theirs For the longer version see the guide on [configuring spack]({% link _guides/spack.markdown %}) Changelog 2024-07-12 created this document
Dependencies matter a lot in terms of who can easily install and use your software. However there are trade-offs in what features are provided by each version and the availability of these versions. This presents an opinionated take on what these trade-offs are so one can know what can be widely supported. Last update: 2023-09-12 Major Linux Distros Distro Standard EoL CentOS-8 compatible December 2021* CentOS-9 stream May 2027* Ubuntu 20....
Spack installations can be really slow on some platforms, however, there are pre-built packages for ubuntu 20.04 sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt update apt install gcc-11 spack mirror add spack-build-cache-develop https://binaries.spack.io/develop spack buildcache keys --install --trust And now you have spack pre-compiled goodness for your packages! You can see the spack cache index for details for what packages are pre-built for which platforms.
tl;dr Put the following in your .bashrc use_build() { if hostname | grep summit &>/dev/null; then echo "loading crusher spack" module swap PrgEnv-cray PrgEnv-gnu module load craype-accel-amd-gfx90a module load rocm export clustername=crusher fi #other OLCF Machines export SPACK_USER_CONFIG_PATH="$HOME/.spack/$clustername" export SPACK_USER_CACHE_PATH="$SPACK_USER_CONFIG_PATH" source $HOME/git/spack-crusher/share/spack/setup-env.sh source $HOME/git/spack-crusher/share/spack/spack-completion.bash } Then run mkdir -p ~/git git clone https://github.com/spack/spack git/spack-crusher source ~/.bashrc spack compiler find First create packages.yaml at ~/.spack/crusher/packages.yaml with: cmake:externals:- spec:cmake@3.17.0prefix:/usrall:providers:mpi:[cray-mpich]hdf5:externals:- spec:hdf5@1.12.2+mpi+shared+hlprefix:/opt/cray/pe/hdf5-parallel/1.12.1.5/gnu/9.1buildable:Falsecray-mpich:externals:- spec:cray-mpich@8.1.16modules:[cray-mpich/8.1.16, libfabric/1.15.0.0, craype-accel-amd-gfx90a, rocm/5....
tl;dr Put the following in your .bashrc use_build() { if hostname | grep summit &>/dev/null; then echo "loading summit spack" module load gcc/10.2.0 export clustername=summit fi #other OLCF Machines export SPACK_USER_CONFIG_PATH="$HOME/.spack/$clustername" export SPACK_USER_CACHE_PATH="$SPACK_USER_CONFIG_PATH" source $HOME/git/spack-summit/share/spack/setup-env.sh source $HOME/git/spack-summit/share/spack/spack-completion.bash } Then run mkdir -p ~/git git clone https://github.com/spack/spack git/spack-summit source ~/.bashrc spack compiler find First create packages.yaml at ~/.spack/summit/packages.yaml with: packages:all:providers:mpi:[spectrum-mpi]openssl:externals:- spec:openssl@1.1.1cprefix:/usrbuildable:Falseopenssh:externals:- spec:openssh@8.0p1prefix:/usrbuildable:Falsecuda:externals:- spec:cuda@11.0.221prefix:/sw/summit/cuda/11.0.3buildable:Falsespectrum-mpi:externals:- spec:spectrum-mpi@10.4.0.03rtm4prefix:/sw/summit/spack-envs/base/opt/linux-rhel8-ppc64le/gcc-10.2.0/spectrum-mpi-10.4.0.3-20210112-ht5bw4jruhjujvkzcvpra5lryg5vfhy4buildable:Falsetar:externals:- spec:tar@1.30prefix:/usrcvs:externals:- spec:cvs@1.11.23prefix:/usrdiffutils:externals:- spec:diffutils@3.6prefix:/usrgroff:externals:- spec:groff@1.22.3prefix:/usrbison:externals:- spec:bison@3.0.4prefix:/usrgawk:externals:- spec:gawk@4.2.1prefix:/usrpkgconf:externals:- spec:pkgconf@1.4.2prefix:/usrm4:externals:- spec:m4@1....
tl;dr define a version of your API using only C compatible types in a header Do NOT include a C++ header in the transitive set of headers make the header compatible with C and C++ using #ifdef __cplusplus and extern "C" Why is this needed C++ is (mostly) a super set of C. If you want C++ to be callable from C, you need to stick to this subset for the declaring code and mark the functions as having a C ABI....
tl;dr Most of the time simply use find_package, set CMAKE_PREFIX_PATH to include the path specified in CMAKE_INSTALL_PREFIX when the package was installed like so: find_package(std_compat REQUIRED)target_link_libraries(my_library PUBLIC std_compat::std_compat)Tools like spack will set CMAKE_PREFIX_PATH for you. Otherwise specify it using an envionment variable or with a -D flag to cmake. How to add the dependency Adding a dependency in CMake is pretty straight forward, but depends on where it is coming from....
#tl;dr # set NEW_VERSION to the desired version cd $SPACK_ROOT git pull cd $(spack repo list | grep robertu94 | sed -E 's/robertu94[[:space:]]+//') && git pull spack install libpressio-tools ^libpressio${NEW_VERSION} spack load libpressio-tools ^libpressio${NEW_VERSION} libpressio is now Mainline LibPressio is now in the mainline version of spack (as of commit da6aeaad44e434da5563d32f2fa9900de362b2ed, October 17, 2022). You no longer need to add robertu94_packages unless you need a development version. You can either spack repo rm robertu94, or the next pull of robertu94_packages will include a dummy package to refer back to the builtin version....
Setting up spack The way that I use spack, there are 6 major steps to configuring spack: Determine what system compiler, python, and MPI you will use Telling spack how to find your compiler Telling spack find major system dependencies such as MPI and OpenSSL as external dependencies Configuring preferred providers for virtual dependencies and target architectures Configuring spack to use a binary cache if it will matter Setting up a shell shortcut for loading spack What system dependencies to use Spack does a pretty good job “living off the land” using what ever dependencies you may need....
tl;dr Put the following in your .bashrc use_build() { if hostname | grep bebop &>/dev/null; then echo "loading bebop spack" module load gcc/11.4.0 module load intel-oneapi-mpi/2021.12.1-tjkrnei module load intel-oneapi-mkl/2024.0.0-jfwrhz5 source $HOME/git/spack-bebop/share/spack/setup-env.sh source $HOME/git/spack-bebop/share/spack/spack-completion.bash export clustername=bebop fi #other LCRC Machines export SPACK_USER_CONFIG_PATH="$HOME/.spack/$clustername" export SPACK_USER_CACHE_PATH="$SPACK_USER_CONFIG_PATH" } Then run mkdir -p ~/git git clone https://github.com/spack/spack git/spack-bebop git clone https://github.com/robertu94/spack_packages git/robertu94_packages source ~/.bashrc # for extra packages like libpressio spack repo add ~/git/robertu94_packages Bebop provides default configurations for packages and compilers so you are ready to go!...