Open FernanMartinez opened 2 years ago
Greetings!
If I remember correctly, CMake compilation might run into trouble after MATLAB version 2016. We tested the parallel version only in the environments given by Table 3 in the article.
The instruction that you had
mex -DUSE_OMP cpp/2d/MC2Dmex.cpp COMPFLAGS='\$COMPFLAGS /openmp /O2' CXXFLAGS='\$CXXFLAGS ' LDFLAGS='\$LDFLAGS"
was meant for visual studio only. (c.f. "Windows (Visual Studio):" above)
The GCC version is
mex -DUSE_OMP cpp/2d/MC2Dmex.cpp COMPFLAGS='\$COMPFLAGS -fopenmp' CXXFLAGS='\$CXXFLAGS -fopenmp' LDFLAGS='\$LDFLAGS -fopenmp'
However, this might not work in windows. You can try.
Since you are running on windows, any chance you could try switching to visual studio? But please make sure the version of visual studio you install is supported by MATLAB before downloading. The code is faster using visual studio anyway because it has a faster implementation of the exponential function by default. The difference is about 1.25×, at least using the compilers from Table 3.
I do not know for sure if this will work with MATLAB 2021, but I this is what I would try first.
Once you have downloaded a supported compiler, you need to follow MATLABs instructions on how to make MATLAB find it. The last step is "mex -setup" at MATLAB prompt, but you might also need to set up some environment variables before that. However, if I remember correctly, visual studio does not need any.
I hope this helps!
For a list of supported compilers for Matlab 2021b, see https://www.mathworks.com/support/requirements/supported-compilers.html
Greetings. Thank you so much for replying. I tried to run the code in Windows, however it did not work. So I used a virtual machine with Ubuntu 20.04 LTS, and the program ran in parallel without any error. It was easier than Windows. Thank you so much. Kind regards
Greeting Many thanks for making available your work. I have been testing your software to calculate the light in a surface in 2D (without multithread). And, it worked well. However, my geometry takes much time to be solved, so I need to use multithread. I followed the README. However, I did not get to activate openMP. I have installed MinGW-w64 C/C++, TDM-GCC-64, and CMake.
When I try to run
mex -DUSE_OMP cpp/2d/MC2Dmex.cpp COMPFLAGS='\$COMPFLAGS /openmp /O2' CXXFLAGS='\$CXXFLAGS ' LDFLAGS='\$LDFLAGS
', I have received the following errorSupported compiler not detected. You can install the freely available MinGW-w64 C/C++ compiler; visit https://www.mathworks.com/matlabcentral/fileexchange/52848-matlab-support-for-mingw-w64-c-c-compiler. For more options, visit https://www.mathworks.com/support/compilers.
I do not know why I am getting this error because I have MinGW-w64, and the environment variables are ok.
I used CMake as you recommend in the article, but when I run it, I get
May you help me with this mistake? I need to use all cores of my PC. I am using Windows 10 and Matlab R2021b. Thank you so much for your attention