precice / matlab-bindings

MATLAB language bindings for preCICE
https://www.precice.org
GNU Lesser General Public License v3.0
5 stars 3 forks source link

Examples crash depending on MatLab version #46

Open ec2608 opened 10 months ago

ec2608 commented 10 months ago

Hi, This may have been reported before but I couldn't find relevant info.

I get the following error at Matlab R2023a (apologies cannot install an earlier version for license related reasons).

Error using mex
/matlab-bindings/+precice/@Participant/private/preciceGateway.cpp:7:10: fatal error:
precice/Participant.hpp: No such file or directory
    7 | #include "precice/Participant.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Error in compile_matlab_bindings_for_precice (line 18)
mex(strcat(path_Interface,".cpp"),'CXXFLAGS="-std=c++17 -fPIC"',"-output",path_Interface,flags{:});

This is in WSL Ununtu 22.04. I installed precise using spack. Thanks in advance

uekerman commented 10 months ago

Which version of the Matlab bindings do you use? Seems like you use the develop version, which is only compatible with the develop version of preCICE. Try using the latest release of the bindings.

ec2608 commented 10 months ago

Many thanks for the reply. Is the relase version of the matlab bindings called by a different..m file or in a different github repo? Many thanks

IshaanDesai commented 10 months ago

Many thanks for the reply. Is the relase version of the matlab bindings called by a different..m file or in a different github repo? Many thanks

The release is tagged: https://github.com/precice/matlab-bindings/releases/tag/v2.5.0.0 you can go to this release by checking out the release branch or also also simply checking out the tag. This release is compatible with preCICE v2.5.0

ec2608 commented 10 months ago

Yes that was indeed the issue all works well with the release version of the bindings

ec2608 commented 10 months ago

Just a minor addition. While the installation file works. I have the issue that the tutorial m file for the explicit solvers cause Matlab to crash immediately. The implicit solver examples works fine. I wonder if you have observed something like this before?

the error message is about XMLParser not being able to parse the configuration file (and then matlab immediately crashes).

uekerman commented 10 months ago

@ec2608 Can you please give more details. Which configuration gives this error exactly?

ec2608 commented 10 months ago

WSL2 Ubuntu 22.04- Matlab 2023a

precice installed by: spack 2.5.0 install precice ^boost@1.74.0

latest Matlab bindings from https://github.com/precice/matlab-bindings/releases/tag/v2.5.0.0

running Matlab with: LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 matlab

Happy to share more info

uekerman commented 10 months ago

I meant the preCICE configuration. What exactly do you run?

ec2608 commented 10 months ago

I am running the Solver_U,m or Solver_I.m file (running from matlab) within the tutorial/explicit folder. So the configuration run is the file within that folder.

uekerman commented 10 months ago

This config file: https://github.com/precice/matlab-bindings/blob/master/tutorial/explicit/precice-config.xml ?

Are you sure you also use the file from the corresponding release? Which error message do you get exactly?

I don't have Matlab to reproduce the problem, but your error sounds like it has nothing to do with Matlab.

ec2608 commented 9 months ago

Yes that is the correct file. Are you sure you also use the file from the corresponding release? yes the bindings is 2.5.0 and so is the spack installed precise version

Here is the error message: (0) 12:02:48 [xml::XMLParser]:152 in readXmlFile: ERROR: XML parser was unable to open configuration file "precice-config.xml"

ec2608 commented 9 months ago

Further on the previous this what the terminal reports while Matlab crashes: The MPI_Comm_rank() function was called after MPI_FINALIZE was invoked. This is disallowed by the MPI standard. *** Your MPI job will now abort.

uekerman commented 9 months ago
(0) 12:02:48 [xml::XMLParser]:152 in readXmlFile: �[31mERROR: �[0mXML parser was unable to open configuration file "precice-config.xml"

This basically means that preCICE is not able to find the file. How do you call your solvers? Do you first step into the tutorial/explicit folder?

ec2608 commented 9 months ago

I first open the matlab gui, then step in the tutorial/explicit folder and then select to run the main script, Perhaps more intriguingly I got the following word behavior when running the script in Matlab debugging line by line with the 'step' command. I get the error when I step over this lines : preciceGateway(uint8(0),SolverName,configFileName,int32(solverProcessIndex),int32(solverProcessSize));

but the code works when I use 'step in' instead. This is more weird because Matlab can't really step in within that function so step and step in would practically be identical commands.

ec2608 commented 9 months ago

Just a follow up on this.: I have managed to install Matlab R2021b in WSL2 and there are no errors. I tried this with the bindings for release and the binary package (precise 2.5.0) so whatever is happening is due to the Matlab version. In Matlab R2021b the examples work fine, they don't in 2023a or 2023b at least in my pc.

uekerman commented 9 months ago

Thanks for following up! Then this sounds like a more intricate problem. Let's re-open.