On May 21, 2016, at 12:17 PM, Andrea Negri <negri.an...@gmail.com> wrote:
> 
> Hi, in the last few days I ported my entire fortran mpi code to "use
> mpif_08". You really did a great job with this interface. However,
> since HDF5 still uses integers to handle communicators, I have a
> module where I still use "use mpi", and with gfortran 5.3.0 and
> openmpi-1.10.2 I got some errors.

FWIW, you can actually mix integer handles with mpi_f08 handles.  The mpi_f08 
handles are derived datatypes that contain exactly one member: an integer.

For example, if you call a subroutine with an integer MPI handle as a dummy 
parameter, and that subroutine has a Type(MPI_Comm)::comm variable, you can 
assign:

comm%mpi_val = integer_handle

And then use that Type(MPI_Comm) as an mpi_f08 handle.

The opposite is true, too -- you can extract the %mpi_val from an mpi_f08 
handle and use it as an integer handle with "use mpi" or mpif.h interfaces.

Meaning: the %mpi_val value is exactly equivalent to the integer handles.

> I have been able to produce an extremely minimalistic example that
> reproduces the same errors. If you try to compile with mpifort -c this
> file

I think you had a typo -- it should be "use test1_mod", right?

I expanded your code a little to give it a program, and run it:

-----
  !==========================================                                   
      
module test1_mod
  ! I use ONLY here just to show you that errors happen even with  ONLY         
      
  use mpi, only: MPI_BARRIER,  MPI_COMM_WORLD
  implicit none
  private
  public ::  test1
contains
  subroutine test1(a)
    implicit none
    real, intent(inout) :: a
    integer :: ierr
    a=0
    print *, "Here I am"
    call MPI_INIT(ierr)
    call mpi_barrier(MPI_COMM_WORLD, ierr)
    call MPI_FINALIZE(ierr)
    print *, "Done with finalize"
  endsubroutine test1
endmodule test1_mod



module prova2
  use mpi_f08
  implicit none
  public :: prova3
contains
  subroutine prova3
    use test1_mod
    implicit none
    real :: a

    call test1(a)
  endsubroutine prova3
endmodule prova2
!==========================================                                     
      

program doit
  use prova2
  implicit none

  call prova3()
end program doit
-----

I then compiled it with the Intel compiler and ran it:

-----
$ mpifort mix-usempi-usempif08-2.f90 -I. && mpirun -np 2 ./a.out
 Here I am
 Here I am
 Done with finalize
 Done with finalize
-----

Now that does not mean that there isn't a bug in OMPI -- I'm just saying that 
it works with the Intel compiler.

I tried the following:

- Open MPI dev master with icc: works
- Open MPI dev master with gcc 5.2.0: works
- Open MPI v1.10.x head with icc: works
- Open MPI v1.10.x head with gcc 5.2.0: same errors you got
- Open MPI v2.x head with gcc 5.2.0: works

We have clearly changed something since v1.10.x, but I don't know offhand 
exactly what would have caused this difference.

Is there a chance you can use the Intel compiler?  Or the Open MPI v2.0.0 rc?

-- 
Jeff Squyres
jsquy...@cisco.com
For corporate legal information go to: 
http://www.cisco.com/web/about/doing_business/legal/cri/

Reply via email to