Skip to content

Commit

Permalink
update pack/unpack related functions
Browse files Browse the repository at this point in the history
Signed-off-by: Howard Pritchard <howardp@lanl.gov>
  • Loading branch information
hppritcha committed Aug 29, 2024
1 parent a5de974 commit 2c5d0b2
Show file tree
Hide file tree
Showing 18 changed files with 194 additions and 367 deletions.
4 changes: 2 additions & 2 deletions VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ minor=1
release=0

# MPI Standard Compliance Level
mpi_standard_version=3
mpi_standard_subversion=1
mpi_standard_version=4
mpi_standard_subversion=0

# OMPI required dependency versions.
# List in x.y.z format.
Expand Down
87 changes: 87 additions & 0 deletions ompi/mpi/bindings/ompi_bindings/fortran_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,38 @@ def c_parameter(self):
type_ = 'MPI_Count' if self.bigcount else 'MPI_Fint'
return f'{type_} *{self.name}'

@FortranType.add('COUNT_INOUT')
class CountTypeInOut(FortranType):
"""COUNT type with INOUT INTENT"""
def declare(self):
if self.bigcount:
return f'INTEGER(KIND=MPI_COUNT_KIND), INTENT(INOUT) :: {self.name}'
else:
return f'INTEGER, INTENT(INOUT) :: {self.name}'

def use(self):
return [('mpi_f08_types', 'MPI_COUNT_KIND')]

def c_parameter(self):
type_ = 'MPI_Count' if self.bigcount else 'MPI_Fint'
return f'{type_} *{self.name}'

@FortranType.add('COUNT_OUT')
class CountTypeInOut(FortranType):
"""COUNT type with OUT INTENT"""
def declare(self):
if self.bigcount:
return f'INTEGER(KIND=MPI_COUNT_KIND), INTENT(OUT) :: {self.name}'
else:
return f'INTEGER, INTENT(IN) :: {self.name}'

def use(self):
return [('mpi_f08_types', 'MPI_COUNT_KIND')]

def c_parameter(self):
type_ = 'MPI_Count' if self.bigcount else 'MPI_Fint'
return f'{type_} *{self.name}'


@FortranType.add('DATATYPE')
class DatatypeType(FortranType):
Expand Down Expand Up @@ -420,6 +452,45 @@ def use(self):
def c_parameter(self):
return f'MPI_Aint *{self.name}'

@FortranType.add('AINT_COUNT_INOUT')
class AintCountTypeInOut(FortranType):
"""AINT/COUNT type with INOUT INTENT"""
def declare(self):
if self.bigcount:
return f'INTEGER(KIND=MPI_COUNT_KIND), INTENT(INOUT) :: {self.name}'
else:
return f'INTEGER(KIND=MPI_ADDRESS_KIND), INTENT(INOUT) :: {self.name}'

def use(self):
if self.bigcount:
return [('mpi_f08_types', 'MPI_COUNT_KIND')]
else:
return [('mpi_f08_types', 'MPI_ADDRESS_KIND')]

def c_parameter(self):
type_ = 'MPI_Count' if self.bigcount else 'MPI_Aint'
return f'{type_} *{self.name}'

@FortranType.add('AINT_COUNT_OUT')
class AintCountTypeOut(FortranType):
"""AINT/COUNT type with OUT INTENT"""
def declare(self):
if self.bigcount:
return f'INTEGER(KIND=MPI_COUNT_KIND), INTENT(OUT) :: {self.name}'
else:
return f'INTEGER(KIND=MPI_ADDRESS_KIND), INTENT(OUT) :: {self.name}'

def use(self):
if self.bigcount:
return [('mpi_f08_types', 'MPI_COUNT_KIND')]
else:
return [('mpi_f08_types', 'MPI_ADDRESS_KIND')]

def c_parameter(self):
type_ = 'MPI_Count' if self.bigcount else 'MPI_Aint'
return f'{type_} *{self.name}'


@FortranType.add('DISP')
class Disp(FortranType):
"""Displacecment type."""
Expand Down Expand Up @@ -558,3 +629,19 @@ def use(self):

def c_parameter(self):
return f'MPI_Offset *{self.name}'

@FortranType.add('CHAR_ARRAY')
class CharArray(FortranType):
"""Fortran CHAR type."""

def declare(self):
return f'CHARACTER(LEN=*), INTENT(IN) :: {self.name}'

def use(self):
return [('iso_c_binding', 'c_char')]

def declare_cbinding_fortran(self):
return f'CHARACTER(KIND=C_CHAR), INTENT(IN) :: {self.name}(*)'

