1
1

* do proper fortran string handling for the MPI-IO functions that take string

arguments.  Thanks to Bernard Knaepen for bringing this to our attention.

This commit was SVN r9792.
Этот коммит содержится в:
Brian Barrett 2006-05-02 14:39:11 +00:00
родитель 10a05dc0d1
Коммит 1aa13c1e5c
7 изменённых файлов: 101 добавлений и 39 удалений

2
NEWS
Просмотреть файл

@ -60,6 +60,8 @@ version 1.0.
1.0.3 1.0.3
----- -----
- Fixed improper handling of string arguments in Fortran bindings
for MPI-IO functionality
- Fixed segmentation fault with 64 bit applications on Solaris when - Fixed segmentation fault with 64 bit applications on Solaris when
using the shared memory transports. using the shared memory transports.
- Fixed MPI_COMM_SELF attributes to free properly at the beginning of - Fixed MPI_COMM_SELF attributes to free properly at the beginning of

Просмотреть файл

@ -19,6 +19,8 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "ompi/mpi/f77/bindings.h" #include "ompi/mpi/f77/bindings.h"
#include "ompi/mpi/f77/strings.h"
#include "ompi/file/file.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER #if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER
#pragma weak PMPI_FILE_DELETE = mpi_file_delete_f #pragma weak PMPI_FILE_DELETE = mpi_file_delete_f
@ -31,8 +33,8 @@ OMPI_GENERATE_F77_BINDINGS (PMPI_FILE_DELETE,
pmpi_file_delete_, pmpi_file_delete_,
pmpi_file_delete__, pmpi_file_delete__,
pmpi_file_delete_f, pmpi_file_delete_f,
(char *filename, MPI_Fint *info, MPI_Fint *ierr), (char *filename, MPI_Fint *info, MPI_Fint *ierr, int filename_len),
(filename, info, ierr) ) (filename, info, ierr, filename_len) )
#endif #endif
#if OMPI_HAVE_WEAK_SYMBOLS #if OMPI_HAVE_WEAK_SYMBOLS
@ -48,8 +50,8 @@ OMPI_GENERATE_F77_BINDINGS (MPI_FILE_DELETE,
mpi_file_delete_, mpi_file_delete_,
mpi_file_delete__, mpi_file_delete__,
mpi_file_delete_f, mpi_file_delete_f,
(char *filename, MPI_Fint *info, MPI_Fint *ierr), (char *filename, MPI_Fint *info, MPI_Fint *ierr, int filename_len),
(filename, info, ierr) ) (filename, info, ierr, filename_len) )
#endif #endif
@ -57,11 +59,23 @@ OMPI_GENERATE_F77_BINDINGS (MPI_FILE_DELETE,
#include "ompi/mpi/f77/profile/defines.h" #include "ompi/mpi/f77/profile/defines.h"
#endif #endif
void mpi_file_delete_f(char *filename, MPI_Fint *info, MPI_Fint *ierr) void mpi_file_delete_f(char *filename, MPI_Fint *info, MPI_Fint *ierr, int filename_len)
{ {
MPI_Info c_info; MPI_Info c_info;
char *c_filename;
int c_err, ret;
c_info = MPI_Info_f2c(*info); c_info = MPI_Info_f2c(*info);
*ierr = OMPI_INT_2_FINT(MPI_File_delete(filename, c_info)); /* Convert the fortran string */
if (OMPI_SUCCESS != (ret = ompi_fortran_string_f2c(filename, filename_len,
&c_filename))) {
c_err = OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, ret, "MPI_FILE_DELETE");
*ierr = OMPI_INT_2_FINT(c_err);
return;
}
*ierr = OMPI_INT_2_FINT(MPI_File_delete(filename, c_info));
free(c_filename);
} }

Просмотреть файл

