Skip to content

Commit

Permalink
Add --enable-bigcount configure switch
Browse files Browse the repository at this point in the history
Signed-off-by: Jake Tronge <[email protected]>
  • Loading branch information
jtronge committed Feb 14, 2024
1 parent 851b513 commit 4008ac8
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 15 deletions.
14 changes: 14 additions & 0 deletions config/ompi_configure_options.m4
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,20 @@ else
fi
AM_CONDITIONAL(OMPI_OMPIO_SUPPORT, test "$ompi_want_ompio" = "1")

AC_MSG_CHECKING([if want bigcount support])
AC_ARG_ENABLE([bigcount],
[AS_HELP_STRING([--enable-bigcount],
[Enable the bigcount API])])
if test "$enable_bigcount" = "yes" ; then
AC_MSG_RESULT([yes])
ompi_enable_bigcount=1
else
AC_MSG_RESULT([no])
ompi_enable_bigcount=0
fi
AC_DEFINE_UNQUOTED([OMPI_BIGCOUNT],[$ompi_enable_bigcount],
[Whether we want to compile bigcount API support])

# If the binding source files don't exist, then we need Python to generate them
AM_PATH_PYTHON([3.6],,[:])
binding_file="${srcdir}/ompi/mpi/c/ompi_send.c"
Expand Down
34 changes: 34 additions & 0 deletions ompi/include/mpi.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -1418,8 +1418,10 @@ OMPI_DECLSPEC int MPI_Alloc_mem(MPI_Aint size, MPI_Info info,
void *baseptr);
OMPI_DECLSPEC int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
MPI_Op op, MPI_Comm comm);
#ifdef OMPI_BIGCOUNT
OMPI_DECLSPEC int MPI_Allreduce_c(const void *sendbuf, void *recvbuf, MPI_Count count, MPI_Datatype datatype,
MPI_Op op, MPI_Comm comm);
#endif
OMPI_DECLSPEC int MPI_Iallreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
MPI_Op op, MPI_Comm comm, MPI_Request *request);
OMPI_DECLSPEC int MPI_Allreduce_init(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
Expand All @@ -1436,9 +1438,11 @@ OMPI_DECLSPEC int MPI_Alltoall_init(const void *sendbuf, int sendcount, MPI_Dat
OMPI_DECLSPEC int MPI_Alltoallv(const void *sendbuf, const int sendcounts[], const int sdispls[], MPI_Datatype sendtype,
void *recvbuf, const int recvcounts[], const int rdispls[], MPI_Datatype recvtype,
MPI_Comm comm);
#ifdef OMPI_BIGCOUNT
OMPI_DECLSPEC int MPI_Alltoallv_c(const void *sendbuf, const MPI_Count sendcounts[], const MPI_Aint sdispls[], MPI_Datatype sendtype,
void *recvbuf, const MPI_Count recvcounts[], const MPI_Aint rdispls[], MPI_Datatype recvtype,
MPI_Comm comm);
#endif
OMPI_DECLSPEC int MPI_Ialltoallv(const void *sendbuf, const int sendcounts[], const int sdispls[], MPI_Datatype sendtype,
void *recvbuf, const int recvcounts[], const int rdispls[], MPI_Datatype recvtype,
MPI_Comm comm, MPI_Request *request);
Expand All @@ -1448,9 +1452,11 @@ OMPI_DECLSPEC int MPI_Alltoallv_init(const void *sendbuf, const int sendcounts[
OMPI_DECLSPEC int MPI_Alltoallw(const void *sendbuf, const int sendcounts[], const int sdispls[], const MPI_Datatype sendtypes[],
void *recvbuf, const int recvcounts[], const int rdispls[], const MPI_Datatype recvtypes[],
MPI_Comm comm);
#ifdef OMPI_BIGCOUNT
OMPI_DECLSPEC int MPI_Alltoallw_c(const void *sendbuf, const MPI_Count sendcounts[], const MPI_Aint sdispls[], const MPI_Datatype sendtypes[],
void *recvbuf, const MPI_Count recvcounts[], const MPI_Aint rdispls[], const MPI_Datatype recvtypes[],
MPI_Comm comm);
#endif
OMPI_DECLSPEC int MPI_Ialltoallw(const void *sendbuf, const int sendcounts[], const int sdispls[], const MPI_Datatype sendtypes[],
void *recvbuf, const int recvcounts[], const int rdispls[], const MPI_Datatype recvtypes[],
MPI_Comm comm, MPI_Request *request);
Expand Down Expand Up @@ -1781,14 +1787,18 @@ OMPI_DECLSPEC int MPI_Iprobe(int source, int tag, MPI_Comm comm, int *flag,
MPI_Status *status);
OMPI_DECLSPEC int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int source,
int tag, MPI_Comm comm, MPI_Request *request);
#ifdef OMPI_BIGCOUNT
OMPI_DECLSPEC int MPI_Irecv_c(void *buf, MPI_Count count, MPI_Datatype datatype, int source,
int tag, MPI_Comm comm, MPI_Request *request);
#endif
OMPI_DECLSPEC int MPI_Irsend(const void *buf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm, MPI_Request *request);
OMPI_DECLSPEC int MPI_Isend(const void *buf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm, MPI_Request *request);
#ifdef OMPI_BIGCOUNT
OMPI_DECLSPEC int MPI_Isend_c(const void *buf, MPI_Count count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm, MPI_Request *request);
#endif
OMPI_DECLSPEC int MPI_Isendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
int dest, int sendtag, void *recvbuf, int recvcount,
MPI_Datatype recvtype, int source, int recvtag,
Expand Down Expand Up @@ -1893,8 +1903,10 @@ OMPI_DECLSPEC int MPI_Recv_init(void *buf, int count, MPI_Datatype datatype, in
int tag, MPI_Comm comm, MPI_Request *request);
OMPI_DECLSPEC int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source,
int tag, MPI_Comm comm, MPI_Status *status);
#ifdef OMPI_BIGCOUNT
OMPI_DECLSPEC int MPI_Recv_c(void *buf, MPI_Count count, MPI_Datatype datatype, int source,
int tag, MPI_Comm comm, MPI_Status *status);
#endif
OMPI_DECLSPEC int MPI_Reduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
MPI_Op op, int root, MPI_Comm comm);
OMPI_DECLSPEC int MPI_Ireduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
Expand Down Expand Up @@ -1943,8 +1955,10 @@ OMPI_DECLSPEC int MPI_Rsend_init(const void *buf, int count, MPI_Datatype datat
MPI_Request *request);
OMPI_DECLSPEC int MPI_Scan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
MPI_Op op, MPI_Comm comm);
#ifdef OMPI_BIGCOUNT
OMPI_DECLSPEC int MPI_Scan_c(const void *sendbuf, void *recvbuf, MPI_Count count, MPI_Datatype datatype,
MPI_Op op, MPI_Comm comm);
#endif
OMPI_DECLSPEC int MPI_Iscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
MPI_Op op, MPI_Comm comm, MPI_Request *request);
OMPI_DECLSPEC int MPI_Scan_init(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
Expand Down Expand Up @@ -1972,8 +1986,10 @@ OMPI_DECLSPEC int MPI_Send_init(const void *buf, int count, MPI_Datatype dataty
MPI_Request *request);
OMPI_DECLSPEC int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm);
#ifdef OMPI_BIGCOUNT
OMPI_DECLSPEC int MPI_Send_c(const void *buf, MPI_Count count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm);
#endif
OMPI_DECLSPEC int MPI_Sendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
int dest, int sendtag, void *recvbuf, int recvcount,
MPI_Datatype recvtype, int source, int recvtag,
Expand Down Expand Up @@ -2170,9 +2186,11 @@ OMPI_DECLSPEC int PMPI_Abort(MPI_Comm comm, int errorcode);
OMPI_DECLSPEC int PMPI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
int target_rank, MPI_Aint target_disp, int target_count,
MPI_Datatype target_datatype, MPI_Op op, MPI_Win win);
#ifdef OMPI_BIGCOUNT
OMPI_DECLSPEC int PMPI_Accumulate_c(const void *origin_addr, MPI_Count origin_count, MPI_Datatype origin_datatype,
int target_rank, MPI_Aint target_disp, MPI_Count target_count,
MPI_Datatype target_datatype, MPI_Op op, MPI_Win win);
#endif
OMPI_DECLSPEC int PMPI_Add_error_class(int *errorclass);
OMPI_DECLSPEC int PMPI_Add_error_code(int errorclass, int *errorcode);
OMPI_DECLSPEC int PMPI_Add_error_string(int errorcode, const char *string);
Expand All @@ -2198,8 +2216,10 @@ OMPI_DECLSPEC int PMPI_Alloc_mem(MPI_Aint size, MPI_Info info,
void *baseptr);
OMPI_DECLSPEC int PMPI_Allreduce(const void *sendbuf, void *recvbuf, int count,
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
#ifdef OMPI_BIGCOUNT
OMPI_DECLSPEC int PMPI_Allreduce_c(const void *sendbuf, void *recvbuf, MPI_Count count,
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
#endif
OMPI_DECLSPEC int PMPI_Iallreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
MPI_Op op, MPI_Comm comm, MPI_Request *request);
OMPI_DECLSPEC int PMPI_Allreduce_init(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
Expand All @@ -2216,9 +2236,11 @@ OMPI_DECLSPEC int PMPI_Alltoall_init(const void *sendbuf, int sendcount, MPI_Da
OMPI_DECLSPEC int PMPI_Alltoallv(const void *sendbuf, const int sendcounts[], const int sdispls[], MPI_Datatype sendtype,
void *recvbuf, const int recvcounts[], const int rdispls[], MPI_Datatype recvtype,
MPI_Comm comm);
#ifdef OMPI_BIGCOUNT
OMPI_DECLSPEC int PMPI_Alltoallv_c(const void *sendbuf, const MPI_Count sendcounts[], const MPI_Aint sdispls[], MPI_Datatype sendtype,
void *recvbuf, const MPI_Count recvcounts[], const MPI_Aint rdispls[], MPI_Datatype recvtype,
MPI_Comm comm);
#endif
OMPI_DECLSPEC int PMPI_Ialltoallv(const void *sendbuf, const int sendcounts[], const int sdispls[], MPI_Datatype sendtype,
void *recvbuf, const int recvcounts[], const int rdispls[], MPI_Datatype recvtype,
MPI_Comm comm, MPI_Request *request);
Expand All @@ -2228,9 +2250,11 @@ OMPI_DECLSPEC int PMPI_Alltoallv_init(const void *sendbuf, const int sendcounts
OMPI_DECLSPEC int PMPI_Alltoallw(const void *sendbuf, const int sendcounts[], const int sdispls[], const MPI_Datatype sendtypes[],
void *recvbuf, const int recvcounts[], const int rdispls[], const MPI_Datatype recvtypes[],
MPI_Comm comm);
#ifdef OMPI_BIGCOUNT
OMPI_DECLSPEC int PMPI_Alltoallw_c(const void *sendbuf, const MPI_Count sendcounts[], const MPI_Aint sdispls[], const MPI_Datatype sendtypes[],
void *recvbuf, const MPI_Count recvcounts[], const MPI_Aint rdispls[], const MPI_Datatype recvtypes[],
MPI_Comm comm);
#endif
OMPI_DECLSPEC int PMPI_Ialltoallw(const void *sendbuf, const int sendcounts[], const int sdispls[], const MPI_Datatype sendtypes[],
void *recvbuf, const int recvcounts[], const int rdispls[], const MPI_Datatype recvtypes[],
MPI_Comm comm, MPI_Request *request);
Expand Down Expand Up @@ -2563,14 +2587,18 @@ OMPI_DECLSPEC int PMPI_Iprobe(int source, int tag, MPI_Comm comm, int *flag,
MPI_Status *status);
OMPI_DECLSPEC int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int source,
int tag, MPI_Comm comm, MPI_Request *request);
#ifdef OMPI_BIGCOUNT
OMPI_DECLSPEC int PMPI_Irecv_c(void *buf, MPI_Count count, MPI_Datatype datatype, int source,
int tag, MPI_Comm comm, MPI_Request *request);
#endif
OMPI_DECLSPEC int PMPI_Irsend(const void *buf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm, MPI_Request *request);
OMPI_DECLSPEC int PMPI_Isend(const void *buf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm, MPI_Request *request);
#ifdef OMPI_BIGCOUNT
OMPI_DECLSPEC int PMPI_Isend_c(const void *buf, MPI_Count count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm, MPI_Request *request);
#endif
OMPI_DECLSPEC int PMPI_Isendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
int dest, int sendtag, void *recvbuf, int recvcount,
MPI_Datatype recvtype, int source, int recvtag,
Expand Down Expand Up @@ -2675,8 +2703,10 @@ OMPI_DECLSPEC int PMPI_Recv_init(void *buf, int count, MPI_Datatype datatype, i
int tag, MPI_Comm comm, MPI_Request *request);
OMPI_DECLSPEC int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int source,
int tag, MPI_Comm comm, MPI_Status *status);
#ifdef OMPI_BIGCOUNT
OMPI_DECLSPEC int PMPI_Recv_c(void *buf, MPI_Count count, MPI_Datatype datatype, int source,
int tag, MPI_Comm comm, MPI_Status *status);
#endif
OMPI_DECLSPEC int PMPI_Reduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
MPI_Op op, int root, MPI_Comm comm);
OMPI_DECLSPEC int PMPI_Ireduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
Expand Down Expand Up @@ -2725,8 +2755,10 @@ OMPI_DECLSPEC int PMPI_Rsend_init(const void *buf, int count, MPI_Datatype data
MPI_Request *request);
OMPI_DECLSPEC int PMPI_Scan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
MPI_Op op, MPI_Comm comm);
#ifdef OMPI_BIGCOUNT
OMPI_DECLSPEC int PMPI_Scan_c(const void *sendbuf, void *recvbuf, MPI_Count count, MPI_Datatype datatype,
MPI_Op op, MPI_Comm comm);
#endif
OMPI_DECLSPEC int PMPI_Iscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
MPI_Op op, MPI_Comm comm, MPI_Request *request);
OMPI_DECLSPEC int PMPI_Scan_init(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
Expand Down Expand Up @@ -2754,8 +2786,10 @@ OMPI_DECLSPEC int PMPI_Send_init(const void *buf, int count, MPI_Datatype datat
MPI_Request *request);
OMPI_DECLSPEC int PMPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm);
#ifdef OMPI_BIGCOUNT
OMPI_DECLSPEC int PMPI_Send_c(const void *buf, MPI_Count count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm);
#endif
OMPI_DECLSPEC int PMPI_Sendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
int dest, int sendtag, void *recvbuf, int recvcount,
MPI_Datatype recvtype, int source, int recvtag,
Expand Down
9 changes: 9 additions & 0 deletions ompi/mpi/bindings/ompi_bindings/c.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,10 @@ def validate_body(body):
raise util.BindingError('Mismatched brackets found in template')


