Using Python on Gautschi cluster¶
Introduction of Python¶
Notice
Python 2.7 has reached end-of-life on Jan 1, 2020 (announcement). Please update your codes and your job scripts to use Python 3.
Python is a high-level, general-purpose, interpreted, dynamic programming language. We suggest using Anaconda which is a Python distribution made for large-scale data processing, predictive analytics, and scientific computing. For example, to use the default Anaconda distribution:
For a full list of available Anaconda and Python modules enter:
Example Python Jobs¶
This section illustrates how to submit a small Python job to a SLURM queue.
Example 1: Hello world¶
Prepare a Python input file with an appropriate filename, here named hello.py:
Prepare a job submission file with an appropriate filename, here named myjob.sub:
Example 2: Matrix multiply¶
Save the following script as matrix.py:
Change the last line in the job submission file above to read:
The standard output file from this job will result in the following matrix:
Example 3: Sine wave plot using numpy and matplotlib packages¶
Save the following script as sine.py:
Change your job submission file to submit this script and the job will output a png file and blank standard output and error files.