219 Commits

Autor SHA1 Mensagem Data
Hui Zhou 42acceeb68 doc: fix mansrc generation
Just using the name without prefix, e.g. MPI_Send -> send.txt, resulting
in duplicated filenames between MPI_/MPI_T_/MPIX_ functions, and they
overwrite each other. This resulted in certain man pages missing. For
example, MPI_Finalize and MPI_Init_thread man pages were missing because
they were overwritten by the MPI_T_ correspondents.
2024-08-20 12:39:12 -05:00
Hui Zhou b57d7a0d8d async: add stream parameter
Add stream parameter to MPIX_Async_start and MPIX_Async_spawn.
We'll implement per-vci async progress next.
2024-06-14 11:41:07 -05:00
Hui Zhou 7fcfd93ca8 mpix/async: add MPIX Async extensions
Add MPIX_Async_start, MPIX_Async_get_state, MPIX_Async_spawn.
2024-06-14 11:41:07 -05:00
Hui Zhou 3eeaa52089 abi: treat MPI_File the same way as other handle types
Now that we added explicit conversion routines for MPI_File
(ABI_File_{from,to}_mpi), we should treat MPI_File the same way as other
MPI handle types.
2024-05-03 09:43:23 -05:00
Hui Zhou 7fd8c12b84 misc: clean up user function code
We no longer need special treat Fortran user functions.
2024-04-25 21:53:33 -05:00
Hui Zhou adb08b2e66 f77: use proxies for errhandler callbacks
Use MPIX_{Comm,Win,File,Session}_create_errhandler_x, which allows
passing an extra_state as context and a destructor for cleanup.
2024-04-25 21:52:37 -05:00
Hui Zhou c3f955c162 errhan: add MPIX_Comm_create_errhandler_x etc.
Add MPIX_{Comm,Win,File,Session}_create_errhandler_x.

Similar to MPIX_Op_create, the _x versions allow users to attach an
extra state and the callback accepts scalar input rather than the
pointer versions for Fortran style.
2024-04-25 21:24:39 -05:00
Hui Zhou be8f761c2a f77: use proxies for op user function
Uses MPIX_op_create_x to implement Fortran Op callback via a proxy
function.
2024-04-25 21:24:39 -05:00
Hui Zhou 457cc5fb08 op: add MPIX_Op_create_x
Differences from MPI_Op_create or MPI_Op_create_c:

    * User function accepts a void * extra_state as user context.
    * User function accepts count and datatype as scalar input.
    * User function accepts count as MPI_Count.
    * There is a destructor callback called upon Op free.

The extra_state is for binding layer to store per-op information if a
proxy function is used. The destructor allow the extra_state to be
freed.
2024-04-25 21:24:39 -05:00
Ken Raffenetti eec539c989 binding/f08: Fixup MPI_UNDEFINED handling
Previous commit [4d96f728e] did not compile because it was missing the
MPI_UNDEFINED symbol in the wrapper function. Make sure to add it to
"uses" so it is accessible.
2024-04-24 10:01:56 -05:00
Ken Raffenetti 4d96f728eb binding/f08: Do not adjust by 1 for MPI_UNDEFINED
Same fix as pmodels/mpich#6403 applied to the mpi_f08. MPI_UNDEFINED
should not be adjusted by 1 because it is a special value and not an
index. Fixes pmodels/mpich#6989.
2024-04-23 16:57:36 -05:00
Hui Zhou 20b2a7f557 binding/c: add back -single-source option
The single source option generates huge c_binding.c. It may be desirable
to opt for multiple source files instead.

TODO: I still think we should do -single-source by default, but it is nice
to have the option.

