Skip to content

Commit 102a46e

Browse files
Merge pull request #6812 from ggouaillardet/topic/mpifh_c_ierr
fortran/mpif-h: fix C to Fortran error code conversion
2 parents 2a78aa8 + 223e6cc commit 102a46e

File tree

9 files changed

+67
-58
lines changed

9 files changed

+67
-58
lines changed

ompi/mpi/fortran/mpif-h/comm_split_type_f.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
* All rights reserved.
1212
* Copyright (c) 2012 Sandia National Laboratories. All rights reserved.
1313
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
14-
* Copyright (c) 2015 Research Organization for Information Science
15-
* and Technology (RIST). All rights reserved.
14+
* Copyright (c) 2015-2019 Research Organization for Information Science
15+
* and Technology (RIST). All rights reserved.
1616
* $COPYRIGHT$
1717
*
1818
* Additional copyrights may follow
@@ -77,11 +77,11 @@ void ompi_comm_split_type_f(MPI_Fint *comm, MPI_Fint *split_type, MPI_Fint *key,
7777

7878
c_info = PMPI_Info_f2c(*info);
7979

80-
c_ierr = OMPI_INT_2_FINT(PMPI_Comm_split_type(c_comm,
81-
OMPI_FINT_2_INT(*split_type),
82-
OMPI_FINT_2_INT(*key),
83-
c_info,
84-
&c_newcomm ));
80+
c_ierr = PMPI_Comm_split_type(c_comm,
81+
OMPI_FINT_2_INT(*split_type),
82+
OMPI_FINT_2_INT(*key),
83+
c_info,
84+
&c_newcomm);
8585
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
8686

8787
if (MPI_SUCCESS == c_ierr) {

ompi/mpi/fortran/mpif-h/dist_graph_create_adjacent_f.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
* Copyright (c) 2013-2014 Cisco Systems, Inc. All rights reserved.
99
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
1010
* reserved.
11-
* Copyright (c) 2015 Research Organization for Information Science
12-
* and Technology (RIST). All rights reserved.
11+
* Copyright (c) 2015-2019 Research Organization for Information Science
12+
* and Technology (RIST). All rights reserved.
1313
* $COPYRIGHT$
1414
*
1515
* Additional copyrights may follow
@@ -78,6 +78,7 @@ void ompi_dist_graph_create_adjacent_f(MPI_Fint *comm_old, MPI_Fint *indegree,
7878
MPI_Info c_info;
7979
MPI_Comm c_comm_old, c_comm_graph;
8080
int *c_destweights, *c_sourceweights;
81+
int c_ierr;
8182

8283
OMPI_ARRAY_NAME_DECL(sources);
8384
OMPI_ARRAY_NAME_DECL(destinations);
@@ -105,16 +106,17 @@ void ompi_dist_graph_create_adjacent_f(MPI_Fint *comm_old, MPI_Fint *indegree,
105106
c_destweights = OMPI_ARRAY_NAME_CONVERT(destweights);
106107
}
107108

108-
*ierr = OMPI_INT_2_FINT(PMPI_Dist_graph_create_adjacent(c_comm_old, OMPI_FINT_2_INT(*indegree),
109-
OMPI_ARRAY_NAME_CONVERT(sources),
110-
c_sourceweights,
111-
OMPI_FINT_2_INT(*outdegree),
112-
OMPI_ARRAY_NAME_CONVERT(destinations),
113-
c_destweights,
114-
c_info,
115-
OMPI_LOGICAL_2_INT(*reorder),
116-
&c_comm_graph));
117-
if (OMPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
109+
c_ierr = PMPI_Dist_graph_create_adjacent(c_comm_old, OMPI_FINT_2_INT(*indegree),
110+
OMPI_ARRAY_NAME_CONVERT(sources),
111+
c_sourceweights,
112+
OMPI_FINT_2_INT(*outdegree),
113+
OMPI_ARRAY_NAME_CONVERT(destinations),
114+
c_destweights,
115+
c_info,
116+
OMPI_LOGICAL_2_INT(*reorder),
117+
&c_comm_graph);
118+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
119+
if (OMPI_SUCCESS == c_ierr) {
118120
*comm_graph = PMPI_Comm_c2f(c_comm_graph);
119121
}
120122

ompi/mpi/fortran/mpif-h/dist_graph_create_f.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* Copyright (c) 2011-2013 Université Bordeaux 1
88
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
99
* reserved.
10-
* Copyright (c) 2015 Research Organization for Information Science
11-
* and Technology (RIST). All rights reserved.
10+
* Copyright (c) 2015-2019 Research Organization for Information Science
11+
* and Technology (RIST). All rights reserved.
1212
* $COPYRIGHT$
1313
*
1414
* Additional copyrights may follow
@@ -75,6 +75,7 @@ void ompi_dist_graph_create_f(MPI_Fint *comm_old, MPI_Fint *n, MPI_Fint *sources
7575
int count = 0, i;
7676
MPI_Info c_info;
7777
int *c_weights;
78+
int c_ierr;
7879

7980
OMPI_ARRAY_NAME_DECL(sources);
8081
OMPI_ARRAY_NAME_DECL(degrees);
@@ -98,10 +99,11 @@ void ompi_dist_graph_create_f(MPI_Fint *comm_old, MPI_Fint *n, MPI_Fint *sources
9899
}
99100

100101

101-
*ierr = OMPI_INT_2_FINT(PMPI_Dist_graph_create(c_comm_old, OMPI_FINT_2_INT(*n), OMPI_ARRAY_NAME_CONVERT(sources),
102-
OMPI_ARRAY_NAME_CONVERT(degrees), OMPI_ARRAY_NAME_CONVERT(destinations),
103-
c_weights, c_info, OMPI_LOGICAL_2_INT(*reorder), &c_comm_graph));
104-
if (OMPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
102+
c_ierr = PMPI_Dist_graph_create(c_comm_old, OMPI_FINT_2_INT(*n), OMPI_ARRAY_NAME_CONVERT(sources),
103+
OMPI_ARRAY_NAME_CONVERT(degrees), OMPI_ARRAY_NAME_CONVERT(destinations),
104+
c_weights, c_info, OMPI_LOGICAL_2_INT(*reorder), &c_comm_graph);
105+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
106+
if (OMPI_SUCCESS == c_ierr) {
105107
*comm_graph = PMPI_Comm_c2f(c_comm_graph);
106108
}
107109

ompi/mpi/fortran/mpif-h/dist_graph_neighbors_count_f.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* reserved.
55
* Copyright (c) 2011-2013 Inria. All rights reserved.
66
* Copyright (c) 2011-2013 Université Bordeaux 1
7-
* Copyright (c) 2015 Research Organization for Information Science
7+
* Copyright (c) 2015-2019 Research Organization for Information Science
88
* and Technology (RIST). All rights reserved.
99
* $COPYRIGHT$
1010
*
@@ -69,15 +69,17 @@ void ompi_dist_graph_neighbors_count_f(MPI_Fint *comm, MPI_Fint *inneighbors,
6969
OMPI_SINGLE_NAME_DECL(inneighbors);
7070
OMPI_SINGLE_NAME_DECL(outneighbors);
7171
OMPI_LOGICAL_NAME_DECL(weighted);
72+
int c_ierr;
7273

7374
c_comm = PMPI_Comm_f2c(*comm);
7475

75-
*ierr = OMPI_INT_2_FINT(PMPI_Dist_graph_neighbors_count(c_comm,
76-
OMPI_SINGLE_NAME_CONVERT(inneighbors),
77-
OMPI_SINGLE_NAME_CONVERT(outneighbors),
78-
OMPI_LOGICAL_SINGLE_NAME_CONVERT(weighted)));
76+
c_ierr = PMPI_Dist_graph_neighbors_count(c_comm,
77+
OMPI_SINGLE_NAME_CONVERT(inneighbors),
78+
OMPI_SINGLE_NAME_CONVERT(outneighbors),
79+
OMPI_LOGICAL_SINGLE_NAME_CONVERT(weighted));
80+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
7981
OMPI_SINGLE_INT_2_LOGICAL(weighted);
80-
if (OMPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
82+
if (OMPI_SUCCESS == c_ierr) {
8183
OMPI_SINGLE_INT_2_FINT(inneighbors);
8284
OMPI_SINGLE_INT_2_FINT(outneighbors);
8385
}

ompi/mpi/fortran/mpif-h/dist_graph_neighbors_f.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* reserved.
55
* Copyright (c) 2011-2013 Inria. All rights reserved.
66
* Copyright (c) 2011-2013 Université Bordeaux 1
7-
* Copyright (c) 2015 Research Organization for Information Science
8-
* and Technology (RIST). All rights reserved.
7+
* Copyright (c) 2015-2019 Research Organization for Information Science
8+
* and Technology (RIST). All rights reserved.
99
* $COPYRIGHT$
1010
*
1111
* Additional copyrights may follow
@@ -74,6 +74,7 @@ void ompi_dist_graph_neighbors_f(MPI_Fint* comm, MPI_Fint* maxindegree,
7474
OMPI_ARRAY_NAME_DECL(sourceweights);
7575
OMPI_ARRAY_NAME_DECL(destinations);
7676
OMPI_ARRAY_NAME_DECL(destweights);
77+
int c_ierr;
7778

7879
c_comm = PMPI_Comm_f2c(*comm);
7980

@@ -86,12 +87,14 @@ void ompi_dist_graph_neighbors_f(MPI_Fint* comm, MPI_Fint* maxindegree,
8687
OMPI_ARRAY_FINT_2_INT_ALLOC(destweights, *maxoutdegree);
8788
}
8889

89-
*ierr = OMPI_INT_2_FINT(PMPI_Dist_graph_neighbors(c_comm, OMPI_FINT_2_INT(*maxindegree),
90-
OMPI_ARRAY_NAME_CONVERT(sources),
91-
OMPI_IS_FORTRAN_UNWEIGHTED(sourceweights) ? MPI_UNWEIGHTED : OMPI_ARRAY_NAME_CONVERT(sourceweights),
92-
OMPI_FINT_2_INT(*maxoutdegree), OMPI_ARRAY_NAME_CONVERT(destinations),
93-
OMPI_IS_FORTRAN_UNWEIGHTED(destweights) ? MPI_UNWEIGHTED : OMPI_ARRAY_NAME_CONVERT(destweights)));
94-
if (OMPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
90+
c_ierr = PMPI_Dist_graph_neighbors(c_comm, OMPI_FINT_2_INT(*maxindegree),
91+
OMPI_ARRAY_NAME_CONVERT(sources),
92+
OMPI_IS_FORTRAN_UNWEIGHTED(sourceweights) ? MPI_UNWEIGHTED : OMPI_ARRAY_NAME_CONVERT(sourceweights),
93+
OMPI_FINT_2_INT(*maxoutdegree), OMPI_ARRAY_NAME_CONVERT(destinations),
94+
OMPI_IS_FORTRAN_UNWEIGHTED(destweights) ? MPI_UNWEIGHTED : OMPI_ARRAY_NAME_CONVERT(destweights));
95+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
96+
97+
if (OMPI_SUCCESS == c_ierr) {
9598
OMPI_ARRAY_INT_2_FINT(sources, *maxindegree);
9699
if( !OMPI_IS_FORTRAN_UNWEIGHTED(sourceweights) ) {
97100
OMPI_ARRAY_INT_2_FINT(sourceweights, *maxindegree);

ompi/mpi/fortran/mpif-h/improbe_f.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
* All rights reserved.
1212
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
1313
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
14-
* Copyright (c) 2015 Research Organization for Information Science
15-
* and Technology (RIST). All rights reserved.
14+
* Copyright (c) 2015-2019 Research Organization for Information Science
15+
* and Technology (RIST). All rights reserved.
1616
* Copyright (c) 2015 FUJITSU LIMITED. All rights reserved.
1717
* $COPYRIGHT$
1818
*
@@ -87,10 +87,10 @@ void ompi_improbe_f(MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm,
8787

8888
OMPI_FORTRAN_STATUS_SET_POINTER(c_status,c_status2,status)
8989

90-
c_ierr = OMPI_INT_2_FINT(PMPI_Improbe(OMPI_FINT_2_INT(*source),
91-
OMPI_FINT_2_INT(*tag),
92-
c_comm, OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag),
93-
&c_message, c_status));
90+
c_ierr = PMPI_Improbe(OMPI_FINT_2_INT(*source),
91+
OMPI_FINT_2_INT(*tag),
92+
c_comm, OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag),
93+
&c_message, c_status);
9494
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
9595

9696
if (MPI_SUCCESS == c_ierr) {

ompi/mpi/fortran/mpif-h/imrecv_f.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
1212
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
13-
* Copyright (c) 2015 Research Organization for Information Science
14-
* and Technology (RIST). All rights reserved.
13+
* Copyright (c) 2015-2019 Research Organization for Information Science
14+
* and Technology (RIST). All rights reserved.
1515
* Copyright (c) 2015 FUJITSU LIMITED. All rights reserved.
1616
* $COPYRIGHT$
1717
*
@@ -80,8 +80,8 @@ void ompi_imrecv_f(char *buf, MPI_Fint *count, MPI_Fint *datatype,
8080

8181
c_message = PMPI_Message_f2c(*message);
8282

83-
c_ierr = OMPI_INT_2_FINT(PMPI_Imrecv(OMPI_F2C_BOTTOM(buf), OMPI_FINT_2_INT(*count),
84-
c_type, &c_message, &c_req));
83+
c_ierr = PMPI_Imrecv(OMPI_F2C_BOTTOM(buf), OMPI_FINT_2_INT(*count),
84+
c_type, &c_message, &c_req);
8585
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
8686

8787
if (MPI_SUCCESS == c_ierr) {

ompi/mpi/fortran/mpif-h/mprobe_f.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
1313
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
1414
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
15-
* Copyright (c) 2015 Research Organization for Information Science
15+
* Copyright (c) 2015-2019 Research Organization for Information Science
1616
* and Technology (RIST). All rights reserved.
1717
* Copyright (c) 2015 FUJITSU LIMITED. All rights reserved.
1818
* $COPYRIGHT$
@@ -86,10 +86,10 @@ void ompi_mprobe_f(MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm,
8686

8787
OMPI_FORTRAN_STATUS_SET_POINTER(c_status,c_status2,status)
8888

89-
c_ierr = OMPI_INT_2_FINT(PMPI_Mprobe(OMPI_FINT_2_INT(*source),
90-
OMPI_FINT_2_INT(*tag),
91-
c_comm, &c_message,
92-
c_status));
89+
c_ierr = PMPI_Mprobe(OMPI_FINT_2_INT(*source),
90+
OMPI_FINT_2_INT(*tag),
91+
c_comm, &c_message,
92+
c_status);
9393
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
9494

9595
if (MPI_SUCCESS == c_ierr) {

ompi/mpi/fortran/mpif-h/mrecv_f.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,16 @@ void ompi_mrecv_f(char *buf, MPI_Fint *count, MPI_Fint *datatype,
7777
MPI_Fint *message, MPI_Fint *status, MPI_Fint *ierr)
7878
{
7979
int c_ierr;
80-
OMPI_FORTRAN_STATUS_DECLARATION(c_status,c_status2)
80+
OMPI_FORTRAN_STATUS_DECLARATION(c_status,c_status2)
8181
MPI_Message c_message = PMPI_Message_f2c(*message);
8282
MPI_Datatype c_type = PMPI_Type_f2c(*datatype);
8383

8484
OMPI_FORTRAN_STATUS_SET_POINTER(c_status,c_status2,status)
8585

8686
/* Call the C function */
87-
c_ierr = OMPI_INT_2_FINT(PMPI_Mrecv(OMPI_F2C_BOTTOM(buf), OMPI_FINT_2_INT(*count),
88-
c_type, &c_message,
89-
c_status));
87+
c_ierr = PMPI_Mrecv(OMPI_F2C_BOTTOM(buf), OMPI_FINT_2_INT(*count),
88+
c_type, &c_message,
89+
c_status);
9090
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
9191

9292
if (MPI_SUCCESS == c_ierr) {

0 commit comments

Comments
 (0)