module 4: working with mpi - eclipsewiki.eclipse.org/images/1/12/ptp-04-mpi.pdfshow mpi artifacts in...

39
Module 4: Working with MPI Objective Learn how to develop, build and launch a parallel (MPI) program on a remote parallel machine Contents Contents Remote project setup Building with Makefiles MPI assistance features Working with resource managers Launching a parallel application 4-0 Module 4 4-0

Upload: others

Post on 04-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Module 4: Working with MPIObjectivej

Learn how to develop, build and launch a parallel (MPI) program on a remote parallel machine

Contents Contents Remote project setup Building with MakefilesMPI assistance features Working with resource managers Launching a parallel applicationg p pp

4-0Module 4 4-0

Page 2: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

L l R tLocal vs. Remote PTP allows the program to be run locally if you have MPI

installed However we want to run the program on a remote

machine We will now show you how to run a parallel program on

a remote machine Interactivelyy Through a batch system

We have provided the source code to an MPI program on the remote machineon the remote machine

The project will be created using this source code

4-1Module 4 4-1

Page 3: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Creating a Remote MPI ProjectCreating a Remote MPI Project Like the previous module, create

a new Remote C/C++ projecta new Remote C/C++ project Enter “shallow” for the Project

Name Use the same Connection as before Use the same Connection as before Click the Browse… button and

choose the directory “shallow” in in your home directory

Select a Remote Makefile Project as before

Click Finish

You may be prompted to open the Remote C/C++ Perspective

4-2Module 4

Page 4: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Changing the Project Build PropertiesChanging the Project Build Properties

The project makefile has a non-standard nameMakefile.mk

We need to change the build properties so that the projectwill build By default, the project is built by

running “make”

Right-click on project “shallow” in the Project ExplorerExplorer

Select Properties

4-3Module 4

Page 5: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Changing the Build CommandChanging the Build Command

Select C/C++ Build Uncheck Use default build command Change the Build command to:

make –f Makefile.mk

4-4Module 4

Page 6: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Building the ProjectBuilding the Project

Click OK to save project properties after changing b ild dbuild command

Select project and hit the build button The project can be built at any time

by hitting this button

4-5Module 4

Page 7: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Include File LocationsInclude File Locations

Like the previous example, Eclipse content assist and f fnavigation require knowledge of include file locations on the

remote system Since the build will be running remotely, the compiler knows

how to find include fileshow to find include files But Eclipse does not

In Project Explorer, j p ,right-click on project

Select Properties

4-6Module 4 4-6

Page 8: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Remote Paths and SymbolsRemote Paths and Symbols

j i

Include files on

In Project Properties, Expand Remote Development Select

Remote Paths and Symbols abe.ncsa.uiuc.eduRemote Paths and Symbols Select Languages>GNU C

This is compiler on abe Click Add…

Enter /usr/local/openmpi-1.4.2-intel-11.1/include Click OK, then Add… again

Enter /usr/include Click OK Click OK to close preferences When prompted to rebuild

index, click OK

Module 4 4-7

Page 9: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

MPI-Specific FeaturesMPI Specific Features

PTP’s Parallel Language Development Tools (PLDT) h l f ifi ll f d l i MPI has several features specifically for developing MPI code Show MPI Artifacts Code completion Context Sensitive Help for MPI Hover HelppMPI Templates in the editor

More MPI features covered in Module 7: Advanced Features

4-8Module 4

Page 10: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Show MPI Artifacts

In Project Explorer, select a project, folder, or a single source file The analysis will be run on the selected resources The analysis will be run on the selected resources

Run the analysis by clicking on drop-down menu next to the analysis button

Selecting Show MPI Artifacts

4-9Module 4 4-9

Page 11: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

MPI Artifact View Markers indicate the

location of artifacts in editoreditor

The MPI Artifact Viewlist the type and location of each artifact

N i t t d Navigate to source code line by double-clicking on the artifact

Run the analysis on yanother file (or entire project!) and its markers will be added to the view

Remove markers via Remove markers via Click on column headings

to sort

4-10Module 4 4-10

Page 12: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

MPI Editor FeaturesMPI Editor Features Code completion will show all

the possible MPI keyword completionsco p et o s

Enter the start of a keyword then press <ctrl-space>