There are functions removed or deprecated with replacement functions,
which we implemented by calling MPI_xxx_internal functions. Thus
we need generate all replaced functions together to avoid making those
static internal functions external.
2024-03-07 12:42:58 -06:00
Hui Zhou db8d1882e9 f08: check err after cdesc_create_datatype
We neglected to check error from cdesc_create_datatype, which resulted
in silent error for case such as:
    call MPI_Isend( A(1:30:3,1:20:2), size(A(1:30:3,1:20:2))-1,
MPI_INTEGER, me, 99, MPI_COMM_WORLD, r(1))
2024-02-13 17:19:05 -06:00
Lisandro Dalcin 6b173cce92 abi: Fix argument handling
comm: Use PMPI routines for rank/size/remote-size.
array: Do not malloc unless size is larger than zero.
MPI_Comm_spawn: access info only at root.
MPI_Comm_spawn_multiple: access array_of_info only at root.
2024-01-24 11:35:49 -06:00
Hui Zhou 7a3f687cb3 abi: set comm to MPI_COMM_NULL on creation failure
This behavior was broken by commit ab70b3a, result failure in
test/mpi/errors/topo/cartsmall.
2024-01-21 15:42:16 -06:00
Lisandro Dalcin ab70b3a298 ABI: fix param_direction=out|inout
Pass NULL thru for error-checking.
2024-01-18 17:48:09 +03:00
Lisandro Dalcin b1ea8f3549 ABI: fix Alltoallw
Pass COMM_NULL and (send|recv)types=NULL thru for error-checking.
2024-01-18 17:48:09 +03:00
Lisandro Dalcin 6160197bbd ABI: fix neighbor collectives
Compute indegree/outdegree accordingly to communicator topology.
2024-01-18 17:48:09 +03:00
Lisandro Dalcin 4470cb168e ABI: fix KEYVAL, direction=inout
Convert keyval values to/from MPI in MPI_XXX_free_keyval routines.
2024-01-18 17:48:09 +03:00
Lisandro Dalcin b6d351bfcc python: fix C binding generator script
str.split() does not work with regex patterns, use re.split() instead.
2024-01-17 21:51:38 +03:00
Hui Zhou c7a27e7994 build: autogen f08 autoconf file
The autoconf .in files have to generated inside the source tree. Thus we
cannot generate them during configure.

Also, use AC_CONFIG_COMMANDS_PRE to run python scripts inside configure,
thus will abort configure upon errors.
2023-12-18 16:00:38 -06:00
Hui Zhou 7542ead643 datatype: move MPI_Type_create_f90_xxx to C bindings
Always build these routines as they are part of the C APIs. When the
fortran binding is disabled, simply return MPI_DATATYPE_NULL.
2023-12-15 10:35:33 -06:00
Hui Zhou 098b85d27f mpir_ext: ABI conversion for ROMIO-defined routines
Three routines are defined in ROMIO, potentially using ABI header. We
need handler conversion to use inside MPICH.

Only include mpir_ext.h in the code that needs it. With BUILD_MPI_ABI,
we need alter the function parameter types for conversions.

Since we no longer include mpir_ext.h in the binding files, we need
explicitly declare them. We can treat them as void pointers to avoid the
distinction between ABI and non-ABI versions.
2023-12-12 22:42:43 -06:00
Hui Zhou 323ff80c07 binding/c: dump c_binding_abi.c
Dump c_binding_abi.c, to be linked into libmpi_abi.so.
2023-12-12 22:42:43 -06:00
Hui Zhou e8867f0d4d binding/c: avoid overwriting func['code-clean_up']
Custom clean up code (ref. MPI_Comm_spawn_multiple) are loaded in
func['code-clean_up']. We need avoid overwriting this attribute or we
will lose the custom cleanup code then function is being processed
twice.
2023-12-12 22:42:43 -06:00
Hui Zhou d1b3f5da2d f08: replace buildiface in gen_binding_f08.py
Similar to previous commit, we replace the perl script that generates
src/binding/fortran/use_mpi_f08/mpi_f08_compile_constants.f90.in in
gen_binding_f08.py.

This also added the missing MPI 4.0/4.1 symbols including:
    MPI_COMBINER_VALUE_INDEX
    MPI_COMM_TYPE_HW_GUIDED
    MPI_COMM_TYPE_HW_UNGUIDED
    MPI_COMM_TYPE_RESOURCE_GUIDED
    MPI_ERRORS_ABORT
    MPI_SESSION_NULL
    MPI_MAX_PSETNAME_LEN
    MPI_MAX_STRINGTAG_LEN

