Skip to content

Commit

Permalink
Convert Fortran file_iwrite_* functions
Browse files Browse the repository at this point in the history
Signed-off-by: Jake Tronge <[email protected]>
  • Loading branch information
jtronge committed Aug 13, 2024
1 parent ced48f8 commit fa6f257
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 253 deletions.
4 changes: 0 additions & 4 deletions ompi/mpi/fortran/use-mpi-f08/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,6 @@ mpi_api_files = \
file_get_size_f08.F90 \
file_get_type_extent_f08.F90 \
file_get_view_f08.F90 \
file_iwrite_at_f08.F90 \
file_iwrite_f08.F90 \
file_iwrite_at_all_f08.F90 \
file_iwrite_shared_f08.F90 \
file_open_f08.F90 \
file_preallocate_f08.F90 \
file_read_all_begin_f08.F90 \
Expand Down
4 changes: 4 additions & 0 deletions ompi/mpi/fortran/use-mpi-f08/Makefile.prototype_files
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ ready_prototype_files = \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/file_iread_shared_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/file_iread_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/file_iwrite_all_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/file_iwrite_at_all_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/file_iwrite_at_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/file_iwrite_shared_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/file_iwrite_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/file_write_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/reduce_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/waitall.c.in \
Expand Down
31 changes: 0 additions & 31 deletions ompi/mpi/fortran/use-mpi-f08/file_iwrite_at_all_f08.F90

This file was deleted.

27 changes: 9 additions & 18 deletions ompi/mpi/fortran/use-mpi-f08/file_iwrite_at_all_ts.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,15 @@
* $HEADER$
*/

#include "ompi_config.h"

#include "ompi/file/file.h"
#include "ompi/errhandler/errhandler.h"
#include "ompi/mpi/fortran/use-mpi-f08/ts/bindings.h"
#include "ompi/mpi/fortran/base/constants.h"

static const char FUNC_NAME[] = "MPI_File_iwrite_at_all";

