How does MATLAB Parallel computing toolbox work?
3 次查看(过去 30 天)
显示 更早的评论
Dear All,
We have recently installed MATLAB and its parallel toolbox in our clusters for linux. We have transferred all of our scripts to linux in order to run them using the new installed MATLAB. However, we have so many difficulties using the parallel computing toolbox. For instance, we do not know how to change the number of processors in a node! Usually we ask for a single node (each of the nodes has 12 cores) and then run our codes on the requested nodes.
We do want to run our codes using 1 processor and monitor the performance, then run the same script with 2 and etc.Should we do/add anything to our scripts?
Basically how can we generally ask for different number of cores in a single node? How can we submit our jobs and monitor them using parallel toolbox in MATLAB? I know that these question are general but I do appreciate if anyone can help me.
Best,
HRJ
1 个评论
Edric Ellis
2015-11-5
Are you using PCT alone, or are you using MDCS with a scheduler? Are you trying to set up the MJS scheduler? For monitoring jobs in PCT, there's the job monitor...
采纳的回答
Federico Becattini
2015-11-5
The simplest way of running matlab code in parallel is to open a parallel pool specifying the number of cores that you want to use with
parpool(numcores)
and then use a parfor loop instead of a for loop. Of course you have to be sure that your code is parallelizable.
If you are using a cluster you can also submit different jobs to different cores using different matlab instances. For example with Sun Grid Engine you can use qsub to submit jobs. In order to do this with matlab you can write you matlab script with the following line to get the job ID
job_id = getenv('SGE_TASK_ID');
then you have to write a simple .sh file that launches matlab with this script. Something like this:
#!/bin/sh
#$ -cwd
path_to_matlab -nojvm -nodisplay -r scriptname
To submit the jobs you can execute the following command from the command line:
qsub -t 1-num_jobs:1 -o output_path -e error_path matlab_job.sh
where num_jobs is the number of jobs that you want to submit, output_path is the path where you want to print matlab's output and error_path is the path for printing any possible errors. matlab_job.sh is the .sh script defined above.
Hope this is useful.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cluster Configuration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!