@ -19,6 +19,8 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "ompi/mpi/f77/bindings.h" #include "ompi/mpi/f77/bindings.h"
#include "ompi/mpi/f77/strings.h"
#include "ompi/file/file.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER #if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER
#pragma weak PMPI_FILE_GET_VIEW = mpi_file_get_view_f #pragma weak PMPI_FILE_GET_VIEW = mpi_file_get_view_f
@ -31,8 +33,8 @@ OMPI_GENERATE_F77_BINDINGS (PMPI_FILE_GET_VIEW,
pmpi_file_get_view_, pmpi_file_get_view_,
pmpi_file_get_view__, pmpi_file_get_view__,
pmpi_file_get_view_f, pmpi_file_get_view_f,
(MPI_Fint *fh, MPI_Offset *disp, MPI_Fint *etype, MPI_Fint *filetype, char *datarep, MPI_Fint *ierr), (MPI_Fint *fh, MPI_Offset *disp, MPI_Fint *etype, MPI_Fint *filetype, char *datarep, MPI_Fint *ierr, int datarep_len),
(fh, disp, etype, filetype, datarep, ierr) ) (fh, disp, etype, filetype, datarep, ierr, datarep_len) )
#endif #endif
#if OMPI_HAVE_WEAK_SYMBOLS #if OMPI_HAVE_WEAK_SYMBOLS
@ -48,8 +50,8 @@ OMPI_GENERATE_F77_BINDINGS (MPI_FILE_GET_VIEW,
mpi_file_get_view_, mpi_file_get_view_,
mpi_file_get_view__, mpi_file_get_view__,
mpi_file_get_view_f, mpi_file_get_view_f,
(MPI_Fint *fh, MPI_Offset *disp, MPI_Fint *etype, MPI_Fint *filetype, char *datarep, MPI_Fint *ierr), (MPI_Fint *fh, MPI_Offset *disp, MPI_Fint *etype, MPI_Fint *filetype, char *datarep, MPI_Fint *ierr, int datarep_len),
(fh, disp, etype, filetype, datarep, ierr) ) (fh, disp, etype, filetype, datarep, ierr, datarep_len) )
#endif #endif
@ -59,17 +61,19 @@ OMPI_GENERATE_F77_BINDINGS (MPI_FILE_GET_VIEW,
void mpi_file_get_view_f(MPI_Fint *fh, MPI_Offset *disp, void mpi_file_get_view_f(MPI_Fint *fh, MPI_Offset *disp,
MPI_Fint *etype, MPI_Fint *filetype, MPI_Fint *etype, MPI_Fint *filetype,
char *datarep, MPI_Fint *ierr) char *datarep, MPI_Fint *ierr, int datarep_len)
{ {
MPI_File c_fh = MPI_File_f2c(*fh); MPI_File c_fh = MPI_File_f2c(*fh);
MPI_Datatype c_etype, c_filetype; MPI_Datatype c_etype, c_filetype;
MPI_Offset c_disp; MPI_Offset c_disp;
char c_datarep[MPI_MAX_DATAREP_STRING];
*ierr = OMPI_INT_2_FINT(MPI_File_get_view(c_fh, &c_disp, &c_etype, *ierr = OMPI_INT_2_FINT(MPI_File_get_view(c_fh, &c_disp, &c_etype,
&c_filetype, datarep)); &c_filetype, c_datarep));
if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) { if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
*disp = (MPI_Fint) c_disp; *disp = (MPI_Fint) c_disp;
*etype = MPI_Type_c2f(c_etype); *etype = MPI_Type_c2f(c_etype);
*filetype = MPI_Type_c2f(c_filetype); *filetype = MPI_Type_c2f(c_filetype);
ompi_fortran_string_c2f(c_datarep, datarep, MPI_MAX_DATAREP_STRING);
} }
} }

Просмотреть файл

