Open Alessandro5I opened 2 months ago
Hi Alessandro, I have not encountered this before. The size of the avrSWAP array is normally given by the variable nc read from MPI_shared.dat then output by MPI_init, so you may check if that one makes sense. If the MPI communication seem to run fine, I would suspect that the error lies on the Matlab side due to some system-dependent behaviour of the mex files. I have now updated the MPI server for easier debugging and recompiling, so you may try recompiling the mex files painlessly (see ReadMe), you just need to have MinGW with gcc suite installed and configured in the Matlab compiler. Regards Valentin
Hi Valentin, Thanks for the answer. I've downloaded the updated version and inserted my Test3turbines folder.
The issue is not located in the inizialization of the avrSWAP matrix. The "Size avrSWAP" is correctly printed. The problem seems to be at the line below the while incomplete, the MPIServer_AnyReceive(avrSWAP) gives back a blank avrSWAP and then later MATLAB closes.
I don't think that recompiling it would change anything as it works on other PCs. What do you suggest?
Thanks, Alessandro
Well, system-dependent issues is precisely what rebuilding (should not call it recompiling, as it is the relinking part we're after) typically can solve, by making sure the correct dependencies are used. I'd not dig any further without having tried it. And to be honest, needing to rebuild is totally normal for this kind of project. I've made the process as easy as possible, you just need to run Build_SC_MPI_server.bat once MinGW with gcc suite is installed and Matlab compiler is setup with it. -Valentin
Hi Valentin, Thanks, I tried to recompile running Build_SC_MPIServer_DLL.bat but same issue. Here a screenshot of the cmd after recompiling.
Is this correct? I still have the same issue anyway.
Bye, Alessandro
Ok, then it didn't help (assuming you compiled on the PC experiencing issues and made sure you use the new mex files and SC_MPIServer.dll, not the old ones), but it was the first thing to try. What is the content of stdout_MPIServerSubs.txt and stdoutMPIClientSubs.txt (for each turbine)?
(assuming you compiled on the PC experiencing issues and made sure you use the new mex files and SC_MPIServer.dll, not the old ones) By "new" you mean the ones from the latest update on the github or what?
No I meant the ones you just recompiled (that seems obvious, but just to be safe before we dig further)
No I meant the ones you just recompiled (that seems obvious, but just to be safe before we dig further)
Shouldn't they overwrite?
Yes, they should, but it does not harm to check the last modified date to be sure. Looking at the files, the server does receive from turbine 1 but does not proceed to sending (because matlab crashes right after). The received message (i.e. avrSWAP matrix) is not empty, everything looks fine. Are the other outputs from MPIServer_AnyReceive (iT and incomplete) correct (1 and true)? I'd try printing out things from MPIServer_AnyReceive.cpp (now that you can recompile) to better locate the problem
I took the screenshots from MATLAB: At line 31 the avrSWAP matrix received is blank :(
How to print out things from MPIServer_AnyReceuve.cpp?
Just ask chatGPT how to print out things in c++ and recompile :-)
Number of elements in the input array: 0 First element of the message after MPIServer_AnyReceive: 1 iT: 1, flag: true, ierror: 0 Message content after MPIServer_AnyReceive:
This is what ChatGPT told me to do...
So the input array has 0 element?
So the input array has 0 element?
Yes, the input array should be the avrSWAP from MATLAB, correct?
Yes, and it should have the right number of elements. Can you check the size of the avrSWAP matrix before calling MPIServer_AnyReceive (I don't see why it should be different than the initialised value zeros(nT,nc, 'single'), but let's check). I won't be available the next two weeks, but anyway cannot help much more now. It's a mex file issue, Google and ChatGPT are your friends... Hope you'll sort this out
Before entering the MPIServer_AnyReceive(), avrSWAP has the correct dimensions, it may be an issue between MATLAB and the mex64?
yes, there is apparently an issue with argument input in mex file, that somehow is system-dependent. There is a good chance this has been experienced by other matlab users, or maybe the syntax in c++ code is bad. This part was done by my student Coen-Jan Smits, I haven't been into this myself.
OK I think I somehow solved this, it was something in MPIServer_AnyReceive.cpp, in the lines where the avrSWAP was read from MATLAB the matrix went lost, I asked ChatGPT for a different way to input (read) the matrix and now it seems to work, for sure it is not the best option for computational performance. I attach the new .cpp for you to analyse and please, solve this issue.
Thanks very much, this tool is saving me a lot of time.
Hi, I've succesful installed and run this tool on 2 laptops. Lately I'm trying to use this on my home desktop and on a desktop remotely controlled. While on the two laptop the tool is running perfectly, I got the same exact issue on the two desktops:
While running the avrSWAP seems to be blank avrSWAP = [] no errors are highlighted from MATLAB but the avrSWAP is blank. I've used the same procedure on both laptop and desktops but I got different results.
Thanks for an help, Alessandro