Skip to content

Commit 3006db4

Browse files
committed
mpif08: add remaining datatype constructors
needing bigcount variants: create_hindexed create_hindexed_block create_hvector create_indexed_block fix a problem in the fortran data type py code. add a AINT_COUNT in type for fortran too. Signed-off-by: Howard Pritchard <howardp@lanl.gov>
1 parent 22c44cd commit 3006db4

12 files changed

+189
-173
lines changed

ompi/mpi/bindings/ompi_bindings/fortran_type.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ def use(self):
470470
return [('mpi_f08_types', 'MPI_ADDRESS_KIND')]
471471

472472
def c_parameter(self):
473-
count_type = 'MPI_Count' if self.bigcount else 'MPI_Fint'
473+
count_type = 'MPI_Count' if self.bigcount else 'MPI_Aint'
474474
return f'{count_type} *{self.name}'
475475

476476

@@ -503,6 +503,26 @@ def c_parameter(self):
503503
return f'MPI_Aint *{self.name}'
504504

505505

506+
@FortranType.add('AINT_COUNT')
507+
class AintCountTypeIn(FortranType):
508+
"""AINT/COUNT type with ININTENT"""
509+
def declare(self):
510+
if self.bigcount:
511+
return f'INTEGER(KIND=MPI_COUNT_KIND), INTENT(IN) :: {self.name}'
512+
else:
513+
return f'INTEGER(KIND=MPI_ADDRESS_KIND), INTENT(IN) :: {self.name}'
514+
515+
def use(self):
516+
if self.bigcount:
517+
return [('mpi_f08_types', 'MPI_COUNT_KIND')]
518+
else:
519+
return [('mpi_f08_types', 'MPI_ADDRESS_KIND')]
520+
521+
def c_parameter(self):
522+
type_ = 'MPI_Count' if self.bigcount else 'MPI_Aint'
523+
return f'{type_} *{self.name}'
524+
525+
506526
@FortranType.add('AINT_COUNT_INOUT')
507527
class AintCountTypeInOut(FortranType):
508528
"""AINT/COUNT type with INOUT INTENT"""

ompi/mpi/fortran/use-mpi-f08/Makefile.am

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,6 @@ mpi_api_files = \
326326
type_create_f90_complex_f08.F90 \
327327
type_create_f90_integer_f08.F90 \
328328
type_create_f90_real_f08.F90 \
329-
type_create_hindexed_f08.F90 \
330-
type_create_hvector_f08.F90 \
331-
type_create_indexed_block_f08.F90 \
332-
type_create_hindexed_block_f08.F90 \
333329
type_create_keyval_f08.F90 \
334330
type_create_resized_f08.F90 \
335331
type_delete_attr_f08.F90 \

ompi/mpi/fortran/use-mpi-f08/Makefile.prototype_files

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,11 @@ complete_prototype_files = \
140140
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/type_create_darray.c.in \
141141
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/type_get_true_extent.c.in \
142142
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/type_create_subarray.c.in \
143-
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/type_create_struct.c.in
143+
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/type_create_struct.c.in \
144+
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/type_create_hindexed.c.in \
145+
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/type_create_hindexed_block.c.in \
146+
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/type_create_indexed_block.c.in \
147+
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/type_create_hvector.c.in
144148

145149
# TODO: Is there any way to get EXTRA_DIST to work with absolute paths? Or,
146150
# better yet, is there some way to make these dependencies a little

ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.h.in

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -473,58 +473,6 @@ subroutine MPI_Type_commit_f08(datatype,ierror)
473473
end subroutine MPI_Type_commit_f08
474474
end interface MPI_Type_commit
475475

