wiki:cypress/Python

Version 19 (modified by fuji, 8 years ago) ( diff )

Running Python on Cypress

Python Modules

As of August 25th, 2016 there are four versions of Python available on Cypress

  • Python 2.6.6 is available by default
  • Python 2.7.11 is available as part of the anaconda module
  • Python 3.5.1 is available as part of the anaconda3 module
  • Python 2.7.11 is available as a stand alone module

Anaconda

As the name implies, Anaconda is a larger version of Python. In addition to Python 2.7.8, Anaconda includes over 300 of the most requested Python packages. This includes

  • NumPy
  • Pandas
  • SciPy
  • Matplotlib
  • IPython.

A complete list of packages available though Anaconda can be found here.

Install Packages to Anaconda Python

If you want to use some package but Anaconda on Cypress doesn't have it, you can install it on your home directory. See here.

Running Python Interactively

Start an interactive session using idev

[tulaneID@cypress1 pp-1.6.4]$ idev 
Requesting 1 node(s)  task(s) to normal queue of defq partition
1 task(s)/node, 20 cpu(s)/task, 2 MIC device(s)/node
Time: 0 (hr) 60 (min).
Submitted batch job 52311
Seems your requst is pending.
JOBID=52311 begin on cypress01-035
--> Creating interactive terminal session (login) on node cypress01-035.
--> You have 0 (hr) 60 (min).
[tulaneID@cypress01-035 pp-1.6.4]$ 

Load the desired Python module

[tulaneID@cypress01-035 pp-1.6.4]$ module load anaconda
[tulaneID@cypress01-035 pp-1.6.4]$ module list
Currently Loaded Modulefiles:
  1) git/2.4.1           3) idev                5) anaconda/2.1.0
  2) slurm/14.03.0       4) bbcp/amd64_rhel60

Run Python in the command line window

[tulaneID@cypress01-035 pp-1.6.4]$ ipython
Python 2.7.11 |Anaconda 2.5.0 (64-bit)| (default, Dec  6 2015, 18:08:32)
Type "copyright", "credits" or "license" for more information.

IPython 4.1.2 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]:

Running a Python script in Batch mode

You can also submit your Python job to the batch nodes (compute nodes) on Cypress. Inside your SLURM script, include a command to load the desired Python module. Then invoke python on your python script.

#!/bin/bash
#SBATCH --qos=normal            # Quality of Service
#SBATCH --job-name=python       # Job Name
#SBATCH --time=00:01:00         # WallTime
#SBATCH --nodes=1               # Number of Nodes
#SBATCH --ntasks-per-node=1     # Number of tasks (MPI processes)
#SBATCH --cpus-per-task=1       # Number of threads per task (OMP threads)

module load anaconda
python mypythonscript.py

Jupyter Notebook

The Jupyter Notebook is a web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text.

Here show an example.

Installing Packages

See here.

Note: See TracWiki for help on using the wiki.