Calcul intensif et Stockage de Masse. CÉCI/CISM HPC training sessions

Similar documents
Calcul intensif et Stockage de Masse. CÉCI/CISM HPC training sessions Use of Matlab on the clusters

Using the MATLAB Parallel Computing Toolbox on the UB CCR cluster

Introduction to Parallel Programming (Session 2: MPI + Matlab/Octave/R)

Parallel Computing with Matlab and R

STARTING THE DDT DEBUGGER ON MIO, AUN, & MC2. (Mouse over to the left to see thumbnails of all of the slides)

Introduction to MATLAB

Parallel Computing with MATLAB

Parallel and Distributed Computing with MATLAB The MathWorks, Inc. 1

Parallel and Distributed Computing with MATLAB Gerardo Hernández Manager, Application Engineer

Parallel MATLAB at VT

Matlab: Parallel Computing Toolbox

NOTE: From the engineering network, users may login directly to the desired computer server using the SSH connection.

Parallel programming in Matlab environment on CRESCO cluster, interactive and batch mode

COSC 6374 Parallel Computation. Debugging MPI applications. Edgar Gabriel. Spring 2008

Parallel Programming in MATLAB on BioHPC

Introduction Matlab Compiler Matlab & Condor Conclusion. From Compilation to Distribution. David J. Herzfeld

Introduction to MATLAB

Parallel Processing Tool-box

High Performance Computing Cluster Advanced course

MATLAB Parallel Computing

Speeding up MATLAB Applications Sean de Wolski Application Engineer

An introduction to checkpointing. for scientific applications

UoW HPC Quick Start. Information Technology Services University of Wollongong. ( Last updated on October 10, 2011)

Parallel Computing with MATLAB

Duke Compute Cluster Workshop. 3/28/2018 Tom Milledge rc.duke.edu

Mit MATLAB auf der Überholspur Methoden zur Beschleunigung von MATLAB Anwendungen

HPC on Windows. Visual Studio 2010 and ISV Software

Performance Analysis of Matlab Code and PCT

An introduction to checkpointing. for scientifc applications

Matlab MPI. Shuxia Zhang Supercomputing Institute Tel: (direct) (help)

Introduction to MPI. EAS 520 High Performance Scientific Computing. University of Massachusetts Dartmouth. Spring 2014

Choosing Resources Wisely Plamen Krastev Office: 38 Oxford, Room 117 FAS Research Computing

CHEOPS Cologne High Efficient Operating Platform for Science Application Software

Introduction to HPC Using zcluster at GACRC

Cluster Clonetroop: HowTo 2014

Using a Linux System 6

High Performance Computing (HPC) Using zcluster at GACRC

CSinParallel Workshop. OnRamp: An Interactive Learning Portal for Parallel Computing Environments

High Performance Computing for BU Economists

MIC Lab Parallel Computing on Stampede

Lab of COMP 406. MATLAB: Quick Start. Lab tutor : Gene Yu Zhao Mailbox: or Lab 1: 11th Sep, 2013

Introduction to HPC Using zcluster at GACRC

MATLAB on BioHPC. portal.biohpc.swmed.edu Updated for

Introduction to Parallel Programming

Speeding up MATLAB Applications The MathWorks, Inc.

JHU Economics August 24, Galaxy How To SSH and RDP

Technical Computing with MATLAB

HPC Middle East. KFUPM HPC Workshop April Mohamed Mekias HPC Solutions Consultant. Agenda

Data Analysis with MATLAB. Steve Lantz Senior Research Associate Cornell CAC

High Performance Computing Cluster Basic course

Duke Compute Cluster Workshop. 10/04/2018 Tom Milledge rc.duke.edu

AMS 200: Working on Linux/Unix Machines

Name Department/Research Area Have you used the Linux command line?

The Accelerator Toolbox (AT) is a heavily matured collection of tools and scripts

Working with Shell Scripting. Daniel Balagué

SUBMITTING JOBS TO ARTEMIS FROM MATLAB

DEBUGGING ON FERMI PREPARING A DEBUGGABLE APPLICATION GDB. GDB on front-end nodes

