This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
wiki:user_guide [2022/05/06 09:35] phegde |
wiki:user_guide [2022/05/28 18:18] (current) cnr-guest [Job preparation ans submission] |
||
---|---|---|---|
Line 101: | Line 101: | ||
Complete documentation is avalailable at '' | Complete documentation is avalailable at '' | ||
- | SLUR is an open source software sytstem for cluster management; it is highly scalable and integrates fault-tolerance and job scheduling mechanisms. | + | SLURM is an open source software sytstem for cluster management; it is highly scalable and integrates fault-tolerance and job scheduling mechanisms. |
==== SLURM basic concepts ==== | ==== SLURM basic concepts ==== | ||
Line 322: | Line 322: | ||
=== Parallel computation in python === | === Parallel computation in python === | ||
- | The effective usage of the hpc can be done using parallelizing the processes. The codes can be parallelized by distributing the tasks among the available nodes and their respective CPUs and GPUs as well. This information can be specified in a simple submission bash script as follows, | + | |
< | < | ||
- | #SBATCH --nodes= | + | #SBATCH --nodes=[nnodes] |
- | #SBATCH --ntasks-per-node= | + | #SBATCH --ntasks-per-node=[ntasks per node] #number of cores per node |
- | #SBATCH --gres=gpu: | + | #SBATCH --gres=gpu:[ngpu] |
- | python example.py | + | |
- | Python offers many packages to parallelize the given process. The basic one among them [[https:// | + | === Example of parallel jobs submission === |
+ | Suppose a given python code has to be executed for different values of a variable " | ||
+ | < | ||
+ | |||
+ | The submission script sub.sh can be used to parallelize the process in following way: | ||
+ | |||
+ | < | ||
+ | #SBATCH --nodes=[nnodes] | ||
+ | #SBATCH --ntasks-per-node=[ntasks per node] #number of cores per node | ||
+ | #SBATCH --gres=gpu: | ||
+ | NPROC=[nprocesses] | ||
+ | |||
+ | tmpstring=tmp | ||
+ | |||
+ | count=0 | ||
+ | for rep in {1..10}; | ||
+ | do | ||
+ | tmpprogram=${tmpstring}_${rep}.py | ||
+ | sed -e " | ||
+ | $program > $tmpprogram | ||
+ | python $tmpprogram & #run the temporary files | ||
+ | (( count++ )) # | ||
+ | [[ $(( count % NPROC )) -eq 0 ]] && wait #wait for the parallel programs to finish. | ||
+ | done | ||
+ | rm ${tmpstring}* | ||
+ | * Parallel job submissions can also be done by job array submission. More information about Job arrays can be found in [[https:// | ||
+ | |||
+ | * Parallelization can be implemented within the python code itself. For example, the evaluation of a function for different variable values can be done in parallel. | ||
+ | |||
+ | * The keras and Pytorch modules in tensorflow which are mainly used for machine learning detects the GPUs automatically. | ||
+ | |||
+ | |||