StarPU-MPI allocates MPI datatypes outside the MPI thread.
Instead of having the allocation function passed to starpu_mpi_interface_datatype_node_register()
creating the MPI datatype,
we should have a function can_allocate_datatype()
to only specify if a mpi type needs to be created and thus can be called outside the MPI thread
_starpu_mpi_submit_ready_request()
would hence not call _starpu_mpi_datatype_allocate()
but instead a new function starpu_mpi_datatype_prepare_allocate()
calling can_allocate_datatype()
to set registered_datatype
.
Within the MPI thread, calling _starpu_mpi_datatype_allocate()
would no longer set registered_datatype
but would call allocate_datatype
(with an assert to check its return value).
If the data does not define any can_allocate_datatype
, that would mean the allocation is supposed to succeed, and then registered_datatype
should be set to 1