SGE Circus Standard Installation Manual. Admin rights and internet connection must be available.

Daniel D. Warner. May 31, Introduction to Parallel Matlab. Daniel D. Warner. Introduction. Matlab s 5-fold way. Basic Matlab Example

Introduction to Joker Cyber Infrastructure Architecture Team CIA.NMSU.EDU

Introduction to GALILEO

Installing and running COMSOL 4.3a on a Linux cluster COMSOL. All rights reserved.

Multicore Computer, GPU 및 Cluster 환경에서의 MATLAB Parallel Computing 기능

Big Orange Bramble. August 09, 2016

Parallel Programming in MATLAB on BioHPC

Using Computing Resources

Sherlock for IBIIS. William Law Stanford Research Computing

Running applications on the Cray XC30

MATLAB Project: Getting Started with MATLAB

Introduction to Parallel Programming and pmatlab v2.0

Linux Tutorial. Ken-ichi Nomura. 3 rd Magics Materials Software Workshop. Gaithersburg Marriott Washingtonian Center November 11-13, 2018

Example of a Parallel Algorithm

Introduction to MATLAB

HPCC - Hrothgar. Getting Started User Guide TotalView. High Performance Computing Center Texas Tech University

High Performance Computing for BU Economists

Parallele Numerik. Blatt 1

EE/CSCI 451 Introduction to Parallel and Distributed Computation. Discussion #4 2/3/2017 University of Southern California

User Guide of High Performance Computing Cluster in School of Physics

"Charting the Course to Your Success!" MOC A Developing High-performance Applications using Microsoft Windows HPC Server 2008

MATLAB The first steps. Edited by Péter Vass

Introduction to CARC. To provide high performance computing to academic researchers.

Optimizing and Accelerating Your MATLAB Code

Scaling up MATLAB Analytics Marta Wilczkowiak, PhD Senior Applications Engineer MathWorks

TUC Labs.

UL HPC Monitoring in practice: why, what, how, where to look

Quick Start Guide. Table of Contents

Concepts from High-Performance Computing

Introduction to High Performance Computing Using Sapelo2 at GACRC

MATLAB Compiler Release Notes

pmatlab: Parallel Matlab Toolbox

Microsoft Windows HPC Server 2008 R2 for the Cluster Developer

Guillimin HPC Users Meeting July 14, 2016

TotalView. Debugging Tool Presentation. Josip Jakić

Introduction to High-Performance Computing (HPC)

The Eclipse Parallel Tools Platform

TDDD56 Multicore and GPU computing Lab 2: Non-blocking data structures

Allinea DDT Debugger. Dan Mazur, McGill HPC March 5,

Introduction to HPC Using zcluster at GACRC

How to run a job on a Cluster?

Getting Started with Serial and Parallel MATLAB on bwgrid

Transcription:

Calcul intensif et Stockage de Masse CÉCI/ HPC training sessions

Calcul intensif et Stockage de Masse Parallel Matlab on the cluster /CÉCI Training session www.uclouvain.be/cism www.ceci-hpc.be November 2015 damien.francois@uclouvain.be

Calcul intensif et Stockage de Masse Parallel Matlab on the cluster Assumptions: You know Matlab, have access to Matlab and have Matlab code. November 2015 damien.francois@uclouvain.be

Typical usage... Interactive Batch Type in and get an answer Submit job and fetch results Sequential Parallel Perform tasks one after the other Perform multiple tasks at the same time

One more obstacle: Matlab Licensing

Calcul intensif et Stockage de Masse Parallel Matlab on the cluster Using Matlab in batch mode With Matlab (e.g. your computer or lm9) Without Matlab (e.g. the clusters) Using Matlab in parallel With no effort With little effort With a lot of effort November 2015 damien.francois@uclouvain.be

Using Matlab in Batch mode You might be used to...

Using Matlab in Batch mode... but no GUI in batch mode!

Using Matlab in Batch mode Two methods for launching a script: You have a script myscript.m: You have a function "function a = myfun(x,y)..."

Using Matlab in Batch mode You need to adapt your Matlab script No more clicks! Paths Data Prompts Figures GUI Make sure to automate any setup that you usually do by hand: adding paths, loading data, saving results, etc.

