Intel® MPI Library Reference Manual for Linux* OS
Use the following options to enable the ILP64 interface
Use the Fortran compiler driver option -i8 for separate compilation and the -ilp64 option for separate linkage. For example,
$ mpiifort -i8 -c test.f
$ mpiifort -ilp64 -o test test.o
Use the mpiexec -ilp64 option to preload the ILP64 interface. For example,
$ mpiexec -ilp64 -n 2 ./myprog
Use the C compiler driver option -ilp64 for both compilation (to choose an appropriate mpi.h header) and linkage (to link against ILP64 binary). For example,
$ mpiicc –ilp64 -c test.c
$ mpiicc -ilp64 -o test test.o
If you use ILP64 data model in the C program, be cautious about mutual correspondence between C datatypes and MPI datatypes, namely, use MPI_LONG datatype while operating on data of type long int (or any other 64-bit integer type).
If you want your C program to be LP64/ILP64 portable by specifying a flexible size integer datatype, do not forget to introduce that flexibility for the MPI integer datatype. This example program is supposed to work correctly both in LP64 and ILP64 data models:
#include <stdlib.h>
#include <stdio.h>
#include “mpi.h”
#ifdef ILP64
#define my_int long
#define MY_MPI_INT MPI_LONG
#else
#define my_int int
#define MY_MPI_INT MPI_INT
#endif
int main() {
my_int i, size, rank, buf[5] = {-1, -1, -1, -1, -1};
MPI_Init( NULL, NULL );
MPI_Comm_size( MPI_COMM_WORLD, &size );
MPI_Comm_rank( MPI_COMM_WORLD, &rank );
if( size < 2 ) return 1;
if( rank == 0 ) {
for( i = 0; i < 5; i++ ) buf[i] = i;
MPI_Send( buf, 5, MY_MPI_INT, 1, 123, MPI_COMM_WORLD );
} else if( rank == 1 ) {
MPI_Recv( buf, 5, MY_MPI_INT, 0, 123, MPI_COMM_WORLD, MPI_STATUS_IGNORE );
for( i = 0; i < 5; i++ ) printf( “Received %d in buf[%d]\n”, (int)buf[i], (int)i );
}
MPI_Finalize();
return 0;
}
The program will work correctly in both variants:
$ mpiicc –o test_lp64 test.c ; mpirun –n 2 ./test_lp64
Received 0 in buf[0]
Received 1 in buf[1]
Received 2 in buf[2]
Received 3 in buf[3]
Received 4 in buf[4]
$ mpiicc –o test_ilp64 –DILP64 –ilp64 test.c ; mpirun –n 2 ./test_ilp64
Received 0 in buf[0]
Received 1 in buf[1]
Received 2 in buf[2]
Received 3 in buf[3]
Received 4 in buf[4]