compiled_matlab_on_igrida
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
compiled_matlab_on_igrida [2013/07/21 09:07] – samer | compiled_matlab_on_igrida [2014/03/02 17:44] (current) – [Preparing the Scripts] samer | ||
---|---|---|---|
Line 10: | Line 10: | ||
When at the IGRIDA front-end, start an interactive job: | When at the IGRIDA front-end, start an interactive job: | ||
<code bash> | <code bash> | ||
- | oarsub -I | + | igrida-oar-frontend%oarsub -I |
</ | </ | ||
=====Preparing the Scripts===== | =====Preparing the Scripts===== | ||
- | Let us assume that your main MATLAB function is called '' | + | Let us assume that your main MATLAB function is called '' |
<file bash main_foo.m> | <file bash main_foo.m> | ||
Line 22: | Line 22: | ||
c=sec_foo(a, | c=sec_foo(a, | ||
matFilename = sprintf('/ | matFilename = sprintf('/ | ||
- | save(matFilename, | + | save(matFilename, |
</ | </ | ||
Line 30: | Line 30: | ||
</ | </ | ||
- | In order to compile your scripts, you can use the '' | + | In order to compile your scripts, you can use the '' |
- | | + | <code bash> |
- | / | + | igrida01-01%module load matlab |
+ | igrida01-01%/ | ||
+ | </ | ||
- | As a good practice, it is recommended | + | Now, you have got an executable called main_foo |
<code bash> | <code bash> | ||
- | mkdir -p / | + | igrida01-01%./main_foo 10 20 |
</ | </ | ||
+ | You can now exit the interactive OAR session and get back to the frontend. | ||
+ | =====Preparing the OAR jobs===== | ||
+ | Let us suppose that you need to run hundreds of simulations of your MATLAB compiled script. You can choose to modify your MATLAB scripts and add iterating loops (then recompile). Then, you can follow this [[matlab_script_on_igrida|tutorial]] to run your job. However, with this method, you launch a single OAR job and do not take full advantage of the computing facilities on IGRIDA. | ||
+ | In order to run multiple jobs, you can write a launcher script as in '' | ||
- | Then, create an OAR launch script in your home directory ''/ | + | <file bash oar_launcher.sh> |
- | + | ||
- | <file bash oar-launch-script.sh> | + | |
#!/bin/bash | #!/bin/bash | ||
- | source / | + | for i in {1..10}; |
- | module load matlab | + | do |
+ | for j in {1..10}; | ||
+ | do | ||
+ | echo "# | ||
+ | echo "source / | ||
+ | echo "module load matlab" >> job$i$j.sh | ||
+ | echo "#OAR -l core=10, | ||
+ | echo "#OAR -O / | ||
+ | echo "#OAR -E / | ||
+ | echo 'echo "My job was ran on these nodes:"' | ||
+ | echo 'cat $OAR_NODEFILE' | ||
+ | echo "# | ||
+ | echo ' | ||
+ | echo 'mkdir -p $MCR_CACHE_ROOT' | ||
+ | echo "#cd to your execution directory first" >> job$i$j.sh | ||
+ | echo "cd / | ||
+ | echo " | ||
+ | echo "# | ||
+ | echo '/ | ||
+ | | ||
+ | done; | ||
- | #OAR -l core=10, | + | for k in job*; |
- | #OAR -O / | + | do |
- | #OAR -E / | + | chmod +x $k; |
- | echo "My job was ran on these nodes:" | + | |
- | cat $OAR_NODEFILE | + | done; |
- | + | ||
- | #Setup MCR cache directory locally | + | |
- | export MCR_CACHE_ROOT=/ | + | |
- | mkdir -p $MCR_CACHE_ROOT | + | |
- | + | ||
- | #cd to your execution directory first | + | |
- | cd / | + | |
- | matlab -r matlab-demo | + | |
- | + | ||
- | #Remove temporary MCR cache directory | + | |
- | /bin/rm -rf $MCR_CACHE_ROOT | + | |
</ | </ | ||
- | + | ||
- | In your Matlab file '' | + | Do not forget to create |
<code bash> | <code bash> | ||
- | a=1; | + | igrida-oar-frontend%mkdir -p / |
- | b=a+1; | + | |
- | matFilename = sprintf(' | + | |
- | save(matFilename, | + | |
</ | </ | ||
Prepare you OAR launch script to be executed: | Prepare you OAR launch script to be executed: | ||
<code bash> | <code bash> | ||
- | igrida-oar-frontend%chmod +x oar-launch-script.sh | + | igrida-oar-frontend%chmod +x oar-launcher.sh |
</ | </ | ||
+ | |||
=====Launching the Job===== | =====Launching the Job===== | ||
- | You can now submit eh job using the command '' | + | You can now launch your jobs by simply calling your launcher script |
<code bash> | <code bash> | ||
- | igrida-oar-frontend%oarsub -S | + | igrida-oar-frontend%./oar-launcher.sh |
[ADMISSION RULE] Modify resource description with type constraints | [ADMISSION RULE] Modify resource description with type constraints | ||
[ADMISSION RULE] Job walltime greater than 4 hours, adding property duration_weight > 2 (large job). | [ADMISSION RULE] Job walltime greater than 4 hours, adding property duration_weight > 2 (large job). | ||
Generate a job key... | Generate a job key... | ||
OAR_JOB_ID=666666 | OAR_JOB_ID=666666 | ||
+ | [ADMISSION RULE] Modify resource description with type constraints | ||
+ | [ADMISSION RULE] Job walltime greater than 4 hours, adding property duration_weight > 2 (large job). | ||
+ | Generate a job key... | ||
+ | OAR_JOB_ID=777777 | ||
</ | </ | ||
| | ||
- | Step back and watch your job being executed. | + | Step back and watch your jobs being successively created then executed. |
=====Verifying the Output===== | =====Verifying the Output===== |
compiled_matlab_on_igrida.1374390472.txt.gz · Last modified: 2014/01/11 05:24 (external edit)