MATLAB running in Linux background

45 次查看(过去 30 天)
Hello,
I am trying to run a MATLAB code remotely in a Linux machine. The code have to keep running even if I get disconnected. I looked up other threads and tried this:
nohup matlab -nodisplay -nosplash -r "run('opt_main.m'); exit" > output.log 2>&1 &
where opt_main is my script. When I do this, I get such messages in the terminal:
[2] 75698
or
[4] 76510
Then I get a very long error message, which includes expressions as such:
corrupted double-linked list
corrupted unsorted chunks
Please note that I include parallel computing. Can anyone help me?

回答(1 个)

Hassaan
Hassaan 2024-1-16
The error messages you're encountering, such as "corrupted double-linked list" and "corrupted unsorted chunks," suggest memory-related issues. Running MATLAB in the background with nohup on a remote machine might lead to problems with the X11 display.
To run MATLAB in the background and prevent issues with the X11 display, you can use the matlab -batch option instead. Also, it's a good practice to use the -singleCompThread option when running MATLAB remotely to avoid potential parallel computing issues.
nohup matlab -nodisplay -nosplash -singleCompThread -batch "run('opt_main.m'); exit" > output.log 2>&1 &
Explanation of changes:
  • -batch is used instead of invoking the MATLAB command prompt directly.
  • -singleCompThread is added to disable multithreading, which can sometimes cause issues when MATLAB is run in the background.
This command should help in running MATLAB in the background on your Linux machine without encountering the X11 display-related issues. Additionally, make sure that your MATLAB script (opt_main.m) is set up to handle any necessary dependencies and paths correctly when running in batch mode.
------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering
Feel free to contact me.
  3 个评论
Hassaan
Hassaan 2024-1-16
You can try.
------------------------------------------------------------------------------------------------------------------------------------------------ If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback. Professional Interests Technical Services and Consulting Embedded Systems | Firmware Developement | Simulations Electrical and Electronics Engineering Feel free to contact me.
Damian Pietrus
Damian Pietrus 2024-1-16
Parallel workers are single-threaded by default, so using -singleCompThread will still allow you to to explicitly start up a parallel pool and use parallel processing.
If you have a lot of serial code that uses multithreaded libraries such as fft outside of your parallel code, then you may wish to leave off the -singleCompThread flag.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by