我在fortran中编写了一个使用MPI进行并行化的代码,我总是使用gfortran作为编译器,但现在我想使用Intel ifort。问题是在服务器上我尝试为mpif90运行它,gnu编译器被设置为默认值:
mpif90 --showme
gfortran -I/usr/lib/openmpi/include -pthread -I/usr/lib/openmpi/lib -L/usr//lib -L/usr/lib/openmpi/lib -lmpi_f90 -lmpi_f77 -lmpi -ldl -lhwloc
我不知道我要用ifort包含哪些标志。我这样试过:
ifort -openmp test_mpi.f -I/usr/local/openmpi-1.8.4-intel/include -I/usr/local/openmpi-1.8.4-intel/lib -L/usr/local/openmpi-1.8.4-intel/lib -lmpi_f90 -lmpi_f77 -lmpi
这让我输出:
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib//libmpi_f77.so: undefined reference to `opal_uses_threads'
我尝试使用的不是英特尔OpenMpi,而是使用/ usr / lib / openmpi /,而不是程序编译,但在执行时我得到:
./a.out: error while loading shared libraries: libiomp5.so: cannot open shared object file: No such file or directory
由于查找了echo $ LD_LIBRARY_PATH:
,因此连线/opt/intel/composer_xe_2013.5.192/compiler/lib/intel64:/opt/intel/composer_xe_2013.5.192/mpirt/lib/intel64:/opt/intel/composer_xe_2013.5.192/ipp/../compiler/lib/intel64:/opt/intel/composer_xe_2013.5.192/ipp/lib/intel64:/opt/intel/composer_xe_2013.5.192/compiler/lib/intel64:/opt/intel/composer_xe_2013.5.192/mkl/lib/intel64:/opt/intel/composer_xe_2013.5.192/tbb/lib/intel64/gcc4.4
并且在/opt/intel/composer_xe_2013.5.192/compiler/lib/intel64中有" libiomp5.so"。
有谁知道如何修复我的编译器标志?
@HighPerformanceMark: 我现在这样做了:
ifort -openmp test_mpi.f -I/opt/intel/mpi-rt/4.1.0/include -I/opt/intel/mpi-rt/4.1.0/lib -L/opt/intel/mpi-rt/4.1.0/lib -lmpi_f90 -lmpi_f77 -lmpi
给了我:
ld: skipping incompatible /opt/intel/mpi-rt/4.1.0/lib/libmpi.so when searching for -lmpi ld: skipping incompatible /opt/intel/mpi-rt/4.1.0/lib/libmpi.a when searching for -lmpi
跳过-lmpi
错误:
include -I/opt/intel/mpi-rt/4.1.0/lib -L/opt/intel/mpi-rt/4.1.0/lib -lmpi_f90 -lmpi_f77 ld: /tmp/ifort41PQRn.o: undefined reference to symbol 'mpi_null_delete_fn_' ld: note: 'mpi_null_delete_fn_' is defined in DSO /usr/lib/libmpi.so.1 so try adding it to the linker command line /usr/lib/libmpi.so.1: could not read symbols: Invalid operation
出现了!