Skip to content

Commit 0d492e7

Browse files
committed
abi_fortran_stuff: fix up the imp of these
Signed-off-by: Howard Pritchard <[email protected]>
1 parent 8f0ca42 commit 0d492e7

File tree

7 files changed

+361
-260
lines changed

7 files changed

+361
-260
lines changed

ompi/include/mpi.h.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,6 +1448,8 @@ OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_ub;
14481448
OMPI_DECLSPEC int MPI_Abi_supported(int *flag);
14491449
OMPI_DECLSPEC int MPI_Abi_version(int *abi_major, int *abi_minor);
14501450
OMPI_DECLSPEC int MPI_Abi_details(int *buflen, char *details, MPI_Info *info);
1451+
OMPI_DECLSPEC int MPI_Abi_get_fortran_info(MPI_Info *info);
1452+
OMPI_DECLSPEC int MPI_Abi_set_fortran_info(MPI_Info info);
14511453
OMPI_DECLSPEC int MPI_Abort(MPI_Comm comm, int errorcode);
14521454
OMPI_DECLSPEC int MPI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
14531455
int target_rank, MPI_Aint target_disp, int target_count,
@@ -2619,6 +2621,11 @@ OMPI_DECLSPEC double MPI_Wtime(void);
26192621
/*
26202622
* Profiling MPI API
26212623
*/
2624+
OMPI_DECLSPEC int PMPI_Abi_supported(int *flag);
2625+
OMPI_DECLSPEC int PMPI_Abi_version(int *abi_major, int *abi_minor);
2626+
OMPI_DECLSPEC int PMPI_Abi_details(int *buflen, char *details, MPI_Info *info);
2627+
OMPI_DECLSPEC int PMPI_Abi_get_fortran_info(MPI_Info *info);
2628+
OMPI_DECLSPEC int PMPI_Abi_set_fortran_info(MPI_Info info);
26222629
OMPI_DECLSPEC int PMPI_Abort(MPI_Comm comm, int errorcode);
26232630
OMPI_DECLSPEC int PMPI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
26242631
int target_rank, MPI_Aint target_disp, int target_count,

ompi/mpi/c/Makefile.am

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,9 @@ libmpi_c_la_SOURCES = \
519519

520520
# functions that do not require profiling implementations.
521521
libmpi_c_la_SOURCES += \
522-
ompi_isendrecv.c \
523-
ompi_sendrecv.c
522+
ompi_isendrecv.c \
523+
ompi_sendrecv.c \
524+
ompi_abi_fortran.c
524525

525526
libmpi_c_la_LIBADD = libmpi_c_profile.la
526527
if BUILD_MPI_BINDINGS_LAYER

ompi/mpi/c/Makefile_abi.include

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ BUILT_SOURCES = abi.h standard_abi/mpi.h
4141
libmpi_c_abi_la_SOURCES = \
4242
attr_fn.c \
4343
ompi_isendrecv.c \
44-
ompi_sendrecv.c
44+
ompi_sendrecv.c \
45+
ompi_abi_fortran.c
4546

4647
extra_abi_fns = \
4748
abi_get_info.c \

ompi/mpi/c/abi_get_fortran_info.c.in

Lines changed: 2 additions & 251 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@
3131

3232
PROTOTYPE ERROR_CLASS abi_get_fortran_info(INFO_OUT info)
3333
{
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;
3934
int ret = MPI_SUCCESS;
4035

4136
if (MPI_PARAM_CHECK) {
@@ -45,250 +40,6 @@ PROTOTYPE ERROR_CLASS abi_get_fortran_info(INFO_OUT info)
4540
}
4641
}
4742

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;
43+
ret = ompi_abi_get_fortran_info(info);
44+
OMPI_ERRHANDLER_NOHANDLE_RETURN( ret, ret, FUNC_NAME );
29445
}

ompi/mpi/c/abi_set_fortran_info.c.in

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
PROTOTYPE ERROR_CLASS abi_set_fortran_info(INFO info)
3333
{
34+
int ret = MPI_SUCCESS;
3435
static bool already_called = false;
3536

3637
if (MPI_PARAM_CHECK) {
@@ -50,10 +51,6 @@ PROTOTYPE ERROR_CLASS abi_set_fortran_info(INFO info)
5051
return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_ABI, FUNC_NAME);
5152
#endif
5253

53-
/*
54-
* Nothing implemented yet so raise MPI_ERR_UNSUPPORTED_OPERATION
55-
*/
56-
57-
return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_UNSUPPORTED_OPERATION,
58-
FUNC_NAME);
54+
ret = ompi_abi_set_fortran_info(info);
55+
OMPI_ERRHANDLER_NOHANDLE_RETURN( ret, ret, FUNC_NAME );
5956
}

ompi/mpi/c/bindings.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "ompi_config.h"
2626
#include "mpi.h"
2727
#include "ompi/datatype/ompi_datatype.h"
28+
#include "ompi/info/info.h"
2829

2930
BEGIN_C_DECLS
3031

@@ -120,6 +121,8 @@ int ompi_sendrecv(const void * sendbuf, size_t sendcount, MPI_Datatype sendtype,
120121
void * recvbuf, size_t recvcount, MPI_Datatype recvtype, int source, int recvtag, MPI_Comm comm, MPI_Status *status);
121122
int ompi_isendrecv(const void * sendbuf, size_t sendcount, MPI_Datatype sendtype, int dest, int sendtag,
122123
void * recvbuf, size_t recvcount, MPI_Datatype recvtype, int source, int recvtag, MPI_Comm comm, MPI_Request * request);
124+
int ompi_abi_get_fortran_info(ompi_info_t **info);
125+
int ompi_abi_set_fortran_info(ompi_info_t *info);
123126

124127
END_C_DECLS
125128

0 commit comments

Comments
 (0)