multiscale / muscle3

The third major version of the MUltiScale Coupling Library and Environment
Apache License 2.0
25 stars 13 forks source link

Checking if a port is connected should be optionally collective when using MPI #165

Open LourensVeen opened 1 year ago

LourensVeen commented 1 year ago

When using MPI, we typically call send only on the root process, but receive on all processes. If you want to explicitly check whether a port is connected before sending, then it gives cleaner code if you do that only on the root process. This is currently supported by is_connected(). If you want to explicitly check whether a port is connected before receiving, then it gives cleaner code if you do that on all processes, but is_connected() can currently only be called on the root process.

So, it would be nicer if is_connected() were callable either on all processes, or only on the root process, like get_settings(). To do this, we would have to broadcast this information when constructing the Instance, like we do with the settings.

Other methods that should be likewise updated:

set_port_length() would be used only for sending ports, so it can remain root process-only, and that would save some implementation complexity.