@ -19,6 +19,8 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "ompi/mpi/f77/bindings.h" #include "ompi/mpi/f77/bindings.h"
#include "ompi/mpi/f77/strings.h"
#include "ompi/file/file.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER #if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER
#pragma weak PMPI_FILE_OPEN = mpi_file_open_f #pragma weak PMPI_FILE_OPEN = mpi_file_open_f
@ -31,8 +33,8 @@ OMPI_GENERATE_F77_BINDINGS (PMPI_FILE_OPEN,
pmpi_file_open_, pmpi_file_open_,
pmpi_file_open__, pmpi_file_open__,
pmpi_file_open_f, pmpi_file_open_f,
(MPI_Fint *comm, char *filename, MPI_Fint *amode, MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr), (MPI_Fint *comm, char *filename, MPI_Fint *amode, MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr, int name_len),
(comm, filename, amode, info, fh, ierr) ) (comm, filename, amode, info, fh, ierr, name_len) )
#endif #endif
#if OMPI_HAVE_WEAK_SYMBOLS #if OMPI_HAVE_WEAK_SYMBOLS
@ -48,8 +50,8 @@ OMPI_GENERATE_F77_BINDINGS (MPI_FILE_OPEN,
mpi_file_open_, mpi_file_open_,
mpi_file_open__, mpi_file_open__,
mpi_file_open_f, mpi_file_open_f,
(MPI_Fint *comm, char *filename, MPI_Fint *amode, MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr), (MPI_Fint *comm, char *filename, MPI_Fint *amode, MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr, int name_len),
(comm, filename, amode, info, fh, ierr) ) (comm, filename, amode, info, fh, ierr, name_len) )
#endif #endif
@ -58,16 +60,28 @@ OMPI_GENERATE_F77_BINDINGS (MPI_FILE_OPEN,
#endif #endif
void mpi_file_open_f(MPI_Fint *comm, char *filename, MPI_Fint *amode, void mpi_file_open_f(MPI_Fint *comm, char *filename, MPI_Fint *amode,
MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr) MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr, int name_len)
{ {
MPI_Comm c_comm = MPI_Comm_f2c(*comm); MPI_Comm c_comm = MPI_Comm_f2c(*comm);
MPI_Info c_info = MPI_Info_f2c(*info); MPI_Info c_info = MPI_Info_f2c(*info);
MPI_File c_fh; MPI_File c_fh;
char *c_filename;
int c_err, ret;
*ierr = OMPI_INT_2_FINT(MPI_File_open(c_comm, filename, /* Convert the fortran string */
if (OMPI_SUCCESS != (ret = ompi_fortran_string_f2c(filename, name_len,
&c_filename))) {
c_err = OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, ret, "MPI_FILE_OPEN");
*ierr = OMPI_INT_2_FINT(c_err);
return;
}
*ierr = OMPI_INT_2_FINT(MPI_File_open(c_comm, c_filename,
OMPI_FINT_2_INT(*amode), OMPI_FINT_2_INT(*amode),
c_info, &c_fh)); c_info, &c_fh));
if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) { if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
*fh = MPI_File_c2f(c_fh); *fh = MPI_File_c2f(c_fh);
} }
free(c_filename);
} }

Просмотреть файл

