Skip to content

Commit 8f0ca42

Browse files
committed
add abi_set/get_fortran_info
implementation of abi_set_fortran_info is not complete. Signed-off-by: Howard Pritchard <[email protected]>
1 parent 20b8580 commit 8f0ca42

File tree

7 files changed

+365
-1
lines changed

7 files changed

+365
-1
lines changed

docs/man-openmpi/man3/MPI_Errors.3.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,13 @@ Standard error return classes for Open MPI:
348348
- Value is too large to store.
349349

350350
* - MPI_ERR_ERRHANDLER
351-
- 89
351+
- 80
352352
- Invalid error handler handle.
353353

354+
* - MPI_ERR_ABI
355+
- 81
356+
- Invalid use of ABI method.
357+
354358
* - MPI_ERR_LASTCODE
355359
- 93
356360
- Last error code.

ompi/errhandler/errcode.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ static ompi_mpi_errcode_t ompi_err_revoked;
128128
static ompi_mpi_errcode_t ompi_err_session;
129129
static ompi_mpi_errcode_t ompi_err_value_too_large;
130130
static ompi_mpi_errcode_t ompi_err_errhandler;
131+
static ompi_mpi_errcode_t ompi_err_abi;
131132

132133
static void ompi_mpi_errcode_construct(ompi_mpi_errcode_t* errcode);
133134
static void ompi_mpi_errcode_destruct(ompi_mpi_errcode_t* errcode);
@@ -247,6 +248,7 @@ int ompi_mpi_errcode_init (void)
247248
CONSTRUCT_ERRCODE( ompi_err_session, MPI_ERR_SESSION, "MPI_ERR_SESSION: Invalid session handle" );
248249
CONSTRUCT_ERRCODE( ompi_err_value_too_large, MPI_ERR_VALUE_TOO_LARGE, "MPI_ERR_VALUE_TOO_LARGE: Value is too large to store" );
249250
CONSTRUCT_ERRCODE( ompi_err_errhandler, MPI_ERR_ERRHANDLER, "MPI_ERR_ERRHANDLER: Invalid error handler handle" );
251+
CONSTRUCT_ERRCODE( ompi_err_abi, MPI_ERR_ABI, "MPI_ERR_ABI: Invalid call to abi fortran method" );
250252

251253
/* Per MPI-3 p353:27-32, MPI_LASTUSEDCODE must be >=
252254
MPI_ERR_LASTCODE. So just start it as == MPI_ERR_LASTCODE. */
@@ -365,6 +367,7 @@ int ompi_mpi_errcode_finalize (void)
365367
OBJ_DESTRUCT(&ompi_err_session);
366368
OBJ_DESTRUCT(&ompi_err_value_too_large);
367369
OBJ_DESTRUCT(&ompi_err_errhandler);
370+
OBJ_DESTRUCT(&ompi_err_abi);
368371
OBJ_DESTRUCT(&ompi_mpi_errcodes);
369372
ompi_mpi_errcode_lastpredefined = 0;
370373
opal_mutex_unlock(&errcode_lock);

