From 4008ac84cb961471418fae29d0221afc2d96e535 Mon Sep 17 00:00:00 2001 From: Jake Tronge Date: Wed, 14 Feb 2024 14:29:58 -0700 Subject: [PATCH] Add --enable-bigcount configure switch Signed-off-by: Jake Tronge --- config/ompi_configure_options.m4 | 14 +++++ ompi/include/mpi.h.in | 34 ++++++++++++ ompi/mpi/bindings/ompi_bindings/c.py | 9 +++ ompi/mpi/bindings/ompi_bindings/fortran.py | 4 ++ .../bindings/ompi_bindings/fortran_type.py | 55 ++++++++++++++----- 5 files changed, 101 insertions(+), 15 deletions(-) diff --git a/config/ompi_configure_options.m4 b/config/ompi_configure_options.m4 index df507d03fce..49fad03cfab 100644 --- a/config/ompi_configure_options.m4 +++ b/config/ompi_configure_options.m4 @@ -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" diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index 93fc5c7fd33..15269f546c2 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -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, @@ -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); @@ -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); @@ -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, @@ -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, @@ -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, @@ -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, @@ -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); @@ -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, @@ -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); @@ -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); @@ -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, @@ -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, @@ -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, @@ -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, diff --git a/ompi/mpi/bindings/ompi_bindings/c.py b/ompi/mpi/bindings/ompi_bindings/c.py index d68ce16d6cb..549686bdada 100644 --- a/ompi/mpi/bindings/ompi_bindings/c.py +++ b/ompi/mpi/bindings/ompi_bindings/c.py @@ -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.""" @@ -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) @@ -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' diff --git a/ompi/mpi/bindings/ompi_bindings/fortran.py b/ompi/mpi/bindings/ompi_bindings/fortran.py index 9b0c6b85493..6159341d0fe 100644 --- a/ompi/mpi/bindings/ompi_bindings/fortran.py +++ b/ompi/mpi/bindings/ompi_bindings/fortran.py @@ -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): @@ -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}') diff --git a/ompi/mpi/bindings/ompi_bindings/fortran_type.py b/ompi/mpi/bindings/ompi_bindings/fortran_type.py index 5cccfce90c3..9e0f8273ace 100644 --- a/ompi/mpi/bindings/ompi_bindings/fortran_type.py +++ b/ompi/mpi/bindings/ompi_bindings/fortran_type.py @@ -264,6 +264,11 @@ def c_prepare(self): tmp_datatype = self.dep_params['type'].tmp_name2 counts = self.dep_params['counts'].name displs = self.dep_params['displs'].name + array_setup = '' + if not self.bigcount: + array_setup = f""" + OMPI_ARRAY_FINT_2_INT({counts}, {comm.size}); + OMPI_ARRAY_FINT_2_INT({displs}, {comm.size});""" return util.prepare_text(f""" if (OMPI_COMM_IS_INTER({comm.tmp_name}) || !OMPI_IS_FORTRAN_IN_PLACE({self.tmp_name})) {{ {tmp_datatype} = PMPI_Type_f2c(*{datatype}); @@ -273,8 +278,7 @@ def c_prepare(self): OMPI_ERRHANDLER_INVOKE({comm.tmp_name}, {consts.C_ERROR_TMP_NAME}, "{self.fn_name}"); return; }} - OMPI_ARRAY_FINT_2_INT({counts}, {comm.size}); - OMPI_ARRAY_FINT_2_INT({displs}, {comm.size}); + {array_setup} }} else {{ {self.tmp_name} = MPI_IN_PLACE; }} @@ -282,7 +286,7 @@ def c_prepare(self): return '' def c_post(self): - if self.ts: + if self.ts and not self.bigcount: counts = self.dep_params['counts'].name displs = self.dep_params['displs'].name return util.prepare_text(f""" @@ -380,11 +384,16 @@ def c_prepare(self): counts = self.dep_params['counts'] displs = self.dep_params['displs'] name = self.tmp_name if self.ts else self.name + array_setup = '' + if not self.bigcount: + array_setup = """ + OMPI_ARRAY_FINT_2_INT({counts.name}, {comm.size}); + OMPI_ARRAY_FINT_2_INT({displs.name}, {comm.size}); + """ second_part = util.prepare_text(f""" if (!OMPI_IS_FORTRAN_IN_PLACE({name})) {{ + {array_setup} {datatypes.tmp_name} = malloc({comm.size} * sizeof(MPI_Datatype)); - OMPI_ARRAY_FINT_2_INT({counts.name}, {comm.size}); - OMPI_ARRAY_FINT_2_INT({displs.name}, {comm.size}); for (int i = 0; i < size; ++i) {{ {datatypes.tmp_name}[i] = PMPI_Type_f2c({datatypes.name}[i]); }} @@ -400,11 +409,16 @@ def c_post(self): counts = self.dep_params['counts'] displs = self.dep_params['displs'] name = self.tmp_name if self.ts else self.name + array_cleanup = '' + if not self.bigcount: + array_cleanup = """ + OMPI_ARRAY_FINT_2_INT_CLEANUP({counts.name}); + OMPI_ARRAY_FINT_2_INT_CLEANUP({displs.name}); + """ return util.prepare_text(f""" if (!OMPI_IS_FORTRAN_IN_PLACE({name})) {{ free({datatypes.tmp_name}); - OMPI_ARRAY_FINT_2_INT_CLEANUP({counts.name}); - OMPI_ARRAY_FINT_2_INT_CLEANUP({displs.name}); + {array_cleanup} }}""") @@ -439,10 +453,13 @@ def c_prepare(self): {datatype.tmp_name} = malloc({comm.size} * sizeof(MPI_Datatype)); for (int i = 0; i < {comm.size}; ++i) {{ {datatype.tmp_name}[i] = PMPI_Type_f2c({datatype.name}[i]); - }} - OMPI_ARRAY_FINT_2_INT({counts.name}, {comm.size}); - OMPI_ARRAY_FINT_2_INT({displs.name}, {comm.size});""") - return '\n'.join([first_part, second_part]) + }}""") + third_part = '' + if not self.bigcount: + third_part = util.prepare_text(f""" + OMPI_ARRAY_FINT_2_INT({counts.name}, {comm.size}); + OMPI_ARRAY_FINT_2_INT({displs.name}, {comm.size});""") + return '\n'.join([first_part, second_part, third_part]) def c_argument(self): name = self.tmp_name if self.ts else self.name @@ -452,10 +469,14 @@ def c_post(self): datatypes = self.dep_params['types'] counts = self.dep_params['counts'] displs = self.dep_params['displs'] + array_cleanup = '' + if not self.bigcount: + util.prepare_text(f""" + OMPI_ARRAY_FINT_2_INT_CLEANUP({counts.name}); + OMPI_ARRAY_FINT_2_INT_CLEANUP({displs.name});""") return util.prepare_text(f""" free({datatypes.tmp_name}); - OMPI_ARRAY_FINT_2_INT_CLEANUP({counts.name}); - OMPI_ARRAY_FINT_2_INT_CLEANUP({displs.name});""") + {array_cleanup}""") @FortranType.add('COUNT') @@ -847,12 +868,16 @@ def c_parameter(self): return f'MPI_Fint *{self.name}' def c_declare_tmp(self): - return f'OMPI_ARRAY_NAME_DECL({self.name});' + if not self.bigcount: + return f'OMPI_ARRAY_NAME_DECL({self.name});' + return '' # NOTE: Most of this code is initialized and freed in the W/VBUFFER code def c_argument(self): - return f'OMPI_ARRAY_NAME_CONVERT({self.name})' + if not self.bigcount: + return f'OMPI_ARRAY_NAME_CONVERT({self.name})' + return self.name @FortranType.add('COUNT_ARRAY')