How do you assign the number of cores via an ssh script?

3 ビュー (過去 30 日間)
Alessandro Maria Laspina
Alessandro Maria Laspina 2020 年 12 月 26 日
コメント済み: Raymond Norris 2021 年 1 月 2 日
Hello,
i have a batch script file that is run on an ssh with the following format:
nohup matlab -nodesktop -nosplash -nodisplay <script_file.m>& output_script_file.txt &
I want to set the number of cores for the job to 6, seeing as the script_file.m uses a parfor loop. I know feature('numcores') will display the number of cores available, but I want to specifically assign the number of cores. Is this done through the batch script file, and if so how? If not, how can I assign the number of cores to a job on an ssh?
Thanks.

採用された回答

Alessandro Maria Laspina
Alessandro Maria Laspina 2020 年 12 月 27 日
編集済み: Alessandro Maria Laspina 2020 年 12 月 28 日
I've tried running Walter Roberson's answer, but for some reason i've had to include maxNumCompThreads(6) in the script file at the start.
Also the > gave me an error as well.
This seemed to work:
nohup matlab -nodesktop -nosplash -nodisplay -batch <script_file> & output_script_file.txt &
EDIT:
As Walter Roberson wrote, > and & should not have a space, so it is:
nohup matlab -nodesktop -nosplash -nodisplay <script_file.m>& output_file.txt &
  2 件のコメント
Walter Roberson
Walter Roberson 2020 年 12 月 27 日
If I recall correctly, you are not permitted to have a space between the > and the &
Alessandro Maria Laspina
Alessandro Maria Laspina 2020 年 12 月 28 日
Indeed! Thank you for pointing it out.

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 12 月 26 日
However you could also consider modifying the cluster profile to limit the cores in it.
  7 件のコメント
Alessandro Maria Laspina
Alessandro Maria Laspina 2020 年 12 月 27 日
Had to change the syntax a bit for it to work. Thanks for the help!
Raymond Norris
Raymond Norris 2021 年 1 月 2 日
Also consider using the -logfile switch
nohup matlab -batch 'maxNumCompThreads(6);script_file' -logfile output_script_file.txt &

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by