Difference between revisions of "Cluster matlab"
From Biomedical Optics Lab
Jump to navigationJump to searchLine 6: | Line 6: | ||
To properly use the cluster, we must submit jobs using the Slurm scheduler. To run an existing Matlab script, we just include its name in the Slurm instructions. Here is an example for running the Matlab code <code>parforcluster.m</code>. The text below could be named <code>ada-submit</code> and used for running all Matlab scripts by updating the filename inside the Matlab run command <code>matlab -nodisplay -nosplash -nodesktop -r "run('./parforcluster.m');exit;"</code>. | To properly use the cluster, we must submit jobs using the Slurm scheduler. To run an existing Matlab script, we just include its name in the Slurm instructions. Here is an example for running the Matlab code <code>parforcluster.m</code>. The text below could be named <code>ada-submit</code> and used for running all Matlab scripts by updating the filename inside the Matlab run command <code>matlab -nodisplay -nosplash -nodesktop -r "run('./parforcluster.m');exit;"</code>. | ||
− | < | + | <pre> |
#!/usr/bin/env bash | #!/usr/bin/env bash | ||
# | # | ||
Line 35: | Line 35: | ||
echo -e "\n# CPU Info ----------------------------" | echo -e "\n# CPU Info ----------------------------" | ||
lscpu | lscpu | ||
− | </ | + | </pre> |
Revision as of 12:36, 25 June 2020
Using Matlab on the Cluster
We are exploring how to use Matlab with the new HPC cluster, and we will use this page to keep track of our current approaches.
Running Matlab Code Using Slurm
To properly use the cluster, we must submit jobs using the Slurm scheduler. To run an existing Matlab script, we just include its name in the Slurm instructions. Here is an example for running the Matlab code parforcluster.m
. The text below could be named ada-submit
and used for running all Matlab scripts by updating the filename inside the Matlab run command matlab -nodisplay -nosplash -nodesktop -r "run('./parforcluster.m');exit;"
.
#!/usr/bin/env bash # # submit batch file; based on CS 416 S20 ada-submit # Set SLURM options (you should not need to change these) #SBATCH --job-name=testing # Job name #SBATCH --output=./test-results/testing-%j.out # Name for output log file (%j is job ID) #SBATCH --nodes=1 # Requesting 1 node and 1 task per node should #SBATCH --ntasks-per-node=1 # ensure exclusive access to the node #SBATCH --cpus-per-task=32 # Limit the job to only two cores #SBATCH --partition=short # Partition (queue) #SBATCH --time=00:15:00 # Time limit hrs:min:sec # DONT MODIFY ANYTHING ABOVE THIS LINE # Print SLURM envirionment variables echo "# Job Info ----------------------------" echo "Job ID: ${SLURM_JOB_ID}" echo "Node: ${SLURMD_NODENAME}" echo "Starting: "`date +"%D %T"` echo -e "\n# Run Results -------------------------" matlab -nodisplay -nosplash -nodesktop -r "run('./parforcluster.m');exit;" #matlab -r "parpool" # For reference, dump info about the processor echo -e "\n# CPU Info ----------------------------" lscpu