In addition, previous perl script failed to account for the "MAX"
constants need to be 1-less than the C correspondent to account for the
terminating NUL in C string.
2023-12-07 22:55:13 -06:00
Hui Zhou 2b8b50ca95 f77: replace buildiface in python scripts
The perl script src/binding/fortran/mpif_h/buildiface generates
mpif.h.in from scraping mpi.h.in and mpio.h.in. The old script has
become difficult to maintain and it is missing a few newly added symbols
including -
    MPI_COMBINER_VALUE_INDEX
    MPI_COMM_TYPE_HW_GUIDED
    MPI_COMM_TYPE_HW_UNGUIDED
    MPI_COMM_TYPE_RESOURCE_GUIDED
    MPI_ERRORS_ABORT
    MPI_MAX_PSET_NAME_LEN
    MPI_MAX_STRINGTAG_LEN
    MPI_SESSION_NULL

In addition, it needs declare all functions that does not return
INTEGER. It was missing MPI_Aint_add and MPI_Aint_diff.
2023-12-07 10:50:57 -06:00
Hui Zhou baf69d00a6 f77: add profiling declaration for cptr functions
The cptr functions are missing prototype declarations and causing
"-wmissing-prototypes" warnings. Extend "dump_profiling" routine to
cover cptr versions.
2023-11-10 10:18:07 -06:00
Hui Zhou dacaa07fb8 fortran: generate cptr generic interface
Commit 804badf added cptr generic interface for MPI_Alloc_mem, but we
are missing MPI_Win_allocate, MPI_Win_allocate_shared, and
MPI_Win_shared_query. Enhance the binding layer to generate all
functions with C_BUFFER kind output parameter.
2023-11-08 12:17:21 -06:00
Hui Zhou 3932ddfc4c python: allow win_shared_query on more window flavors
MPI 4.1 allow MPI_Win_shared_query to be called on windows created by
MPI_Win_create and MPI_Win_allocate.
2023-11-07 17:47:44 -06:00
Hui Zhou 37ea2b48f1 python: allow passing null handles to get_name functions
Need exceptions in validating the handle parameters.
2023-11-06 11:04:43 -06:00
Hui Zhou 7736d972e2 fortran: add MPI_BUFFER_AUTOMATIC to f77 bindings
Add common block variable for MPI_BUFFER_AUTOMATIC and check for
conversions in buffer_attach routines.
2023-11-03 23:16:01 -05:00
Hui Zhou 64de17bd1c binding/f08: add missing PMPI_Status_{f082f,f2f08}
The PMPI versions of MPI_Status_{f082f,f2f08} were missing.
2023-10-27 16:47:30 -05:00
Hui Zhou ef15e2ef48 mpi: add MPI_ERR_ERRHANDLER
New error class added in MPI-4.1, used when functions are passed in
invalid error handler argument.
2023-10-26 10:42:18 -05:00
Hui Zhou c0f968b879 mpi/request: add MPI_Request_get_status_{all,any,some}
These are new functions added in MPI-4.1. They are of the same semantics
as MPI_Test{all,any,some} except they do not free the requests.
2023-10-25 17:04:14 -05:00
Hui Zhou c5077f0074 request: free requests in the binding layer
For MPI_{Test,Wait}_{all,any,some}, free the completed requests and set
to MPI_REQUEST_NULL in the binding layer. This prepares for
MPI_Get_status_{all,any,some} that are added in MPI 4.1.

