Uni.lu HPC School 2019 - PS07: Scientific Computing Using MATLAB

1y ago
9 Views
2 Downloads
712.82 KB
42 Pages
Last View : 11d ago
Last Download : 3m ago
Upload by : Kaydence Vann
Transcription

Uni.lu HPC School 2019PS07: Scientific computing usingMATLABUni.lu High Performance Computing (HPC) TeamV. PlugaruUniversity of Luxembourg (UL), Luxembourghttp://hpc.uni.luV. Plugaru & Uni.lu HPC Team (University of Luxembourg)NUni.lu HPC School 2019/ PS071 / 24

Latest versions available on Github:UL HPC tutorials:UL HPC c.uni.lu/hpc-school/PS07 tutorial /latest/maths/matlab/basics/V. Plugaru & Uni.lu HPC Team (University of Luxembourg)NUni.lu HPC School 2019/ PS072 / 24

Practical Session ObjectivesSummary1 Practical Session Objectives2 MATLAB on UL HPCPrerequisitesUsing MATLAB3 ConclusionV. Plugaru & Uni.lu HPC Team (University of Luxembourg)NUni.lu HPC School 2019/ PS073 / 24

Practical Session ObjectivesSession ObjectivesBetter understand the usage of MATLAB on the Uni.lu HPC Platformrunning in interactive mode, with either the full graphical or the text-mode interface, graphical web portal based on OnDemand coming soonV. Plugaru & Uni.lu HPC Team (University of Luxembourg)NUni.lu HPC School 2019/ PS074 / 24

Practical Session ObjectivesSession ObjectivesBetter understand the usage of MATLAB on the Uni.lu HPC Platformrunning in interactive mode, with either the full graphical or the text-mode interface, graphical web portal based on OnDemand coming soonrunning in passive mode, several ways of submitting MATLAB jobs, example launchers for SLURMV. Plugaru & Uni.lu HPC Team (University of Luxembourg)NUni.lu HPC School 2019/ PS074 / 24

Practical Session ObjectivesSession ObjectivesBetter understand the usage of MATLAB on the Uni.lu HPC Platformrunning in interactive mode, with either the full graphical or the text-mode interface, graphical web portal based on OnDemand coming soonrunning in passive mode, several ways of submitting MATLAB jobs, example launchers for SLURMchecking available toolboxes & licenses statusV. Plugaru & Uni.lu HPC Team (University of Luxembourg)NUni.lu HPC School 2019/ PS074 / 24

Practical Session ObjectivesSession ObjectivesBetter understand the usage of MATLAB on the Uni.lu HPC Platformrunning in interactive mode, with either the full graphical or the text-mode interface, graphical web portal based on OnDemand coming soonrunning in passive mode, several ways of submitting MATLAB jobs, example launchers for SLURMchecking available toolboxes & licenses statususing script (.m) filesV. Plugaru & Uni.lu HPC Team (University of Luxembourg)NUni.lu HPC School 2019/ PS074 / 24

Practical Session ObjectivesSession ObjectivesBetter understand the usage of MATLAB on the Uni.lu HPC Platformrunning in interactive mode, with either the full graphical or the text-mode interface, graphical web portal based on OnDemand coming soonrunning in passive mode, several ways of submitting MATLAB jobs, example launchers for SLURMchecking available toolboxes & licenses statususing script (.m) filesplotting data, saving the plots to fileV. Plugaru & Uni.lu HPC Team (University of Luxembourg)NUni.lu HPC School 2019/ PS074 / 24

MATLAB on UL HPCSummary1 Practical Session Objectives2 MATLAB on UL HPCPrerequisitesUsing MATLAB3 ConclusionV. Plugaru & Uni.lu HPC Team (University of Luxembourg)NUni.lu HPC School 2019/ PS075 / 24

MATLAB on UL HPCTutorial filesSample MATLAB scripts used in the tutorialdownload only the scriptsmkdir HOME/matlab-tutorialcd HOME/matlab-tutorialwget /\matlab/basics/code/example1.mexample2.mgoogle finance data.mfile data source.mAAPL.csvor download the full repository and link to the MATLAB tutorialgit clone https://github.com/ULHPC/tutorials.gitln -s tutorials/maths/matlab/basics HOME/matlab-tutorialV. Plugaru & Uni.lu HPC Team (University of Luxembourg)NUni.lu HPC School 2019/ PS076 / 24

