Developer Guide

Developer Guide for Intel® oneAPI Math Kernel Library Windows*

ID 766692
Date 3/31/2023

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Setting Environment Variables on a Cluster

By default, when you call the MPI launch command mpiexec, the entire launching node environment is passed to the MPI processes. However, if there are undefined variables or variables that are different from what is stored in your environment, you can use -env or -genv options with mpiexec. Each of these options take two arguments- the name and the value of the environment variable to be passed.

-genv NAME1 VALUE1 -genv NAME2 VALUE2

-env NAME VALUE -genv

See these Intel MPI examples on how to set the value of OMP_NUM_THREADS explicitly:

mpiexec -genv OMP_NUM_THREADS 2 ....

mpiexec -n 1 -host first -env OMP_NUM_THREADS 2 test.exe : -n 2 -host second -env OMP_NUM_THREADS 3 test.exe ....

See these Intel MPI examples on how to set the value of MKL_BLACS_MPI explicitly:

mpiexec -genv MKL_BLACS_MPI INTELMPI ....

mpiexec -n 1 -host first -env MKL_BLACS_MPI INTELMPI test.exe : -n 1 -host second -env MKL_BLACS_MPI INTELMPI test.exe.

If you want to pass all environment variables by default and avoid passing these values explicitly, modify the user or system environment variables on each Windows node. From the Start menu, select Settings > Control Panel > System > Advanced > Environment Variables.

If you are using Microsoft MPI, the ways of setting environment variables described above are also applicable if the Microsoft Single Program Multiple Data (SPMD) process managers are running in a debug mode on all nodes of the cluster. However, the best way to set environment variables is by using the Job Scheduler with the Microsoft Management Console (MMC) and/or the Command Line Interface (CLI) to submit a job and pass environment variables. For more information about MMC and CLI, see the Microsoft Help and Support page at the Microsoft Web site (