def c_parameter(self):
return f'char *{self.name}'
2 changes: 2 additions & 0 deletions ompi/mpi/bindings/ompi_bindings/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,12 @@ def abi_internal_name(extname):
'DISP',
'DISP_ARRAY',
'DISP_OUT',
'COUNT_INOUT',
'COUNT_OUT',
'AINT_COUNT',
'AINT_COUNT_ARRAY',
'AINT_COUNT_OUT',
'AINT_COUNT_INOUT',
'INT_AINT_OUT',
'USER_FUNCTION',
'DATAREP_CONVERSION_FUNCTION',
Expand Down
6 changes: 0 additions & 6 deletions ompi/mpi/fortran/use-mpi-f08/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,6 @@ mpi_api_files = \
op_create_f08.F90 \
open_port_f08.F90 \
op_free_f08.F90 \
pack_external_f08.F90 \
pack_external_size_f08.F90 \
pack_f08.F90 \
pack_size_f08.F90 \
parrived_f08.F90 \
pcontrol_f08.F90 \
pready_f08.F90 \
Expand Down Expand Up @@ -393,8 +389,6 @@ mpi_api_files = \
type_size_f08.F90 \
type_size_x_f08.F90 \
type_vector_f08.F90 \
unpack_external_f08.F90 \
unpack_f08.F90 \
unpublish_name_f08.F90 \
waitany_f08.F90 \
wait_f08.F90 \
Expand Down
18 changes: 11 additions & 7 deletions ompi/mpi/fortran/use-mpi-f08/Makefile.prototype_files
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ incomplete_prototype_files = \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoall_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoallv_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoallw_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/pack_external_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/pack_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/put_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/raccumulate_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/recv_init_ts.c.in \
Expand All @@ -49,9 +47,7 @@ incomplete_prototype_files = \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/sendrecv_replace_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/sendrecv_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/ssend_init_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/ssend_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/unpack_external_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/unpack_ts.c.in
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/ssend_ts.c.in

complete_prototype_files = \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/accumulate_ts.c.in \
Expand Down Expand Up @@ -130,7 +126,13 @@ complete_prototype_files = \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/win_create_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/win_detach_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/win_allocate.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/win_allocate_shared.c.in
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/win_allocate_shared.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/unpack_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/unpack_external_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/pack_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/pack_size.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/pack_external_size.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/pack_external_ts.c.in

# TODO: Is there any way to get EXTRA_DIST to work with absolute paths? Or,
# better yet, is there some way to make these dependencies a little
Expand Down Expand Up @@ -165,6 +167,7 @@ extra_dist_prototype_files = \
ineighbor_alltoallv_ts.c.in \
neighbor_alltoall_ts.c.in \
reduce_ts.c.in \
pack_size.c.in \
pack_ts.c.in \
file_read_all_ts.c.in \
raccumulate_ts.c.in \
Expand Down Expand Up @@ -211,6 +214,7 @@ extra_dist_prototype_files = \
allreduce_ts.c.in \
allgatherv_ts.c.in \
pack_external_ts.c.in \
pack_external_size.c.in \
file_write_ordered_begin_ts.c.in \
ineighbor_allgatherv_ts.c.in \
recv_ts.c.in \
Expand Down Expand Up @@ -246,6 +250,7 @@ extra_dist_prototype_files = \
file_read_at_all_end_ts.c.in \
get_ts.c.in \
unpack_ts.c.in \
unpack_external_ts.c.in \
ibcast_ts.c.in \
bcast_ts.c.in \
bsend_ts.c.in \
Expand All @@ -255,7 +260,6 @@ extra_dist_prototype_files = \
gatherv_ts.c.in \
file_read_ordered_end_ts.c.in \
file_iread_at_ts.c.in \
unpack_external_ts.c.in \
rget_ts.c.in \
iscatterv_ts.c.in \
ireduce_scatter_ts.c.in \
Expand Down
91 changes: 0 additions & 91 deletions ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -564,63 +564,6 @@ subroutine MPI_Get_elements_x_f08(status,datatype,count,ierror)
end subroutine MPI_Get_elements_x_f08
end interface MPI_Get_elements_x