Using Matlab in Batch mode You need to adapt your Matlab script Put all 'configuration' values in a file and load it Paths Data Prompts Figures GUI

Using Matlab in Batch mode You need to adapt your Matlab script Paths Data Prompts Figures GUI Use 'print' to put your graphics to a file. Or avoid plotting at all and do that interactively at postprocess time

Using Matlab in Batch mode You need to adapt your Matlab script Paths Data Prompts Figures GUI Simplest solution: avoid GUI's and use command line version

Using Matlab in Batch mode And then launch it! Options Launch -nodisplay: do not try to display plots -nodesktop: do not launch full GUI -nojvm: do not launch Java support (do not use in recent versions of Matlab) -nosplash: do not display splashscreen

Using Matlab in Batch mode Use 'screen' for unattended execution As soon as you press ENTER, the screen is cleared and you are in a 'screen' session

Using Matlab in Batch mode Use 'screen' for unattended execution We are now in a 'screen' session

Using Matlab in Batch mode Use 'screen' for unattended execution We launch Matlab and we 'detach' with CTRL-a d

Using Matlab in Batch mode Use 'screen' for unattended execution We are now detached and disconnected.

Using Matlab in Batch mode Use 'screen' for unattended execution We connect back to lm9 and 'reattach' to the 'screen' session

Using Matlab in Batch mode Use 'screen' for unattended execution And we find our result

Your turn.. 1. Connect to lm9 ssh -X lm9.cism.ucl.ac.be Login: tutoxx where XX is a number between 01 and 19 Password 2. Copy directory ~dfr/matlab/batch to your directory and cd there 3. Load module matlab/r2010a 3. Launch Matlab 4. Run 'go' to see what it does (you will have to set the paths correctly: File > Set Paths mytools) 5. Edit go.m so as to be able to run it in batch 6. Quit Matlab 7. Test your Matlab script in 'batch mode' 8. Make a longer test with screen

Your turn.. Step 2 : create the SGE script Tell SGE you need Matlab use -nosplash -nodesktop -nodisplay -nojvm use redirection < or option -r Step 3 & 4 : submit & wait Step 5 : get the results

Your turn..

Calcul intensif et Stockage de Masse Parallel matlab on the cluster Using Matlab in batch mode With Matlab (e.g. your computer or lm9) Without Matlab (e.g. the clusters) Using Matlab in parallel With no effort With little effort With a lot of effort November 2015 damien.francois@uclouvain.be

Dealing with the license Number of licenses is limited!

Dealing with the license Option 1 : Compile Matlab to C... Why How Issues

Dealing with the license Option 1 : Compile Matlab to C... Within Matlab: Why myfunction must be a function, not a script How Issues Use -a to add resources (additional code or mat files) Addpath are forbidden in compiled code. Protect them with if ~isdeployed addpath(...) end

Dealing with the license Option 1 : Compile Matlab to C...

Dealing with the license Option 1 : Compile Matlab to C...

Dealing with the license Option 1 : Compile Matlab to C...

Dealing with the license Option 1 : Compile Matlab to C... Why How Issues

Dealing with the license Option 1 :... and deploy with MCR Why How Issues

Dealing with the license Option 1 :... and deploy with MCR

Dealing with the license Option 1 :... and deploy with MCR

Dealing with the license Option 1 :... and deploy with MCR

Dealing with the license Option 1 :... and deploy with MCR

Dealing with the license Option 1 :... and deploy with MCR

Dealing with the license Option 1 :... and deploy with MCR

Dealing with the license Option 1 :... and deploy with MCR

Your turn.. 1. Connect to lm9 ssh -X lm9.cism.ucl.ac.be Login: tutoxx where XX is a number between 01 and 19 Password: 2. Copy directory ~dfr/matlab/compile to your directory and cd there 3. Load module matlab/r2010a and launch Matlab 4. Compile go_f.m (note if ~isdeployed ) mcc -a mytools/ -m go_f.m 5. Connect to Manneback (same login, same password) 6. Go to your 'compile' directory (no need to copy it, shared fs) 7. Load MCR module version 713 (no need to copy/install MCR) 9. Run go_f (no need for run_go_f.sh)

