Difference between revisions of "Python/Example"

From ScientificComputing
Jump to: navigation, search
(Created page with "As an example for running a Python script on the cluster, we use the built-in tests of the scientific Python packages numpy and scipy. [leonhard@euler02 ~]$ module load pyth...")
 
Line 1: Line 1:
 
As an example for running a Python script on the cluster, we use the built-in tests of the scientific Python packages numpy and scipy.
 
As an example for running a Python script on the cluster, we use the built-in tests of the scientific Python packages numpy and scipy.
  
  [leonhard@euler02 ~]$ module load python/3.3.3
+
  [leonhard@euler02 ~]$ '''module load python/3.3.3'''
 
  Autoloading openblas/0.2.13_seq
 
  Autoloading openblas/0.2.13_seq
  [leonhard@euler02 ~]$ cat test_python.py  
+
  [leonhard@euler02 ~]$ '''cat test_python.py'''
 
  import numpy
 
  import numpy
 
  import scipy
 
  import scipy
 
  numpy.test()
 
  numpy.test()
 
  scipy.test()
 
  scipy.test()
  [leonhard@euler02 ~]$ bsub -n 1 -W 4:00 -R "rusage[mem=1024]" python ./test_python.py
+
  [leonhard@euler02 ~]$ '''bsub -n 1 -W 4:00 -R "rusage[mem=1024]" python ./test_python.py'''
 
  Generic job.
 
  Generic job.
 
  Job <25518323> is submitted to queue <normal.4h>.
 
  Job <25518323> is submitted to queue <normal.4h>.
  [leonhard@euler02 ~]$ bjobs
+
  [leonhard@euler02 ~]$ '''bjobs'''
 
  JOBID      USER    STAT  QUEUE      FROM_HOST  EXEC_HOST  JOB_NAME  SUBMIT_TIME
 
  JOBID      USER    STAT  QUEUE      FROM_HOST  EXEC_HOST  JOB_NAME  SUBMIT_TIME
 
  25518323  leonhard    PEND  normal.4h  euler02                *python.py Aug 23 15:05
 
  25518323  leonhard    PEND  normal.4h  euler02                *python.py Aug 23 15:05
  [leonhard@euler02 ~]$ bjobs
+
  [leonhard@euler02 ~]$ '''bjobs'''
 
  JOBID      USER    STAT  QUEUE      FROM_HOST  EXEC_HOST  JOB_NAME  SUBMIT_TIME
 
  JOBID      USER    STAT  QUEUE      FROM_HOST  EXEC_HOST  JOB_NAME  SUBMIT_TIME
 
  25518323  leonhard    RUN  normal.4h  euler02    e1408      *python.py Aug 23 15:05
 
  25518323  leonhard    RUN  normal.4h  euler02    e1408      *python.py Aug 23 15:05
  [leonhard@euler02 ~]$ bjobs
+
  [leonhard@euler02 ~]$ '''bjobs'''
 
  No unfinished job found
 
  No unfinished job found
  [leonhard@euler02 ~]$ grep Ran lsf.o25518323  
+
  [leonhard@euler02 ~]$ '''grep Ran lsf.o25518323'''
 
  Ran 6139 tests in 114.985s
 
  Ran 6139 tests in 114.985s
 
  Ran 20195 tests in 366.931s
 
  Ran 20195 tests in 366.931s

Revision as of 13:45, 23 August 2016

As an example for running a Python script on the cluster, we use the built-in tests of the scientific Python packages numpy and scipy.

[leonhard@euler02 ~]$ module load python/3.3.3
Autoloading openblas/0.2.13_seq
[leonhard@euler02 ~]$ cat test_python.py 
import numpy
import scipy
numpy.test()
scipy.test()
[leonhard@euler02 ~]$ bsub -n 1 -W 4:00 -R "rusage[mem=1024]" python ./test_python.py
Generic job.
Job <25518323> is submitted to queue <normal.4h>.
[leonhard@euler02 ~]$ bjobs
JOBID      USER    STAT  QUEUE      FROM_HOST   EXEC_HOST   JOB_NAME   SUBMIT_TIME
25518323   leonhard    PEND  normal.4h  euler02                 *python.py Aug 23 15:05
[leonhard@euler02 ~]$ bjobs
JOBID      USER    STAT  QUEUE      FROM_HOST   EXEC_HOST   JOB_NAME   SUBMIT_TIME
25518323   leonhard    RUN   normal.4h  euler02     e1408       *python.py Aug 23 15:05
[leonhard@euler02 ~]$ bjobs
No unfinished job found
[leonhard@euler02 ~]$ grep Ran lsf.o25518323 
Ran 6139 tests in 114.985s
Ran 20195 tests in 366.931s