preCICE communication over network

I am currently trying to set up a simulation using openFOAM and MaMiCo. Thereby, MaMiCo should run on a compute node of a slurm cluster and openFOAM should run on my local computer. I am locally port forwarding from my computer to the cluster login node and then to the compute node. The exchange directory is set up using sshfs and has the necessary permissions. Once I run the MaMiCo simulation preCICE returns an error that says that the specified port is already in use. However, before I started the simulation, the port was free and if run a simple python socket on this port I am able to connect easily. This problem also occurs for any port that I have tried so far. When I run the two simulations both locally, i.e., both on the cluster or both on my computer, the simulation works fine. Only the above described setup does not work.

Does anyone have an idea what the issue might be?
Thank you in advance!

precice-config.xml (1.6 KB)

What happens if you first delete any left-over precice-run directory? This contains the addresses of each rank.

If I delete precice-run before I run the simulation, the error remains with the described output. I also sorted out port lingering as an issue.

Mistakenly, I was using remote port forwarding when I took the screenshots from above.
When I use local forwarding, a primary rank connection is established. However, a secondary rank connection is refused because the port is already in use. I think this could have two reasons. One could be that the primary connection still exists on the port that is forwarded. The other could be that the primary connection is closed but, because of lingering, the port remains occupied. Yet, I am no expert on preCICE and I am not sure here. Maybe you have a solution for this problem.


As preCICE is able to establish the primary connection you can enforce gather scatter communication in the m2n tag to solve your issue.

We will have to think about the port forwarding issue.
An alternative would be to establish a VPN to avoid issues with NAT.

Thank you! This indeed solved the issue.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.