Skip to content

Commit

Permalink
Add more generated fortran 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 569efa1 commit ced48f8
Show file tree
Hide file tree
Showing 26 changed files with 90 additions and 637 deletions.
14 changes: 14 additions & 0 deletions ompi/mpi/bindings/ompi_bindings/fortran_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,3 +473,17 @@ def use(self):

def c_parameter(self):
return f'MPI_Fint *{self.name}'


@FortranType.add('OFFSET')
class Offset(FortranType):
"""MPI_Offset type."""

def declare(self):
return f'INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: {self.name}'

def use(self):
return [('mpi_f08_types', 'MPI_OFFSET_KIND')]

def c_parameter(self):
return f'MPI_Offset *{self.name}'
2 changes: 1 addition & 1 deletion ompi/mpi/bindings/ompi_bindings/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def load(fname, prefix=None, type_constructor=None):
header.append(line)

if not prototype:
raise RuntimeError('missing prototype')
raise RuntimeError(f'missing prototype for {fname}')
# Parse the prototype
prototype = ''.join(prototype)
prototype = prototype[len('PROTOTYPE'):]
Expand Down
11 changes: 0 additions & 11 deletions ompi/mpi/fortran/use-mpi-f08/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ mpi_api_files = \
barrier_f08.F90 \
barrier_init_f08.F90 \
bcast_init_f08.F90 \
bsend_init_f08.F90 \
buffer_attach_f08.F90 \
buffer_detach_f08.F90 \
cancel_f08.F90 \
cart_coords_f08.F90 \
Expand Down Expand Up @@ -177,7 +175,6 @@ mpi_api_files = \
comm_split_f08.F90 \
comm_split_type_f08.F90 \
comm_test_inter_f08.F90 \
compare_and_swap_f08.F90 \
dist_graph_create_adjacent_f08.F90 \
dist_graph_create_f08.F90 \
dist_graph_neighbors_count_f08.F90 \
Expand All @@ -186,10 +183,8 @@ mpi_api_files = \
errhandler_free_f08.F90 \
error_class_f08.F90 \
error_string_f08.F90 \
exscan_f08.F90 \
exscan_init_f08.F90 \
f_sync_reg_f08.F90 \
fetch_and_op_f08.F90 \
file_call_errhandler_f08.F90 \
file_close_f08.F90 \
file_create_errhandler_f08.F90 \
Expand All @@ -205,15 +200,9 @@ mpi_api_files = \
file_get_size_f08.F90 \
file_get_type_extent_f08.F90 \
file_get_view_f08.F90 \
file_iread_at_f08.F90 \
file_iread_f08.F90 \
file_iread_at_all_f08.F90 \
file_iread_all_f08.F90 \
file_iread_shared_f08.F90 \
file_iwrite_at_f08.F90 \
file_iwrite_f08.F90 \
file_iwrite_at_all_f08.F90 \
file_iwrite_all_f08.F90 \
file_iwrite_shared_f08.F90 \
file_open_f08.F90 \
file_preallocate_f08.F90 \
Expand Down
10 changes: 10 additions & 0 deletions ompi/mpi/fortran/use-mpi-f08/Makefile.prototype_files
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,20 @@ ready_prototype_files = \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/alltoallw_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/bcast_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/bsend_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/bsend_init_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/buffer_attach_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/exscan_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/fetch_and_op_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/send_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/recv_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/isend_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/irecv_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/file_iread_all_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/file_iread_at_all_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/file_iread_at_ts.c.in \
$(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_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
32 changes: 0 additions & 32 deletions ompi/mpi/fortran/use-mpi-f08/bsend_init_f08.F90

This file was deleted.

24 changes: 8 additions & 16 deletions ompi/mpi/fortran/use-mpi-f08/bsend_init_ts.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,16 @@
* $HEADER$
*/

#include "ompi_config.h"

#include "ompi/communicator/communicator.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_Bsend_init";

void ompi_bsend_init_ts(CFI_cdesc_t* x, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr)
PROTOTYPE VOID bsend_init(BUFFER x, COUNT count, DATATYPE datatype, RANK dest,
TAG tag, COMM comm, REQUEST_OUT request)
{
int c_ierr;
MPI_Datatype c_datatype, c_type = PMPI_Type_f2c(*datatype);
MPI_Request c_req;
MPI_Comm c_comm = PMPI_Comm_f2c (*comm);

void *buf = OMPI_CFI_BASE_ADDR(x);
int c_count = OMPI_FINT_2_INT(*count);
@COUNT_TYPE@ c_count = (@COUNT_TYPE@) *count;

OMPI_CFI_2_C(x, c_count, c_type, c_datatype, c_ierr);
if (MPI_SUCCESS != c_ierr) {
Expand All @@ -45,11 +37,11 @@ void ompi_bsend_init_ts(CFI_cdesc_t* x, MPI_Fint *count, MPI_Fint *datatype, MPI
return;
}

c_ierr = PMPI_Bsend_init(OMPI_F2C_BOTTOM(buf), c_count,
c_datatype,
OMPI_FINT_2_INT(*dest),
OMPI_FINT_2_INT(*tag),
c_comm, &c_req);
c_ierr = @INNER_CALL@(OMPI_F2C_BOTTOM(buf), c_count,
c_datatype,
OMPI_FINT_2_INT(*dest),
OMPI_FINT_2_INT(*tag),
c_comm, &c_req);
if (c_datatype != c_type) {
ompi_datatype_destroy(&c_datatype);
}
Expand Down
26 changes: 0 additions & 26 deletions ompi/mpi/fortran/use-mpi-f08/buffer_attach_f08.F90

This file was deleted.

10 changes: 1 addition & 9 deletions ompi/mpi/fortran/use-mpi-f08/buffer_attach_ts.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,7 @@
* $HEADER$
*/

#include "ompi_config.h"

#include "ompi/communicator/communicator.h"
#include "ompi/errhandler/errhandler.h"
#include "ompi/mpi/fortran/use-mpi-f08/ts/bindings.h"

static const char FUNC_NAME[] = "MPI_Buffer_attach";

void ompi_buffer_attach_ts(CFI_cdesc_t *x, MPI_Fint *size, MPI_Fint *ierr)
PROTOTYPE VOID buffer_attach(BUFFER_ASYNC x, COUNT size)
{
int c_ierr;
if (OMPI_CFI_IS_CONTIGUOUS(x)) {
Expand Down
33 changes: 0 additions & 33 deletions ompi/mpi/fortran/use-mpi-f08/compare_and_swap_f08.F90

This file was deleted.

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

#include "ompi_config.h"

#include "ompi/win/win.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_Compare_and_swap";

void ompi_compare_and_swap_ts(CFI_cdesc_t *x1, CFI_cdesc_t *x2, CFI_cdesc_t *x3,
MPI_Fint *datatype, MPI_Fint *target_rank, MPI_Aint *target_disp,
MPI_Fint *win, MPI_Fint *ierr)
PROTOTYPE VOID compare_and_swap(BUFFER x1, BUFFER x2, BUFFER_ASYNC x3,
DATATYPE datatype, RANK target_rank, AINT target_disp,
WIN win)
{
int c_ierr;
MPI_Datatype c_datatype = PMPI_Type_f2c(*datatype);
Expand Down
31 changes: 0 additions & 31 deletions ompi/mpi/fortran/use-mpi-f08/exscan_f08.F90

This file was deleted.

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

#include "ompi_config.h"

#include "ompi/communicator/communicator.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_Exscan";

void ompi_exscan_ts(CFI_cdesc_t *x1, CFI_cdesc_t *x2, MPI_Fint *count,
MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm,
MPI_Fint *ierr)
PROTOTYPE VOID exscan(BUFFER x1, BUFFER_OUT x2, COUNT count,
DATATYPE datatype, OP op, COMM comm)
{
int c_ierr;
MPI_Comm c_comm = PMPI_Comm_f2c(*comm);
Expand All @@ -57,8 +47,8 @@ void ompi_exscan_ts(CFI_cdesc_t *x1, CFI_cdesc_t *x2, MPI_Fint *count,
sendbuf = (char *) OMPI_F2C_BOTTOM (sendbuf);
recvbuf = (char *) OMPI_F2C_BOTTOM (recvbuf);

c_ierr = PMPI_Exscan(sendbuf, recvbuf,
OMPI_FINT_2_INT(*count),
c_type, c_op, c_comm);
c_ierr = @INNER_CALL@(sendbuf, recvbuf,
(@COUNT_TYPE@) *count,
c_type, c_op, c_comm);
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
}
33 changes: 0 additions & 33 deletions ompi/mpi/fortran/use-mpi-f08/fetch_and_op_f08.F90

This file was deleted.

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

#include "ompi_config.h"

#include "ompi/win/win.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_Fetch_and_op";

void ompi_fetch_and_op_ts(CFI_cdesc_t *x1, CFI_cdesc_t *x2, MPI_Fint *datatype,
MPI_Fint *target_rank, MPI_Aint *target_disp,
MPI_Fint *op, MPI_Fint *win, MPI_Fint *ierr)
PROTOTYPE VOID fetch_and_op(BUFFER x1, BUFFER_OUT x2, DATATYPE datatype,
RANK target_rank, AINT target_disp,
OP op, WIN win)
{
int c_ierr;
MPI_Datatype c_datatype = PMPI_Type_f2c(*datatype);
Expand Down
Loading

0 comments on commit ced48f8

Please sign in to comment.