Skip to content

Commit 90d6570

Browse files
hppritchaggouaillardet
authored andcommitted
fortran/use-mpi-f08: add TS C files
Co-authored-by: Gilles Gouaillardet <gilles@rist.or.jp> Signed-off-by: Jake Tronge <jtronge@lanl.gov>
1 parent 8a912b0 commit 90d6570

File tree

101 files changed

+7135
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+7135
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
2+
prototype_files = \
3+
accumulate_ts.c.in \
4+
bsend_init_ts.c.in \
5+
bsend_ts.c.in \
6+
buffer_attach_ts.c.in \
7+
compare_and_swap_ts.c.in \
8+
f_sync_reg_ts.c.in \
9+
fetch_and_op_ts.c.in \
10+
file_iread_all_ts.c.in \
11+
file_iread_at_all_ts.c.in \
12+
file_iread_at_ts.c.in \
13+
file_iread_shared_ts.c.in \
14+
file_iread_ts.c.in \
15+
file_iwrite_all_ts.c.in \
16+
file_iwrite_at_all_ts.c.in \
17+
file_iwrite_at_ts.c.in \
18+
file_iwrite_shared_ts.c.in \
19+
file_iwrite_ts.c.in \
20+
file_read_all_begin_ts.c.in \
21+
file_read_all_end_ts.c.in \
22+
file_read_all_ts.c.in \
23+
file_read_at_all_begin_ts.c.in \
24+
file_read_at_all_end_ts.c.in \
25+
file_read_at_all_ts.c.in \
26+
file_read_at_ts.c.in \
27+
file_read_ordered_begin_ts.c.in \
28+
file_read_ordered_end_ts.c.in \
29+
file_read_ordered_ts.c.in \
30+
file_read_shared_ts.c.in \
31+
file_read_ts.c.in \
32+
file_write_all_begin_ts.c.in \
33+
file_write_all_end_ts.c.in \
34+
file_write_all_ts.c.in \
35+
file_write_at_all_begin_ts.c.in \
36+
file_write_at_all_end_ts.c.in \
37+
file_write_at_all_ts.c.in \
38+
file_write_at_ts.c.in \
39+
file_write_ordered_begin_ts.c.in \
40+
file_write_ordered_end_ts.c.in \
41+
file_write_ordered_ts.c.in \
42+
file_write_shared_ts.c.in \
43+
file_write_ts.c.in \
44+
free_mem_ts.c.in \
45+
get_accumulate_ts.c.in \
46+
get_address_ts.c.in \
47+
get_ts.c.in \
48+
iallgather_ts.c.in \
49+
iallgatherv_ts.c.in \
50+
iallreduce_ts.c.in \
51+
ialltoall_ts.c.in \
52+
ialltoallv_ts.c.in \
53+
ialltoallw_ts.c.in \
54+
ibcast_ts.c.in \
55+
ibsend_ts.c.in \
56+
iexscan_ts.c.in \
57+
igather_ts.c.in \
58+
igatherv_ts.c.in \
59+
imrecv_ts.c.in \
60+
ineighbor_allgather_ts.c.in \
61+
ineighbor_allgatherv_ts.c.in \
62+
ineighbor_alltoall_ts.c.in \
63+
ineighbor_alltoallv_ts.c.in \
64+
ineighbor_alltoallw_ts.c.in \
65+
irecv_ts.c.in \
66+
ireduce_scatter_block_ts.c.in \
67+
ireduce_scatter_ts.c.in \
68+
ireduce_ts.c.in \
69+
irsend_ts.c.in \
70+
iscan_ts.c.in \
71+
iscatter_ts.c.in \
72+
iscatterv_ts.c.in \
73+
isend_ts.c.in \
74+
isendrecv_replace_ts.c.in \
75+
isendrecv_ts.c.in \
76+
issend_ts.c.in \
77+
mrecv_ts.c.in \
78+
pack_external_ts.c.in \
79+
pack_ts.c.in \
80+
put_ts.c.in \
81+
raccumulate_ts.c.in \
82+
recv_init_ts.c.in \
83+
recv_ts.c.in \
84+
rget_accumulate_ts.c.in \
85+
rget_ts.c.in \
86+
rput_ts.c.in \
87+
rsend_init_ts.c.in \
88+
rsend_ts.c.in \
89+
send_init_ts.c.in \
90+
send_ts.c.in \
91+
sendrecv_replace_ts.c.in \
92+
sendrecv_ts.c.in \
93+
ssend_init_ts.c.in \
94+
ssend_ts.c.in \
95+
ts.c.in \
96+
unpack_external_ts.c.in \
97+
unpack_ts.c.in \
98+
win_attach_ts.c.in \
99+
win_create_ts.c.in \
100+
win_detach_ts.c.in
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3+
* University Research and Technology
4+
* Corporation. All rights reserved.
5+
* Copyright (c) 2004-2005 The University of Tennessee and The University
6+
* of Tennessee Research Foundation. All rights
7+
* reserved.
8+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9+
* University of Stuttgart. All rights reserved.
10+
* Copyright (c) 2004-2005 The Regents of the University of California.
11+
* All rights reserved.
12+
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2015-2019 Research Organization for Information Science
14+
* and Technology (RIST). All rights reserved.
15+
* $COPYRIGHT$
16+
*
17+
* Additional copyrights may follow
18+
*
19+
* $HEADER$
20+
*/
21+
22+
#include "ompi_config.h"
23+
24+
#include "ompi/win/win.h"
25+
#include "ompi/errhandler/errhandler.h"
26+
#include "ompi/mpi/fortran/use-mpi-f08/ts/bindings.h"
27+
#include "ompi/mpi/fortran/base/constants.h"
28+
29+
static const char FUNC_NAME[] = "MPI_Accumulate";
30+
31+
void ompi_accumulate_ts(CFI_cdesc_t *x, MPI_Fint *origin_count,
32+
MPI_Fint *origin_datatype, MPI_Fint *target_rank,
33+
MPI_Aint *target_disp, MPI_Fint *target_count,
34+
MPI_Fint *target_datatype, MPI_Fint *op, MPI_Fint *win,
35+
MPI_Fint *ierr)
36+
{
37+
int c_ierr;
38+
39+
MPI_Datatype c_origin_datatype, c_origin_type = PMPI_Type_f2c(*origin_datatype);
40+
MPI_Datatype c_target_datatype = PMPI_Type_f2c(*target_datatype);
41+
MPI_Win c_win = PMPI_Win_f2c(*win);
42+
MPI_Op c_op = PMPI_Op_f2c(*op);
43+
char *origin_addr = x->base_addr;
44+
int c_origin_count = OMPI_INT_2_FINT(*origin_count);
45+
46+
OMPI_CFI_2_C(x, c_origin_count, c_origin_type, c_origin_datatype, c_ierr);
47+
if (MPI_SUCCESS != c_ierr) {
48+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
49+
OMPI_ERRHANDLER_INVOKE(c_win, c_ierr, FUNC_NAME)
50+
return;
51+
}
52+
c_ierr = PMPI_Accumulate(OMPI_F2C_BOTTOM(origin_addr),
53+
c_origin_count,
54+
c_origin_datatype,
55+
OMPI_FINT_2_INT(*target_rank),
56+
*target_disp,
57+
OMPI_FINT_2_INT(*target_count),
58+
c_target_datatype, c_op, c_win);
59+
if (c_origin_datatype != c_origin_type) {
60+
ompi_datatype_destroy(&c_origin_datatype);
61+
}
62+
63+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
64+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3+
* University Research and Technology
4+
* Corporation. All rights reserved.
5+
* Copyright (c) 2004-2005 The University of Tennessee and The University
6+
* of Tennessee Research Foundation. All rights
7+
* reserved.
8+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9+
* University of Stuttgart. All rights reserved.
10+
* Copyright (c) 2004-2005 The Regents of the University of California.
11+
* All rights reserved.
12+
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2015-2019 Research Organization for Information Science
14+
* and Technology (RIST). All rights reserved.
15+
* $COPYRIGHT$
16+
*
17+
* Additional copyrights may follow
18+
*
19+
* $HEADER$
20+
*/
21+
22+
#include "ompi_config.h"
23+
24+
#include "ompi/communicator/communicator.h"
25+
#include "ompi/errhandler/errhandler.h"
26+
#include "ompi/mpi/fortran/use-mpi-f08/ts/bindings.h"
27+
#include "ompi/mpi/fortran/base/constants.h"
28+
29+
static const char FUNC_NAME[] = "MPI_Bsend_init";
30+
31+
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)
32+
{
33+
int c_ierr;
34+
MPI_Datatype c_datatype, c_type = PMPI_Type_f2c(*datatype);
35+
MPI_Request c_req;
36+
MPI_Comm c_comm = PMPI_Comm_f2c (*comm);
37+
38+
void *buf = x->base_addr;
39+
int c_count = OMPI_FINT_2_INT(*count);
40+
41+
OMPI_CFI_2_C(x, c_count, c_type, c_datatype, c_ierr);
42+
if (MPI_SUCCESS != c_ierr) {
43+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
44+
OMPI_ERRHANDLER_INVOKE(c_comm, c_ierr, FUNC_NAME);
45+
return;
46+
}
47+
48+
c_ierr = PMPI_Bsend_init(OMPI_F2C_BOTTOM(buf), c_count,
49+
c_datatype,
50+
OMPI_FINT_2_INT(*dest),
51+
OMPI_FINT_2_INT(*tag),
52+
c_comm, &c_req);
53+
if (c_datatype != c_type) {
54+
ompi_datatype_destroy(&c_datatype);
55+
}
56+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
57+
58+
if (MPI_SUCCESS == c_ierr) {
59+
*request = PMPI_Request_c2f(c_req);
60+
}
61+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3+
* University Research and Technology
4+
* Corporation. All rights reserved.
5+
* Copyright (c) 2004-2005 The University of Tennessee and The University
6+
* of Tennessee Research Foundation. All rights
7+
* reserved.
8+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9+
* University of Stuttgart. All rights reserved.
10+
* Copyright (c) 2004-2005 The Regents of the University of California.
11+
* All rights reserved.
12+
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2015-2019 Research Organization for Information Science
14+
* and Technology (RIST). All rights reserved.
15+
* $COPYRIGHT$
16+
*
17+
* Additional copyrights may follow
18+
*
19+
* $HEADER$
20+
*/
21+
22+
#include "ompi_config.h"
23+
24+
#include "ompi/communicator/communicator.h"
25+
#include "ompi/errhandler/errhandler.h"
26+
#include "ompi/mpi/fortran/use-mpi-f08/ts/bindings.h"
27+
#include "ompi/mpi/fortran/base/constants.h"
28+
29+
static const char FUNC_NAME[] = "MPI_Bsend";
30+
31+
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)
32+
{
33+
int c_ierr;
34+
MPI_Comm c_comm = PMPI_Comm_f2c (*comm);
35+
MPI_Datatype c_datatype, c_type = PMPI_Type_f2c(*datatype);
36+
void *buf = x->base_addr;
37+
int c_count = OMPI_FINT_2_INT(*count);
38+
39+
OMPI_CFI_2_C(x, c_count, c_type, c_datatype, c_ierr);
40+
if (MPI_SUCCESS != c_ierr) {
41+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
42+
OMPI_ERRHANDLER_INVOKE(c_comm, c_ierr, FUNC_NAME);
43+
return;
44+
}
45+
46+
c_ierr = PMPI_Bsend(OMPI_F2C_BOTTOM(buf), c_count,
47+
c_datatype, OMPI_FINT_2_INT(*dest),
48+
OMPI_FINT_2_INT(*tag), c_comm);
49+
if (c_datatype != c_type) {
50+
ompi_datatype_destroy(&c_datatype);
51+
}
52+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
53+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3+
* University Research and Technology
4+
* Corporation. All rights reserved.
5+
* Copyright (c) 2004-2005 The University of Tennessee and The University
6+
* of Tennessee Research Foundation. All rights
7+
* reserved.
8+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9+
* University of Stuttgart. All rights reserved.
10+
* Copyright (c) 2004-2005 The Regents of the University of California.
11+
* All rights reserved.
12+
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2015-2019 Research Organization for Information Science
14+
* and Technology (RIST). All rights reserved.
15+
* $COPYRIGHT$
16+
*
17+
* Additional copyrights may follow
18+
*
19+
* $HEADER$
20+
*/
21+
22+
#include "ompi_config.h"
23+
24+
#include "ompi/communicator/communicator.h"
25+
#include "ompi/errhandler/errhandler.h"
26+
#include "ompi/mpi/fortran/use-mpi-f08/ts/bindings.h"
27+
28+
static const char FUNC_NAME[] = "MPI_Buffer_attach";
29+
30+
void ompi_buffer_attach_ts(CFI_cdesc_t *x, MPI_Fint *size, MPI_Fint *ierr)
31+
{
32+
int c_ierr;
33+
if (OMPI_CFI_IS_CONTIGUOUS(x)) {
34+
c_ierr = PMPI_Buffer_attach(x->base_addr, OMPI_FINT_2_INT(*size));
35+
} else {
36+
c_ierr = MPI_ERR_BUFFER;
37+
OMPI_ERRHANDLER_INVOKE(MPI_COMM_SELF, c_ierr, FUNC_NAME);
38+
}
39+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
40+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2+
/*
3+
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
4+
* University Research and Technology
5+
* Corporation. All rights reserved.
6+
* Copyright (c) 2004-2005 The University of Tennessee and The University
7+
* of Tennessee Research Foundation. All rights
8+
* reserved.
9+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10+
* University of Stuttgart. All rights reserved.
11+
* Copyright (c) 2004-2005 The Regents of the University of California.
12+
* All rights reserved.
13+
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
14+
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
15+
* reserved.
16+
* Copyright (c) 2015-2019 Research Organization for Information Science
17+
* and Technology (RIST). All rights reserved.
18+
* $COPYRIGHT$
19+
*
20+
* Additional copyrights may follow
21+
*
22+
* $HEADER$
23+
*/
24+
25+
#include "ompi_config.h"
26+
27+
#include "ompi/win/win.h"
28+
#include "ompi/errhandler/errhandler.h"
29+
#include "ompi/mpi/fortran/use-mpi-f08/ts/bindings.h"
30+
#include "ompi/mpi/fortran/base/constants.h"
31+
32+
static const char FUNC_NAME[] = "MPI_Compare_and_swap";
33+
34+
void ompi_compare_and_swap_ts(CFI_cdesc_t *x1, CFI_cdesc_t *x2, CFI_cdesc_t *x3,
35+
MPI_Fint *datatype, MPI_Fint *target_rank, MPI_Aint *target_disp,
36+
MPI_Fint *win, MPI_Fint *ierr)
37+
{
38+
int c_ierr;
39+
MPI_Datatype c_datatype = PMPI_Type_f2c(*datatype);
40+
MPI_Win c_win = PMPI_Win_f2c(*win);
41+
char *origin_addr = x1->base_addr, *compare_addr = x2->base_addr, *result_addr = x3->base_addr;
42+
43+
OMPI_CFI_CHECK_CONTIGUOUS(x1, c_ierr);
44+
if (MPI_SUCCESS != c_ierr) {
45+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
46+
OMPI_ERRHANDLER_INVOKE(c_win, c_ierr, FUNC_NAME)
47+
return;
48+
}
49+
OMPI_CFI_CHECK_CONTIGUOUS(x2, c_ierr);
50+
if (MPI_SUCCESS != c_ierr) {
51+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
52+
OMPI_ERRHANDLER_INVOKE(c_win, c_ierr, FUNC_NAME)
53+
return;
54+
}
55+
OMPI_CFI_CHECK_CONTIGUOUS(x3, c_ierr);
56+
if (MPI_SUCCESS != c_ierr) {
57+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
58+
return;
59+
}
60+
c_ierr = PMPI_Compare_and_swap(OMPI_F2C_BOTTOM(origin_addr),
61+
OMPI_F2C_BOTTOM(compare_addr),
62+
OMPI_F2C_BOTTOM(result_addr),
63+
c_datatype,
64+
OMPI_FINT_2_INT(*target_rank),
65+
*target_disp, c_win);
66+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
67+
}

0 commit comments

Comments
 (0)