Download presentation
Presentation is loading. Please wait.
Published byMaud Loren Powers Modified over 6 years ago
1
Parallel computation with R & Python on TACC HPC server
NSF REU site at UNCW, Parallel computation with R & Python on TACC HPC server Dr. Cuixian Chen, 10/12/2017 Declaimer: This PPT is modified based on Dr. Yishi Wang’s HPC tutorial on 9/21/2017. Modified from Dr. Patricia Kelley, 06/13/2017
2
Overview on HPC with R and Python
Online resources:
3
follow the instruction for system setups
NSF REU site at UNCW, For first time users: follow the instruction for system setups Modified from Dr. Patricia Kelley, 06/13/2017
4
Login to your TACC account, as a first-time user
5
Login to your TACC account, as a first-time user
6
Login to your TACC account, as a first-time user
7
Login to your TACC account, as a first-time user
Please follow the instruction to obtain the valid Token and get ready for the next step.
8
Logins and file transferring into Xsede
NSF REU site at UNCW, Logins and file transferring into Xsede Modified from Dr. Patricia Kelley, 06/13/2017
9
Log into TACC – From Windows
From Computer Lab desktops: search for putty From personal Windows laptops: Install and open Putty. Hostname: stampede2.tacc.utexas.edu Saved Sessions: give a name for the future use, such as Stampede2.
10
Log into TACC – From Windows
From Computer Lab desktops: search for putty From personal Windows laptops: Install and open Putty. Username: Use the one such as tg****** Eg: For Chen is tg842131 Then use the same password with your Xsede account. Input your valid Token for the login here.
11
Log into TACC – From Windows
If you can log in successfully, you will see the following message:
12
Log into TACC – From Mac Start Terminal in Mac;
Or you can use xshell from Windows;
13
Log into TACC – From Mac
14
To transfer files into Xsede systems
To transfer files, use Cyberduck for mac. For windows, you can consider: Xftp5 Winscp (chen’s option) Filezilla
15
Use Winscp To transfer files into Xsede
1) Hostname: Stampede2.tacc.utexas.edu 2) Username: Use the one such as tg****** Eg: For Chen is tg842131 3) Then use the same password with your Xsede account. 4) Input your valid Token for the login here.
16
Use Winscp To transfer files into Xsede
Once you log into the system: Now you are able to transfer files between your computer and the Xsede system.
17
Use Cyberduck for mac To transfer files into Xsede
dos2unix YTr.sh sbatch -A TG-TRA YTr.sh sbatch -A TG-DMS YTr.sh
18
Run R in HPC Job submission R tutorials:
NSF REU site at UNCW, Run R in HPC Job submission R tutorials: Modified from Dr. Patricia Kelley, 06/13/2017
19
Load R in both Windows or Mac
Type "module load Rstats", then "R” You then can do a lot of things with R Type “library(parallel)” Type ”detectCores()” module load Rstats R library(parallel) detectCores() Right click the mouse to paste the contents.
20
Log into TACC – From Windows
After typing in the following notes, you will see the following message: moduel load Rstats R library(parallel) detectCores()
21
Useful commands lscpu to see the info about cpu ls to list all files
Familiar with UNIX commands, vi? ’showq -u tg831870’, to see any job working? logout to logout
22
Use Cyberduck for Mac To transfer files into Xsede
dos2unix YTr.sh Job submission: sbatch -A TG-TRA YTr.sh sbatch -A TG-DMS YTr.sh
23
How to submit a job in Windows
NSF REU site at UNCW, How to submit a job in Windows echo $HOME echo $WOKR echo $DATA echo $SCRATCH To submit a job: sbatch ccx.sh
24
How to submit a job in Windows
NSF REU site at UNCW, How to submit a job in Windows After submitting a job: sbatch ccx.sh
25
How to submit a job in Windows
NSF REU site at UNCW, How to submit a job in Windows When a job is done, an will be received: Now go into your winscp to look at the result file “ccx txt” Message Passing Interface (MPI)
26
How to make parallel computing in R
NSF REU site at UNCW, How to make parallel computing in R Example code for parallel computing in R: library(parallel) workerFunc <- function(n) {message(paste('we are working on the ',n,'th loop')); x<-rnorm(N,5,1); return(mean(x)) } numWorkers <- detectCores(); set.seed(12345); st<-Sys.time() res<-mclapply(c(1:n), workerFunc, mc.cores = numWorkers); Sys.time()-st Message Passing Interface (MPI)
27
Python Tutorials: https://cvw.cac.cornell.edu/python/hpp
NSF REU site at UNCW, Run Python in HPC Python Tutorials: Modified from Dr. Patricia Kelley, 06/13/2017
28
How to run python in TACC
NSF REU site at UNCW, How to run python in TACC module load python module load python3* first, type $ module spider python3 to get instructions on other required modules
29
Multiprocess example from multiprocessing import Pool def f(x):
NSF REU site at UNCW, Multiprocess example from multiprocessing import Pool def f(x): return x*x p=Pool(4) ##starts 4 worker process print(p.map(f, range(10))) #prints[0, 1, 4, ..., 81] # idev -r ## This is only for reservation nodes Run in an interactive session: module load python python python_multiprocessing.py
30
Use a standard batch file: batch.sh
NSF REU site at UNCW, Use a standard batch file: batch.sh #!/bin/bash #SBATCH -p development #SBATCH -A your_account_name_goes_here #SBATCH -J mpi4py-demo #SBATCH -o mpi4py-demo.o%j #SBATCH -n 16 #SBATCH -t 00:05:00 # Prohibit writing core files on error. ulimit -c 0 set -x python receiver.py & ibrun python sample.py --loghost `hostname` --level debug pkill python
31
pip install --user line_profiler Time python filename.py
NSF REU site at UNCW, pip install --user line_profiler Time python filename.py
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.