Hover over MPI API Displays the function Displays the function

prototype and a description

4-11Module 4 4-11

Page 13: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Context Sensitive HelpContext Sensitive Help Click mouse, then press help

key when the cursor is within a function name Windows: F1 key Linux: ctrl-F1 key MacOS X: Help key or

HelpDynamic HelpHelpDynamic Help A help view appears (Related

Topics) which shows additional information(You may need to click on MPI S i l (You may need to click on MPI API in editor again, to populate)

Click on the function name to i f i

Some special info has been added for MPI

APIs

see more information Move the help view within your

Eclipse workbench, if you like, by dragging its title tab

4-12

y gg g

Module 4 4-12

Page 14: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

MPI TemplatesMPI TemplatesAllows quick entry of common patterns in MPI programming

Example: MPI send-receive

Enter: mpisr <ctrl-space>

Expands to a send-receive pattern

Highlighted variable names g gcan all be changed at once

Type mpi <ctrl-space> <ctrl-space> to see all templates

Add more templates using Eclipse preferences!C/C++>Editor>Templates

Extend to other common patterns

4-13

Extend to other common patterns

Module 4 4-13

Page 15: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

R i th PRunning the Program Creating a resource managerg g Starting the resource manager Creating a launch configuration Launching the application Viewing the application run

4-14Module 4 4-14

Page 16: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

T i lTerminology The Parallel Runtime perspective is provided for The Parallel Runtime perspective is provided for

monitoring and controlling applications Some terminology

Resource manager - Corresponds to an instance of Resource manager Corresponds to an instance of a resource management system (e.g. a job scheduler). You can have multiple resource managers connected to different machines.

Queue - A queue of pending jobs Job – A single run of a parallel applicationMachine - A parallel computer systemNode - Some form of computational resource Process - An execution unit (may be multiple

threads of execution)

4-15Module 4 4-15

Page 17: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Resource ManagersResource Managers

PTP uses the term “resource manager” to refer to any subsystem that controls the resources required for launching a parallel job.

Examples: Job scheduler (e.g. LoadLeveler, PBS, SLURM) Interactive execution (e.g. Open MPI, MPICH2, etc.)

Each resource manager controls one target system Each resource manager controls one target system Resource Managers can be local or remote

4-16Module 4 4-16

Page 18: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Preparing to LaunchPreparing to Launch Setting up a resource manager is done in the Parallel

Runtime perspectivep p Select Window>Open Perspective>Other Choose Parallel Runtime and click OK

4-17Module 4 4-17

Page 19: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Parallel Runtime PerspectiveParallel Runtime PerspectiveResource managers managers view

Machines

Console view

view

Node details viewview

Jobs List viewJobs List viewProperties

view

4-18Module 4 4-18

Page 20: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

About PTP IconsAbout PTP Icons Open using legend icon in

toolbartoolbar

4-19Module 4 4-19

Page 21: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Running Jobs InteractivelyRunning Jobs Interactively

Interactive resource ill th managers will run the

parallel application immediately

They are also used for They are also used for debugging the application

Right-click in Resource Managers view and select gAdd Resource Manager

Choose the Open MPI Resource Manager Type

Select Next>

4-20Module 4 4-20

Page 22: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Configure the Remote LocationConfigure the Remote Location Choose Remote Tools for

Remote service provider Choose the remote

connection you made previously

C fi T li Configure Tunneling Options to use SSH Port Forwarding

Click Next> Click Next>

4-21Module 4 4-21

Page 23: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Configure the Resource ManagerConfigure the Resource Manager The Open MPI resource

manager will auto detect the e sion and se the version and use the

appropriate commands Change only if you’re an

expert Set the location of the

“mpirun” command if it is not in your path

Click Next> Click Next> Change the Name or

Description of the resource manager if you wish

You can also set the resource manager to automatically start

Click Finish

4-22Module 4 4-22

Page 24: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Starting the Resource ManagerStarting the Resource Manager Right click on new

resource manager and resource manager and select Start resource manager

If everything is ok, you should see the resource manager change to green

If something goes wrong, it will change to redit will change to red

4-23Module 4 4-23

Page 25: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

System MonitoringSystem Monitoring

Machine status shown i M hi iin Machines view

Node status also shown Machines view

Hover over node to see Hover over node to see node name

Double-click on node to show attributesto show attributes

4-24Module 4 4-24

Page 26: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Create a Launch ConfigurationCreate a Launch Configuration

Open the run configuration dialog Run>Run Configurations…

Select Parallel Application Select the New button

Depending on which flavor of Eclipse you installed you might have more choices in

4-25

installed, you might have more choices in Application types

Module 4 4-25

Page 27: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Complete the Resources TabComplete the Resources Tab Enter a name for the

launch configuration launch configuration, e.g. “shallow”

In Resources tab, select the resource manager you want to manager you want to use to launch this job

Enter a value in the Number of processes fieldprocesses field

Other fields can be used to specify resource manager-specific informationinformation E.g. specify

By node to allocate each process to a diff t d

4-26Module 4 4-26

different node

Page 28: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Complete the Application TabComplete the Application Tab Select the Application

tabtab Choose the Application

program by clicking the Browse button and locating the executable gon the remote machine There should be a

“shallow” executable in the “shallow” directory

Select Display output Select Display output from all processes in a console view

Click Run to run the applicationapplication

4-27Module 4 4-27

Page 29: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Viewing The RunViewing The Run

Double-click a d i hi node in machines

view to see which processes ran on the nodethe node

Hover over a process for tooltip p ppopup

Job status and information

4-28Module 4 4-28

Page 30: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Viewing Program OutputViewing Program Output

Console displays combined output from all processesp

Properties view shows job details

4-29Module 4 4-29

Page 31: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Using a Job SchedulerUsing a Job Scheduler

Right-click in Resource M i d Managers view and select Add Resource Manager

Choose the PBS Resource Manager Resource Manager Type

Select Next>

4-30Module 4 4-30

Page 32: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Configure the Remote LocationConfigure the Remote Location Choose Remote Tools for

Remote service provider Choose the remote

connection you made previously

C fi T li Configure Tunneling Options to use SSH Port Forwarding

Click Next> Click Next>

4-31Module 4 4-31

Page 33: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Configure the Resource ManagerConfigure the Resource Manager The PBS resource manager

allows customization to match the local site options match the local site options for the PBS installation

By default, all known PBS options will be displayed

Templates can be used to customize the options for each installation

We will not change this just We will not change this, just click Finish to complete the configuration

4-32Module 4 4-32

Page 34: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Starting the Resource ManagerStarting the Resource Manager

Right click on new resource manager and select Start resource manager

If everything is ok If everything is ok, you should see the resource manager change to greeng g

If something goes wrong, it will change to red

4-33Module 4 4-33

Page 35: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

System MonitoringSystem Monitoring

Machine status shown i M hi iin Machines view

Node status also shown Machines view

Hover over node to see Hover over node to see node name

Double-click on node to show attributesto show attributes

4-34Module 4 4-34

Page 36: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Create a Launch Configuration Open the run configuration

dialog Run>Run

Create a Launch Configuration

gConfigurations…

Select Parallel Application Select the New

button

4-35Module 4 4-35

Page 37: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Complete the Resources TabComplete the Resources Tab Enter a name for this

launch configuration e g launch configuration, e.g. “shallow (PBS)”

In Resources tab, select the PBS resource manager you just createdyou just created

The MPI Command field allows this job to be run as an MPI job Choose mpirun Choose mpirun

Enter account name “dvd” Enter the number of

nodes to reserve in the R Li t d Resource_List.nodes field Use 4 nodes

Select the destination

4-36

queue -- nomss

Module 4 4-36

Page 38: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Complete the Application TabComplete the Application Tab Select the Application

tabtab Choose the Application

program by clicking the Browse button and locating the executable on locating the executable on the remote machine Use the same “shallow”

executable Select Display output p y p

from all processes in a console view

If Debugger tab has error,select Debugger: SDM

Click Run to submit the application to the job scheduler

4-37Module 4 4-37

Page 39: Module 4: Working with MPI - Eclipsewiki.eclipse.org/images/1/12/Ptp-04-mpi.pdfShow MPI Artifacts In Project Explorer, select a project, folder, or a single source file The analysis

Job MonitoringJob Monitoring

Job status is tracked here, successful jobs disappear from disappear from list

To cancel, select job and select jRed button in Jobs List

4-38Module 4 4-38