构建MPI程序时出错 [英] Error in building MPI program

查看:282
本文介绍了构建MPI程序时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是MPI的新手。我试图编写一个用MPI和FORTRAN计算PI的程序。但是,当我尝试构建程序时,我收到以下消息。

  make all 
gfortran -O2 -g \\ \\
-o bin / MpiTest.exe \
src / MpiTest.f -fno-range-check
C:/ Program Files / MicrosoftMPI / Inc / mpif.h:344.38:
包含在src / MpiTest.f中:11:

PARAMETER(MPI_AINT = z'4c00043b')
1
错误:'mpi_aint'的PARAMETER属性与PARAMETER冲突属性在(1)
C:/ Program Files / MicrosoftMPI / Inc / mpif.h:359.35:
包含在src / MpiTest.f中:11:

PARAMETER(MPI_ADDRESS_KIND = INT_PTR_KIND())
1
错误:在(1)初始化表达式中的函数'int_ptr_kind'必须是内部函数
make:*** [all]错误1

任何人都可以帮我吗?



p>

  PROGRAM CAL culatePI 
包含C:/ Program Files / MicrosoftMPI / Inc / mpif.h

INTEGER :: i = 0,nThrows = 0,nSuccess = 0,ierror = 0,numOfProcessors = 0,myID = 0
REAL :: x = 0,y = 0,results = 0

INTEGER :: Counter = 0

call mpi_init(ierror)
调用mpi_comm_rank(MPI_COMM_WORLD,myID,ierror)
调用mpi_comm_size(MPI_COMM_WORLD,numOfProcessors,ierror)
....


解决方案

INT_PTR_KIND 是英特尔Fortran编译器扩展功能;也就是说,它不是Fortran的内在。您报告的第二条错误消息表明,在编译包含对其无法找到的函数的引用的代码时, gfortran 会阻挠。我猜第一个错误是出于同样的问题,你正试图用'错误的'编译器进行编译。



正如Alexander Vogt所建议的,使用编译器包装器,如 mpif90 ,但它必须是正确的包装器,即调用gfortran并与MS MPI库链接的包装器。不知道这个包装是否存在我不知道,但是在 C:/ Program Files / MicrosoftMPI / 下查找。



但是,由于这些错误来自你包含的 mpif.h 文件,你还必须找到一个相应的包含文件来编译 gfortran 。我不使用MS MPI,但如果您发现它只提供用于与英特尔Fortran编译的工具,库和包含文件,则不会感到意外。


I'm new to MPI. I'm trying to write a program for calculating PI using MPI and FORTRAN. But when I try to build the program I get the following messages.

make all
 gfortran -O2 -g \
    -o bin/MpiTest.exe \
    src/MpiTest.f -fno-range-check
C:/Program Files/MicrosoftMPI/Inc/mpif.h:344.38:
    Included at src/MpiTest.f:11:

       PARAMETER (MPI_AINT=z'4c00043b')                                 
                                      1
Error: PARAMETER attribute of 'mpi_aint' conflicts with PARAMETER attribute at (1)
C:/Program Files/MicrosoftMPI/Inc/mpif.h:359.35:
    Included at src/MpiTest.f:11:

       PARAMETER (MPI_ADDRESS_KIND=INT_PTR_KIND())                      
                                   1
Error: Function 'int_ptr_kind' in initialization expression at (1) must be an intrinsic function
make: *** [all] Error 1

Can anyone help me here ?

P.S :

PROGRAM CalculatePI
        include "C:/Program Files/MicrosoftMPI/Inc/mpif.h"

            INTEGER :: i = 0, nThrows = 0, nSuccess = 0, ierror =0, numOfProcessors=0,myID=0
            REAL :: x = 0, y = 0, results = 0

            INTEGER :: Counter = 0

            call mpi_init(ierror)
            call mpi_comm_rank(MPI_COMM_WORLD, myID, ierror)
            call mpi_comm_size(MPI_COMM_WORLD, numOfProcessors, ierror)
            ....

解决方案

INT_PTR_KIND is an Intel Fortran compiler extension function; that is, it is not a Fortran intrinsic. The second of the error messages that you report indicates that gfortran is baulking at compiling code which contains references to a function it can't find. I guess the first error arises from the same problem, you are trying to compile with the 'wrong' compiler.

As Alexander Vogt has suggested you might make better progress using a compiler wrapper such as mpif90, but it has to be the right wrapper, the one which calls gfortran and links with the MS MPI library. Whether that wrapper exists I do not know, but look for it under C:/Program Files/MicrosoftMPI/.

However, since those errors emanate from the mpif.h file you have included you'll also have to find a corresponding include file for compiling with gfortran. I don't use MS MPI but it won't surprise me if you find that it only provides tools, libraries and include files for compilation with Intel Fortran.

这篇关于构建MPI程序时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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