interface MPI_Pack
subroutine MPI_Pack_f08(inbuf,incount,datatype,outbuf,outsize,position,comm,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm
implicit none
@OMPI_FORTRAN_IGNORE_TKR_PREDECL@ inbuf, outbuf
@OMPI_FORTRAN_IGNORE_TKR_TYPE@, INTENT(IN) :: inbuf
@OMPI_FORTRAN_IGNORE_TKR_TYPE@ :: outbuf
INTEGER, INTENT(IN) :: incount, outsize
TYPE(MPI_Datatype), INTENT(IN) :: datatype
INTEGER, INTENT(INOUT) :: position
TYPE(MPI_Comm), INTENT(IN) :: comm
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
end subroutine MPI_Pack_f08
end interface MPI_Pack

interface MPI_Pack_external
subroutine MPI_Pack_external_f08(datarep,inbuf,incount,datatype,outbuf,outsize, &
position,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND
implicit none
CHARACTER(LEN=*), INTENT(IN) :: datarep
@OMPI_FORTRAN_IGNORE_TKR_PREDECL@ inbuf, outbuf
@OMPI_FORTRAN_IGNORE_TKR_TYPE@, INTENT(IN) :: inbuf
@OMPI_FORTRAN_IGNORE_TKR_TYPE@ :: outbuf
INTEGER, INTENT(IN) :: incount
TYPE(MPI_Datatype), INTENT(IN) :: datatype
INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: outsize
INTEGER(MPI_ADDRESS_KIND), INTENT(INOUT) :: position
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
end subroutine MPI_Pack_external_f08
end interface MPI_Pack_external

interface MPI_Pack_external_size
subroutine MPI_Pack_external_size_f08(datarep,incount,datatype,size,ierror &
)
use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND
implicit none
TYPE(MPI_Datatype), INTENT(IN) :: datatype
INTEGER, INTENT(IN) :: incount
CHARACTER(LEN=*), INTENT(IN) :: datarep
INTEGER(MPI_ADDRESS_KIND), INTENT(OUT) :: size
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
end subroutine MPI_Pack_external_size_f08
end interface MPI_Pack_external_size

interface MPI_Pack_size
subroutine MPI_Pack_size_f08(incount,datatype,comm,size,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm
implicit none
INTEGER, INTENT(IN) :: incount
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
INTEGER, INTENT(OUT) :: size
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
end subroutine MPI_Pack_size_f08
end interface MPI_Pack_size

interface MPI_Type_commit
subroutine MPI_Type_commit_f08(datatype,ierror)
use :: mpi_f08_types, only : MPI_Datatype
Expand Down Expand Up @@ -876,40 +819,6 @@ subroutine MPI_Type_vector_f08(count,blocklength,stride,oldtype,newtype,ierror)
end subroutine MPI_Type_vector_f08
end interface MPI_Type_vector

interface MPI_Unpack
subroutine MPI_Unpack_f08(inbuf,insize,position,outbuf,outcount,datatype,comm, &
ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm
implicit none
@OMPI_FORTRAN_IGNORE_TKR_PREDECL@ inbuf, outbuf
@OMPI_FORTRAN_IGNORE_TKR_TYPE@, INTENT(IN) :: inbuf
@OMPI_FORTRAN_IGNORE_TKR_TYPE@ :: outbuf
INTEGER, INTENT(IN) :: insize, outcount
INTEGER, INTENT(INOUT) :: position
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
end subroutine MPI_Unpack_f08
end interface MPI_Unpack

interface MPI_Unpack_external
subroutine MPI_Unpack_external_f08(datarep,inbuf,insize,position,outbuf,outcount, &
datatype,ierror &
)
use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND
implicit none
CHARACTER(LEN=*), INTENT(IN) :: datarep
@OMPI_FORTRAN_IGNORE_TKR_PREDECL@ inbuf, outbuf
@OMPI_FORTRAN_IGNORE_TKR_TYPE@, INTENT(IN) :: inbuf
@OMPI_FORTRAN_IGNORE_TKR_TYPE@ :: outbuf
INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: insize
INTEGER(MPI_ADDRESS_KIND), INTENT(INOUT) :: position
INTEGER, INTENT(IN) :: outcount
TYPE(MPI_Datatype), INTENT(IN) :: datatype
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
end subroutine MPI_Unpack_external_f08
end interface MPI_Unpack_external

interface MPI_Allgather_init
subroutine MPI_Allgather_init_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype, &
comm,info,request,ierror)
Expand Down
34 changes: 0 additions & 34 deletions ompi/mpi/fortran/use-mpi-f08/pack_external_f08.F90

This file was deleted.

32 changes: 32 additions & 0 deletions ompi/mpi/fortran/use-mpi-f08/pack_external_size.c.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2020 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/

PROTOTYPE VOID pack_external_size(CHAR_ARRAY datarep, COUNT incount,
DATATYPE datatype, AINT_COUNT_OUT size)
{
int c_ierr;
MPI_Datatype type = PMPI_Type_f2c(*datatype);

c_ierr = @INNER_CALL@(datarep,
OMPI_FINT_2_INT(*incount),
type, size);
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
}
Loading

0 comments on commit 2c5d0b2

Please sign in to comment.