Python for HPC

For batch processing, you have to write R script and Job script. R script can be written in R studio and saved as a script file. But to submit a job one needs to avail of PuTTY & WinSCP. A brief description of different steps are provided below (click on R for HPC for details).

  1. Download and install PuTTY from following the instructions therein.
  2. Download and install WinSCP from the instructions therein.
  3. Write a Python script and job script test.slurm as given below

(a) Write the Python script file given below

from mpi4py import MPI
import numpy
a = numpy.asarray([ [1,2,3], [4,5,6], [7,8,9] ])
numpy.savetxt("/datastore/kha04m/foo.csv", a, delimiter=",")

(b) Write the job file test.slurm given below

#SBATCH --time=00:05:00
#SBATCH --nodes=1
#SBATCH --ntasks=3
#SBATCH --job-name=python_mpi
#SBATCH --mem=8000
module load python/2.7.10
module load openmpi/1.8.7
mpirun python ./

(c) Submit the job on SLURM by using the command

sbatch test.slurm