|  | 
|  | 1 | +# EESSI Guide | 
|  | 2 | + | 
|  | 3 | +## How to Load EESSI | 
|  | 4 | + | 
|  | 5 | +The EESSI environment can be initialise by running: | 
|  | 6 | + | 
|  | 7 | +```[bash] | 
|  | 8 | +source /cvmfs/software.eessi.io/versions/2023.06/init/bash | 
|  | 9 | +``` | 
|  | 10 | + | 
|  | 11 | +This is non-reversible because it: | 
|  | 12 | + | 
|  | 13 | +- Changes your `$PATH`, `$MODULEPATH`, `$LD_LIBRARY_PATH`, and other critical environment variables. | 
|  | 14 | +- Sets EESSI-specific variables such as `EESSI_ROOT`. | 
|  | 15 | + | 
|  | 16 | +However, it is the recommended method because it: | 
|  | 17 | + | 
|  | 18 | +- Detects system CPU architecture and OS. | 
|  | 19 | +- Detects and configures GPU support. | 
|  | 20 | +- Prepares the full EESSI software stack. | 
|  | 21 | +- Sets up Lmod (environment module system). | 
|  | 22 | + | 
|  | 23 | +The [EESSI docs](https://www.eessi.io/docs/using_eessi/setting_up_environment/) offer another method to load EESSI. This alternative method only initialises the Lmod module system and does not load a platform-specific setup. For these reasons, it is recommended to use the method detailed above. | 
|  | 24 | + | 
|  | 25 | +Successful environment setup will show `{EESSI 2023.06}` at the start of your CLI. | 
|  | 26 | + | 
|  | 27 | +To deactivate your EESSI environment you can either restart your shell using `exec bash` or exit the shell by running `exit`. | 
|  | 28 | + | 
|  | 29 | +## GPU Support with EESSI | 
|  | 30 | + | 
|  | 31 | +To enable GPU support, the cluster must be running a site-specific image build that has CUDA enabled. For a guide on how to do this, please refer to [docs/image-build.md](../image-build.md). | 
|  | 32 | + | 
|  | 33 | +### Using GPUs | 
|  | 34 | + | 
|  | 35 | +All CUDA-enabled software in EESSI expects CUDA drivers in a specific `host_injections` directory. | 
|  | 36 | + | 
|  | 37 | +#### To expose the NVIDIA GPU drivers | 
|  | 38 | + | 
|  | 39 | +Use the `link_nvidia_host_libraries.sh` script, provided by EESSI, to symlink your GPU drivers into `host_injections`. | 
|  | 40 | + | 
|  | 41 | +```[bash] | 
|  | 42 | +/cvmfs/software.eessi.io/versions/2023.06/scripts/gpu_support/nvidia/link_nvidia_host_libraries.sh | 
|  | 43 | +``` | 
|  | 44 | + | 
|  | 45 | +Rerun this script when your NVIDIA GPU drivers are updated. It is also safe to rerun at any time as the script will detect if the driver versions have already been symlinked. | 
|  | 46 | + | 
|  | 47 | +### Building with GPUs | 
|  | 48 | + | 
|  | 49 | +Run `which nvcc` to confirm that the CUDA compiler is found. | 
|  | 50 | + | 
|  | 51 | +If `nvcc` is not found, add the CUDA path to your environment: | 
|  | 52 | + | 
|  | 53 | +```[bash] | 
|  | 54 | +export PATH=/usr/local/cuda/bin:$PATH | 
|  | 55 | +``` | 
|  | 56 | + | 
|  | 57 | +`which nvcc` should now show the path to the CUDA compiler. | 
|  | 58 | + | 
|  | 59 | +#### Loading EESSI module for the GCC compiler | 
|  | 60 | + | 
|  | 61 | +Running `which gcc` with EESSI initialised should initially show a path `.../2023.06/compat...` which points to the compatibility compiler. | 
|  | 62 | + | 
|  | 63 | +It is important to load a `gcc` version that is compatible with the host's CUDA version. This can be found by referring to the table below: | 
|  | 64 | + | 
|  | 65 | +To find your cuda version run `nvcc --version` | 
|  | 66 | + | 
|  | 67 | +| **CUDA Version** | **Recommended GCC Module (EESSI 2023.06)**              | | 
|  | 68 | +| ---------------- | ------------------------------------------------------- | | 
|  | 69 | +| CUDA 13.0        | GCC/12.3.0                                              | | 
|  | 70 | +| CUDA 12.3 – 12.5 | GCC/12.3.0 or GCC/12.2.0 (officially supports GCC 12.x) | | 
|  | 71 | +| CUDA 12.0 – 12.2 | GCC/12.2.0 (officially listed supported version)        | | 
|  | 72 | +| CUDA 11.4 – 11.8 | no matching GCC module in EESSI 2023.06                 | | 
|  | 73 | +| CUDA < 11.4      | not supported                                           | | 
|  | 74 | + | 
|  | 75 | +To load correct ESSI module run, substituting x for the compatible GCC version: | 
|  | 76 | + | 
|  | 77 | +```[bash] | 
|  | 78 | +module load GCC/12.x.0 | 
|  | 79 | +``` | 
|  | 80 | + | 
|  | 81 | +Running `which gcc` will now give a path `.../2023.06/software...` which is the full compiler provided by EESSI. This is what we want for CUDA builds. | 
|  | 82 | + | 
|  | 83 | +Now you can run `cmake` and `make` to compile CUDA using EESSI's `gcc`. | 
|  | 84 | + | 
|  | 85 | +#### Test: Compile deviceQuery from CUDA-Samples | 
|  | 86 | + | 
|  | 87 | +To test that your EESSI setup can compile CUDA, try compiling `deviceQuery` from CUDA-Samples with the following steps: | 
|  | 88 | + | 
|  | 89 | +```[bash] | 
|  | 90 | +git clone https://github.com/NVIDIA/cuda-samples.git | 
|  | 91 | +cd cuda-samples/Samples/1_Utilities/deviceQuery | 
|  | 92 | +mkdir -p build | 
|  | 93 | +cd build | 
|  | 94 | +cmake .. | 
|  | 95 | +make | 
|  | 96 | +./deviceQuery | 
|  | 97 | +``` | 
0 commit comments