ompi/include/mpi.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,7 @@ enum {
760760
#define MPI_ERR_SESSION 78
761761
#define MPI_ERR_VALUE_TOO_LARGE 79
762762
#define MPI_ERR_ERRHANDLER 80
763+
#define MPI_ERR_ABI 81
763764

764765
/* Per MPI-3 p349 47, MPI_ERR_LASTCODE must be >= the last predefined
765766
MPI_ERR_<foo> code. Set the last code to allow some room for adding

ompi/include/mpif-values.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@
298298
'MPI_ERR_SESSION': 78,
299299
'MPI_ERR_VALUE_TOO_LARGE': 79,
300300
'MPI_ERR_ERRHANDLER': 80,
301+
'MPI_ERR_ABI': 81,
301302
'MPI_ERR_LASTCODE': 92,
302303
'MPI_IDENT': 0,
303304
'MPI_CONGRUENT': 1,

ompi/mpi/c/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ headers = bindings.h
5050
#
5151

5252
prototype_sources = \
53+
abi_get_fortran_info.c.in \
54+
abi_set_fortran_info.c.in \
5355
abort.c.in \
5456
accumulate.c.in \
5557
add_error_class.c.in \
Lines changed: 294 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,294 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2+
/*
3+
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
4+
* University Research and Technology
5+
* Corporation. All rights reserved.
6+
* Copyright (c) 2004-2020 The University of Tennessee and The University
7+
* of Tennessee Research Foundation. All rights
8+
* reserved.
9+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10+
* University of Stuttgart. All rights reserved.
11+
* Copyright (c) 2004-2005 The Regents of the University of California.
12+
* All rights reserved.
13+
* Copyright (c) 2015 Research Organization for Information Science
14+
* and Technology (RIST). All rights reserved.
15+
* Copyright (c) 2018-2025 Triad National Security, LLC. All rights
16+
* reserved.
17+
* $COPYRIGHT$
18+
*
19+
* Additional copyrights may follow
20+
*
21+
* $HEADER$
22+
*/
23+
24+
#include "ompi_config.h"
25+
26+
#include "ompi/mpi/c/bindings.h"
27+
#include "ompi/runtime/params.h"
28+
#include "ompi/communicator/communicator.h"
29+
#include "ompi/errhandler/errhandler.h"
30+
#include "ompi/info/info.h"
31+
32+
PROTOTYPE ERROR_CLASS abi_get_fortran_info(INFO_OUT info)
33+
{
34+
char tmp[16];
35+
ompi_info_t *newinfo = NULL;
36+
const char true_str[]="true";
37+
const char false_str[]="false";
38+
const char *cptr;
39+
int ret = MPI_SUCCESS;
40+
41+
if (MPI_PARAM_CHECK) {
42+
if (NULL == info) {
43+
return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_INFO,
44+
FUNC_NAME);
45+
}
46+
}
47+
48+
#if OMPI_BUILD_FORTRAN_BINDINGS
49+
50+
*info = ompi_info_allocate ();
51+
if (NULL == (*info)) {
52+
return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_NO_MEM,
53+
FUNC_NAME);
54+
}
55+
56+
57+
#if OMPI_SIZEOF_FORTRAN_LOGICAL
58+
snprintf(tmp, 16, "%d", OMPI_SIZEOF_FORTRAN_LOGICAL);
59+
ret = opal_info_set(&newinfo->super, "mpi_logical_size", tmp);
60+
if (OPAL_SUCCESS != ret) {
61+
goto err_cleanup;
62+
}
63+
#endif
64+
65+
#if OMPI_SIZEOF_FORTRAN_INTEGER
66+
snprintf(tmp, 16, "%d", OMPI_SIZEOF_FORTRAN_INTEGER);
67+
ret = opal_info_set(&newinfo->super, "mpi_integer_size", tmp);
68+
if (OPAL_SUCCESS != ret) {
69+
goto err_cleanup;
70+
}
71+
#endif
72+
73+
#if OMPI_SIZEOF_FORTRAN_REAL
74+
snprintf(tmp, 16, "%d", OMPI_SIZEOF_FORTRAN_REAL);
75+
ret = opal_info_set(&newinfo->super, "mpi_real_size", tmp);
76+
if (OPAL_SUCCESS != ret) {
77+
goto err_cleanup;
78+
}
79+
#endif
80+
81+
#if OMPI_SIZEOF_FORTRAN_DOUBLE_PRECISION
82+
snprintf(tmp, 16, "%d", OMPI_SIZEOF_FORTRAN_DOUBLE_PRECISION);
83+
ret = opal_info_set(&newinfo->super, "mpi_double_precision_size", tmp);
84+
if (OPAL_SUCCESS != ret) {
85+
goto err_cleanup;
86+
}
87+
#endif
88+
89+
#if OMPI_SIZEOF_FORTRAN_LOGICAL1
90+
cptr = true_str;
91+
#else
92+
cptr = false_str;
93+
#endif
94+
ret = opal_info_set(&newinfo->super, "mpi_logical1_supported", cptr);
95+
if (OPAL_SUCCESS != ret) {
96+
goto err_cleanup;
97+
}
98+
99+
#if OMPI_SIZEOF_FORTRAN_LOGICAL2
100+
cptr = true_str;
101+
#else
102+
cptr = false_str;
103+
#endif
104+
ret = opal_info_set(&newinfo->super, "mpi_logical2_supported", cptr);
105+
if (OPAL_SUCCESS != ret) {
106+
goto err_cleanup;
107+
}
108+
109+
#if OMPI_SIZEOF_FORTRAN_LOGICAL4
110+
cptr = true_str;
111+
#else
112+
cptr = false_str;
113+
#endif
114+
ret = opal_info_set(&newinfo->super, "mpi_logical4_supported", cptr);
115+
if (OPAL_SUCCESS != ret) {
116+
goto err_cleanup;
117+
}
118+
119+
#if OMPI_SIZEOF_FORTRAN_LOGICAL8
120+
cptr = true_str;
121+
#else
122+
cptr = false_str;
123+
#endif
124+
ret = opal_info_set(&newinfo->super, "mpi_logical8_supported", cptr);
125+
if (OPAL_SUCCESS != ret) {
126+
goto err_cleanup;
127+
}
128+
129+
#if OMPI_SIZEOF_FORTRAN_LOGICAL16
130+
cptr = true_str;
131+
#else
132+
cptr = false_str;
133+
#endif
134+
ret = opal_info_set(&newinfo->super, "mpi_logical16_supported", cptr);
135+
if (OPAL_SUCCESS != ret) {
136+
goto err_cleanup;
137+
}
138+
139+
#if OMPI_SIZEOF_FORTRAN_INTEGER1
140+
cptr = true_str;
141+
#else
142+
cptr = false_str;
143+
#endif
144+
ret = opal_info_set(&newinfo->super, "mpi_integer1_supported", cptr);
145+
if (OPAL_SUCCESS != ret) {
146+
goto err_cleanup;
147+
}
148+
149+
#if OMPI_SIZEOF_FORTRAN_INTEGER2
150+
cptr = true_str;
151+
#else
152+
cptr = false_str;
153+
#endif
154+
ret = opal_info_set(&newinfo->super, "mpi_integer2_supported", cptr);
155+
if (OPAL_SUCCESS != ret) {
156+
goto err_cleanup;
157+
}
158+
159+
#if OMPI_SIZEOF_FORTRAN_INTEGER4
160+
cptr = true_str;
161+
#else
162+
cptr = false_str;
163+
#endif
164+
ret = opal_info_set(&newinfo->super, "mpi_integer4_supported", cptr);
165+
if (OPAL_SUCCESS != ret) {
166+
goto err_cleanup;
167+
}
168+
169+
#if OMPI_SIZEOF_FORTRAN_INTEGER8
170+
cptr = true_str;
171+
#else
172+
cptr = false_str;
173+
#endif
174+
ret = opal_info_set(&newinfo->super, "mpi_integer8_supported", cptr);
175+
if (OPAL_SUCCESS != ret) {
176+
goto err_cleanup;
177+
}
178+
179+
#if OMPI_SIZEOF_FORTRAN_INTEGER16
180+
cptr = true_str;
181+
#else
182+
cptr = false_str;
183+
#endif
184+
ret = opal_info_set(&newinfo->super, "mpi_integer16_supported", cptr);
185+
if (OPAL_SUCCESS != ret) {
186+
goto err_cleanup;
187+
}
188+
189+
#if OMPI_SIZEOF_FORTRAN_REAL4
190+
cptr = true_str;
191+
#else
192+
cptr = false_str;
193+
#endif
194+
ret = opal_info_set(&newinfo->super, "mpi_real2_supported", cptr);
195+
if (OPAL_SUCCESS != ret) {
196+
goto err_cleanup;
197+
}
198+
199+
#if OMPI_SIZEOF_FORTRAN_REAL4
200+
cptr = true_str;
201+
#else
202+
cptr = false_str;
203+
#endif
204+
ret = opal_info_set(&newinfo->super, "mpi_real4_supported", cptr);
205+
if (OPAL_SUCCESS != ret) {
206+
goto err_cleanup;
207+
}
208+
209+
#if OMPI_SIZEOF_FORTRAN_REAL8
210+
cptr = true_str;
211+
#else
212+
cptr = false_str;
213+
#endif
214+
ret = opal_info_set(&newinfo->super, "mpi_real8_supported", cptr);
215+
if (OPAL_SUCCESS != ret) {
216+
goto err_cleanup;
217+
}
218+
219+
#if OMPI_SIZEOF_FORTRAN_REAL16
220+
cptr = true_str;
221+
#else
222+
cptr = false_str;
223+
#endif
224+
ret = opal_info_set(&newinfo->super, "mpi_real16_supported", cptr);
225+
if (OPAL_SUCCESS != ret) {
226+
goto err_cleanup;
227+
}
228+
229+
#if OMPI_SIZEOF_FORTRAN_COMPLEX4
230+
cptr = true_str;
231+
#else
232+
cptr = false_str;
233+
#endif
234+
ret = opal_info_set(&newinfo->super, "mpi_complex4_supported", cptr);
235+
if (OPAL_SUCCESS != ret) {
236+
goto err_cleanup;
237+
}
238+
239+
#if OMPI_SIZEOF_FORTRAN_COMPLEX8
240+
cptr = true_str;
241+
#else
242+
cptr = false_str;
243+
#endif
244+
ret = opal_info_set(&newinfo->super, "mpi_complex8_supported", cptr);
245+
if (OPAL_SUCCESS != ret) {
246+
goto err_cleanup;
247+
}
248+
249+
#if OMPI_SIZEOF_FORTRAN_COMPLEX16
250+
cptr = true_str;
251+
#else
252+
cptr = false_str;
253+
#endif
254+
ret = opal_info_set(&newinfo->super, "mpi_complex16_supported", cptr);
255+
if (OPAL_SUCCESS != ret) {
256+
goto err_cleanup;
257+
}
258+
259+
#if OMPI_SIZEOF_FORTRAN_COMPLEX32
260+
cptr = true_str;
261+
#else
262+
cptr = false_str;
263+
#endif
264+
ret = opal_info_set(&newinfo->super, "mpi_complex32_supported", cptr);
265+
if (OPAL_SUCCESS != ret) {
266+
goto err_cleanup;
267+
}
268+
269+
#if OMPI_SIZEOF_FORTRAN_DOUBLE_COMPLEX
270+
cptr = true_str;
271+
#else
272+
cptr = false_str;
273+
#endif
274+
ret = opal_info_set(&newinfo->super, "mpi_double_complex_supported", cptr);
275+
if (OPAL_SUCCESS != ret) {
276+
goto err_cleanup;
277+
}
278+
279+
*info = newinfo;
280+
281+
#else
282+
283+
*info = MPI_INFO_NULL;
284+
285+
#endif /* OMPI_BUILD_FORTRAN_BINDINGS */
286+
287+
return ret;
288+
289+
err_cleanup:
290+
ompi_info_free(&newinfo);
291+
return ret;
292+
293+
return MPI_SUCCESS;
294+
}

0 commit comments

Comments
 (0)