@ -19,6 +19,8 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "ompi/mpi/f77/bindings.h" #include "ompi/mpi/f77/bindings.h"
#include "ompi/mpi/f77/strings.h"
#include "ompi/file/file.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER #if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER
#pragma weak PMPI_FILE_SET_VIEW = mpi_file_set_view_f #pragma weak PMPI_FILE_SET_VIEW = mpi_file_set_view_f
@ -31,8 +33,8 @@ OMPI_GENERATE_F77_BINDINGS (PMPI_FILE_SET_VIEW,
pmpi_file_set_view_, pmpi_file_set_view_,
pmpi_file_set_view__, pmpi_file_set_view__,
pmpi_file_set_view_f, pmpi_file_set_view_f,
(MPI_Fint *fh, MPI_Offset *disp, MPI_Fint *etype, MPI_Fint *filetype, char *datarep, MPI_Fint *info, MPI_Fint *ierr), (MPI_Fint *fh, MPI_Offset *disp, MPI_Fint *etype, MPI_Fint *filetype, char *datarep, MPI_Fint *info, MPI_Fint *ierr, int datarep_len),
(fh, disp, etype, filetype, datarep, info, ierr) ) (fh, disp, etype, filetype, datarep, info, ierr, datarep_len) )
#endif #endif
#if OMPI_HAVE_WEAK_SYMBOLS #if OMPI_HAVE_WEAK_SYMBOLS
@ -48,8 +50,8 @@ OMPI_GENERATE_F77_BINDINGS (MPI_FILE_SET_VIEW,
mpi_file_set_view_, mpi_file_set_view_,
mpi_file_set_view__, mpi_file_set_view__,
mpi_file_set_view_f, mpi_file_set_view_f,
(MPI_Fint *fh, MPI_Offset *disp, MPI_Fint *etype, MPI_Fint *filetype, char *datarep, MPI_Fint *info, MPI_Fint *ierr), (MPI_Fint *fh, MPI_Offset *disp, MPI_Fint *etype, MPI_Fint *filetype, char *datarep, MPI_Fint *info, MPI_Fint *ierr, int datarep_len),
(fh, disp, etype, filetype, datarep, info, ierr) ) (fh, disp, etype, filetype, datarep, info, ierr, datarep_len) )
#endif #endif
@ -59,14 +61,27 @@ OMPI_GENERATE_F77_BINDINGS (MPI_FILE_SET_VIEW,
void mpi_file_set_view_f(MPI_Fint *fh, MPI_Offset *disp, void mpi_file_set_view_f(MPI_Fint *fh, MPI_Offset *disp,
MPI_Fint *etype, MPI_Fint *filetype, MPI_Fint *etype, MPI_Fint *filetype,
char *datarep, MPI_Fint *info, MPI_Fint *ierr) char *datarep, MPI_Fint *info, MPI_Fint *ierr,
int datarep_len)
{ {
MPI_File c_fh = MPI_File_f2c(*fh); MPI_File c_fh = MPI_File_f2c(*fh);
MPI_Datatype c_etype = MPI_Type_f2c(*etype); MPI_Datatype c_etype = MPI_Type_f2c(*etype);
MPI_Datatype c_filetype = MPI_Type_f2c(*filetype); MPI_Datatype c_filetype = MPI_Type_f2c(*filetype);
MPI_Info c_info = MPI_Info_f2c(*info); MPI_Info c_info = MPI_Info_f2c(*info);
char *c_datarep;
int c_err, ret;
/* Convert the fortran string */
if (OMPI_SUCCESS != (ret = ompi_fortran_string_f2c(datarep, datarep_len,
&c_datarep))) {
c_err = OMPI_ERRHANDLER_INVOKE(c_fh, ret, "MPI_FILE_SET_VIEW");
*ierr = OMPI_INT_2_FINT(c_err);
return;
}
*ierr = OMPI_INT_2_FINT(MPI_File_set_view(c_fh, (MPI_Offset) *disp, *ierr = OMPI_INT_2_FINT(MPI_File_set_view(c_fh, (MPI_Offset) *disp,
c_etype, c_filetype, c_etype, c_filetype,
datarep, c_info)); c_datarep, c_info));
free(c_datarep);
} }

Просмотреть файл

@ -127,9 +127,9 @@ PN(void, mpi_file_call_errhandler, MPI_FILE_CALL_ERRHANDLER, (MPI_Fint *fh, MPI_
PN(void, mpi_file_create_errhandler, MPI_FILE_CREATE_ERRHANDLER, (ompi_errhandler_fortran_handler_fn_t* function, MPI_Fint *errhandler, MPI_Fint *ierr)); PN(void, mpi_file_create_errhandler, MPI_FILE_CREATE_ERRHANDLER, (ompi_errhandler_fortran_handler_fn_t* function, MPI_Fint *errhandler, MPI_Fint *ierr));
PN(void, mpi_file_set_errhandler, MPI_FILE_SET_ERRHANDLER, (MPI_Fint *file, MPI_Fint *errhandler, MPI_Fint *ierr)); PN(void, mpi_file_set_errhandler, MPI_FILE_SET_ERRHANDLER, (MPI_Fint *file, MPI_Fint *errhandler, MPI_Fint *ierr));
PN(void, mpi_file_get_errhandler, MPI_FILE_GET_ERRHANDLER, (MPI_Fint *file, MPI_Fint *errhandler, MPI_Fint *ierr)); PN(void, mpi_file_get_errhandler, MPI_FILE_GET_ERRHANDLER, (MPI_Fint *file, MPI_Fint *errhandler, MPI_Fint *ierr));
PN(void, mpi_file_open, MPI_FILE_OPEN, (MPI_Fint *comm, char *filename, MPI_Fint *amode, MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr)); PN(void, mpi_file_open, MPI_FILE_OPEN, (MPI_Fint *comm, char *filename, MPI_Fint *amode, MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr, int name_len));
PN(void, mpi_file_close, MPI_FILE_CLOSE, (MPI_Fint *fh, MPI_Fint *ierr)); PN(void, mpi_file_close, MPI_FILE_CLOSE, (MPI_Fint *fh, MPI_Fint *ierr));
PN(void, mpi_file_delete, MPI_FILE_DELETE, (char *filename, MPI_Fint *info, MPI_Fint *ierr)); PN(void, mpi_file_delete, MPI_FILE_DELETE, (char *filename, MPI_Fint *info, MPI_Fint *ierr, int filename_len));
PN(void, mpi_file_set_size, MPI_FILE_SET_SIZE, (MPI_Fint *fh, MPI_Offset *size, MPI_Fint *ierr)); PN(void, mpi_file_set_size, MPI_FILE_SET_SIZE, (MPI_Fint *fh, MPI_Offset *size, MPI_Fint *ierr));
PN(void, mpi_file_preallocate, MPI_FILE_PREALLOCATE, (MPI_Fint *fh, MPI_Offset *size, MPI_Fint *ierr)); PN(void, mpi_file_preallocate, MPI_FILE_PREALLOCATE, (MPI_Fint *fh, MPI_Offset *size, MPI_Fint *ierr));
PN(void, mpi_file_get_size, MPI_FILE_GET_SIZE, (MPI_Fint *fh, MPI_Offset *size, MPI_Fint *ierr)); PN(void, mpi_file_get_size, MPI_FILE_GET_SIZE, (MPI_Fint *fh, MPI_Offset *size, MPI_Fint *ierr));
@ -137,8 +137,8 @@ PN(void, mpi_file_get_group, MPI_FILE_GET_GROUP, (MPI_Fint *fh, MPI_Fint *group,
PN(void, mpi_file_get_amode, MPI_FILE_GET_AMODE, (MPI_Fint *fh, MPI_Fint *amode, MPI_Fint *ierr)); PN(void, mpi_file_get_amode, MPI_FILE_GET_AMODE, (MPI_Fint *fh, MPI_Fint *amode, MPI_Fint *ierr));
PN(void, mpi_file_set_info, MPI_FILE_SET_INFO, (MPI_Fint *fh, MPI_Fint *info, MPI_Fint *ierr)); PN(void, mpi_file_set_info, MPI_FILE_SET_INFO, (MPI_Fint *fh, MPI_Fint *info, MPI_Fint *ierr));
PN(void, mpi_file_get_info, MPI_FILE_GET_INFO, (MPI_Fint *fh, MPI_Fint *info_used, MPI_Fint *ierr)); PN(void, mpi_file_get_info, MPI_FILE_GET_INFO, (MPI_Fint *fh, MPI_Fint *info_used, MPI_Fint *ierr));
PN(void, mpi_file_set_view, MPI_FILE_SET_VIEW, (MPI_Fint *fh, MPI_Offset *disp, MPI_Fint *etype, MPI_Fint *filetype, char *datarep, MPI_Fint *info, MPI_Fint *ierr)); PN(void, mpi_file_set_view, MPI_FILE_SET_VIEW, (MPI_Fint *fh, MPI_Offset *disp, MPI_Fint *etype, MPI_Fint *filetype, char *datarep, MPI_Fint *info, MPI_Fint *ierr, int datarep_len));
PN(void, mpi_file_get_view, MPI_FILE_GET_VIEW, (MPI_Fint *fh, MPI_Offset *disp, MPI_Fint *etype, MPI_Fint *filetype, char *datarep, MPI_Fint *ierr)); PN(void, mpi_file_get_view, MPI_FILE_GET_VIEW, (MPI_Fint *fh, MPI_Offset *disp, MPI_Fint *etype, MPI_Fint *filetype, char *datarep, MPI_Fint *ierr, int datarep_len));
PN(void, mpi_file_read_at, MPI_FILE_READ_AT, (MPI_Fint *fh, MPI_Offset *offset, char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *status, MPI_Fint *ierr)); PN(void, mpi_file_read_at, MPI_FILE_READ_AT, (MPI_Fint *fh, MPI_Offset *offset, char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *status, MPI_Fint *ierr));
PN(void, mpi_file_read_at_all, MPI_FILE_READ_AT_ALL, (MPI_Fint *fh, MPI_Offset *offset, char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *status, MPI_Fint *ierr)); PN(void, mpi_file_read_at_all, MPI_FILE_READ_AT_ALL, (MPI_Fint *fh, MPI_Offset *offset, char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *status, MPI_Fint *ierr));
PN(void, mpi_file_write_at, MPI_FILE_WRITE_AT, (MPI_Fint *fh, MPI_Offset *offset, char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *status, MPI_Fint *ierr)); PN(void, mpi_file_write_at, MPI_FILE_WRITE_AT, (MPI_Fint *fh, MPI_Offset *offset, char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *status, MPI_Fint *ierr));
@ -249,7 +249,7 @@ PN(void, mpi_recv_init, MPI_RECV_INIT, (char *buf, MPI_Fint *count, MPI_Fint *da
PN(void, mpi_recv, MPI_RECV, (char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr)); PN(void, mpi_recv, MPI_RECV, (char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr));
PN(void, mpi_reduce, MPI_REDUCE, (char *sendbuf, char *recvbuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr)); PN(void, mpi_reduce, MPI_REDUCE, (char *sendbuf, char *recvbuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr));
PN(void, mpi_reduce_scatter, MPI_REDUCE_SCATTER, (char *sendbuf, char *recvbuf, MPI_Fint *recvcounts, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm, MPI_Fint *ierr)); PN(void, mpi_reduce_scatter, MPI_REDUCE_SCATTER, (char *sendbuf, char *recvbuf, MPI_Fint *recvcounts, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm, MPI_Fint *ierr));
PN(void, mpi_register_datarep, MPI_REGISTER_DATAREP, (char *datarep, void *read_conversion_fn, void *write_conversion_fn, void *dtype_file_extent_fn, MPI_Fint *extra_state, MPI_Fint *ierr)); PN(void, mpi_register_datarep, MPI_REGISTER_DATAREP, (char *datarep, void *read_conversion_fn, void *write_conversion_fn, void *dtype_file_extent_fn, MPI_Fint *extra_state, MPI_Fint *ierr, int datarep_len));
PN(void, mpi_request_free, MPI_REQUEST_FREE, (MPI_Fint *request, MPI_Fint *ierr)); PN(void, mpi_request_free, MPI_REQUEST_FREE, (MPI_Fint *request, MPI_Fint *ierr));
PN(void, mpi_request_get_status, MPI_REQUEST_GET_STATUS, (MPI_Fint *request, MPI_Flogical *flag, MPI_Fint *status, MPI_Fint *ierr)); PN(void, mpi_request_get_status, MPI_REQUEST_GET_STATUS, (MPI_Fint *request, MPI_Flogical *flag, MPI_Fint *status, MPI_Fint *ierr));
PN(void, mpi_rsend, MPI_RSEND, (char *ibuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr)); PN(void, mpi_rsend, MPI_RSEND, (char *ibuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr));

Просмотреть файл

@ -19,6 +19,8 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "ompi/mpi/f77/bindings.h" #include "ompi/mpi/f77/bindings.h"
#include "ompi/mpi/f77/strings.h"
#include "ompi/file/file.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER #if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER
#pragma weak PMPI_REGISTER_DATAREP = mpi_register_datarep_f #pragma weak PMPI_REGISTER_DATAREP = mpi_register_datarep_f
@ -31,8 +33,8 @@ OMPI_GENERATE_F77_BINDINGS (PMPI_REGISTER_DATAREP,
pmpi_register_datarep_, pmpi_register_datarep_,
pmpi_register_datarep__, pmpi_register_datarep__,
pmpi_register_datarep_f, pmpi_register_datarep_f,
(char *datarep, void *read_conversion_fn, void *write_conversion_fn, void *dtype_file_extent_fn, MPI_Fint *extra_state, MPI_Fint *ierr), (char *datarep, void *read_conversion_fn, void *write_conversion_fn, void *dtype_file_extent_fn, MPI_Fint *extra_state, MPI_Fint *ierr, int datarep_len),
(datarep, read_conversion_fn, write_conversion_fn, dtype_file_extent_fn, extra_state, ierr) ) (datarep, read_conversion_fn, write_conversion_fn, dtype_file_extent_fn, extra_state, ierr, datarep_len) )
#endif #endif
#if OMPI_HAVE_WEAK_SYMBOLS #if OMPI_HAVE_WEAK_SYMBOLS
@ -48,8 +50,8 @@ OMPI_GENERATE_F77_BINDINGS (MPI_REGISTER_DATAREP,
mpi_register_datarep_, mpi_register_datarep_,
mpi_register_datarep__, mpi_register_datarep__,
mpi_register_datarep_f, mpi_register_datarep_f,
(char *datarep, void *read_conversion_fn, void *write_conversion_fn, void *dtype_file_extent_fn, MPI_Fint *extra_state, MPI_Fint *ierr), (char *datarep, void *read_conversion_fn, void *write_conversion_fn, void *dtype_file_extent_fn, MPI_Fint *extra_state, MPI_Fint *ierr, int datarep_len),
(datarep, read_conversion_fn, write_conversion_fn, dtype_file_extent_fn, extra_state, ierr) ) (datarep, read_conversion_fn, write_conversion_fn, dtype_file_extent_fn, extra_state, ierr, datarep_len) )
#endif #endif
@ -66,18 +68,29 @@ union local_type_convert {
void mpi_register_datarep_f(char *datarep, void *read_conversion_fn, void mpi_register_datarep_f(char *datarep, void *read_conversion_fn,
void *write_conversion_fn, void *write_conversion_fn,
void *dtype_file_extent_fn, MPI_Fint *extra_state, void *dtype_file_extent_fn, MPI_Fint *extra_state,
MPI_Fint *ierr) MPI_Fint *ierr, int datarep_len)
{ {
/* Do a little type shifting so that we don't get compiler char *c_datarep;
warnings */ int c_err, ret;
union local_type_convert a, b, c; union local_type_convert a, b, c;
/* Convert the fortran string */
if (OMPI_SUCCESS != (ret = ompi_fortran_string_f2c(datarep, datarep_len,
&c_datarep))) {
c_err = OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, ret, "MPI_FILE_SET_VIEW");
*ierr = OMPI_INT_2_FINT(c_err);
return;
}
/* Do a little type shifting so that we don't get compiler
warnings */
a.voidp = read_conversion_fn; a.voidp = read_conversion_fn;
b.voidp = write_conversion_fn; b.voidp = write_conversion_fn;
c.voidp = dtype_file_extent_fn; c.voidp = dtype_file_extent_fn;
*ierr = OMPI_INT_2_FINT(MPI_Register_datarep(datarep, a.convertp, *ierr = OMPI_INT_2_FINT(MPI_Register_datarep(c_datarep, a.convertp,
b.convertp, c.extentp, b.convertp, c.extentp,
extra_state)); extra_state));
free(c_datarep);
} }