通过带有gfortran的mpi_f08模块对MPI Fortran的支持 [英] MPI Fortran support through the mpi_f08 module with gfortran

查看:177
本文介绍了通过带有gfortran的mpi_f08模块对MPI Fortran的支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些要与MPI并行的Fortran代码.显然,推荐的方法是通过 mpi_f08 模块(此讨论给我的印象是,因为gfortran可以建立F08绑定.在下面可以看到我的配置,gfortran和mpich都是通过ubuntu上的apt install安装的,应该是最新的.我不确定几件事:

I have some Fortran code I would like to paralelize with MPI. Appereantly, recomended way to use MPI (MPICH, in my case) with Fortran is through mpi_f08 module (mpi-forum entry on the matter), but I have trouble making it work, since corresponding mod file is simply not created (unlike mpi.mod, which works fine, but it's not up to date with Fortran standart). This discussion left me under the impression it's because gfortran can't build the F08 bindings. Below you can see my configuration, both gfortran and mpich have been installed throught apt install on ubuntu and should be up to date. I'm unsure about a few things :

  • 是否有任何方法可以使Fortran 2008 MPI语法与gfortran一起使用?从我遇到的情况来看,似乎答案是否定的,但希望有人可能会知道解决方法.我对此不太了解,因此任何相关的链接或更多入门级别的解释都将不胜感激.
  • 可以使用其他编译器帮助吗?也许是英特尔编译器*?如果合理的话,我宁愿坚持使用gfortran.
  • 也许与当前的标准保持一致并不是什么大问题.根据您的经验,仅通过mpi.mod模块获得支持会更好吗?那我能期待什么问题呢?我的应用程序没有长期的雄心壮志,因此,如果现在可以正常运行,那么一段时间后失去支持将不是一个大问题.

使用gfortran的过时版本似乎存在问题.这将我的问题简化为如何使用gfortran-10构建MPICH.

It seem's to have been problem of using outdated version of gfortran. This reduces my question to how to build MPICH with gfortran-10.

为清楚起见,这里有我的gfortran和mpich配置

Just for clarity, there's my gfortran and mpich configuration

pavel@pavel:~$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) 

pavel@pavel:~$ mpiexec --version
HYDRA build details:
    Version:                                 3.3a2
    Release Date:                            Sun Nov 13 09:12:11 MST 2016
    CC:                              gcc   -Wl,-Bsymbolic-functions -Wl,-z,relro 
    CXX:                             g++   -Wl,-Bsymbolic-functions -Wl,-z,relro 
    F77:                             gfortran  -Wl,-Bsymbolic-functions -Wl,-z,relro 
    F90:                             gfortran  -Wl,-Bsymbolic-functions -Wl,-z,relro 
    Configure options:                       '--disable-option-checking' '--prefix=/usr' '--build=x86_64-linux-gnu' '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--sysconfdir=/etc' '--localstatedir=/var' '--disable-silent-rules' '--libdir=${prefix}/lib/x86_64-linux-gnu' '--libexecdir=${prefix}/lib/x86_64-linux-gnu' '--disable-maintainer-mode' '--disable-dependency-tracking' '--with-libfabric' '--enable-shared' '--enable-fortran=all' '--disable-rpath' '--disable-wrapper-rpath' '--sysconfdir=/etc/mpich' '--libdir=/usr/lib/x86_64-linux-gnu' '--includedir=/usr/include/mpich' '--docdir=/usr/share/doc/mpich' '--with-hwloc-prefix=system' '--enable-checkpointing' '--with-hydra-ckpointlib=blcr' 'CPPFLAGS= -Wdate-time -D_FORTIFY_SOURCE=2 -I/build/mpich-O9at2o/mpich-3.3~a2/src/mpl/include -I/build/mpich-O9at2o/mpich-3.3~a2/src/mpl/include -I/build/mpich-O9at2o/mpich-3.3~a2/src/openpa/src -I/build/mpich-O9at2o/mpich-3.3~a2/src/openpa/src -D_REENTRANT -I/build/mpich-O9at2o/mpich-3.3~a2/src/mpi/romio/include' 'CFLAGS= -g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -Wformat -Werror=format-security -O2' 'CXXFLAGS= -g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -Wformat -Werror=format-security -O2' 'FFLAGS= -g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -O2' 'FCFLAGS= -g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -O2' 'build_alias=x86_64-linux-gnu' 'MPICHLIB_CFLAGS=-g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -Wformat -Werror=format-security' 'MPICHLIB_CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'MPICHLIB_CXXFLAGS=-g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong -Wformat -Werror=format-security' 'MPICHLIB_FFLAGS=-g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong' 'MPICHLIB_FCFLAGS=-g -O2 -fdebug-prefix-map=/build/mpich-O9at2o/mpich-3.3~a2=. -fstack-protector-strong' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro' 'FC=gfortran' 'F77=gfortran' 'MPILIBNAME=mpich' '--cache-file=/dev/null' '--srcdir=.' 'CC=gcc' 'LIBS=' 'MPLLIBNAME=mpl'
    Process Manager:                         pmi
    Launchers available:                     ssh rsh fork slurm ll lsf sge manual persist
    Topology libraries available:            hwloc
    Resource management kernels available:   user slurm ll lsf sge pbs cobalt
    Checkpointing libraries available:       blcr
    Demux engines available:                 poll select

尝试使用 mpif90 编译我的代码会导致

trying to compile my code with mpif90 leads to

something.f90:2:5:

  use mpi_f08
     1
Fatal Error: Can't open module file ‘mpi_f08.mod’ for reading at (1): File does not exist
compilation terminated.

推荐答案

MPICH要求Fortran编译器支持技术规范29113的数组描述符,并且仅在 gfortran 的最新版本中支持(GNU 10没问题).英特尔编译器已经好一阵子了.

MPICH requires the Fortran compiler to support the array descriptor of Technical Specification 29113, and this is only supported in recent versions of gfortran (GNU 10 is ok). Intel compilers have been fine for a while fwiw.

请注意,打开MPI并不挑剔.TS 29113,不需要支持数组描述符.GNU 7.5可用于生成 mpi_f08 模块.

Note that Open MPI is not that picky w.r.t. TS 29113 and does not need support for the array descriptor. GNU 7.5 can be used to generate the mpi_f08 module.

最重要的是,您有两个选择. mpi_f08 Fortran模块:

Bottom line, you have two options w.r.t. the mpi_f08 Fortran module:

  • 使用满足MPICH预期的Fortran支持TS 29113(例如GNU 10或Intel编译器)
  • 移动以打开MPI

这篇关于通过带有gfortran的mpi_f08模块对MPI Fortran的支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