Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Note

The intention of this page is to demonstrate how to use the oneAPI toolkit on MedicineBow

It is not to teach C/C++/Fortran nor any of the associated libraries such as the MKL. , MPI and TBB.

Table of Contents
stylenone

...

To get started, first load the oneapi/<version> module you wsh to use.

This will setup you your environment, adding and extending various environment variables, opening up access to compilers and libraries.

Expand
titleExample Module Load Output
Code Block
[salexan5@mblog2 ~]$ module load oneapi/2024.1.0
:: initializing oneAPI environment ...
   -bash: BASH_VERSION = 5.1.8(1)-release
   args: Using "$@" for setvars.sh arguments: load oneapi/2024.1.0
:: advisor -- latest
:: ccl -- latest
:: compiler -- latest
:: dal -- latest
:: debugger -- latest
:: dev-utilities -- latest
:: dnnl -- latest
:: dpcpp-ct -- latest
:: dpl -- latest
:: ipp -- latest
:: ippcp -- latest
:: mkl -- latest
:: mpi -- latest
:: tbb -- latest
:: vtune -- latest
:: oneAPI environment initialized ::

If you try loading the module a second time within an existing session, you will see the following warning:

Expand
titleCalling module load again
Code Block
[]$ module load oneapi/2024.2.1
:: WARNING: setvars.sh has already been run. Skipping re-execution.
   To force a re-execution of setvars.sh, use the '--force' option.
   Using '--force' can result in excessive use of your environment variables.

usage: source setvars.sh [--force] [--config=file] [--help] [...]
  --force        Force setvars.sh to re-run, doing so may overload environment.
  --config=file  Customize env vars using a setvars.sh configuration file.
  --help         Display this help message and exit.
  ...            Additional args are passed to individual env/vars.sh scripts
                 and should follow this script's arguments.

  Some POSIX shells do not accept command-line options. In that case, you can pass
  command-line options via the SETVARS_ARGS environment variable. For example:

  $ SETVARS_ARGS="ia32 --config=config.txt" ; export SETVARS_ARGS
  $ . path/to/setvars.sh

  The SETVARS_ARGS environment variable is cleared on exiting setvars.sh.
Note

Note: Although performing a module purge will remove the oneapi module from your module list, it does not clean up the new/modified environment variables - basically because these were not . This is due to them not being directly set using by the module file, but rather by an addition script that was called.

Currently, you will need to start a new session if you want a clean environment.

Using

Use the module name oneapi to discover versions available and to load the toolkit.

Examples

Intel provides a comprehensive list of examples of code samples available via their GitHub oneAPI-samples repository.

Expand
titleMPI Example
Code Block
[]$ git clone https://github.com/oneapi-src/oneAPI-samples
[]$ module load oneapi/2024.2.1
[]$ cd oneAPI-samples/Libraries/MPI/jacobian_solver

[]$ make clean
[]$ make

[jacobian_solver]$ salloc -A arcc -t 10:00 --cpus-per-task=1 --nodes=3 --ntasks-per-node=2 --mem=16G --partition=teton
salloc: Granted job allocation 3782711
salloc: Nodes t[285-287] are ready for job

[@t285 jacobian_solver]$ unset I_MPI_EXTRA_FILESYSTEM_LIST
[@t285 jacobian_solver]$ unset I_MPI_PMI_LIBRARY

[@t285 jacobian_solver]$ mpirun -n 6 ./src/01_jacobian_host_mpi_one-sided/mpi3_onesided_jacobian
NORM value on iteration 10: 52.076099
...
NORM value on iteration 100: 9.178927
Average solver time: 11.540843(sec)
SUCCESS

[@t285 jacobian_solver]$ exit
exit
salloc: Relinquishing job allocation 3782711
[jacobian_solver]$
Note

Note: In the MPI Example above:

  • You must unset I_MPI_EXTRA_FILESYSTEM_LIST and I_MPI_PMI_LIBRARY.

  • Use mpirun (which is actually the oneAPI’s version) and not srun to execute your code.

If you do not, you will warnings of the following form:

Expand
titleWarning: I_MPI_PMI_LIBRARY
Code Block
[]$ mpirun -n 6 ./src/01_jacobian_host_mpi_one-sided/mpi3_onesided_jacobian
MPI startup(): Warning: I_MPI_PMI_LIBRARY will be ignored since the hydra process manager was found
MPI startup(): Warning: I_MPI_PMI_LIBRARY will be ignored since the hydra process manager was found
MPI startup(): Warning: I_MPI_PMI_LIBRARY will be ignored since the hydra process manager was found
MPI startup(): Warning: I_MPI_PMI_LIBRARY will be ignored since the hydra process manager was found
MPI startup(): Warning: I_MPI_PMI_LIBRARY will be ignored since the hydra process manager was found
MPI startup(): Warning: I_MPI_PMI_LIBRARY will be ignored since the hydra process manager was found
MPI startup(): I_MPI_EXTRA_FILESYSTEM_LIST environment variable is not supported.
MPI startup(): Similar variables:
         I_MPI_EXTRA_FILESYSTEM
         I_MPI_EXTRA_FILESYSTEM_FORCE
         I_MPI_EXTRA_FILESYSTEM_NFS_DIRECT
MPI startup(): To check the list of supported variables, use the impi_info utility or refer to https://www.intel.com/content/www/us/en/docs/mpi-library/developer-reference-linux/