Pass task-parallel jobs with multiple tasks to a scheduler.

버전 1.0.0.0 (2.28 KB) 작성자: Bruce Raine
This script creates 2 jobs, each with 2 parallel tasks, to pass to a local or remote scheduler.
다운로드 수: 736
업데이트 날짜: 2010/7/1

라이선스 보기

This script demonstrates how to create jobs with tasks to be processed in parallel and how to pass them to either a local or remote scheduler.

To run the script with a local scheduler you will need the Parallel Computing Toolbox (in addition to MATLAB R2010a). To run it with a remote scheduler you will also need the Distributed Computing Server.

When running the parforv4 script you need to ensure that both files: parjobv4.m and myrand.m
are co-resident i.e. in the same folder. You can swap out myrand.m and put your own pet function in its place but if you do, be careful to observe the special syntax for both calling the function and passing parameters to it.

myrand.m takes one parameter and I call it twice in each job, hence 2 tasks per job are passed to the scheduler. You can change the literal parameter (i.e. the 3 passed to myrand) to a higher value to create larger n x n matrices of random numbers. You may want to alter the fprint statements to accommodate bigger matrices if you do this. Note that you cannot call myrand by itself as it must be called from the parjobv4.m script.

I don't use parfor in myrand.m but feel free to put this
in a function of your choice if you want to speed up 'for loops' as well as pass task-parallel jobs to a scheduler

Running the parforv4 script, as it stands, produces 4 3x3 matrices (2 per job) of random numbers.

>> parjobv4
Finished job one
Finished job two
Job 1 results
0.18715 0.23947 0.22958
0.97552 0.89324 0.63034
0.88797 0.38953 0.78726
0.41598 0.79888 0.78901
0.16128 0.41097 0.38039
0.63030 0.92824 0.74550
Job 2 results
0.96928 0.07264 0.63719
0.19574 0.54839 0.89868
0.51598 0.64808 0.54161
0.51760 0.00946 0.14139
0.49429 0.02560 0.41964
0.01753 0.60851 0.23285
>>

인용 양식

Bruce Raine (2024). Pass task-parallel jobs with multiple tasks to a scheduler. (https://www.mathworks.com/matlabcentral/fileexchange/28094-pass-task-parallel-jobs-with-multiple-tasks-to-a-scheduler), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2010a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Parallel Computing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0