Академический Документы
Профессиональный Документы
Культура Документы
Build
View
Run
SwitchPerspective
View
Outline
View
11/09/12tibbitts@us.ibm.com
Consoleview:Buildoutput;Runoutput
Editor
Problemsview:Builderrorsetc.
Current
Debug
Perspective
name:C/C++
Preferences:Menu:Window>Preferences
Mac:Eclipse>Preferences
>Indicates
changefrom
SCR
Version#in
SCR
SourceCode
Repository
Rightmousefor
ProjectProperties
Tutorial Outline
Time (Tentative!)
Module
Topics
Presenter
10:30-11:00
Jay
11:00-11:30
Wyatt
11:30-12:00
Jay
12:00-1:00
Lunch
1:00-2:30
Wyatt
2:30-3:00
4. Debugging Part A
Jay
3:00-3:30
Break
3:30-4:00
4. Debugging Part B
Jay
4:00-5:00
Wyatt
Tutorial Outline
Time (Tentative!)
Module
Topics
Presenter
8:30-9:30
Wyatt/Jay
9:30-10:00
Jay
10:00-10:30
Break
10:30-11:30
Jay
11:30-12:00
Jay
12:00-1:00
Lunch
1:00-3:00
3:00-3:30
Break
3:00-5:00
Wyatt/Jay
Wyatt/Jay
PDF
page #
Slide page
# prefix
PTP Installation
Install-
PTP Introduction
21
Intro-
Eclipse Basics
30
Basic-
43
Shell-
Creating a Synchronized project from existing remote dir (Project creation alt. #1)
51
Sync-
Creating a project from CVS Team features then convert to Synchronized project
(Project creation alt. #2) for SC tutorial we will do #2
73
CVS-
93
Editor-
MPI Programming Features (similar features for OpenMP, UPC, OpenSHMEM, OpenACC)
110
MPI-
132
Tunnel-
135
Build-
153
Run-
Fortran
174
Fortran-
191
Advanced-
208
NCSA-
Parallel Debugging
215
Debug-
250
Perf-
253
TAU-
272
GEM-
308
Linux-
Wrap-up
328
WrapUP-
Installation
Objective
To learn how to install Eclipse and PTP
Contents
System Prerequisites
Eclipse Download and Installation of Eclipse for
Parallel Application Developers
Installation Confirmation
Updating the PTP within your Eclipse to the latest
release
Installation
Install-0
System Prerequisites
Local system (running Eclipse)
Linux (just about any version)
MacOSX (10.5 Leopard or higher)
Windows (XP on)
Install-1
Eclipse Packages
The current version of Eclipse (4.2) is also
known as Juno
Eclipse is available in a number of different
packages for different kinds of development
http://eclipse.org/downloads
Installation
Install-2
Exercise
1. Download the Eclipse for Parallel Application
Developers package to your laptop
Your tutorial instructions will provide the location of
the package
Make sure you match the architecture with that of
your laptop
Install-3
Starting Eclipse
Linux
From a terminal window, enter
<eclipse_installation_path>/eclipse/eclipse &
Mac OS X
From finder, open the eclipse folder where you installed
Double-click on the Eclipse application
Or from a terminal window
Windows
Open the eclipse folder
Double-click on the eclipse executable
Installation
Install-4
Specifying A Workspace
Eclipse prompts for a workspace location at
startup time
The workspace contains all user-defined data
Projects and resources such as folders and files
The default workspace location is fine for this tutorial
The prompt can be
turned off
Installation
Install-5
Install-6
Installation
You must enable (and install from) the PTPspecific update site before the updates will be
found
SEA Note: we will show you specific instructions
on applying a needed update on slide 9
Installation
Install-7
Updating PTP
Now select Help>Install New Software
In the Work With: dropdown box, select this update site,
or enter it:
http://download.eclipse.org/tools/ptp/updates/juno
Installation
Install-8
Installation
Install-9
Installation
Install-10
Installation
Install-11
Installation
Install-12
Installation
Install-13
Installation
Install-14
Installation
Install-15
Install-16
Exercise
1. Launch Eclipse and select the default
workspace
2. Configure Eclipse to check for PTP updates
3. Update all PTP features to the latest level
4. Install the optional features of PTP, including
TAU and GEM
Selecting all features accomplishes 3. and 4.
Installation
Install-17
Introduction
Objective
To introduce the Eclipse platform and PTP
Contents
New and Improved Features
What is Eclipse?
What is PTP?
Introduction
Intro-0
What is Eclipse?
A vendor-neutral open-source workbench for
multi-language development
A extensible platform for tool integration
Plug-in based framework to create, integrate
and utilize software tools
Introduction
Intro-1
Eclipse Features
Full development lifecycle support
Revision control integration (CVS, SVN, Git)
Project dependency management
Incremental building
Content assistance
Context sensitive help
Language sensitive searching
Multi-language support
Debugging
Introduction
Intro-2
http://www.eclipse.org/ptp
Introduction
Intro-3
Launching &
Monitoring
Introduction
Performance Tuning
Parallel Debugging
(TAU, PPW, )
Intro-4
Local Source
Code
Introduction
Remote
Source Code
Intro-5
Source Code
Executable
Introduction
Intro-6
Source Code
Executable
Introduction
Intro-7
Source Code
Executable
Perf. Data
Introduction
Intro-8
Eclipse Basics
Objective
Learn about basic Eclipse workbench concepts:
projects,
Learn about projects: local, synchronized, remote
Contents
Workbench components: Perspectives, Views, Editors
Local, remote, and synchronized projects
Learn how to create and manage a C project
Learn about Eclipse editing features
Eclipse Basics
Basic-0
Eclipse Basics
A workbench contains the menus, toolbars, editors and
views that make up the main Eclipse window
The workbench represents
the desktop development
environment
Contains a set of tools
for resource mgmt
Provides a common way
of navigating through
the resources
Multiple workbenches
can be opened at the
same time
Only one workbench can
be open on a workspace
at a time
Eclipse Basics
view
view
editor
view
perspective
Basic-1
Perspectives
Perspectives define the layout of views and
editors in the workbench
They are task oriented, i.e. they contain
specific views for doing certain tasks:
C/C++ Perspective for manipulating compiled code
Debug Perspective for debugging applications
System Monitoring Perspective for monitoring
jobs
Basic-2
Switching Perspectives
Three ways of changing
perspectives
1. Choose the Window>Open
Perspective menu option
Then choose Other
2. Click on the Open Perspective button in the
upper right corner of
screen (hover over it to
see names)
3. Click on a
perspective
shortcut button
Eclipse Basics
Basic-3
Which Perspective?
The current perspective is displayed in the title
bar
Eclipse Basics
Basic-4
Views
The workbench window is
divided up into Views
The main purpose of a view is:
view
view
view
Basic-5
Stacked Views
Stacked views appear as tabs
Selecting a tab brings that view to the
foreground
Eclipse Basics
Basic-6
Expand a View
Double-click on a view/editors tab to fill the
workbench with its content;
Repeat to return to original size
Double
click
Double
click
Basic-7
Help
To access help
Help>Help Contents
Help>Search
Help>Dynamic Help
Basic-8
Eclipse Preferences
Eclipse Preferences allow
customization of almost
everything
To open use
Mac: Eclipse>Preferences
Others:
Window>Preferences
Eclipse Basics
Basic-9
Preferences Example
More C/C++ preferences:
In this example the
Code Style preferences
are shown
Eclipse Basics
Basic-10
Exercise
1. Change to a different perspective
2. Experiment with moving and resizing views
Move a view from a stack to beside another view
Expand a view to maximize it; return to original size
3.
4.
5.
6.
7.
Eclipse Basics
Basic-11
Optional Exercise
1.
Basic-12
Contents
Set up Remote Systems Explorer (RSE) connection
Add Remote Shell view
Connect to remote system
Allow opportunity to inspect remote system, copy file,
etc as needed
Eclipse Basics
Shell-0
Shell in a View
Shell-1
Shell in a View
Shell-2
Shell in a View
Shell-3
Shell in a View
Shell-4
Notes
Why did we do this?
To show you can gain traditional access to a
remote host through Eclipse
Why did I have to specify the connection
information again?
Note: RSE Connection information is not
shared with PTP Synchronized projects.
PTP will allow using existing connections with
terminal consoles in a future release.
Shell in a View
Shell-5
Basic-6
Exercise
1. Add the Remote Systems view to your
workbench
2. Connect to the remote machine and open an
ssh terminal
3. Inspect home directory
Eclipse Basics
Shell-7
Contents
Eclipse project types
Creating a synchronized project
Using synchronize filters
Converting an existing project to synchronized
Synchronized Projects
Sync-0
Project Types
Local
Source is located on local machine, builds happen
locally
Remote
Source is located on remote machine(s), build and
launch takes place on remote machine(s)
Synchronized
Source is local, then synchronized with remote
machine(s) (or vice-versa)
Building and launching happens remotely
(can also happen locally)
Synchronized Projects
Sync-1
Remote Projects
Projects types can be:
LaunchService
Compute
DebugService
BuildService
Executable
IndexService
FileService
Sourcecode
Local
Remote
Synchronized Projects
Sync-2
-2
Synchronized Projects
Projects types can be:
LaunchService
Compute
DebugService
BuildService
Executable
IndexService
FileService
Edit
Search/Index
Navigation
Localsource
code
Synchronize
Local
Synchronized Projects
Sourcecode
copy
Remote
Sync-3
-3
Makefile-based
Project contains its own makefile (or makefiles) for
building the application or other build command
Managed
Eclipse manages the build process, no makefile
required
Synchronized Projects
Sync-4
-4
Create Project
This module creates a Synchronized project
from source code already existing on the
remote system
- or
The CVS module creates a Synchronized
project from a CVS source code repository
Synchronized
Projects
Sync-5
Synchronized Projects
Sync-6
Sync-7
Synchronized Projects
Sync-8
Creating a Connection
In the Target Environment Configuration
dialog
Enter a Target name
for the remote host
Enter host name,
user name, and
user password or
other credentials
Select Finish
If your machine access requires
ssh access through a
frontend/intermediate node, use
localhost and port see
alternate instructions
Synchronized Projects
Sync-9
Sync-10
Synchronized Project
Synchronized projects are indicated
with a synchronized icon
Right click on project to access
Synchronization menu
Select Auto-Sync to enable/disable
automatic syncing
Project Auto-Sync Settings are used
to determine which configurations are
synchronized (Active only, All or None)
Sync Active/All Now to manually
synchronize
Filter to manage synchronization
filters
Synchronized Projects
Sync-11
Synchronize Filters
If not all files in the remote project should be
synchronized, a filter can be set up
For example, it may not be desirable to synchronize
binary files, or large data files
Synchronized Projects
Sync-12
Synchronized Projects
Sync-13
Synchronized Projects
Sync-14
Sync-15
Converting a Local
C/C++/Fortran Project
to a
Synchronized Project
The following slides are for reference.
Our project is already a Synchronized Project.
Synchronized Projects
Sync-16
Converting To Synchronized
If source files exist on the local machine and you wish to
convert it to a Synchronized Project on a remote
system
Select File>New>Other
Open the Remote folder
Select Convert C/C++
or Fortran Project to a
Synchronized Project
Click Next>
Synchronized Projects
Sync-17
Target name
Host name of remote system
User ID
Password
Sync-18
Click Finish
The project should synchronize
automatically
Synchronized Projects
Sync-19
10
Exercise
1. Create a synchronized project
Your login information and source directory will be
provided by the tutorial instructor
Synchronized Projects
Sync-20
Optional Exercise
1. Modify Sync filters to not bring the *.o files and
your executable back from the remote host
Rebuild and confirm the files dont get copied
Synchronized Projects
Sync-21
11
Contents
Checking out project in CVS
Setting up a Connection for a Synchronized Project
Handling changes; Comparing files (diffs)
In this scenario, we will check out code from a CVS source code
repository, setting it up as a synchronized project on a remote host.
(Project Creation Alternative #1 in this PTP tutorial is to create a
Synchronized project directly from code existing on a remote host)
CVS-0
CVS-1
Select Finish
CVS-2
The default of
Check out as a
project configured
using the New
Project Wizard is
what we want
CVS Source Code
Repository
CVS-3
CVS-4
CVS-5
Select Finish
* See http://wiki.eclipse.org/PTP/FAQ
and search for tunnel
Basic-6
Basic-7
Expand the
project root
to see the
projects
contents
CVS-8
CVS-9
Synchronized Project
Back in the Project
Explorer, decorator on
project icon indicates
synchronized project
Double-+ icon
CVS-10
Team Features
CVS-11
Team Features
Eclipse supports integration with multiple
version control systems (VCS)
CVS, SVN, Git, and others
Collectively known as Team services
Some differences
Version numbers
Branching
CVS Source Code
Repository
CVS-12
Team synchronize
Show differences between local project and source
code repository versions
Basic-13
CVS Features
Shows version numbers next to
each resource
Marks resources that have
changed
Can also change color (preference
option)
* Team synchronize
CVS-14
CVS-15
CVS-16
CVS-17
CVS-18
Exercise
Check out the shallow project from CVS as a
synchronized project - as described in this
module
Optional Exercise
1. Name every person who modified the Makefile
2. Identify which parts of the Makefile changed
since revision 1.3
Hint: Right-click the Makefile and select Team > Show History.
Both of these can be done from the History view.
CVS Source Code Repository
CVS-19
10
Editor Features
Objective
Learn about Eclipse editor features
Contents
Saving
Editor markers
Setting up include paths
Code analysis
Content assistance and templates
Editor Features
Editor-0
Editors
An editor for a resource (e.g. a file) opens when you
double-click on a resource
The type of editor depends on the type of the resource
.c files are opened with the
C/C++ editor by default
You can use Open With to
use another editor
In this case the default
editor is fine (double-click)
Some editors do not just edit raw text
Editor-1
Editor Features
Editor-2
Outline view is
shown for file in
editor
Console shows
results of build,
local runs, etc.
Editor Features
Editor-3
Icons:
Editor Features
Editor-4
In order for editor and build features to work properly, Eclipse needs to know
where your include files are located
The build environment on the remote host knows your include files etc., but
we must tell Eclipse so that indexing, search, completion, etc. will know where
things are
Open Project Properties
Expand C/C++ General
Select Preprocessor
Include Paths
Click GNU C, then CDT
User Setting Entries,
then click Add
In upper right, select
Filesystem in pulldown
A UNC-style path specifies
//<connection>/<path>
Enter Path
//trestles/opt/openmpi/incl
ude
Select OK
Editor Features
Editor-5
Bug: on Mac, it appears as blank. Close and re-open the twisty to see
the correct value.
//trestles/usr/include
... the same way
Editor Features
Editor-6
Editor Features
Editor-7
and uncheck
all problems
Select OK to
close
Preferences
Uncheck all
Editor Features
Editor-8
Line Numbers
Text editors can show line numbers in the
left column
To turn on line
numbering:
Right-mouse click in
the editor marker bar
(at editor left edge)
Click on Show Line
Numbers
Editor Features
Editor-9
Open declaration
Right-click and select Open
Declaration will also open the
file in which the element is
declared
E.g. in main.c line 29 right-click
on decs.h and select Open
Declaration
Editor Features
Editor Features
Editor-11
Editor Features
Editor-12
Hover Help
Hover the mouse over a program element in
the source file to see additional information
Editor Features
Editor-13
Inactive code
Inactive code will appear grayed out in the
CDT editor
Editor Features
Editor-14
Exercise
1. Open an editor by double clicking on a source file in the
Project Explorer
2. Use the Outline View to navigate to a different line in
the editor
3. Back in main.c, turn on line numbering
4. In main.c, ctrl-click on line 99, master_packet, should
navigate to its definition in the file
5. In worker.c, line 132, hover over variable p to see info
Editor Features
Editor-15
Optional Exercise
1. Type for, then activate content assist
Select the for loop with temporary variable template, insert it,
then modify the template variable
Surround the code you just inserted with #if 0 and #endif and
observe that it is marked as inactive
Save the file
Select any source files you changed and do rightmouse > replace with ..
(if you made project from CVS) .Latest from HEAD
(If you made project from remote files) Local History .
Editor Features
Editor-16
MPI Programming
Objective
Learn about MPI features for your source files
Contents
Using Editor features for MPI
MPI Help features
Finding MPI Artifacts
MPI New Project Wizards
MPI Barrier Analysis
MPI Programming
MPI-0
MPI-Specific Features
PTPs Parallel Language Development Tools (PLDT) has
several features specifically for developing MPI code
Show MPI Artifacts
Code completion / Content Assist
Context Sensitive Help for MPI
Hover Help
MPI Templates in the editor
MPI Barrier Analysis
MPI Programming
MPI-1
MPI-2
-2
MPI Programming
MPI-3
-3
MPI Programming
MPI-4
-4
Some special
info has been
added for MPI
APIs
MPI-5
-5
MPI Templates
Allows 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
can all be changed at once
Type mpi <ctrl-space> <ctrlspace> to see all templates
MPI-6
-6
MPI Programming
MPI-7
MPI Programming
MPI-8
MPI Programming
MPI-9
MPI Programming
MPI-10
Barrier Errors
Lets cause a barrier mismatch error
Open worker.c in the editor by double-clicking
on it in Project Explorer
At about line 125,
enter a barrier:
Type MPI_B
Hit Ctl-space
Select MPI_Barrier
Add communicator
arg MPI_COMM_WORLD
MPI Programming
MPI-11
MPI Programming
MPI-12
MPI-13
MPI Programming
MPI-14
MPI Programming
MPI-15
MPI-16
MPI-17
MPI-18
MPI Preferences
Settings for MPI New Project wizards
MPI Include paths, if set in MPI
Preferences, are added in MPI New
Project Wizard
MPI-19
10
Exercise
1. Find MPI artifacts in shallow project
Locate all the MPI communication (send/receive)
calls
MPI Programming
MPI-20
Optional Exercise
1. Insert an MPI_Barrier function call into one of
your source files using content assist
E.g. Line 125 of worker.c
MPI Programming
MPI-21
11
Building a Project
Objective
Learn how to build an MPI program on a remote
system
Contents
How
How
How
How
to
to
to
to
Building a Project
Build-0
Build
Build-1
Build-2
Build
* To see Project
Properties: in Project
Explorer view, right mouse
on project and select
Properties at the
bottom of the context
menu
Build
Build-3
Changed file:
Building a Project
Click on the
hammer button in toolbar to run a build
using the active build configuration
Build-5
Building a Project
Build-6
Build Problems
Build problems will be
shown in a variety of
ways
Marker on file
Marker on editor line
Line is highlighted
Marker on overview ruler
Listed in the Problems
view
Double-click on line in
Problems view to go
to location of error in
the editor
Building a Project
Build-7
Forcing a Rebuild
If no changes have been made,
make doesnt think a build is needed
e.g. if you only change the Makefile
In Project Explorer, right click on
project; Select Clean Project
Build console will display results
Building a Project
Build-8
Forcing a Resync
Project should resync with remote
system when things change
Sometimes you may need to
do it explicitly
Right mouse on project,
Synchronization>Sync Active Now
Status area in lower right shows
when Synchronization occurs
Building a Project
Build-9
Building a Project
Build-10
Build Configuration
The build configuration is specified in the project properties
Open the properties by right-clicking on the project name in the Project
Explorer view and selecting Properties (bottom of the context menu
list)
C/C++ Build
Configure the build command
Default is make but this can be
changed to anything
Building a Project
Build-11
Building a Project
Build-12
Building a Project
Build-13
Building a Project
Build-14
Building a Project
Build-15
Exercise
1. Start with your shallow project
2. Build the project
3. Edit a source file and introduce a compile error
In main.c, line 97, change ; to :
Save, rebuild, and watch the Console view
Use the Problems view to locate the error
Locate the error in the source code by double
clicking on the error in the Problems view
Fix the error
4. Rebuild the project and verify there are no build errors
Building a Project
Build-18
Optional Exercise
1. Open the Makefile in Eclipse. Note the line starting with
tags: this defines a make target named tags.
2. Open the Outline view while the Makefile is open. What icon
is used to denote make targets in the Outline?
3. Right-click the tags entry in the Outline view. Add a Make
Target for tags.
4. Open the Make Targets view, and build the tags target.
Build-19
10
Running an Application
Objective
Learn how to run an MPI program on a remote system
Contents
Creating a run configuration
Configuring the application run
Monitoring the system and jobs
Controlling jobs
Obtaining job output
Running an Application
Run-0
Run-1
Running an Application
Run-2
-2
SEA: use
Target system
configurations can be
generic or can be specific
to a particular system
Use the specific
configuration if available,
or the generic
configuration that most
closely matches your
system
Running an Application
Run-3
-3
Running an Application
Run-4
-4
Resources Tab
The content of the
Resources tab will vary
depending on the target
system configuration
selected
This example shows the
IBM Platform LSF
configuration
For the SEA workshop,
we will indicate the
settings that need to be
set on the next slide
Running an Application
Run-5
-5
Value
Exclusive Execution
false
Job is Resizable
false
True
Completion_Notification
false
Dispatch_Notification
false
Number of Processors
True
Project Name
SCSG004
Job Queue
tutorial
false
Estimated Runtime
30
Runtime Limit:
30
/glade/u/home/jalameda/shallow03apr2013-test/
/glade/u/home/jalameda/shallow03apr2013-test/
Running
an Application
MPI Command
mpirun.lsf
Run-6
Running an Application
Run-7
-7
Application Tab
Select the Application
tab
Choose the
Application program
by clicking the Browse
button and locating the
executable on the
remote machine
Use the same
shallow executable
Running an Application
Run-8
-8
Running an Application
Run-9
-9
Running an Application
Run-10
-10
Running an Application
Run-11
-11
Running an Application
Run-12
-12
Run
Select Run to launch the job
You may be asked to switch to the System
Monitoring Perspective
Run-13
Messages
Console
Running an Application
Run-14
Moving views
The System Monitoring Perspective overlaps
the Active Jobs and Inactive Jobs views
To split them apart and see both at once,
drag the tab for the Inactive Jobs view to
the lower half of its area, and let go of mouse
Run-15
System Monitoring
System view, with
abstraction of system
configuration
Hold mouse button
down on a job in
Active Jobs view to
see where it is
running in System
view
Hover over node in
System view to see
job running on node
in Active Jobs view
Pull down to filter
jobs, or select your
own
Running an Application
Run-16
-16
Job Monitoring
Job initially appears in
Inactive Jobs view
Moves to the Active Jobs
view when execution
begings
Returns to Inactive Jobs
view on completion
Status refreshes
automatically every 60 sec
Can force refresh with menu
Running an Application
Run-17
-17
Controlling Jobs
Right click on a job to open
context menu
Actions will be enabled IFF
The job belongs to you
The action is available on the
target system
The job is in the correct state for
the action
Running an Application
Run-18
-18
Run-19
-19
10
Add a Monitor
You can monitor other systems too
In Monitors view, select the + button to
add a monitor
Double click
new monitor
to start
Run-20
Running an Application
Exercise
1.
2.
3.
4.
5.
6.
Running an Application
Run-21
11
Fortran
Objectives
Learn how to create and convert Fortran projects
Learn to use Fortran-specific editing features
Learn about Fortran-specific properties/preferences
Contents
Fortran projects
Using the Fortran editor
Fortran project properties and workbench preferences
Prerequisites
Basics (for exercises)
Fortran Projects
Fortran-0
Fortran Projects
Fortran-3
Project Properties
Right-click Project
Select Properties
Fortran Projects
Fortran-4
No Fortran categories
Do this
once
Fortran-5
Project Location
How to tell where a project
resides?
In the project properties
dialog, select the
Resource category
Fortran Projects
Fortran-6
Error Parsers
Are compiler errors not appearing in the
Problems view?
Make sure the correct error parser is enabled
In the project properties, navigate to
C++ BuildSettings or Fortran BuildSettings
Switch to the Error Parsers tab
Check the error parser(s) for your compiler(s)
Fortran Projects
Do this
once
Fortran-7
.f
.fix
.for
.fpp
Free form:
.f08
.F08
.f03
.F03
.f95
.F95
.f90
.F90
.ftn
.f77
< unpreprocessed
< preprocessed
Fortran Projects
Fortran-8
In the project
properties, select
Fortran General
Source Form
Select source form
for each filename
extension
Click OK
Fortran Projects
Fortran-9
Do this
once
Fortran-10
Exercise
1. Convert shallow to a Fortran project
2. Make sure errors from the GNU Fortran
compiler will be recognized
3. Make sure *.f90 files are treated as
Free Form which is unpreprocessed
4. Make sure search and refactoring will work in
Fortran
Fortran Projects
Fortran-11
Advanced Editing
Code Templates
Fortran Projects
Fortran-12
Code Templates
(C/C++ and Fortran)
Fortran Projects
Fortran-13
Fortran-14
Exercise
Open tstep.f90 and retype the last loop nest
Use the code template to complete the do-loops
Use content assist to complete variable names
Fortran Projects
Fortran-15
Fortran-16
Contents
Searching
Refactoring and Transformation
Prerequisites
Basics
Fortran
Advanced Features
Advanced-0
Advanced Features
Advanced-1
Mark Occurrences
(C/C++ Only)
Advanced Features
Advanced-2
Language-Based Searching
(C/C++ and Fortran)
Advanced Features
Advanced-3
Find References
(C/C++ and Fortran)
Search view
shows matches
Advanced Features
Advanced-4
Open Declaration
(C/C++ and Fortran)
Advanced Features
Advanced-5
Advanced Features
Advanced-6
Advanced Features
Advanced-7
Refactoring
(making changes to source code that dont affect the behavior of the program)
Advanced Features
Advanced-8
Refactoring Caveats
Photran can only refactor free form code that
is not preprocessed
Determined by Source Form settings
(recall from earlier that these are configured in
Project Properties: Fortran GeneralSource Form)
.f03
.f95
.f90
.F08
.F03
.F95
.F90
Fixed Form:
.for
.fpp
.ftn
.f77
.f
.fix
Advanced-9
Rename Refactoring
(also available in Fortran)
Advanced Features
Advanced-10
Rename in File
(C/C++ Only)
(Command-1 on Mac).
Advanced Features
Advanced-11
Select a sequence of
statements
Select menu item
Refactor
Extract Function
Enter new name
Advanced Features
Advanced-12
(by default, names starting with I-N are integer variables; others are reals)
Advanced-13
Loop Transformations
(Fortran only)
Interchange Loops
Loop Transformations
(Fortran only)
Unroll Loop
Select a loop, click RefactorDo LoopUnroll Loop
do i = 1, 10
print *, 10*i
end do
Unroll 4
do i = 1, 10, 4
print *, 10*i
print *, 10*(i+1)
print *, 10*(i+2)
print *, 10*(i+3)
end do
Advanced Features
Advanced-15
Advanced Features
Advanced-16
NCSA/XSEDE Features
Objectives
Install NCSAs GSI auth and XSEDE support plug-ins
Become familiar with the System menu
Contents
Capabilities
Installation
Prerequisites
(none)
NCSA-0
NCSA-1
System Menu
Open Web content in Eclipse:
Open XSEDE User Portal
Open User Guide for a machine
NCSA-2
System Menu
Shortcuts for common PTP tasks:
Add Remote Environment adds a
Remote Tools connection for a
particular machine
Add System Monitor opens the
System Monitoring perspective and
begins monitoring a particular
machine
NCSA-3
System Menu
The plug-in is preconfigured with
information about XSEDE and
NCSA resources
The bottom four commands
generally prompt for a system
Select System can be used to
eliminate this prompt, so these
commands always act on a
particular system
NCSA-4
MyProxy Logon
MyProxy Logon allows you
to authenticate with a
MyProxy server
Often myproxy.teragrid.org
NCSA-5
Installation
1. Click Help > Install New Software
2. Click Add to open the Add Repository dialog
3. In the Location field, enter
http://forecaster.ncsa.uiuc.edu/updates/juno
NCSA-6
SSH Tunnel
Tunnel-0
Configure the
Synchronized Project SSH tunnel (1)
If your machine access requires ssh access through a
frontend/intermediate node, set up an ssh tunnel before configuring
the project - from command line or e.g. Windows PuTTY, e.g.
ssh -L <port>:<target-host> <userid>@<frontend-host>
(For details see http://wiki.eclipse.org/PTP/FAQ)
SSH Tunnel
Tunnel-1
Configure connection to
remote host SSH Tunnel (2)
In Target Environment Configuration
dialog, enter target name,
and host information
1. Specify Target name
2. If using a tunnel, select
Localhost and enter userid and
password for remote system
For direct access, just
select Remote Host, enter
hostname, userid,
password
3. select the Advanced button
to specify the port
Select Finish
1.
2.
3.
SSH Tunnel
Tunnel-2
Parallel Debugging
Objective
Learn the basics of debugging parallel programs
Contents
Launching a debug session
The Parallel Debug Perspective
Controlling sets of processes
Controlling individual processes
Parallel Breakpoints
Terminating processes
Parallel Debugging
Debug-0
Debugging Setup
Debugging requires interactive access to the application
Can use any of the -Interactive target configurations
Torque-Generic-Interactive
PBS-Generic-Interactive
OpenMPI-Generic-Interactive
Parallel Debugging
Debug-1
A debug configuration is
essentially the same as a run
configuration (like we used
in the Running an
Application module)
It is possible to re-use an
existing configuration and
add debug information
Use the drop-down next to
the debug button (bug icon)
instead of run button
Select Debug
Configurations to open
the Debug Configurations
dialog
Parallel Debugging
Debug-2
Parallel Debugging
Debug-3
Parallel Debugging
Debug-4
Debug-5
Exercise
1. Open the debug configuration dialog
2. Create a new configuration
3. Select the edu.sdsc.trestles.torque.interactive.openmpi
target configuration
4. Configure the Debug tab
Queue: shared
Number of nodes: 1:ppn=5
MPI Command: mpirun
MPI Number of Processes: 5
Parallel Debugging
Debug-6
Parallel Debugging
Debug-7
Parallel Debugging
Debug-8
Parallel Debugging
Debug-9
Parallel Debugging
Debug-10
Parallel Debugging
Debug-11
Parallel Debugging
Debug-12
Parallel Debugging
Debug-13
Remove
from set
Change
current set
Delete
set
Parallel Debugging
Debug-14
Parallel Debugging
Debug-15
Parallel Debugging
Debug-16
Process Registration
Process set commands apply to groups of
processes
For finer control and more detailed
information, a process can be registered and
isolated in the Debug view
Registered processes, including their stack
traces and threads, appear in the Debug
view
Any number of processes can be registered,
and processes can be registered or
un-registered at any time
Parallel Debugging
Debug-17
Debug-18
Registering A Process
To register a process,
double-click its process
icon in the Parallel
Debug view or select a
number of processes and
click on the register
button
Groups (sets)
of processes
Individual
(registered)
processes
To un-register a process,
double-click on the
process icon or select a
number of processes and
click on the unregister
button
Parallel Debugging
5-19
10
Parallel Debugging
Debug-20
Debug-21
11
Exercise
1. From the initial debugger session, step all processes
until the current line is just after MPI_Init (line 68)
2. Create a process set called workers containing
processes 1-4
3. Step the worker processes twice, observe two line
markers
4. Hover over markers to see properties
5. Switch to the root set
6. Step only process 0 twice so that all processes are now
at line 71 (hint use the debug view)
Debug-22
Parallel Debugging
Breakpoints
Apply only to processes in the particular set that is
active in the Parallel Debug view when the breakpoint
is created
Breakpoints are colored depending on the active
process set and the set the breakpoint applies to:
Green indicates the breakpoint set is the same
as the active set.
Blue indicates some processes in the breakpoint set are
also in the active set (i.e. the process sets overlap)
Yellow indicates the breakpoint set is different from the
active set (i.e. the process sets are disjoint)
Parallel Debugging
Debug-23
12
Creating A Breakpoint
Select the process set that
the breakpoint should apply
to, in this case, the workers
set
Double-click on the left edge
of an editor window, at the
line on which you want to set
the breakpoint, or right click
and use the Parallel
BreakpointToggle
Breakpoint context menu
The breakpoint is displayed
on the marker bar
Parallel Debugging
Debug-24
Parallel Debugging
Debug-25
13
More On Stepping
The Step buttons are only
enabled when all processes
in the active set are
suspended (yellow icon)
In this case, process 0 is still
running
Parallel Debugging
Debug-26
Breakpoint Information
Hover over breakpoint icon
Will show the sets this breakpoint applies to
Parallel Debugging
Debug-27
14
Breakpoints View
Use the menu in the breakpoints view to
group breakpoints by type
Breakpoints sorted by breakpoint set (process
set)
Parallel Debugging
Debug-28
Global Breakpoints
Apply to all processes and all jobs
Used for gaining control at debugger startup
To create a global breakpoint
First make sure that no jobs are selected (click in white
part of jobs view if necessary)
Double-click on the left edge of an editor window
Note that if a job is selected, the breakpoint will apply to
the current set
Parallel Debugging
Debug-29
15
Exercise
1. Select the worker process set
2. Create a breakpoint by double-clicking on right hand
bar at line 88 (worker function)
3. Hover over breakpoint to see properties
4. Switch to root process set
5. Observer breakpoint color changes to blue
6. Resume all processes
7. Observe worker processes at breakpoint, and process
0 still running (green icon)
8. Switch to worker process set
9. Step worker processes over worker() function
10. Observe output from program
Parallel Debugging
Debug-30
Debug-31
16
Parallel Debugging
Debug-32
Exercise
1.
2.
3.
4.
Parallel Debugging
Debug-33
17
Optional Exercise
1.
2.
3.
4.
5.
6.
7.
8.
Debug-34
18
Performance Tuning
and Analysis Tools
Objective
Become familiar with tools integrated with PTP, to help
enhance performance of parallel applications
Contents
Overview of ETFw and Performance Tools
Perf-0
Goal:
Reduce the eclipse plumbing
necessary to integrate tools
Provide integration for
instrumentation, measurement, and
analysis for a variety of performance
tools
Perf-1
4/3/2013
Performance Tuning
and Analysis Tools - TAU
Objective
Become familiar with tools integrated with PTP, to help
enhance performance of parallel applications
Contents
Performance Tuning and external tools:
PTP External Tools Framework (ETFw), TAU
Hands-on exercise using TAU with PTP
TAU
TAU-1
TAU
TAU-2
4/3/2013
TAU
TAU-3
TAU
TAU-4
4/3/2013
TAU-5
TAU
TAU-6
4/3/2013
TAU-7
Assumptions
Obtain and install TAU*
Download at tau.uoregon.edu
The website includes setup and user guides
TAU-8
4/3/2013
Selective Instrumentation
By default tau provides timing data for each
subroutine of your application
Selective instrumentation allows you to
include/exclude code from analysis and control
additional analysis features
TAU-9
TAU-10
4/3/2013
Select Configuration
Select the shallow configuration
prepared earlier
The Resource and Application
configuration tabs require little or
no modification
TAU
TAU-11
Select Tool/Workflow
Select the Performance Analysis tab and
choose the TAU tool set in the Select Tool
dropdown box
Other tools may be available, either installed as
plug-ins or loaded from workflow definition XML files
Configuration sub-panes appear depending on the
selected tool
Tabs may be
hidden if the
window is too
small
TAU
TAU-12
4/3/2013
TAU-13
TAU-14
4/3/2013
Compiler Options
TAU Compiler Options
Set arguments to TAU compiler scripts
Control instrumentation and
compilation behavior
Verbose shows activity of compiler
wrapper
KeepFiles retains instrumented source
PreProcess handles C type ifdefs in
fortran
In the Selective Instrumentation tab
select Internal then hit Apply
Scroll to bottom of the Tau Compiler tab
and activate TauSelectFile to use
tau.selective
TAU
TAU-15
Runtime Options
TAU Runtime options
Set environment variables used by
TAU
Control data collection behavior
Verbose provides debugging info
Callpath shows call stack
placement of events
Throttling reduces overhead
Tracing generates execution
timelines
TAU
Hover help
TAU-16
4/3/2013
TAU
TAU-17
TAU
TAU-18
4/3/2013
Paraprof
Use ParaProf for profile visualization to identify
performance hotspots
Inefficient sequential computation
Communication overhead
IO/Memory bottlenecks
Load imbalance
Suboptimal cache performance
TAU-19
Exercise
Multi-Trial profile comparison
1. Edit the shallow Makefile, adding -O3 to CFLAGS and FFLAGS
2. Rerun the analysis (Run->Profile Configurations. Hit Profile)
3. A second trial, distinguished by a new timestamp, will be
generated
It will appear in your Performance Data Manager view if a profile
database is available
Also present in the Profile subdirectory of your project directory
If you do not see a Profile directory right click on your project and go
to Synchronization->'Sync All Now'
4. Load the two trials in paraprof (on the command line: paraprof
/path/to/tauprofile.xml)
5. Open Windows->ParaProf Manager
6. Expand your database down to reveal all trials
7. Right click on each trial and click 'Add Mean to Comparison
Window' to visualize the two trials side by side
TAU
TAU-20
10
GEM
Graphical Explorer of MPI Programs
GEM
GEM-0
GEM
Graphical Explorer of MPI Programs
Dynamic verification for MPI C/C++ that detects:
Deadlocks
MPI object leaks (e.g. communicators, requests, datatypes)
Functionally irrelevant barriers
Local assertion violations
MPI Send/Recv Type Mismatches
GEM-1
GEM - Overview
Front-end for In-situ Partial Order (ISP)
developed at University of Utah
Contributes push-button C/C++ MPI
verification and analysis to the
development cycle
Automatically instruments and runs user
code, displaying post verification results
Variety of views & tools to facilitate
debugging and MPI runtime
understanding
GEM
GEM-2
GEM
Browser View
Groups and localizes MPI
problems. Maps errors to source
code in Eclipse editor
GEM-3
GEM
GEM-4
GEM-5
Pacheco Plugin
Ties in to GEM toolbar button
Provides a New
Eclipse View with
programming
examples from book
Automatically
import
examples into
workspace as
Eclipse C
projects
GEM-6
GEM
GEM-7
GEM
Hands-on Section
GEM
GEM-8
2
GEM
gem-demo
GEM-9
GEM
GEM
Instrumented executable
(.gem extension) is visible
after build (output in console)
Force a project sync if this is
not visible
GEM-11
GEM
GEM-12
GEM
GEM-13
GEM-14
Should look
like this now
GEM-15
GEM
Previous Transition
Last Transition
Next Transition
GEM
GEM-17
GEM
GEM-18
GEM-19
10
GEM
GEM-20
GEM-21
11
GEM-22
GEM-23
12
NOTE
Fixing these warnings is left as an exercise
at the end of this section
GEM
GEM-24
GEM
GEM-25
13
Reference Slides
NOTE: The following slides are not part of the
presentation or hands-on section
They are meant to be used as further reference and
to provide more detailed information on:
GEM setup, configuration and preference pages
Using GEM views
Help contribution
Troubleshooting
GEM Success stories
GEM
GEM-26
ISP Installation
ISP itself must be installed prior to using GEM
Download ISP at http://www.cs.utah.edu/fv/ISP
Make sure libtool, automake and autoconf are installed.
Just untar isp-0.3.1.tar.gz into a tmp directory:
Configure and install
./configure prefix=/my/preferred/install/location
make
make install
This installs binaries and necessary scripts
GEM
GEM-27
14
GEM Preferences
Set preferences for GEM and its underlying
verification tool, ISP
GEM
GEM-28
Also controls:
Call Browser
Happens Before Viewer launch
Re-launching of GEM
GEM
GEM-29
15
GEM
GEM-30
GEM
GEM-31
16
GEM-32
GEM-33
17
GEM
GEM-34
18
Contents
Build with -pg for gprof profiling
Build with -ftest-coverage fprofile-arcs for gcov
Run gcov to determine code coverage which parts of
your program are logically getting exercised
Run gprof to determined which parts of your program
are taking most of the execution time
Linux-0
Linux Tools
Linux Tools
http://eclipse.org/linuxtools
Linux Tools
Linux-1
Linux-2
Linux Tools
Linux Tools
Linux-3
Linux-4
Linux Tools
Windows only.
Mac/Linux can show
coverage for whole
Windows
file
only
Linux Tools
Linux-5
Linux-6
Linux Tools
Gprof tab
Double-click on gmon.out file to open
gprof viewer
Linux Tools
Linux-7
Linux Tools
Linux-8
Linux Tools
Linux-9
Linux Tools
Linux-11
Linux-12
Linux Tools
Linux Tools
Linux-13
It's interesting to
compare the summary
gmon output to that
from one of the ranks.
This view shows a
gmon.out file (you have
a gmon_shallow.xxx
file) from a single rank.
Linux Tools
Linux-14
Linux Tools
Linux-15
Linux-16
Linux Tools
Linux Tools
Linux-17
Linux-18
Linux Tools
Exercise
Follow directions in previous slides to
1. Add the compiler flags to Makefile
2. Modify run configuration as described (add gmon
prefix), and Run
3. View gmon and gcov files with gprof and gcov
viewers
Linux Tools
Linux-19
10
Optional Exercise
1) Run the shallow application with gcov compiler flags enabled.
a) Re-sync with Sync Active Now under Synchronization
b) View the tstep.gcno file and note the count, then repeat 1)a-b ,
have the counts changed?
2) Compare the tstep.f90 loops at lines 61, 70, 80 in the gprof and
gcov displays .
a) Change the Makefile to use O3 with FFLAGS and clean/rebuild/rerun
b) gprof s shallow gmon_shallow.273* [your most recent gmon_
files from the run you just finished ]
c) Re-sync the project
d) Does the gprof view of gmon.sum still exactly match up with the
gcov display? If not, what happened to the missing loop(s)?
Linux Tools
Linux-20
11
Contents
Import WRF from local directory and make into
synchronized project
Checkout WRF from CVS repository, and make into
synchronized project
Interactive configure script execution
Driving makefile from Eclipse
Installation
Install-0
WRF Scenarios
Case A: User downloads tarball from WRF
download site
Case B: User checks out WRF from source
repository
Quirks
WRF uses a user-interactive configure script to get
things going
But, can drive make after configure script is initially
run
WRF
WRF-1
WRF-2
Finish
Installation
Install-3
Import WRF
Import WRF from
local filesystem
Right click on project
name, Import
General, Filesystem
Installation
Install-4
Filesystem Browser
Select Browse to
look at your local
filesystem
Navigate to source
directory
Installation
Install-5
Installation
Install-6
Installation
Install-7
Convert to a synchronized
project
Right click on project
name, New>Other
Installation
Install-8
Installation
Install-9
Converting to synchronized
project
Can only convert one
project at a time
New project is eligible
Select open
connection to
yellowstone
Destination directory
should autofill
Select Finish
Installation
Install-10
Case A complete
We have successfully imported source from
our filesystem, and pushed it to yellowstone
Next, well try checking out the code from CVS
WRF
WRF-11
WRF-12
WRF
WRF-13
Check out as
Right click on
WRF341_2, select
Check out as
Note that since this
project is already an
Eclipse project, you
can only just check
out the project
Can rename on the
way (change project
name)
WRF
WRF-14
Installation
Install-15
Interactive Configure
Switch to the
Remote System
Explorer perspective
Open SSH Terminal
to yellowstone
Ptp-03-01-shell
Dont enter
password
Yubikey...
WRF
WRF-16
WRF-17
Synchronization Filtering
Git (used in
synchronized
projects) does not
like large, binary
files
Suggest to establish
filters on the project,
to prevent
performance issues
Right click on
project, Syncronize,
Filter
WRF
WRF-18
WRF
WRF-19
10
WRF
WRF-20
Exercise
Create a WRF synchronized project
Set up some synchronization filters for your
synchonized project
Run configure script
Make WRF from Eclipse
Make run configuration for WRF
WRF
WRF-21
11
Choose appropriate
repository
Installation
Install-22
Installation
Install-23
12
Share resources
And launch the
commit wizard
Installation
Install-24
File types
Note that can
classify unknown file
types (and make
persistent)
Installation
Install-25
13
Installation
Install-26
14
Tutorial Wrap-up
Objective
How to find more information on PTP
Learn about other tools related to PTP
See PTP upcoming features
Contents
Links to other tools, including performance tools
Planned features for new versions of PTP
Additional documentation
How to get involved
Tutorial Wrap Up
WrapUp-0
Python
http://pydev.org
Ruby
http://www.aptana.com/products/radrails
Perl
http://www.epic-ide.org
VI bindings
Vrapper (open source) - http://vrapper.sourceforge.net
viPlugin (commercial) - http://www.viplugin.com
Tutorial Wrap Up
WrapUp-1
Online Information
Information about PTP
PTP online help
http://help.eclipse.org
Main web site for downloads, documentation, etc.
http://eclipse.org/ptp
Wiki for designs, planning, meetings, etc.
http://wiki.eclipse.org/PTP
Tutorial Wrap Up
WrapUp-2
Mailing Lists
User Mailing Lists
PTP
http://dev.eclipse.org/mailman/listinfo/ptp-user
Photran
http://dev.eclipse.org/mailman/listinfo/photran
Tutorial Wrap Up
WrapUp-3
Getting Involved
See http://eclipse.org/ptp
Read the developer documentation on the wiki
http://wiki.eclipse.org/PTP
Tutorial Wrap Up
WrapUp-4
Tutorial Wrap Up
WrapUp-5
5
very useless
4
not so good
5
unacceptable
4
not so good
5
unacceptable