Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Solving a model takes x8 longer when launched from the MATLAB Livelink than from the COMSOL GUI

Please login with a confirmed email address before reporting spam

Hi there,

I'm seeing unusually long solution times when I run my model from the Matlab livelink. From Matlab it takes around 60-100s to obtain a solution in my model. Running the same model in COMSOL GUI yields only 10s solution time. This is a big headache for me since I need to run long sweeps, whose accumulated time becomes unpractical with the long solution times from Matlab.

Since I didn't have this issue in previous versions of COMSOL, I wonder if this is a known COMSOL 5.4 bug. The effect stays the same after I restarted Matlab and my desktop.

Does anyone have an idea of what could be going on?

Thank you!


6 Replies Last Post May 15, 2019, 3:49 p.m. EDT
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 5 years ago May 6, 2019, 3:01 a.m. EDT

Hi Raphael

This sounds strange.

We have seen problems on some combinations of operating systems and CPUs. What operating system are your using? What CPU(s) do you have? How much RAM does you computer have?

-------------------
Lars Gregersen
Comsol Denmark
Hi Raphael This sounds strange. We have seen problems on some combinations of operating systems and CPUs. What operating system are your using? What CPU(s) do you have? How much RAM does you computer have?

Please login with a confirmed email address before reporting spam

Posted: 5 years ago May 14, 2019, 7:51 p.m. EDT

Dear Lars,

my operating system is Windows 10. The system has two Intel Xeon CPUs running at 1.7 GHz and 64 GB of RAM.

Any ideas on what might be going on?

Thank you!

Dear Lars, my operating system is Windows 10. The system has two Intel Xeon CPUs running at 1.7 GHz and 64 GB of RAM. Any ideas on what might be going on? Thank you!

Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 5 years ago May 15, 2019, 8:47 a.m. EDT

We very rarely see problems with some Xeon processors. It may be a conflict with some of the libraries we use. Try to start Comsol with Matlab with the -np option to adjust the number of threads. E.g. something like this: comsolmphserver matlab -np 16 You can try with other values. E.g. 24 or 8 and see if that makes a difference.

-------------------
Lars Gregersen
Comsol Denmark
We very rarely see problems with some Xeon processors. It may be a conflict with some of the libraries we use. Try to start Comsol with Matlab with the -np option to adjust the number of threads. E.g. something like this: comsolmphserver matlab -np 16 You can try with other values. E.g. 24 or 8 and see if that makes a difference.

Please login with a confirmed email address before reporting spam

Posted: 5 years ago May 15, 2019, 11:37 a.m. EDT

Thanks, I will check this but the command is not recognized by my system. Should I run "comsolmphserver -np 16" from command prompt before starting the livelink? Or after starting the livelink?

Thanks, I will check this but the command is not recognized by my system. Should I run "comsolmphserver -np 16" from command prompt before starting the livelink? Or after starting the livelink?

Please login with a confirmed email address before reporting spam

Posted: 5 years ago May 15, 2019, 1:49 p.m. EDT

Okay, I believe I managed to change the -np option by editing the shortcut to "C:\Program Files\COMSOL\COMSOL54\Multiphysics\bin\win64\comsolmphserver.exe" matlab -np 8 -Dcs.ckl"

And as you expected, this seems to be very important. With -np 8 the solution time is x10 shorter than without -np changes. Very strange but also really good to know! I will play around a bit more and try to find the optimum.

Thanks!

Okay, I believe I managed to change the -np option by editing the shortcut to "C:\Program Files\COMSOL\COMSOL54\Multiphysics\bin\win64\comsolmphserver.exe" matlab -np 8 -Dcs.ckl" And as you expected, this seems to be very important. With -np 8 the solution time is x10 shorter than without -np changes. Very strange but also really good to know! I will play around a bit more and try to find the optimum. Thanks!

Please login with a confirmed email address before reporting spam

Posted: 5 years ago May 15, 2019, 3:49 p.m. EDT
Updated: 5 years ago May 15, 2019, 3:50 p.m. EDT

For your interest, here are the solution times as a function of "-np":

  • -np 1: ~15s
  • -np 2: ~12s
  • -np 3: ~11s
  • -np 4: ~10s
  • -np 5: ~11s
  • -np 6: ~10s
  • -np 8: ~11s
  • -np 12: ~13s
  • -np 16:~75s
  • -np 24: ~100s

Is there a way to have the optimal -np for the Livelink set automatically? After all, it seems that the COMSOL GUI somehow finds a better setting than the Livelink?

For your interest, here are the solution times as a function of "-np": * -np 1: ~15s * -np 2: ~12s * -np 3: ~11s * -np 4: ~10s * -np 5: ~11s * -np 6: ~10s * -np 8: ~11s * -np 12: ~13s * -np 16:~75s * -np 24: ~100s Is there a way to have the optimal -np for the Livelink set automatically? After all, it seems that the COMSOL GUI somehow finds a better setting than the Livelink?

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.