HP-MPI Version 1.1 for Windows Release Note

HP-MPI V1.1 for Windows Release Note
C command line basics
44
C command line basics
The utility "%MPI_ROOT%\bin\mpicc" is included to aid in command line compilation. To
compile with this utility, set MPI_CC to the path of the command line compiler you want to use.
Specify -mpi32 or -mpi64 to indicate if you are compiling a 32- or 64-bit application. Specify
the command line options that you would normally pass to the compiler on the mpicc
command line. The mpicc utility will add additional command line options for HP-MPI
include directories and libraries. The -show option can be specified to indicate that mpicc
should display the command generated without actually executing the compilation command.
See the man page mpicc(1) for more information.
In order to construct the desired compilation command, the mpicc utility needs to know what
command line compiler is to be used, the bitness of the executable that compiler will produce,
and the syntax accepted by the compiler. These can be controlled by environment variables or
from the command line.
For example, to compile hello_world.c using a 64-bit 'cl' contained in your PATH could be
done with the following command since 'cl' and the 'Windows' syntax are defaults:
"%MPI_ROOT%\bin\mpicc" -mpi64 hello_world.c /link /out:hello_world_cl64.exe
Or, use the following example to compile using the PGI compiler which uses a more UNIX-like
syntax:
"%MPI_ROOT%\bin\mpicc" -mpicc pgcc -mpisyntax unix -mpi32 hello_world.c -o ^
hello_world_pgi32.exe
To compile C code and link against HP-MPI without utilizing the mpicc tool, start a command
prompt that has the appropriate environment settings loaded for your compiler, and use it
with the compiler option:
/I"%MPI_ROOT%\include\<32|64>"
Table 2 mpicc Utility
Environment Variable Value Command Line
MPI_CC desired compiler (default
cl)
-mpicc <value>
MPI_BITNESS 32 or 64 (no default) -mpi32 or -mpi64
MPI_WRAPPER_SYNTAX windows or unix (default
windows)
-mpisyntax <value>