MATLAB on UL HPCX Window SystemIn order to see locally the MATLAB graphical interface,a package providing the X Window System is required:on OS X: XQuartzon Windows:http://xquartz.macosforge.org/landing/, in combination with Putty: VcXsrv http://sourceforge.net/projects/vcxsrv/, with MobaXTerm: nothing additional neededNow you will be able to connect with X11 forwarding enabled:on Linux & macOS: ssh iris-cluster -Xon Windows, with Putty: Connection SSH X11 Enable X11 forwarding, with MobaXTerm: remote GUI applications should work by defaultV. Plugaru & Uni.lu HPC Team (University of Luxembourg)NUni.lu HPC School 2019/ PS077 / 24

MATLAB on UL HPCScripts and plotsexample1.m: non-interactive script that showsthe use of a stopwatch timerhow to use an external function (financial data retrieval)how to use different plotting methodshow to export the plots in different graphic formats120Closing stock prices for AAPL between 4-Jan-16 and 30-Dec-16Closing stock prices and trading volumes for AAPL between 4-Jan-16 and 30-Dec-1611510 71411010Trading volumePrice DateV. Plugaru & Uni.lu HPC Team (Universityof Luxembourg)N16/03/11Price (USD)9015/12/02DateUni.lu HPC School 2019/ PS078 / 24

MATLAB on UL HPCParallelizationexample2.m: non-interactive script that showsthe serial execution of time consuming operationsV. Plugaru & Uni.lu HPC Team (University of Luxembourg)NUni.lu HPC School 2019/ PS079 / 24

MATLAB on UL HPCParallelizationexample2.m: non-interactive script that showsthe serial execution of time consuming operationsand revisited in the second part of the tutorial:, the parallel execution and relative speedup vs serial execution, setting the # of parallel threads through environment variables, GPU-based parallel executionparfor based parallel speedup vs serial execution6speedupspeedup with overhead5Parallel speedup4321012345V. Plugaru & Uni.lu HPC Team (University of Luxembourg)N678Number of cores9101112Uni.lu HPC School 2019/ PS079 / 24

MATLAB on UL HPCBeyond simple executionsapplication-level checkpointing, using in-built MATLAB functionsV. Plugaru & Uni.lu HPC Team (University of Luxembourg)NUni.lu HPC School 2019/ PS0710 / 24

MATLAB on UL HPCBeyond simple executionsapplication-level checkpointing, using in-built MATLAB functionstaking advantage of some parallelization capabilities, use of parfor, use of GPU-enabled functionsV. Plugaru & Uni.lu HPC Team (University of Luxembourg)NUni.lu HPC School 2019/ PS0710 / 24

MATLAB on UL HPCBeyond simple executionsapplication-level checkpointing, using in-built MATLAB functionstaking advantage of some parallelization capabilities, use of parfor, use of GPU-enabled functionsadapting parallel code with checkpoint/restart featuresV. Plugaru & Uni.lu HPC Team (University of Luxembourg)NUni.lu HPC School 2019/ PS0710 / 24

MATLAB on UL HPCCheckpointingWhat is it?Technique for adding fault tolerance to your application.You adapt your code to (regularly) save a snapshot of theenvironment (workspace). . . and restart execution from the snapshot in case of failure.V. Plugaru & Uni.lu HPC Team (University of Luxembourg)NUni.lu HPC School 2019/ PS0711 / 24

MATLAB on UL HPCCheckpointingWhat is it?Technique for adding fault tolerance to your application.You adapt your code to (regularly) save a snapshot of theenvironment (workspace). . . and restart execution from the snapshot in case of failure.Why make the effort to checkpoint?because your code may take longer to execute than themaximum walltime allowedbecause losing (precious) hours or days of computation whensomething fails may (should!) not be acceptableV. Plugaru & Uni.lu HPC Team (University of Luxembourg)NUni.lu HPC School 2019/ PS0711 / 24

MATLAB on UL HPCCheckpointing pitfallscheckpointing (too) often can be counterproductive, saving state in each loop may take longer than its actualcomputing time, saving state incrementally can lead to fast exhaustion of your HOME space, in extreme cases can lead to platform instability – especially ifrunning parallel jobs!V. Plugaru & Uni.lu HPC Team (University of Luxembourg)NUni.lu HPC School 2019/ PS0712 / 24