Dealing with the license Option 1 :... and deploy with MCR Matlab is not installed on Manneback but the MCR is

Dealing with the license Option 2 : Develop with Matlab, run with Octave Why How Issues a language that is mostly compatible with Matlab GPL license, free

Dealing with the license Option 2 : Develop with Matlab, run with Octave Why You have a script myscript.m. Rather than: How Issues Simply write The other option '-r' becomes '--eval '

Dealing with the license Option 2 : Develop with Matlab, run with Octave Why How Issues

Dealing with the license Option 2 : Develop with Matlab, run with Octave Why How Issues Plots Toolboxes Java Multithreading Speed Not as good as Matlab's

Your turn.. 1. Connect to lm9 ssh -X lm9.cism.ucl.ac.be Login: tutoxx where XX is a number between 01 and 19 Password: 2. Copy your 'batch' directory into 'octave' : cp -r batch octave 3. Go to your octave directory 4. Load the octave module 5. Launch octave 6. Run go_f 7. exit octave 8 Launch octave eval go_f

Calcul intensif et Stockage de Masse Parallel matlab on the cluster Using Matlab in batch mode Launch a script, get results Deal with licenses Using Matlab in parallel With no effort With little effort With a lot of effort November 2015 damien.francois@uclouvain.be

No effort: Multithreading

No effort: Multithreading maxnumcompthreads exists since R2007b, defaults to one core defaults to available number of cores from R2008a marked deprecated since R2009b warning off MATLAB:maxNumCompThreads:Deprecated to suppress warning

No effort: Multithreading Ask for several cores in the submission script Alone on the node With 2 Matlab running concurrently

No effort: Multithreading Element wise operations and linear algebra

No effort: Multithreading More with the Parallel Computing Toolbox

Calcul intensif et Stockage de Masse Matlab on the cluster Using Matlab in batch mode Launch a script, get results Deal with licenses Using Matlab in parallel With no effort With little effort With a lot of effort November 2015 damien.francois@uclouvain.be

Little effort: embarrassingly parallel Embarrassingly parallel programs (fork-join without communication / synchronization) e.g. Parameter sweep, Monte carlo, Multiple data sets Outer-loop splitting: Inner-loop splitting : e.g. Loop over parameter e.g. Loop over a vector index Program-level parallelism Data-level parallelism

Little effort: embarrassingly parallel Outer-loop splitting with Slurm's srun

Little effort: embarrassingly parallel Outer-loop splitting with Slurm's srun

Little effort: embarrassingly parallel Outer-loop splitting with Slurm's srun

Little effort: embarrassingly parallel Outer-loop splitting with Slurm's srun Requires one license per task! But we know what to do, don't we?

Little effort: embarrassingly parallel Outer-loop splitting with Slurm's srun Try it yourself! : ~dfr/matlab/embarrassingly*

Little effort: embarrassingly parallel

Little effort: embarrassingly parallel Parallel Computing Toolbox Parfor, spmd and distributed arrays

Little effort: embarrassingly parallel Parallel Computing Toolbox Parfor, spmd and distributed arrays

Little effort: embarrassingly parallel Parallel Computing Toolbox Parfor, spmd and distributed arrays Can be compiled!

Little effort: embarrassingly parallel Parallel Computing Toolbox Parfor, spmd and distributed arrays