# Values to replace in function bodies per-function (empty for now).
FUNCTION_BODY_REPLACEMENTS = {}


class SourceTemplate:
"""Source template for a single API function."""

Expand Down Expand Up @@ -414,6 +418,9 @@ def print_body(self, func_name, out):
for line in self.body:
# FUNC_NAME is used for error messages
line = line.replace('FUNC_NAME', f'"{func_name}"')
if func_name in FUNCTION_BODY_REPLACEMENTS:
for key, value in FUNCTION_BODY_REPLACEMENTS[func_name]:
line = line.replace(key, value)
out.dump(line)


Expand All @@ -435,10 +442,12 @@ def ompi_abi(base_name, template, out):
template.print_body(func_name=base_name, out=out)
# Check if we need to generate the bigcount interface
if template.prototype.need_bigcount:
out.dump('#if OMPI_BIGCOUNT')
base_name_c = f'{base_name}_c'
print_profiling_header(base_name_c, out)
out.dump(template.prototype.signature('ompi', base_name_c, enable_count=True))
template.print_body(func_name=base_name_c, out=out)
out.dump('#endif /* OMPI_BIGCOUNT */')


ABI_INTERNAL_HEADER = 'ompi/mpi/c/abi.h'
Expand Down
4 changes: 4 additions & 0 deletions ompi/mpi/bindings/ompi_bindings/fortran.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,9 @@ def generate_code(args, out):
print_binding(prototype, args.lang, out, ts=args.ts)
if util.fortran_prototype_has_bigcount(prototype):
out.dump()
out.dump('#if OMPI_BIGCOUNT')
print_binding(prototype, args.lang, bigcount=True, out=out, ts=args.ts)
out.dump('#endif /* OMPI_BIGCOUNT */')


def generate_interface(args, out):
Expand All @@ -330,5 +332,7 @@ def generate_interface(args, out):
if util.fortran_prototype_has_bigcount(prototype):
out.dump()
binding_c = FortranBinding(prototype, out=out, bigcount=True, ts=args.ts)
out.dump('#if OMPI_BIGCOUNT')
binding_c.print_interface()
out.dump('#endif /* OMPI_BIGCOUNT */')
out.dump(f'end interface {ext_name}')
Loading

0 comments on commit 4008ac8

Please sign in to comment.