MATLAB on UL HPCCheckpointing pitfallscheckpointing (too) often can be counterproductive, saving state in each loop may take longer than its actualcomputing time, saving state incrementally can lead to fast exhaustion of your HOME space, in extreme cases can lead to platform instability – especially ifrunning parallel jobs!checkpointing (especially parallel) code can be trickyextra-care required if checkpointing simulations involving PRNG(e.g. Monte Carlo-based experiments)ensure results consistency after you add checkpointingV. Plugaru & Uni.lu HPC Team (University of Luxembourg)NUni.lu HPC School 2019/ PS0712 / 24

MATLAB on UL HPCCheckpointing basics1 Check that a checkpoint file exists:2 If it exists, restore workspace data from it:V. Plugaru & Uni.lu HPC Team (University of �save.mat’)Uni.lu HPC School 2019/ PS07N13 / 24

MATLAB on UL HPCCheckpointing basics1 Check that a checkpoint file exists:2 If it exists, restore workspace data from t’)3 During computing steps, use control variables to direct (re)start ofcomputationV. Plugaru & Uni.lu HPC Team (University of Luxembourg)Uni.lu HPC School 2019/ PS07N13 / 24

MATLAB on UL HPCCheckpointing basics1 Check that a checkpoint file exists:2 If it exists, restore workspace data from t’)3 During computing steps, use control variables to direct (re)start ofcomputation4 Every n loops, or if execution time (in loop or since startup) isabove threshold, checkpoint:, save full workspace state:, save partial state:V. Plugaru & Uni.lu HPC Team (University of , ’var1’, ’var2’)Uni.lu HPC School 2019/ PS07N13 / 24

MATLAB on UL HPCCheckpointing basics1 Check that a checkpoint file exists:2 If it exists, restore workspace data from t’)3 During computing steps, use control variables to direct (re)start ofcomputation4 Every n loops, or if execution time (in loop or since startup) isabove threshold, checkpoint:, save full workspace state:, save partial state:5 Rename state file to final name:save(’save.tmp’)save(’save.tmp’, ’var1’, ’var2’)system(’mv save.tmp save.mat’), this process ensures that in case of failure during checkpointing,next execution doesn’t try to restart from incomplete stateV. Plugaru & Uni.lu HPC Team (University of Luxembourg)Uni.lu HPC School 2019/ PS07N13 / 24

MATLAB on UL HPCWhen to trigger checkpointing?when (loop) execution time is above threshold (e.g. 1h):, use tic and toc stopwatch functions, remember they can beassigned to variables, use the clock function, add some randomness to the threshold if you run several instancesin parallel!V. Plugaru & Uni.lu HPC Team (University of Luxembourg)Uni.lu HPC School 2019/ PS07N14 / 24

MATLAB on UL HPCWhen to trigger checkpointing?when (loop) execution time is above threshold (e.g. 1h):, use tic and toc stopwatch functions, remember they can beassigned to variables, use the clock function, add some randomness to the threshold if you run several instancesin parallel!every n loop executions, remember that saving state takes time, depending on workspacesize & shared filesystem usage, and, if loops finish fast your code may be slowed down considerably, add some randomness to n if you run several instances in parallel!V. Plugaru & Uni.lu HPC Team (University of Luxembourg)Uni.lu HPC School 2019/ PS07N14 / 24

MATLAB on UL HPCAdding checkpointing to seq. codeexample1.m: non-interactive script that showsthe use of a stopwatch timerhow to use an external function (financial data retrieval)how to use different plotting methodshow to export the plots in different graphic formatsTasks to tackle with checkpointingmodify the script to download data for Fortune100 companiesadd & test checkpointing to save state after each company’sdata is downloadedmore granular downloads - modify download period from 1 yearto 1 month, add & test checkpointing to save state after eachdownloadV. Plugaru & Uni.lu HPC Team (University of Luxembourg)Uni.lu HPC School 2019/ PS07N15 / 24

MATLAB on UL HPCRef. documentation - parallelizationParallel Computing .htmlParallel for-Loops ing-started-with-parfor.htmlGPU gpu.htmlMulti-GPU computing pus.htmlV. Plugaru & Uni.lu HPC Team (University of Luxembourg)Uni.lu HPC School 2019/ PS07N16 / 24

MATLAB on UL HPCAccelerating the time to resultOption 1: Split input over several parallel, independent jobs, great if it’s possible (embarrassingly parallel problem)V. Plugaru & Uni.lu HPC Team (University of Luxembourg)Uni.lu HPC School 2019/ PS07N17 / 24

