BDF编译:mpi_info设置不正确

问题

Fatal error in MPI_Win_allocate: Invalid argument, error stack:
MPI_Win_allocate(173): MPI_Win_allocate(size=8, disp_unit=8, info=0x0, MPI_COMM_WORLD, base=0x459d540, win=0x459d100) failed
MPI_Win_allocate(98).: Invalid MPI_Info

解决方案

其实可以清楚的看到,是这个info的值设定的不正确。在源代码中这个语句为

 call MPI_WIN_ALLOCATE(nsize_queue,disp_unit_queue,mpi_info_null,comm_queue,cptr_task, win_task_queue,ierror)

其中info_queue定义为整型。赋值为0

找了一下mpi_win_allocate的man

man mpi_win_allocate

打印信息如下

NAME
       MPI_Win_allocate -  Create and allocate an MPI Window object for one-sided communication.

SYNOPSIS
       int MPI_Win_allocate(MPI_Aint size, int disp_unit, MPI_Info info,
                         MPI_Comm comm, void *baseptr, MPI_Win *win)

   This  is  a collective call executed by all processes in the group of comm. On each process, it allocates memory
       of at least size bytes, returns a pointer to it, and returns a window object that can be used by  all  processes
       in comm to perform RMA operations. The returned memory consists of size bytes local to each process, starting at
       address baseptr and is associated with the window as if the user called MPI_Win_create on existing  memory.  The
       size  argument  may  be  different  at each process and size = 0 is valid; however, a library might allocate and
       expose more memory in order to create a fast, globally symmetric allocation.

INPUT PARAMETERS
       size   - size of window in bytes (nonnegative integer)
       disp_unit
              - local unit size for displacements, in bytes (positive integer)
       info   - info argument (handle)
       comm   - communicator (handle)

OUTPUT PARAMETERS
       baseptr
              - base address of the window in local memory
       win    - window object returned by the call (handle)

NOTES FOR FORTRAN
       All MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK ) have an additional argument ierr at the end of
       the argument list.  ierr is an integer and has the same meaning as the return value of the  routine  in  C.   In
       Fortran, MPI routines are subroutines, and are invoked with the call statement.  All MPI objects (e.g., MPI_Datatype 
       , MPI_Comm ) are of type INTEGER in Fortran.
    

可以看到这里解释的mpi_info为句柄,但是,又说对于fortran而言将这些mpi_info等等类型看成是integer即整型,按理说不应该有问题的,后来查看了一些文献,虽然没有发现问题在哪里,但是将info_queue改成mpi_info_null竟然就通过了。

思考

老师写这些代码是针对openmpi而言的,应该是跑通了,而我用的是Intel mpi 所以可能针对某些参数有些不同,应该先问问老师的编译环境是什么的。


  1. 推荐一些有用的学习mpi的网站和书籍
    https://www.open-mpi.org/doc/current/ openmpi官网,有简略的函数介绍
    《 Parallel Programming for Multicore and Cluster Systems》 一本讲的很清楚的mpi入门书籍,每章后面有习题。讲了mpi-2,但是之后版本的就没有介绍了
    https://www.mpi-forum.org/docs/ MPI 各版本的使用手册,但是感觉上面那本书讲的详尽
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值