Submit LSF command from matlab script

6 次查看(过去 30 天)
I want to subbmit LSF command from matlab:
command = 'bsub -q normal -G example sleep 100';
% Execute the command using system
[status, result] = system(command);
in the result i get command not found
  2 个评论
Damian Pietrus
Damian Pietrus 2024-3-19
Integrating MATLAB with LSF requires a support package which can be accessed here:
Is your MATLAB client (where you're submitting the command from) on the cluster or off-cluster?
lior
lior 2024-4-24
编辑:lior 2024-4-24
I dont want to use cluster and parallel computing on matlab.
There is way to send job to LSF without using cluster and parllel computing on matlab?

请先登录,再进行评论。

回答(1 个)

Swastik Sarkar
Swastik Sarkar 2024-8-30
编辑:Swastik Sarkar 2024-8-30
Hi @lior,
The "command not found" error likely results from a PATH issue. To diagnose this, verify the directory containing bsub by executing the following in a terminal where bsub is accessible:
which bsub
'bsub' not found.
Next, check if this directory is included in the PATH variable of the MATLAB Client using:
getenv("PATH")
ans = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
This is likely the cause of the error being encountered. Below is a demonstration of a similar error using the ls command:
system("ls -al")
total 8 drwxr-xr-x 2 matlab matlabgroup 4096 Aug 30 12:35 . drwx------ 3 matlab matlabgroup 4096 Aug 30 12:35 ..
ans = 0
system("which ls")
/usr/bin/ls
ans = 0
getenv("PATH") % You will notice that the above directory is present here.
ans = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
setenv("PATH", "") % Setting to PATH to empty string to simulate a “No command found”
system("ls -al") % Command not found
/bin/bash: line 1: ls: No such file or directory
ans = 127
This issue can be resolved by specifying the absolute path of bsub, thereby eliminating the dependency on the PATH variable. Below is an example using ls:
getenv("PATH") % Verifying PATH is empty
ans = 0x0 empty char array
system("/usr/bin/ls -al")
total 8 drwxr-xr-x 2 matlab matlabgroup 4096 Aug 30 12:35 . drwx------ 3 matlab matlabgroup 4096 Aug 30 12:35 ..
ans = 0
A more official method to communicate with LSF is to use the Parallel Computing Toolbox plugin for LSF, as mentioned by @Damian Pietrus. This approach allows MATLAB to construct the necessary bsub command. The plugin can be found here:
Hope this helps.

类别

Help CenterFile Exchange 中查找有关 GPU Computing 的更多信息

标签

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by