MATLAB on UL HPCAccelerating the time to resultOption 1: Split input over several parallel, independent jobs, great if it’s possible (embarrassingly parallel problem)Option 2: Use parfor to execute loop iterations in parallel, single node only, Iris bigmem partition nodes with 112 cores for big problemsV. Plugaru & Uni.lu HPC Team (University of Luxembourg)Uni.lu HPC School 2019/ PS07N17 / 24

MATLAB on UL HPCAccelerating the time to resultOption 1: Split input over several parallel, independent jobs, great if it’s possible (embarrassingly parallel problem)Option 2: Use parfor to execute loop iterations in parallel, single node only, Iris bigmem partition nodes with 112 cores for big problemsOption 3: Use GPU-enabled functions that work on the gpuArraydata type, require the code to be run on GPU nodes (subset of Iris), great speedup for some workloads, multiple hundreds of in-built MATLAB functions work on gpuArrayXincluding discrete Fourier transform, matrix multiplication, left matrix divisionV. Plugaru & Uni.lu HPC Team (University of Luxembourg)Uni.lu HPC School 2019/ PS07N17 / 24

MATLAB on UL HPCAccelerating the time to resultOption 1: Split input over several parallel, independent jobs, great if it’s possible (embarrassingly parallel problem)Option 2: Use parfor to execute loop iterations in parallel, single node only, Iris bigmem partition nodes with 112 cores for big problemsOption 3: Use GPU-enabled functions that work on the gpuArraydata type, require the code to be run on GPU nodes (subset of Iris), great speedup for some workloads, multiple hundreds of in-built MATLAB functions work on gpuArrayXincluding discrete Fourier transform, matrix multiplication, left matrix divisionOption 4: MATLAB Distributed Computing Server (MDCS), allows multi-node parallel execution, not yet part of the MATLAB licenseV. Plugaru & Uni.lu HPC Team (University of Luxembourg)Uni.lu HPC School 2019/ PS07N17 / 24

MATLAB on UL HPCSpeed up your seq. codeexample2.m: non-interactive script that showsthe serial execution of time consuming operationsV. Plugaru & Uni.lu HPC Team (University of Luxembourg)Uni.lu HPC School 2019/ PS07N18 / 24

MATLAB on UL HPCSpeed up your seq. codeexample2.m: non-interactive script that showsthe serial execution of time consuming operationsand revisited in the second part of the tutorial:, the parallel execution and relative speedup vs serial execution, setting the # of parallel threads through environment variables, GPU-based parallel executionparfor based parallel speedup vs serial execution6speedupspeedup with overhead5Parallel speedup4321012345V. Plugaru & Uni.lu HPC Team (University of Luxembourg)678Number of cores9101112Uni.lu HPC School 2019/ PS07N18 / 24

MATLAB on UL HPCSpeed up your seq. codeexample2.m: non-interactive script that showsthe serial execution of time consuming operationsand revisited in the second part of the tutorial:, the parallel execution and relative speedup vs serial execution, setting the # of parallel threads through environment variables, GPU-based parallel executionTasks to tackleexecute the script on regular vs GPU nodes (with diff. GPUs)increase # of iterations, matrix sizeincrease # of workers with/out changing # of req. coresmodify the script with other GPU-enabled functionsV. Plugaru & Uni.lu HPC Team (University of Luxembourg)Uni.lu HPC School 2019/ PS07N18 / 24

ConclusionSummary1 Practical Session Objectives2 MATLAB on UL HPCPrerequisitesUsing MATLAB3 ConclusionV. Plugaru & Uni.lu HPC Team (University of Luxembourg)Uni.lu HPC School 2019/ PS07N19 / 24

ConclusionExercises - your mission todayRead and understand the MATLAB vel/maths/matlab, all provided scripts are fully commentedRun all the examples, launching interactive/passive mode MATLAB, plotting script, parallel execution scriptV. Plugaru & Uni.lu HPC Team (University of Luxembourg)Uni.lu HPC School 2019/ PS07N20 / 24

ConclusionUseful linksGetting Started with Parallel Computing allel for-Loops (parfor) p/parfor.htmlGPU Computing tlab-gpu.htmlMulti-GPU computing pus.htmlV. Plugaru & Uni.lu HPC Team (University of Luxembourg)Uni.lu HPC School 2019/ PS07N21 / 24

ConclusionWhat we’ve seen so far (I)MATLAB execution modes on the Uni.lu HPC PlatformChecking for available toolboxes and licensesBasics of plottingPerspectivesPersonalize the UL HPC launchers with the MATLAB commandsCheck example #2 M-file for insight into basic parallel executionParallelize your own tasks using parfor/GPU-enabled instructionsV. Plugaru & Uni.lu HPC Team (University of Luxembourg)Uni.lu HPC School 2019/ PS07N22 / 24