476-
interface MPI_Type_create_hindexed
477-
subroutine MPI_Type_create_hindexed_f08(count,array_of_blocklengths, &
478-
array_of_displacements,oldtype,newtype,ierror)
479-
use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND
480-
implicit none
481-
INTEGER, INTENT(IN) :: count
482-
INTEGER, INTENT(IN) :: array_of_blocklengths(count)
483-
INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: array_of_displacements(count)
484-
TYPE(MPI_Datatype), INTENT(IN) :: oldtype
485-
TYPE(MPI_Datatype), INTENT(OUT) :: newtype
486-
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
487-
end subroutine MPI_Type_create_hindexed_f08
488-
end interface MPI_Type_create_hindexed
489-
490-
interface MPI_Type_create_hvector
491-
subroutine MPI_Type_create_hvector_f08(count,blocklength,stride,oldtype,newtype,ierror)
492-
use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND
493-
implicit none
494-
INTEGER, INTENT(IN) :: count, blocklength
495-
INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: stride
496-
TYPE(MPI_Datatype), INTENT(IN) :: oldtype
497-
TYPE(MPI_Datatype), INTENT(OUT) :: newtype
498-
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
499-
end subroutine MPI_Type_create_hvector_f08
500-
end interface MPI_Type_create_hvector
501-
502-
interface MPI_Type_create_indexed_block
503-
subroutine MPI_Type_create_indexed_block_f08(count,blocklength, &
504-
array_of_displacements,oldtype,newtype,ierror)
505-
use :: mpi_f08_types, only : MPI_Datatype
506-
implicit none
507-
INTEGER, INTENT(IN) :: count, blocklength
508-
INTEGER, INTENT(IN) :: array_of_displacements(count)
509-
TYPE(MPI_Datatype), INTENT(IN) :: oldtype
510-
TYPE(MPI_Datatype), INTENT(OUT) :: newtype
511-
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
512-
end subroutine MPI_Type_create_indexed_block_f08
513-
end interface MPI_Type_create_indexed_block
514-
515-
interface MPI_Type_create_hindexed_block
516-
subroutine MPI_Type_create_hindexed_block_f08(count,blocklength, &
517-
array_of_displacements,oldtype,newtype,ierror)
518-
use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND
519-
implicit none
520-
INTEGER, INTENT(IN) :: count, blocklength
521-
INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: array_of_displacements(count)
522-
TYPE(MPI_Datatype), INTENT(IN) :: oldtype
523-
TYPE(MPI_Datatype), INTENT(OUT) :: newtype
524-
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
525-
end subroutine MPI_Type_create_hindexed_block_f08
526-
end interface MPI_Type_create_hindexed_block
527-
528476
interface MPI_Type_create_resized
529477
subroutine MPI_Type_create_resized_f08(oldtype,lb,extent,newtype,ierror)
530478
use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3+
* University Research and Technology
4+
* Corporation. All rights reserved.
5+
* Copyright (c) 2004-2005 The University of Tennessee and The University
6+
* of Tennessee Research Foundation. All rights
7+
* reserved.
8+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9+
* University of Stuttgart. All rights reserved.
10+
* Copyright (c) 2004-2005 The Regents of the University of California.
11+
* All rights reserved.
12+
* Copyright (c) 2011-2014 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2015 Research Organization for Information Science
14+
* and Technology (RIST). All rights reserved.
15+
* $COPYRIGHT$
16+
*
17+
* Additional copyrights may follow
18+
*
19+
* $HEADER$
20+
*/
21+
22+
PROTOTYPE VOID type_create_hindexed(COUNT count,
23+
COUNT_ARRAY array_of_blocklengths,
24+
AINT_COUNT_ARRAY array_of_displacements,
25+
DATATYPE oldtype,
26+
DATATYPE_OUT newtype)
27+
{
28+
int c_ierr;
29+
MPI_Datatype c_old = PMPI_Type_f2c(*oldtype);
30+
MPI_Datatype c_new;
31+
OMPI_ARRAY_NAME_DECL(array_of_blocklengths);
32+
33+
OMPI_ARRAY_FINT_2_INT(array_of_blocklengths, *count);
34+
35+
c_ierr = @INNER_CALL@(OMPI_FINT_2_INT(*count),
36+
OMPI_ARRAY_NAME_CONVERT(array_of_blocklengths),
37+
array_of_displacements, c_old,
38+
&c_new);
39+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
40+
41+
if (MPI_SUCCESS == c_ierr) {
42+
*newtype = PMPI_Type_c2f(c_new);
43+
}
44+
45+
OMPI_ARRAY_FINT_2_INT_CLEANUP(array_of_blocklengths);
46+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright (c) 2012 The University of Tennessee and The University
3+
* of Tennessee Research Foundation. All rights
4+
* reserved.
5+
* Copyright (c) 2012 Inria. All rights reserved.
6+
* Copyright (c) 2015 Research Organization for Information Science
7+
* and Technology (RIST). All rights reserved.
8+
* $COPYRIGHT$
9+
*
10+
* Additional copyrights may follow
11+
*
12+
* $HEADER$
13+
*/
14+
15+
16+
PROTOTYPE VOID type_create_hindexed_block(COUNT count, COUNT blocklength,
17+
AINT_COUNT_ARRAY array_of_displacements,
18+
DATATYPE oldtype, DATATYPE_OUT newtype)
19+
{
20+
int c_ierr;
21+
MPI_Datatype c_old = PMPI_Type_f2c(*oldtype);
22+
MPI_Datatype c_new;
23+
24+
c_ierr = @INNER_CALL@(OMPI_FINT_2_INT(*count),
25+
OMPI_FINT_2_INT(*blocklength),
26+
array_of_displacements,
27+
c_old, &c_new);
28+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
29+
30+
if (MPI_SUCCESS == c_ierr) {
31+
*newtype = PMPI_Type_c2f(c_new);
32+
}
33+
}

ompi/mpi/fortran/use-mpi-f08/type_create_hindexed_block_f08.F90

Lines changed: 0 additions & 30 deletions
This file was deleted.

ompi/mpi/fortran/use-mpi-f08/type_create_hindexed_f08.F90

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3+
* University Research and Technology
4+
* Corporation. All rights reserved.
5+
* Copyright (c) 2004-2005 The University of Tennessee and The University
6+
* of Tennessee Research Foundation. All rights
7+
* reserved.
8+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9+
* University of Stuttgart. All rights reserved.
10+
* Copyright (c) 2004-2005 The Regents of the University of California.
11+
* All rights reserved.
12+
* Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2015 Research Organization for Information Science
14+
* and Technology (RIST). All rights reserved.
15+
* $COPYRIGHT$
16+
*
17+
* Additional copyrights may follow
18+
*
19+
* $HEADER$
20+
*/
21+
22+
PROTOTYPE VOID type_create_hvector(COUNT count, COUNT blocklength,
23+
AINT_COUNT stride, DATATYPE oldtype,
24+
DATATYPE_OUT newtype)
25+
{
26+
int c_ierr;
27+
MPI_Datatype c_old = PMPI_Type_f2c(*oldtype);
28+
MPI_Datatype c_new;
29+
30+
c_ierr = @INNER_CALL@(OMPI_FINT_2_INT(*count),
31+
OMPI_FINT_2_INT(*blocklength),
32+
*stride,
33+
c_old, &c_new);
34+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
35+
36+
if (MPI_SUCCESS == c_ierr) {
37+
*newtype = PMPI_Type_c2f(c_new);
38+
}
39+
}

ompi/mpi/fortran/use-mpi-f08/type_create_hvector_f08.F90

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)