git clone https://github.com/spack/spack.git
cd spack
git checkout releases/latest
source ./share/spack/setup-env.shPlease add the last command to .bashrc with absolute path to start spack by default.
- Add Compilers
spack install gcc@10.2.0 ## specify version spack find -p gcc ## get location spack compiler add /jet/packages/spack/opt/spack/linux-centos8-zen/gcc-8.3.1/gcc-10.2.0-tfzxq7udz2a53dmujvasy4uz33t27iwv ## or the location of any other compilers
The -j 32 flag in spack install means to make with 32 jobs, which will reduce installation time
spack info cuda # find available version of cuda
spack install -j 32 cuda@11.8 # install specified version of cuda
spack load cuda@11.8 # load corresponding cuda-
Create an Environment
spack env create neko spack env activate neko
-
Add Packages to the Environment Edit
spack.yamlfromspack/var/spack/environments/nekocd var/spack/environments/neko vim spack.yamlAnd modify the file to add the package you need.
spack: specs: - zlib - binutils - cuda@11.8 - numactl - xz - libxml2 - libpciaccess - hwloc - libevent - check - gdrcopy - ucx - openmpi+cuda - openblas - pmix - fftw - scalapack - libfabric view: true concretizer: unify: trueOr you can just type
spack add cuda@11.8
Concretize the packages:
spack concretize
Finally, install all packages in the environment
spack install --overwrite
More in Reference
By adding a packages.yaml to the .spack folder, you can change the default compiler and use external cuda to build openmpi.
- The
+cudais used to compile openmpi with cuda support %means to specify the compiler used so that packages match with each others
packages:
all:
compiler: [gcc@12.3.0]
openmpi:
variants: +cuda
cuda:
externals:
- spec: cuda@11.8%gcc@12.3.0
prefix: /usr/local/cuda/
buildable: false
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
sh Miniconda3-latest-Linux-x86_64.shTerminal needs to be restarted.
conda create -n my_env python=3.11 # or any other environment names and python
conda activate my_env
conda install numpy