void ompi_file_iwrite_at_all_ts(MPI_Fint *fh, MPI_Offset *offset, CFI_cdesc_t *x,
MPI_Fint *count, MPI_Fint *datatype,
MPI_Fint *request, MPI_Fint *ierr)
PROTOTYPE VOID file_iwrite_at_all(FILE fh, OFFSET offset, BUFFER x,
COUNT count, DATATYPE datatype,
REQUEST_OUT request)
{
int c_ierr;
MPI_File c_fh = PMPI_File_f2c(*fh);
MPI_Datatype c_datatype, c_type = PMPI_Type_f2c(*datatype);
void *buf = OMPI_CFI_BASE_ADDR(x);
int c_count = OMPI_FINT_2_INT(*count);
@COUNT_TYPE@ c_count = (@COUNT_TYPE@) *count;
MPI_Request c_request;

OMPI_CFI_2_C(x, c_count, c_type, c_datatype, c_ierr);
Expand All @@ -46,11 +37,11 @@ void ompi_file_iwrite_at_all_ts(MPI_Fint *fh, MPI_Offset *offset, CFI_cdesc_t *x
return;
}

c_ierr = PMPI_File_iwrite_at_all(c_fh, (MPI_Offset) *offset,
OMPI_F2C_BOTTOM(buf),
c_count,
c_datatype,
&c_request);
c_ierr = @INNER_CALL@(c_fh, (MPI_Offset) *offset,
OMPI_F2C_BOTTOM(buf),
c_count,
c_datatype,
&c_request);

if (c_datatype != c_type) {
ompi_datatype_destroy(&c_datatype);
Expand Down
31 changes: 0 additions & 31 deletions ompi/mpi/fortran/use-mpi-f08/file_iwrite_at_f08.F90

This file was deleted.

27 changes: 9 additions & 18 deletions ompi/mpi/fortran/use-mpi-f08/file_iwrite_at_ts.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,15 @@
* $HEADER$
*/

#include "ompi_config.h"

#include "ompi/file/file.h"
#include "ompi/errhandler/errhandler.h"
#include "ompi/mpi/fortran/use-mpi-f08/ts/bindings.h"
#include "ompi/mpi/fortran/base/constants.h"

static const char FUNC_NAME[] = "MPI_File_iwrite_at";

void ompi_file_iwrite_at_ts(MPI_Fint *fh, MPI_Offset *offset, CFI_cdesc_t *x,
MPI_Fint *count, MPI_Fint *datatype,
MPI_Fint *request, MPI_Fint *ierr)
PROTOTYPE VOID file_iwrite_at(FILE fh, OFFSET offset, BUFFER x,
COUNT count, DATATYPE datatype,
REQUEST_OUT request)
{
int c_ierr;
MPI_File c_fh = PMPI_File_f2c(*fh);
MPI_Datatype c_datatype, c_type = PMPI_Type_f2c(*datatype);
void *buf = OMPI_CFI_BASE_ADDR(x);
int c_count = OMPI_FINT_2_INT(*count);
@COUNT_TYPE@ c_count = (@COUNT_TYPE@) *count;
MPI_Request c_request;

OMPI_CFI_2_C(x, c_count, c_type, c_datatype, c_ierr);
Expand All @@ -46,11 +37,11 @@ void ompi_file_iwrite_at_ts(MPI_Fint *fh, MPI_Offset *offset, CFI_cdesc_t *x,
return;
}

c_ierr = PMPI_File_iwrite_at(c_fh, (MPI_Offset) *offset,
OMPI_F2C_BOTTOM(buf),
c_count,
c_datatype,
&c_request);
c_ierr = @INNER_CALL@(c_fh, (MPI_Offset) *offset,
OMPI_F2C_BOTTOM(buf),
c_count,
c_datatype,
&c_request);

if (c_datatype != c_type) {
ompi_datatype_destroy(&c_datatype);
Expand Down
30 changes: 0 additions & 30 deletions ompi/mpi/fortran/use-mpi-f08/file_iwrite_f08.F90

This file was deleted.

30 changes: 0 additions & 30 deletions ompi/mpi/fortran/use-mpi-f08/file_iwrite_shared_f08.F90

This file was deleted.

23 changes: 5 additions & 18 deletions ompi/mpi/fortran/use-mpi-f08/file_iwrite_shared_ts.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,14 @@
* $HEADER$
*/

#include "ompi_config.h"

#include "ompi/file/file.h"
#include "ompi/errhandler/errhandler.h"
#include "ompi/mpi/fortran/use-mpi-f08/ts/bindings.h"
#include "ompi/mpi/fortran/base/constants.h"

static const char FUNC_NAME[] = "MPI_File_iwrite_shared";

void ompi_file_iwrite_shared_ts(MPI_Fint *fh, CFI_cdesc_t *x, MPI_Fint *count,
MPI_Fint *datatype, MPI_Fint *request,
MPI_Fint *ierr)
PROTOTYPE VOID file_iwrite_shared(FILE fh, BUFFER x, COUNT count,
DATATYPE datatype, REQUEST_OUT request)
{
int c_ierr;
MPI_File c_fh = PMPI_File_f2c(*fh);
MPI_Datatype c_datatype, c_type = PMPI_Type_f2c(*datatype);
void *buf = OMPI_CFI_BASE_ADDR(x);
int c_count = OMPI_FINT_2_INT(*count);
@COUNT_TYPE@ c_count = (@COUNT_TYPE@) *count;
MPI_Request c_request;

OMPI_CFI_2_C(x, c_count, c_type, c_datatype, c_ierr);
Expand All @@ -46,11 +36,8 @@ void ompi_file_iwrite_shared_ts(MPI_Fint *fh, CFI_cdesc_t *x, MPI_Fint *count,
return;
}

c_ierr = PMPI_File_iwrite_shared(c_fh,
OMPI_F2C_BOTTOM(buf),
c_count,
c_datatype,
&c_request);
c_ierr = @INNER_CALL@(c_fh, OMPI_F2C_BOTTOM(buf), c_count,
c_datatype, &c_request);

if (c_datatype != c_type) {
ompi_datatype_destroy(&c_datatype);
Expand Down
20 changes: 5 additions & 15 deletions ompi/mpi/fortran/use-mpi-f08/file_iwrite_ts.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,14 @@
* $HEADER$
*/

#include "ompi_config.h"

#include "ompi/file/file.h"
#include "ompi/errhandler/errhandler.h"
#include "ompi/mpi/fortran/use-mpi-f08/ts/bindings.h"
#include "ompi/mpi/fortran/base/constants.h"

static const char FUNC_NAME[] = "MPI_File_iwrite";

void ompi_file_iwrite_ts(MPI_Fint *fh, CFI_cdesc_t *x, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *request, MPI_Fint *ierr)
PROTOTYPE VOID file_iwrite(FILE fh, BUFFER x, COUNT count, DATATYPE datatype,
REQUEST_OUT request)
{
int c_ierr;
MPI_File c_fh = PMPI_File_f2c(*fh);
MPI_Datatype c_datatype, c_type = PMPI_Type_f2c(*datatype);
void *buf = OMPI_CFI_BASE_ADDR(x);
int c_count = OMPI_FINT_2_INT(*count);
@COUNT_TYPE@ c_count = (@COUNT_TYPE@) *count;
MPI_Request c_request;

OMPI_CFI_2_C(x, c_count, c_type, c_datatype, c_ierr);
Expand All @@ -44,10 +36,8 @@ void ompi_file_iwrite_ts(MPI_Fint *fh, CFI_cdesc_t *x, MPI_Fint *count, MPI_Fint
return;
}

c_ierr = PMPI_File_iwrite(c_fh, OMPI_F2C_BOTTOM(buf),
c_count,
c_datatype,
&c_request);
c_ierr = @INNER_CODE@(c_fh, OMPI_F2C_BOTTOM(buf), c_count,
c_datatype, &c_request);

if (c_datatype != c_type) {
ompi_datatype_destroy(&c_datatype);
Expand Down
58 changes: 0 additions & 58 deletions ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -3595,64 +3595,6 @@ subroutine MPI_File_get_view_f08(fh,disp,etype,filetype,datarep,ierror)
end subroutine MPI_File_get_view_f08
end interface MPI_File_get_view

interface MPI_File_iwrite
subroutine MPI_File_iwrite_f08(fh,buf,count,datatype,request,ierror)
use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request
implicit none
TYPE(MPI_File), INTENT(IN) :: fh
@OMPI_FORTRAN_IGNORE_TKR_PREDECL@ buf
@OMPI_FORTRAN_IGNORE_TKR_TYPE@, INTENT(IN) OMPI_ASYNCHRONOUS :: buf
INTEGER, INTENT(IN) :: count
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Request), INTENT(OUT) :: request
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
end subroutine MPI_File_iwrite_f08
end interface MPI_File_iwrite

interface MPI_File_iwrite_at
subroutine MPI_File_iwrite_at_f08(fh,offset,buf,count,datatype,request,ierror)
use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request, MPI_OFFSET_KIND
implicit none
TYPE(MPI_File), INTENT(IN) :: fh
INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset
@OMPI_FORTRAN_IGNORE_TKR_PREDECL@ buf
@OMPI_FORTRAN_IGNORE_TKR_TYPE@, INTENT(IN) OMPI_ASYNCHRONOUS :: buf
INTEGER, INTENT(IN) :: count
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Request), INTENT(OUT) :: request
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
end subroutine MPI_File_iwrite_at_f08
end interface MPI_File_iwrite_at

interface MPI_File_iwrite_at_all
subroutine MPI_File_iwrite_at_all_f08(fh,offset,buf,count,datatype,request,ierror)
use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request, MPI_OFFSET_KIND
implicit none
TYPE(MPI_File), INTENT(IN) :: fh
INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset
@OMPI_FORTRAN_IGNORE_TKR_PREDECL@ buf
@OMPI_FORTRAN_IGNORE_TKR_TYPE@, INTENT(IN) OMPI_ASYNCHRONOUS :: buf
INTEGER, INTENT(IN) :: count
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Request), INTENT(OUT) :: request
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
end subroutine MPI_File_iwrite_at_all_f08
end interface MPI_File_iwrite_at_all

interface MPI_File_iwrite_shared
subroutine MPI_File_iwrite_shared_f08(fh,buf,count,datatype,request,ierror)
use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request
implicit none
@OMPI_FORTRAN_IGNORE_TKR_PREDECL@ buf
@OMPI_FORTRAN_IGNORE_TKR_TYPE@, INTENT(IN) OMPI_ASYNCHRONOUS :: buf
TYPE(MPI_File), INTENT(IN) :: fh
INTEGER, INTENT(IN) :: count
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Request), INTENT(OUT) :: request
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
end subroutine MPI_File_iwrite_shared_f08
end interface MPI_File_iwrite_shared

interface MPI_File_open
subroutine MPI_File_open_f08(comm,filename,amode,info,fh,ierror)
use :: mpi_f08_types, only : MPI_Comm, MPI_Info, MPI_File
Expand Down

0 comments on commit fa6f257

Please sign in to comment.