Little effort: embarrassingly parallel Parallel Computing Toolbox Parfor, spmd and distributed arrays Compilation can fail :(

Little effort: embarrassingly parallel rd Matlab 3 party peval : jpar In bu ter co t n es m ot tin g pi la bl e On the solvers: On the server: >> jpar_solver(['hostname']); >> a = rand(100,100,10) + i*rand(100,100,10); >> [V,D] = jpar_client('eig', a)

Little effort: embarrassingly parallel rd Matlab 3 party peval : Multicore C us om sy es pil m ste fil ab u l m e le tin od e On the slaves: >> startmulticoreslave On the master: >> for i=1:10; a{i} = rand(100,100) ;end >> cellres = multicoremaster(@eig, a)

Little effort: embarrassingly parallel

Little effort: embarrassingly parallel rd Matlab 3 party peval : Multicore Compile (e.g. lm9): matlab -r "mcc -a mytools/ -a multicore/ -m go_adapted_function_compile_peval;" matlab -r "cd multicore/;mcc -a../mytools/ -a../ -m startmulticoreslave;exit" Submit (e.g. Manneback):

Little effort: embarrassingly parallel rd Matlab 3 party peval : Multicore Try it yourself! : ~dfr/matlab/multicore_compiled

Little effort: embarrassingly parallel M ul tic or e Octave peval: parcellfun, pararrayfun A = {rand(100,100), rand(100,100), rand(100,100)} Res = parcellfun(2, @eig, A)

Little effort: embarrassingly parallel Octave peval: parcellfun, pararrayfun srun --ntasks=1 --cpus-per-task=4 octave < go_f_parcellfun.m Try it! ~dfr/matlab/parcellfun_octave

Little effort: embarrassingly parallel Octave peval: parcellfun, pararrayfun A = rand(100,100,3) Res = pararrayfun(2, @eig, A)

Little effort: embarrassingly parallel m ul tin od e Octave peval: multicore On the slaves: >> startmulticoreslaves On the master: >> for i=1:10; a{i} = rand(100,100) ;end >> cellres = multicoremaster(@eig, a)

Little effort: embarrassingly parallel Octave peval: multicore

Little effort: embarrassingly parallel Octave peval: multicore Try it! ~dfr/matlab/multicore_octave

Little effort: embarrassingly parallel Octave peval: multicore

Calcul intensif et Stockage de Masse Matlab on the cluster Using Matlab in batch mode Launch a script, get results Deal with licenses Using Matlab in parallel With no effort With little effort With a lot of effort November 2015 damien.francois@uclouvain.be

A lot of effort: explicitly parallel Explicitly parallel programs Communications handled explicitly by the user Matlab not specifically good at it.. SPMD & MPMD

A lot of effort: explicitly parallel Parallel Computing Toolbox OpenMP-like construct based on MPI for distributed memory Parfor, spmd and distributed arrays

A lot of effort: explicitly parallel Lincoln Laboratory MatlabMPI

A lot of effort: explicitly parallel Lincoln Laboratory pmatlab

A lot of effort: explicitly parallel OpenMP Mex files http://www.walkingrandomly.com/?p=1795

A lot of effort: explicitly parallel Octave: reval (parallel package) 3rd party toolboxes Compile Octave

A lot of effort: explicitly parallel Octave and MPI

Batch Matlab/Octave Scripts need adjustment Batch processing with Matlab Use 'screen' Batch processing without Matlab Compile with mcc Dev. with Matlab, Prod. with Octave

Parallel Matlab/Octave C om O in ct g av to e No effort: Matlab Multithreading Some effort: embarrassingly parallel Matlab: Jpar, multicore Octave: parcelleval, multicore More (too much?) effort Matlab: SPMD, MPI toolboxes Octave: parallel, openmpi_ext

---------------------------------------------MATLAB MATLAB MATLAB Release Component Compiler Runtime (MCR) Version ---------------------------------------------R14 (7.0) 7.0 4.0 R14SP1 (7.0.1) 7.1 4.1 R14SP2 (7.0.4) 7.2 4.2 R14SP3 (7.1) 7.3 4.3 R2006a (7.2) 7.4 4.4 R2006b (7.3) 7.5 4.5 R2007a (7.4) 7.6 4.6 R2007b (7.5) 7.7 4.7 R2008a (7.6) 7.8 4.8 R2008b (7.7) 7.9 4.9 R2009a (7.8) 7.10 4.10 R2009b (7.9) 7.11 4.11 R2009bSP1 (7.9.1) 7.12 4.12 R2010a (7.10) 7.13 4.13 R2010b(7.11) 7.14 4.14 R2010bSP1 (7.11.1) 7.14.1 4.14.1 R2011a(7.12) 7.15 4.15 R2011b(7.13) 7.16 4.16 R2012a(7.14) 7.17 4.17 R2012b(8.0) 8.0 4.18 ----------------------------------------------