We also convert all request pointers for MPI_Testall and MPI_Waitall.
MPI_Waitall will need to convert all pointers anyway, so there shouldn't
be performance difference -- if any, should be better. MPI_Testall has
no impact for count < 64, the batch size. The impact of large testall
request arrays will be negligible compared to the overhead of running
progress.
2023-10-25 17:04:13 -05:00
Hui Zhou 8240e0a4bd binding/f90: fix types for array_of_statuses
It was a bug previously but it did not trigger test failures due to not
using generic interfaces. Now we it triggers compile error that we
switched all functions to generic interfaces.
2023-10-25 16:55:08 -05:00
Hui Zhou f762b3235e binding/f90: add pmpi interfaces
We need PMPI_Wtime and PMPI_Wtick since otherwise the compiler doesn't
know the function return type. We need PMPI interfaces for other
functions for the same reason that we need MPI interfaces.
2023-10-25 16:55:08 -05:00
Hui Zhou 804badf34f binding/f90: generic interface for MPI_Alloc_mem
Provide specific interface so MPI_Alloc_mem could return baseptr as
TYPE(C_PTR), as specified in the standard.
2023-10-25 16:55:08 -05:00
Hui Zhou d4a22e792b mpi: convert f2c/c2f from macros to functions
MPI-4.1 require these APIs to be implemented as functions.
2023-10-17 16:25:07 -05:00
Sonja Happ fb94206b23 errhan: error return function for MPI_Comm_create_from_group
Add separate error return function for MPI_Comm_create_from_group
to use the errhandler provided to this function.
2023-10-04 13:12:13 +02:00
Sonja Happ 0c7f63744e errhan: enable groups to use errhandler of session
Enable MPI Group routines that operate on a single group
to use the error handler of the session to which they
belong (if any). If a group does not belong to a session
(world model), the error return falls back to comm error
return as before.
2023-10-04 13:12:13 +02:00
Hui Zhou 360842a9ed binding/f90: fix ierr as ierror
The fortran interface uses ierror for the return argument rather than
ierr. This matters if user call with explicit keyword e.g.

    call MPI_Init(ierror=status)

, where status is the actual variable to use.
2023-09-22 13:47:33 -05:00
Hui Zhou a40e3ac9d7 python: enable MPIX_EQUAL in c binding
A hack to allow users to use MPIX_EQUAL. The recvbuf will be treated as
output boolean variable, is_equal.
2023-09-08 10:45:34 -05:00
Hui Zhou 043a85e7d5 binding/c: fix collective buffer validation for threadcomm
Threadcomm need special branch for comm size and rank.
2023-08-25 18:40:10 -05:00
Hui Zhou 0258e0f130 binding/c: fix dump_coll_v_swap memory leak
The temp_array used in dump_coll_v_swap was not freed previously.
2023-08-25 18:40:10 -05:00
Hui Zhou 2d49ec6d24 binding/c: fix dump_coll_v_swap for threadcomm
To do collective v-array swap, we need the communicator size and rank.
Expand the code to accommodate thread communicators.

Rather than repeat the regex pattern multiple times, check the regex at
the beginning and save as func["_need_coll_v_swap"] and
func["_need_type_create_swap"].
2023-08-25 18:40:10 -05:00
Hui Zhou d8a1dcbc7a binding: allow MPIX_STREAM_NULL in MPIX_Stream_progress
MPIX_STREAM_NULL is allowed in MPIX_Stream_progress. It pokes global
progress (excluding reserved vcis).
2023-08-07 15:14:06 -05:00
Ken Raffenetti 12a17cf79a binding/f08: Fix large count subroutine names
Section 19.2 of MPI-4.0 specifies for large count routines:

  The other specific procedure has the same name followed by "_c", and
  then suffixed by the token specified in Table 19.1 for USE mpi_f08.

Fixes pmodels/mpich#6575.
2023-06-30 14:36:41 -05:00
Hui Zhou a535eef58c binding/c: allow selected mpi functions to accept threadcomm
To mark selected functions to support threadcomm, add "threadcomm" to
the "extra" flags in custom api files, e.g. src/binding/c/comm_api.txt.

The binding layer will generate code to check if the comm parameter is
a thread communicator, and if yes, call the threadcomm impl functions.

This method allows a separate MPIR_Threadcomm_xxx_impl function to
handle threadcomm and leave the existing MPIR_xxx_impl unchanged to
handle normal communicators.

Alternatively, if we just add a little extra handling in the existing
implementation, we can skip the binding-layer hack and directly add
`if (comm->threadcomm)` branch into the existing impl functions. For
example, we'll extend `MPI_Comm_{set,get}_attr` the latter way.
2023-05-05 09:26:07 -05:00