mpi_f08: fix MPI_BUFFER_DETACH interfaces
Add an mpi_f08-specific implementation for MPI_BUFFER_DETACH. Per MPI-3.1:3.6, p45, the buffer argument is ignored in MPI_BUFFER_DETACH for mpif.h and the mpi module. But in the mpi_f08 module, the buffer argument is treated like it is in the C binding.
Этот коммит содержится в:
родитель
77367ca02c
Коммит
bd94da7de4
@ -10,7 +10,7 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2011-2015 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -65,14 +65,17 @@ OMPI_GENERATE_F77_BINDINGS (MPI_BUFFER_DETACH,
|
||||
#include "ompi/mpi/fortran/mpif-h/profile/defines.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* MPI-3.1 section 3.6, page 45, states that the mpif.h and mpi module
|
||||
* interfaces for MPI_BUFFER_DETACH ignore the buffer argument.
|
||||
* Therefore, for the mpif.h and mpi module interfaces, we use a dummy
|
||||
* variable and leave the value handed in alone.
|
||||
*
|
||||
* The mpi_f08 implementation for MPI_BUFFER_DETACH is a separate
|
||||
* routine -- see below.
|
||||
*/
|
||||
void ompi_buffer_detach_f(char *buffer, MPI_Fint *size, MPI_Fint *ierr)
|
||||
{
|
||||
/*
|
||||
* It does not make sense in fortran to return a pointer
|
||||
* here as the user may get a behavior that is unexpected.
|
||||
* Therefore, we use a dummy variable and leave the value
|
||||
* handed in alone.
|
||||
*/
|
||||
int c_ierr;
|
||||
void *dummy;
|
||||
OMPI_SINGLE_NAME_DECL(size);
|
||||
@ -83,3 +86,25 @@ void ompi_buffer_detach_f(char *buffer, MPI_Fint *size, MPI_Fint *ierr)
|
||||
OMPI_SINGLE_INT_2_FINT(size);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Per above, this is the mpi_f08 module implementation of
|
||||
* MPI_BUFFER_DETACH. It handles the buffer arugment just like the C
|
||||
* binding.
|
||||
*/
|
||||
void ompi_buffer_detach_f08(char *buffer, MPI_Fint *size, MPI_Fint *ierr)
|
||||
{
|
||||
int c_ierr;
|
||||
void *dummy;
|
||||
|
||||
OMPI_SINGLE_NAME_DECL(size);
|
||||
c_ierr = MPI_Buffer_detach(&dummy, OMPI_SINGLE_NAME_CONVERT(size));
|
||||
if (NULL != ierr) {
|
||||
*(void **)buffer = dummy;
|
||||
*ierr = OMPI_INT_2_FINT(c_ierr);
|
||||
}
|
||||
|
||||
if (MPI_SUCCESS == c_ierr) {
|
||||
OMPI_SINGLE_INT_2_FINT(size);
|
||||
}
|
||||
}
|
||||
|
@ -189,8 +189,11 @@ subroutine ompi_buffer_attach_f(buffer,size,ierror) &
|
||||
INTEGER, INTENT(OUT) :: ierror
|
||||
end subroutine ompi_buffer_attach_f
|
||||
|
||||
! Note that we have an F08-specific C implementation function for
|
||||
! MPI_BUFFER_DETACH (i.e., it is different than the mpif.h / mpi
|
||||
! module C implementation function).
|
||||
subroutine ompi_buffer_detach_f(buffer_addr,size,ierror) &
|
||||
BIND(C, name="ompi_buffer_detach_f")
|
||||
BIND(C, name="ompi_buffer_detach_f08")
|
||||
USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR
|
||||
implicit none
|
||||
TYPE(C_PTR), INTENT(OUT) :: buffer_addr
|
||||
|
@ -91,8 +91,16 @@ subroutine pompi_buffer_attach_f(buffer,size,ierror) &
|
||||
INTEGER, INTENT(OUT) :: ierror
|
||||
end subroutine pompi_buffer_attach_f
|
||||
|
||||
! Note that we have an F08-specific C implementation function for
|
||||
! PMPI_BUFFER_DETACH (i.e., it is different than the mpif.h / mpi
|
||||
! module C implementation function).
|
||||
!
|
||||
! Note, too, we don't need a "p" version of the C implementation
|
||||
! function -- Fortran's interfaces provide MPI_ and PMPI_ names for
|
||||
! us; they can just both be bound to the same back-end
|
||||
! ompi_buffer_detach_f08 C function.
|
||||
subroutine pompi_buffer_detach_f(buffer_addr,size,ierror) &
|
||||
BIND(C, name="pompi_buffer_detach_f")
|
||||
BIND(C, name="ompi_buffer_detach_f08")
|
||||
implicit none
|
||||
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer_addr
|
||||
INTEGER, INTENT(OUT) :: size
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user