simona
simona

Reputation: 2181

compiling mpirun and mpif90 for a different platform (crosscompiling?)

I have a system A (aka Host) with compilers and a system B (aka Target) where I would like to run a MPI application. On system B there is no compiler or mpirun. I would like to do the following: compile mpirun (from openmpi) on system A and then using it on system B (with executable compiled on system A). I have never compiled for a different platform. Can this thing work? What do I do with shared libraries? I see that mpirun links to :

linux-vdso.so.1 =>  (0x00002aaaaaaab000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003a89e00000)
libm.so.6 => /lib64/libm.so.6 (0x0000003a89600000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003a89a00000)
libc.so.6 => /lib64/libc.so.6 (0x0000003a89200000)
/lib64/ld-linux-x86-64.so.2 (0x0000003a88e00000) 

do I have to statically link mpirun to libraries on system A? How do I do that?


Also, I would like to know if I can compile mpif90 on system A, so I can use it directly to compile programs on system B. Keep in mind that there is no compiler on system B, and I am not willing to install them


output of uname -a on Host

Linux host 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 19:48:22 GMT 2011 x86_64 x86_64 x86_64 GNU/Linux

output of uname -a on Target

Linux target 2.6.35-32-server #67-Ubuntu SMP Mon Mar 5 21:13:25 UTC 2012 x86_64 GNU/Linux

so far I have tried to compile with the following configuration

CC=icc
FC=ifort
CXX=icpc
LDFLAGS=-static-intel

./configure --prefix=/gpfs/data/garzilli/data/local/openmpi-1.8.4-cc/ --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --enable-static --disable-shared

I know that in this case I am not technically cross-compiling, because host and build coincide, in principle they could be different. Maybe, should I also set --target, because I am compiling a compiler?

Upvotes: 0

Views: 511

Answers (1)

Wes
Wes

Reputation: 1840

It is possible to compile on one platform and execute on the other. I do this often with Fortran binaries compile with ifort and mpif90. I just ran a test where I compiled an executable with the ifort compiler and mpif90 on OpenSUSE 2.6.34 kernel x86_64 and ran it on a Amazon Linux kernel version 3.14 x86_64 that had no mpi libs installed.

The problem is that without mpirun (or mpiexec), you will only be able to run a single instance of the program. So, if you have to launch multiple instances, you will need something like mpirun on the other machine (system B) to launch the multiple instances.

Upvotes: 0

Related Questions