Visible to Intel only — GUID: GUID-777AE09D-BB0D-4B0C-8E14-5054075F8BD7
Visible to Intel only — GUID: GUID-777AE09D-BB0D-4B0C-8E14-5054075F8BD7
Compiling an MPI Program
This topic describes the basic steps required to compile and link an MPI program, using the Intel® MPI Library SDK.
To simplify linking with MPI library files, Intel MPI Library provides a set of compiler wrapper scripts with the mpi prefix for all supported compilers. To compile and link an MPI program, do the following:
Make sure you have a compiler in your PATH environment variable. For example, to check if you have the Intel® C/C++ Compiler, enter the command:
> icl
If the command is not found, add the full path to your compiler into the PATH. For Intel® compilers, you can run the script setvars.bat to set the required environment variables.
NOTE:If you are using Intel MPI in a Unified Directory Layout, set the environment variables using the C:\Program Files (x86)\Intel\oneAPI\<toolkit-version-number>\oneapi_setvars.bat script instead. To understand more about the Unified Directory Layout, including how the environment is initialized and the advantages of using the layout, see Use the setvars and oneapi-vars Scripts with Windows*.In the same command-line session, run the setvars.bat script in the installation directory to set the proper environment variables for the Intel MPI Library (the default installation directory location is C:\Program Files(x86)\Intel\oneAPI\<version>
Compile your MPI program using the appropriate compiler wrapper script. For example, to compile a C program with the Intel® C Compiler, use the mpiicc script as follows:
> mpiicx myprog.c -o myprog
You will get an executable file myprog.exe in the current directory, which you can start immediately. For instructions of how to launch MPI applications, see Running an MPI Program.
For details on the available compiler wrapper scripts, see the Developer Reference.
Compiling an MPI/OpenMP* Program
To compile a hybrid MPI/OpenMP* program using the Intel® compiler, use the /Qopenmp option. For example:
> mpiicx /Qopenmp test.c
This enables the underlying compiler to generate multi-threaded code based on the OpenMP* pragmas in the source. For details on running such programs, refer to Running an MPI/OpenMP* Program.
Test MPI Programs
The Intel® MPI Library comes with a set of source files for simple MPI programs that enable you to test your installation. Test program sources are available for all supported programming languages and are located in the test directory in your installation directory.