ConclusionWhat we’ve seen so far (II)Checkpointing basicsSpecific MATLAB instructions for checkpointingMATLAB parallelization capabilitiesPerspectives(incrementally) modify your own MATLAB code for faulttoleranceparallelize your own tasks using parfor/GPU-enabled instructionsV. Plugaru & Uni.lu HPC Team (University of Luxembourg)Uni.lu HPC School 2019/ PS07N23 / 24

Thank you for your attention.Questions?http://hpc.uni.luHigh Performance Computing @ uni.luProf. Pascal BouvryDr. Sebastien VarretteValentin PlugaruSarah PeterHyacinthe CartiauxClement ParisotDr. FrÃľderic PinelDr. Emmanuel KiefferUniversity of Luxembourg, Belval CampusMaison du Nombre, 4th floor2, avenue de l’UniversitéL-4365 Esch-sur-Alzettemail: hpc@uni.lu1Practical Session Objectives2MATLAB on UL HPCV. Plugaru & Uni.lu HPC Team (University of Luxembourg)PrerequisitesUsing MATLAB3ConclusionUni.lu HPC School 2019/ PS07N24 / 24

Uni.luHPCSchool2019 PS07: Scientificcomputingusing MATLAB Uni.luHighPerformanceComputing(HPC)Team V.Plugaru UniversityofLuxembourg(UL),Luxembourg

Related Documents:

XSEDE HPC Monthly Workshop Schedule January 21 HPC Monthly Workshop: OpenMP February 19-20 HPC Monthly Workshop: Big Data March 3 HPC Monthly Workshop: OpenACC April 7-8 HPC Monthly Workshop: Big Data May 5-6 HPC Monthly Workshop: MPI June 2-5 Summer Boot Camp August 4-5 HPC Monthly Workshop: Big Data September 1-2 HPC Monthly Workshop: MPI October 6-7 HPC Monthly Workshop: Big Data

Blade Runner Classic Uncommon flooring - Common standards Solerunner Uni Solerunner Bladerunner Solerunner Uni Uni ICE Uni SKY Uni SAND Uni EARTH Uni NIGHT Uni POOL Uni MOSS Uni PINE Sky Sky UNI Sky STONE ENDURANCE VISION SPLASH Ice Ice UNI Ice STONE Ice ENDURANCE Ice SPL

HPC Architecture Engineer Sarah Peter Infrastructure & Architecture Engineer LCSB BioCore sysadmins manager UniversityofLuxembourg,BelvalCampus MaisonduNombre,4thfloor 2,avenuedel’Université L-4365Esch-sur-Alzette mail: hpc@uni.lu 1 Introduction 2 HPCContainers 11/11 E.Kieffer&Uni.luHPCTeam (UniversityofLuxembourg) Uni.luHPCSchool2020/PS6 .

Uni.lu HPC School 2019 PS3: [Advanced] Job scheduling (SLURM) Uni.lu High Performance Computing (HPC) Team C. Parisot University of Luxembourg (UL), Luxembourg

Microsoft HPC Pack [6]. This meant that all the users of the Windows HPC cluster needed to be migrated to the Linux clusters. The Windows HPC cluster was used to run engineering . HPC Pack 2012 R2. In order to understand how much the resources were being used, some monitoring statis-tics were extracted from the cluster head node. Figure 2 .

Building up High Performance Computing & Big Data Competence Center to support national priorities 1 . expert UL HPC team S. Varrette, V. Plugaru, S. Peter, H. Cartiaux, C. Parisot, among others . SC-Camp 2017 (Cadiz) Bi-annual HPC School @ Uni.lu (Part of the doctoral program)

16247-1:2012 Requisiti generali UNI CEI EN 16247-2:2014 Edifici UNI CEI EN 16247-3:2014 Processi UNI CEI EN 16247-5 Qualificazione degli Energy Auditors (2015) UNI CEI EN 16247-4:2014 Trasporti UNI CEI EN 16247 9 . UNI CEI EN 1624

academic writing, the purpose of which is to explore complex concepts and issues. Terms like Zin essence or to summarise, are more appropriate. The use of the word Ztalking [ is unsuitable because the law is a concept and concepts are not capable of talking! Words that could be used instead include state, articulate or describe. Sentences Try to express a single idea or point in each sentence .