Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] Fortran90 functions missing: MPI_COMM_GET_ATTR / MPI_ATTR_GET()
From: Jens (jens-devel_at_[hidden])
Date: 2008-12-05 10:33:36


Hi Jeff,

thanks a lot. This fixed a bug in my code.
I already like open-mpi for this :)

Greeting
Jens

Jeff Squyres schrieb:
> These functions do exist in Open MPI, but your code is not quite
> correct. Here's a new version that is correct:
>
> -----
> program main
> use mpi
> implicit none
> integer :: ierr, rank, size
> integer :: mpi1_val
> integer(kind = MPI_ADDRESS_KIND) :: mpi2_val
> logical :: attr_flag
>
> call MPI_INIT(ierr)
> call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr)
> call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierr)
>
> call MPI_COMM_GET_ATTR(MPI_COMM_WORLD, MPI_IO, mpi2_val, attr_flag, ierr)
> call MPI_ATTR_GET(MPI_COMM_WORLD, MPI_IO, mpi1_val, attr_flag, ierr)
>
> print *, "Hello, world, I am ", rank, " of ", size
> call MPI_FINALIZE(ierr)
> end
> -----
>
> Note three things:
>
> 1. attr_flag is supposed to be of type logical, not integer
> 2. In MPI-1 (MPI_ATTR_GET) the type of the value is integer
> 2. In MPI-2 (MPI_COMM_GET_ATTR), the type of the value is
> integer(kind=MPI_ADDRESS_KIND)
>
> F90 is strongly typed, so the F90 compiler is correct in claiming that
> functions of the signature you specified were not found.
>
> Make sense?
>
> I'm not sure why your original code works with MPICH2 -- perhaps they
> don't have F90 bindings for these functions, and therefore they're
> falling through to the F77 bindings (where no type checking is
> done)...? If so, you're getting lucky that it works; perhaps
> sizeof(INTEGER) == sizeof(LOGICAL), and sizeof(INTEGER) ==
> sizeof(INTEGER(KIND=MPI_ADDRESS_KIND)). That's a guess.
>
>
>
> On Dec 5, 2008, at 4:49 AM, Jens wrote:
>
>> Hi,
>>
>> I just switched from MPICH2 to openmpi because of sge-support, but I am
>> missing some mpi-functions for fortran 90.
>>
>> Does anyone know why
>> MPI_COMM_GET_ATTR()
>> MPI_ATTR_GET()
>> are not available? They work fine with MPICH2.
>>
>> I compiled openmpi 1.2.8/1.3rc on a clean CentOS 5.2 with GNU-compilers
>> and Intel 11.0. Both give me the same error:
>>
>> GNU:
>> Error: There is no specific subroutine for the generic 'mpi_attr_get'
>> at (1)
>>
>> Intel 11.0:
>> hello_f90.f90(22): error #6285: There is no matching specific subroutine
>> for this generic subroutine call. [MPI_ATTR_GET]
>> call MPI_ATTR_GET(MPI_COMM_WORLD, MPI_IO, attr_val, attr_flag, ierr)
>>
>> Any ideas ...?
>>
>> Greetings
>> Jens
>>
>> --------------------------------
>> program main
>> use mpi
>> implicit none
>> integer :: ierr, rank, size
>> integer :: attr_val, attr_flag
>>
>> call MPI_INIT(ierr)
>> call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr)
>> call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierr)
>>
>> call MPI_COMM_GET_ATTR(MPI_COMM_WORLD, MPI_IO, attr_val, attr_flag, ierr)
>> call MPI_ATTR_GET(MPI_COMM_WORLD, MPI_IO, attr_val, attr_flag, ierr)
>>
>> print *, "Hello, world, I am ", rank, " of ", size
>> call MPI_FINALIZE(ierr)
>> end
>> -------------------------------
>> _______________________________________________
>> users mailing list
>> users_at_[hidden]
>> http://www.open-mpi.org/mailman/listinfo.cgi/users
>
>