6 | | As of August 18th, 2015 there are three (3) versions of Python available on Cypress |
7 | | * Python 2.6.6 is loaded by default for al users |
8 | | * Python 2.7.8 is available as part of the Anaconda module |
9 | | * Python 2.7.10 is available as a stand alone module |
10 | | |
11 | | We currently do not have Python 3 installed on Cypress as we have had no requests for Python 3. |
| 6 | As of August 25th, 2016 there are four versions of Python available on Cypress |
| 7 | * Python 2.6.6 is available by default |
| 8 | * Python 2.7.11 is available as part of the anaconda module |
| 9 | * Python 3.5.1 is available as part of the anaconda3 module |
| 10 | * Python 2.7.11 is available as a stand alone module |
57 | | {{{ |
58 | | [tulaneID@cypress01-035 pp-1.6.4]$ python |
59 | | Python 2.7.8 |Anaconda 2.1.0 (64-bit)| (default, Aug 21 2014, 18:22:21) |
60 | | [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2 |
61 | | Type "help", "copyright", "credits" or "license" for more information. |
62 | | Anaconda is brought to you by Continuum Analytics. |
63 | | Please check out: http://continuum.io/thanks and https://binstar.org |
64 | | >>> |
| 56 | {{{#!python |
| 57 | [tulaneID@cypress01-035 pp-1.6.4]$ ipython |
| 58 | Python 2.7.11 |Anaconda 2.5.0 (64-bit)| (default, Dec 6 2015, 18:08:32) |
| 59 | Type "copyright", "credits" or "license" for more information. |
| 60 | |
| 61 | IPython 4.1.2 -- An enhanced Interactive Python. |
| 62 | ? -> Introduction and overview of IPython's features. |
| 63 | %quickref -> Quick reference. |
| 64 | help -> Python's own help system. |
| 65 | object? -> Details about 'object', use 'object??' for extra details. |
| 66 | |
| 67 | In [1]: |
84 | | == Running a Parallel Python Job == |
85 | | |
86 | | The exact configuration of you parallel job script will depend on the flavor of parallelism that you choose for you Python script. |
87 | | |
88 | | As an example we will use the Parallel Python (pp) package that we installed above. Parallel Python used the shared memory model of parallelism (analogous to to OpenMP). Let's run the [http://www.parallelpython.com/content/view/17/31/ sum of primes] example from the Parallel Python website. |
89 | | |
90 | | We need to communicate the number of cores we wish to use to our script. The syntax here is |
91 | | |
92 | | {{{ |
93 | | python sum_primes.py [ncpus] |
94 | | }}} |
95 | | |
96 | | We can communicate the SLURM parameters to the script using the appropriate SLURM environment variable. |
97 | | |
98 | | {{{#!bash |
99 | | #!/bin/bash |
100 | | #SBATCH --qos=normal # Quality of Service |
101 | | #SBATCH --job-name=python # Job Name |
102 | | #SBATCH --time=00:01:00 # WallTime |
103 | | #SBATCH --nodes=1 # Number of Nodes |
104 | | #SBATCH --ntasks-per-node=1 # Number of tasks (MPI processes) |
105 | | #SBATCH --cpus-per-task=15 # Number of threads per task (OMP threads) |
106 | | |
107 | | module load anaconda |
108 | | python sum_primes.py $SLURM_CPUS_PER_TASK |
109 | | }}} |