简体   繁体   English

为另一个平台编译mpirun和mpif90(交叉编译?)

[英]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. 我有一个带有编译器的系统A(又称主机)和一个我想运行MPI应用程序的系统B(又称目标)。 On system B there is no compiler or mpirun. 在系统B上,没有编译器或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). 我想执行以下操作:在系统A上编译mpirun(来自openmpi),然后在系统B上使用它(在系统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 : 我看到mpirun链接到:

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? 我必须将mpirun静态链接到系统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 另外,我想知道是否可以在系统A上编译mpif90,因此可以直接使用它在系统B上编译程序。请记住,系统B上没有编译器,并且我不愿意安装它们


output of uname -a on Host 在主机上输出uname -a

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 在目标上输出uname -a

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? 也许,因为要编译一个编译器,我还应该设置--target吗?

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. 我经常使用Fortran二进制文件使用ifort和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. 我只是运行了一个测试,在OpenSUSE 2.6.34内核x86_64上使用ifort编译器和mpif90编译了可执行文件,并在未安装mpi库的Amazon Linux内核3.14 x86_64版本上运行了该测试。

The problem is that without mpirun (or mpiexec), you will only be able to run a single instance of the program. 问题在于,没有mpirun(或mpiexec),您将只能运行该程序的单个实例。 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. 因此,如果必须启动多个实例,则需要在另一台计算机(系统B)上使用诸如mpirun之类的东西来启动多个实例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM