Skip to content

Commit

Permalink
fortran/use-mpi-f08: add TS C files
Browse files Browse the repository at this point in the history
Co-authored-by: Gilles Gouaillardet <gilles@rist.or.jp>
Signed-off-by: Jake Tronge <jtronge@lanl.gov>
  • Loading branch information
2 people authored and jtronge committed Aug 1, 2024
1 parent 8a912b0 commit 90d6570
Show file tree
Hide file tree
Showing 101 changed files with 7,135 additions and 0 deletions.
100 changes: 100 additions & 0 deletions ompi/mpi/fortran/use-mpi-f08/Makefile.prototype_files
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@

prototype_files = \
accumulate_ts.c.in \
bsend_init_ts.c.in \
bsend_ts.c.in \
buffer_attach_ts.c.in \
compare_and_swap_ts.c.in \
f_sync_reg_ts.c.in \
fetch_and_op_ts.c.in \
file_iread_all_ts.c.in \
file_iread_at_all_ts.c.in \
file_iread_at_ts.c.in \
file_iread_shared_ts.c.in \
file_iread_ts.c.in \
file_iwrite_all_ts.c.in \
file_iwrite_at_all_ts.c.in \
file_iwrite_at_ts.c.in \
file_iwrite_shared_ts.c.in \
file_iwrite_ts.c.in \
file_read_all_begin_ts.c.in \
file_read_all_end_ts.c.in \
file_read_all_ts.c.in \
file_read_at_all_begin_ts.c.in \
file_read_at_all_end_ts.c.in \
file_read_at_all_ts.c.in \
file_read_at_ts.c.in \
file_read_ordered_begin_ts.c.in \
file_read_ordered_end_ts.c.in \
file_read_ordered_ts.c.in \
file_read_shared_ts.c.in \
file_read_ts.c.in \
file_write_all_begin_ts.c.in \
file_write_all_end_ts.c.in \
file_write_all_ts.c.in \
file_write_at_all_begin_ts.c.in \
file_write_at_all_end_ts.c.in \
file_write_at_all_ts.c.in \
file_write_at_ts.c.in \
file_write_ordered_begin_ts.c.in \
file_write_ordered_end_ts.c.in \
file_write_ordered_ts.c.in \
file_write_shared_ts.c.in \
file_write_ts.c.in \
free_mem_ts.c.in \
get_accumulate_ts.c.in \
get_address_ts.c.in \
get_ts.c.in \
iallgather_ts.c.in \
iallgatherv_ts.c.in \
iallreduce_ts.c.in \
ialltoall_ts.c.in \
ialltoallv_ts.c.in \
ialltoallw_ts.c.in \
ibcast_ts.c.in \
ibsend_ts.c.in \
iexscan_ts.c.in \
igather_ts.c.in \
igatherv_ts.c.in \
imrecv_ts.c.in \
ineighbor_allgather_ts.c.in \
ineighbor_allgatherv_ts.c.in \
ineighbor_alltoall_ts.c.in \
ineighbor_alltoallv_ts.c.in \
ineighbor_alltoallw_ts.c.in \
irecv_ts.c.in \
ireduce_scatter_block_ts.c.in \
ireduce_scatter_ts.c.in \
ireduce_ts.c.in \
irsend_ts.c.in \
iscan_ts.c.in \
iscatter_ts.c.in \
iscatterv_ts.c.in \
isend_ts.c.in \
isendrecv_replace_ts.c.in \
isendrecv_ts.c.in \
issend_ts.c.in \
mrecv_ts.c.in \
pack_external_ts.c.in \
pack_ts.c.in \
put_ts.c.in \
raccumulate_ts.c.in \
recv_init_ts.c.in \
recv_ts.c.in \
rget_accumulate_ts.c.in \
rget_ts.c.in \
rput_ts.c.in \
rsend_init_ts.c.in \
rsend_ts.c.in \
send_init_ts.c.in \
send_ts.c.in \
sendrecv_replace_ts.c.in \
sendrecv_ts.c.in \
ssend_init_ts.c.in \
ssend_ts.c.in \
ts.c.in \
unpack_external_ts.c.in \
unpack_ts.c.in \
win_attach_ts.c.in \
win_create_ts.c.in \
win_detach_ts.c.in
64 changes: 64 additions & 0 deletions ompi/mpi/fortran/use-mpi-f08/accumulate_ts.c.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $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_Accumulate";

void ompi_accumulate_ts(CFI_cdesc_t *x, MPI_Fint *origin_count,
MPI_Fint *origin_datatype, MPI_Fint *target_rank,
MPI_Aint *target_disp, MPI_Fint *target_count,
MPI_Fint *target_datatype, MPI_Fint *op, MPI_Fint *win,
MPI_Fint *ierr)
{
int c_ierr;

MPI_Datatype c_origin_datatype, c_origin_type = PMPI_Type_f2c(*origin_datatype);
MPI_Datatype c_target_datatype = PMPI_Type_f2c(*target_datatype);
MPI_Win c_win = PMPI_Win_f2c(*win);
MPI_Op c_op = PMPI_Op_f2c(*op);
char *origin_addr = x->base_addr;
int c_origin_count = OMPI_INT_2_FINT(*origin_count);

OMPI_CFI_2_C(x, c_origin_count, c_origin_type, c_origin_datatype, c_ierr);
if (MPI_SUCCESS != c_ierr) {
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
OMPI_ERRHANDLER_INVOKE(c_win, c_ierr, FUNC_NAME)
return;
}
c_ierr = PMPI_Accumulate(OMPI_F2C_BOTTOM(origin_addr),
c_origin_count,
c_origin_datatype,
OMPI_FINT_2_INT(*target_rank),
*target_disp,
OMPI_FINT_2_INT(*target_count),
c_target_datatype, c_op, c_win);
if (c_origin_datatype != c_origin_type) {
ompi_datatype_destroy(&c_origin_datatype);
}

if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
}
61 changes: 61 additions & 0 deletions ompi/mpi/fortran/use-mpi-f08/bsend_init_ts.c.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $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)
{
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 = x->base_addr;
int c_count = OMPI_FINT_2_INT(*count);

OMPI_CFI_2_C(x, c_count, c_type, c_datatype, c_ierr);
if (MPI_SUCCESS != c_ierr) {
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
OMPI_ERRHANDLER_INVOKE(c_comm, c_ierr, FUNC_NAME);
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);
if (c_datatype != c_type) {
ompi_datatype_destroy(&c_datatype);
}
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);

if (MPI_SUCCESS == c_ierr) {
*request = PMPI_Request_c2f(c_req);
}
}
53 changes: 53 additions & 0 deletions ompi/mpi/fortran/use-mpi-f08/bsend_ts.c.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $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";

void ompi_bsend_ts(CFI_cdesc_t* x, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr)
{
int c_ierr;
MPI_Comm c_comm = PMPI_Comm_f2c (*comm);
MPI_Datatype c_datatype, c_type = PMPI_Type_f2c(*datatype);
void *buf = x->base_addr;
int c_count = OMPI_FINT_2_INT(*count);

OMPI_CFI_2_C(x, c_count, c_type, c_datatype, c_ierr);
if (MPI_SUCCESS != c_ierr) {
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
OMPI_ERRHANDLER_INVOKE(c_comm, c_ierr, FUNC_NAME);
return;
}

c_ierr = PMPI_Bsend(OMPI_F2C_BOTTOM(buf), c_count,
c_datatype, OMPI_FINT_2_INT(*dest),
OMPI_FINT_2_INT(*tag), c_comm);
if (c_datatype != c_type) {
ompi_datatype_destroy(&c_datatype);
}
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
}
40 changes: 40 additions & 0 deletions ompi/mpi/fortran/use-mpi-f08/buffer_attach_ts.c.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $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)
{
int c_ierr;
if (OMPI_CFI_IS_CONTIGUOUS(x)) {
c_ierr = PMPI_Buffer_attach(x->base_addr, OMPI_FINT_2_INT(*size));
} else {
c_ierr = MPI_ERR_BUFFER;
OMPI_ERRHANDLER_INVOKE(MPI_COMM_SELF, c_ierr, FUNC_NAME);
}
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
}
67 changes: 67 additions & 0 deletions ompi/mpi/fortran/use-mpi-f08/compare_and_swap_ts.c.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $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)
{
int c_ierr;
MPI_Datatype c_datatype = PMPI_Type_f2c(*datatype);
MPI_Win c_win = PMPI_Win_f2c(*win);
char *origin_addr = x1->base_addr, *compare_addr = x2->base_addr, *result_addr = x3->base_addr;

OMPI_CFI_CHECK_CONTIGUOUS(x1, c_ierr);
if (MPI_SUCCESS != c_ierr) {
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
OMPI_ERRHANDLER_INVOKE(c_win, c_ierr, FUNC_NAME)
return;
}
OMPI_CFI_CHECK_CONTIGUOUS(x2, c_ierr);
if (MPI_SUCCESS != c_ierr) {
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
OMPI_ERRHANDLER_INVOKE(c_win, c_ierr, FUNC_NAME)
return;
}
OMPI_CFI_CHECK_CONTIGUOUS(x3, c_ierr);
if (MPI_SUCCESS != c_ierr) {
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
return;
}
c_ierr = PMPI_Compare_and_swap(OMPI_F2C_BOTTOM(origin_addr),
OMPI_F2C_BOTTOM(compare_addr),
OMPI_F2C_BOTTOM(result_addr),
c_datatype,
OMPI_FINT_2_INT(*target_rank),
*target_disp, c_win);
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
}
Loading

0 comments on commit 90d6570

Please sign in to comment.