Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.parallel.ru/sites/default/files/ftp/cluster/scali/Scali_LibGuide_30.pdf
Дата изменения: Wed Nov 2 11:53:58 2011
Дата индексирования: Tue Oct 2 03:57:54 2012
Кодировка:

Поисковые слова: m 2-9
Scali Library User 's Guide


Copyright © 1999-2002 Scali AS. All rights reserved.

Acknowledgement
The development of ScaMPI has benefited greatly from the work of people not connected to Scali. We wish especially to thank the developers of MPICH for their work which serv ed as a reference w hen implementing the first version of ScaMPI. The list of persons contributing to algorithmic ScaMPI improvements is impossible to compile here. We apologise to those who remain unnamed and mention only those who certainly are responsible for a step forw ard. Scali is thankful to Rolf Rabenseifner for the improved reduce algorithm used in ScaMPI.


Table of contents
Chapter 1 Introduction .............................................................................................. 1.1 Scali Library Suite .................................................................................................... 1.1.1 ScaMPI ........................................................................................................ 1.1.2 ScaShmem ................................................................................................... 1.1.3 ScaIP ........................................................................................................... 1.1.4 ScaMAC ....................................................................................................... 7 7 7 7 7 7

Chapter 2 Using ScaMPI ............................................................................................ 9 2.1 Setting up a ScaMPI environment ........................................................................... 9 2.1.1 ScaMPI environment variables ................................................................. 9 2.2 Compiling and linking .............................................................................................. 9 2.2.1 Compiler support ...................................................................................... 10 2.2.2 Compiler flags ........................................................................................... 10 2.2.3 Linker flags ............................................................................................... 10 2.3 Running ScaMPI programs .................................................................................... 10 2.3.1 Nam ing convention ................................................................................... 10 2.3.2 mpimon - monitor program ...................................................................... 11 2.3.3 mpirun - wrapper script ........................................................................... 16 2.4 Useful tools .............................................................................................................. 19 2.4.1 Debug ging with a sequential debugger ................................................... 19 2.4.2 Usefull builtin-tools for debugging .......................................................... 19 2.4.3 Profiling ScaMPI applications ................................................................. 20 2.4.4 Profiling with ScaMPE ............................................................................. 26 2.5 An example program ............................................................................................... 28 2.5.1 Hello-world.c - source in C ....................................................................... 28 2.5.2 Hello-world.f - source in Fortran ............................................................. 28 2.5.3 Compiling .................................................................................................. 29 2.5.4 Linking ...................................................................................................... 29 2.5.5 Running ..................................................................................................... 29 2.6 MPI test programs .................................................................................................. 29 2.6.1 Producer - a producer-consumer MPI test program ............................... 29 2.6.2 Bandwidth - a bandwidth MPI test program .......................................... 30 2.6.3 Bidirect - a bidirectional MPI test prog ram. ........................................... 30 Chapter 3 3.1 General 3.1.1 3.1.2 Description of ScaMPI . description ........................ ScaMPI libraries .............. ScaMPI executables ......... ... ... ... ... .. .. .. .. ... ... ... ... .. .. .. .. .. .. .. .. ... ... ... ... .. .. .. .. ... ... ... ... .. .. .. .. ... ... ... ... .. .. .. .. .. .. .. .. ... ... ... ... .. .. .. .. ... ... ... ... .. .. .. .. ... ... ... ... .. .. .. .. .. .. .. .. ... ... ... ... .. .. .. .. ... ... ... ... .. .. .. .. ... ... ... ... .. .. .. .. ... ... ... ... .. .. .. .. .. .. .. .. ... ... ... ... .. .. .. .. 31 31 31 31

Scali Library User's Guide Version 3.0

3


3.2 Starting ScaMPI application programs ................................................................. 3.2.1 Application start-up - phase 1 .................................................................. 3.2.2 Application start-up - phase 2 .................................................................. 3.2.3 Application start-up - phase 3 .................................................................. 3.3 Stopping ScaMPI application programs ................................................................ 3.4 Communication protocols........................................................................................ 3.4.1 Inlining protocol ........................................................................................ 3.4.2 Eagerbuffering protocol ............................................................................ 3.4.3 Transporter protocol ................................................................................. 3.5 Communication resources ....................................................................................... 3.5.1 Channel buffer .......................................................................................... 3.5.2 Eagerbuffer buffer..................................................................................... 3.5.3 Transporter buffer .................................................................................... Chapter 4 Tips & Tricks for ScaMPI .................................................................... 4.1 Application program notes...................................................................................... 4.1.1 MPI_Probe() and MPI_Recv() ................................................................... 4.1.2 Unsafe MPI programs............................................................................... 4.2 Namespace pollution ............................................................................................... 4.3 Error and warning messages .................................................................................. 4.3.1 User interface errors and warnings ......................................................... 4.3.2 Fatal errors ............................................................................................... 4.4 When things don't work - troubleshooting ............................................................. 4.4.1 Standard input and ScaMPI .................................................................... 4.4.2 Why doesn't my program start to run? .................................................... 4.4.3 Why doesn't mpid start ............................................................................. 4.4.4 Interconnect problem s .............................................................................. 4.4.5 Why does my program terminate abnormally? ....................................... 4.4.6 How do I control SC I and local shared memory usag e? .......................... 4.5 H ow to optimize MPI performance......................................................................... 4.5.1 Performance analysis................................................................................ 4.5.2 Using MPI_Isend(), MPI_Irecv(). ............................................................. 4.5.3 Using MPI_Bsend(). .................................................................................. 4.5.4 Avoid starving mpi-processes - fairness. ................................................. 4.5.5 Using processor-power to poll. ................................................................. 4.5.6 Communication buffer adaption .............................................................. 4.5.7 Reorder network traffic to avoid conflicts................................................ 4.6 Benchmarking ......................................................................................................... 4.6.1 How to get ex pected performance ............................................................ 4.6.2 Memory consum ption increase after warm-up ........................................

3 3 3 3 3 3 3 3 3 3 4 4 4

2 2 2 3 4 5 6 7 8 9 0 1 2

43 43 43 44 44 45 45 45 45 45 45 46 46 47 48 49 49 49 49 49 50 50 50 51 51 51

4

Scali Library User's G uide Version 3.0


Ch 5.1 5.2 5.3

apter 5 ScaShmem ................................................................................................ Description .............................................................................................................. Application porting to ScaShmem.......................................................................... Features and limitations ........................................................................................ 5.3.1 Communication initialization and termination ...................................... 5.3.2 Runtime requirements ............................................................................. 5.3.3 Datatypes / porting ................................................................................... 5.3.4 Dynamic memory allocation..................................................................... 5.3.5 ScaShmem environment variables .......................................................... 5.4 Compiling and linking ............................................................................................ 5.5 Running y our application ....................................................................................... Ch 6.1 6.2 6.3 6.4 Ch 7.1 7.2 7.3 7.4 apter 6 ScaIP - IP for SCI ........................................................... Introduction ..................................................................................... Simplified netw ork model ............................................................... Config uration .................................................................................. ScaIP package installation ............................................................. .. .. .. .. .. ... ... ... ... ... .. .. .. .. .. ... ... ... ... ... .. .. .. .. .. ... ... ... ... ... .. .. .. .. .. .. .. .. .. .. ... ... ... ... ... .. .. .. .. ..

53 53 53 54 54 54 54 54 55 55 56 57 57 57 58 59 61 61 61 62 63 63 64 65 66 67 67 67 67 67 68 68 68

apter 7 ScaMAC .................................................................................................... Introduction ............................................................................................................. The scimac driv er .................................................................................................... Setting up the scimac driv er .................................................................................. The ScaMAC utilities .............................................................................................. 7.4.1 macstat - display scimac driver status .................................................... 7.4.2 macping - check reachability of remote scimac drivers .......................... 7.4.3 macctl - set the debug level of the scimac driver .................................... 7.5 ScaMAC packag e installation ................................................................................ Ch 8.1 8.2 8.3 8.4 8.5 8.6 8.7 apter 8 Support ..................................................................................................... Feedback .................................................................................................................. Scali mailing lists .................................................................................................... ScaMPI FAQ............................................................................................................ ScaMPI release documents ..................................................................................... Problem reports ....................................................................................................... Platforms supported ............................................................................................... Licensing .................................................................................................................

Chapter 9 Related documentation ........................................................................ 69 9.1 References ............................................................................................................... 69

Scali Library User's Guide Version 3.0

5


6

Scali Library User's G uide Version 3.0


Chapter 1

Introduction

A Scali System is a set of SCI interconnected nodes, where each node is a multiprocessor w orkstation running Linux. To help y ou use the full potential power of such a system we have developed a suite of libraries.

1.1 Scali Library Suite
1.1.1 ScaM PI ScaMPI is a high performance MPI implementation. The prog ramming environment for ScaMPI provides a variety of options and tools for tuning and debugging. ScaMPI utilises shared memory on intranode communication, and the fast SCI interconnect on internode communication. Any parallel MPI-conforming application can be run with ScaMPI and benefit from the SCI performance. The chapters conserning ScaMPI is written for users w hich have a basic understanding of MPI [1, 2, 3], and some basic knowledge of the C and/or Fortran programming language. gcc and bash are used for all examples.

1.1.2 ScaShmem ScaShMem is an implementation of the Cray/SG I Shmem abstraction. It is built on top of ScaMPI 1.1.3 ScaIP ScaIP is a version of IP based on SCI. 1.1.4 ScaM AC ScaMA C, Scali Media Access Control driv er for SCI, includes a kernel mode driver and some utilities to allow fast transfer of data on SCI.

Scali Library User's Guide Version 3.0

7


Chapter 1 Introduction

8

Scali Library User's G uide Version 3.0


Chapter 2

Using ScaMPI

This chapter describes the setup, compile, link and run of a prog ram using ScaMPI. Furthermore some useful tools for debugging and profiling are briefly discussed. Please note that the "ScaMPI release notes" are av ailable in the /opt/scali/doc/ScaMPI directory.

2.1 Setting up a ScaMPI environment
2.1.1 ScaM PI environment variables The use of ScaMPI requires that some environment v ariables are defined. These are usually set in the standard startup scripts (e.g. .bashrc when using bash), but they can also be defined manually.

Name
MPI_HOME

Description
Installa tion directory. For a standa rd installation, the variable should b e set as:

export MPI_HOME=/opt/scali
LD_LIBRARY_PATH Path to dyna mic link libraries. Must b e set to include the pa th to the directory where these libraries can b e found:

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$MPI_HOME/lib
PATH Path variab le. Must be updated to include the pa th to the directory where the MPI binaries can be found:

export PATH=${PATH}:$MPI_HOME/bin

Table 2-1: Environment variables Normally, the ScaMPI library's header files mpi.h and mpif.h reside in the $MPI_HO ME/include directory.

2.2 Compiling and linking
MPI is an "Application Programming Interface"(API) and not an "Application Binary Interface"(ABI). This means that you as a main rule should recompile and relink your application when starting to use ScaMPI. But since the MPICH-implementation is

Scali Library User's Guide Version 3.0

9


Chapter 2 Using ScaMPI

widely and Sc linked linked

used we have made ScaMPI ABI compatible depending on versions of MPICH aMPI. Please check "ScaMPI release notes" for details. Having an application with mpich you should be able to just change library-path if it is dynamically or you have to relink it if you have linked it statically.

2.2.1 Compiler support ScaMPI is a C++ library built using the GNU compiler.This implies that you have to link with the G NU runtime library. Depending on the compiler used, the way to link with the ScaMPI libraries varies. Check the "ScaMPI release notes" for information on supported compilers and how linking is done. Please note that the GNU compiler, or a similar version of the C++ compiler, must be installed on your system. The G NU compilers are included in the ScaFegcs package, available for dow nload at http://www.scali.com/download. 2.2.2 Compiler flags The follow ing string must be included as compile flags (bash syntax):
"-D_REENTRANT -I$MPI_HOME/include"

2.2.3 Linker flags The follow ing string outlines the setup for the necessary link flags (bash syntax):
"-L/opt/scali/lib $CRT_BEGIN -lmpi $CRT_END"

The runtime setup CRT_BEG IN and CRT_END libraries are defined for some compilers. Please note that when linking a Fortran main prog ram, the Fortran interface library libfmpi must be included before CRT_B EGIN.

2.3 Running ScaMPI programs
Note that executables issuing ScaMPI calls cannot be started directly from a shell prompt. ScaMPI programs can either be started using the MPI monitor program mpimon, the wrapper script mpirun, or from the Scali Universe GUI [4]. 2.3.1 Naming convention When an application program is started, ScaMPI is modifying argv[0]. The following convention is used for the executable, reported on the command line using the Unix utility ps: -(mpi:@) where:

10

Scali Library User's G uide Version 3.0


2.3 Running ScaMPI programs

is the name of the application program. is the application's mpi-process rank number. is the Unix process identifier of the monitor program mpimon. is the name of the node where mpimon is running. Note that ScaMPI requires a homogenous file system image, i.e., a file system providing the same path and program names on all nodes of the Scali System. 2.3.2 mpimon - monitor program The control and start-up of an ScaMPI application is monitored by mpimon. The program mpimon has several options which can be used for optimising ScaMPI performance. Normally it should not be necessary to use any of these options. However, unsafe MPI programs [3] mig ht need buffer adjustments to solve deadlocks. Trading performance by changing communication space is best av oided if there is no compelling reason to do so. 2.3.2.1 Basic usage Normally the program is invoked as:
mpimon -- [] [ []]...

Parameter
-[ []] Name of a pplication program.

Description

Program options for the application program. Separator, ma rks end of user progra m options. Name of node and the number of mpi-processes to run on that node. The option can occur several times in the list. Mpi-processes will be given ra nks sequentia lly according to the list of node-number pairs.

Table 2-2: Basic options to mpimon 2.3.2.2 Advanced usage The complete syntax for the program:
mpimon []... [-- ]...

Scali Library User's Guide Version 3.0

11


Chapter 2 Using ScaMPI

Parameter
-

Description
-- []... []... Name of application program. Program options for the application program. Separator, signa ls end of user progra m options. [] Name of node. Given either a s a node name or as an Internet a ddress expressed in the Internet standard dot notation. Number of mpi-processes to run on node. If is omitted, one mpiprocess is started on each node specified.



Table 2-3: mpimon parameters Numeric values can be given as mpimon options in the following way: Option


Description
| : = * 1024 : = * 1024 * 1024

Table 2-4: Numeric input

12

Scali Library User's G uide Version 3.0


2.3 Running ScaMPI programs

A complete lists of available mpimon options

:

mpimon option
--automatic

Description
Separa tor, ma rks end of user program options. Set automatic-mode for process(es). Default: none Legal: `n,m,o..' = (list) or `n-m' = (range) or `all' Set numb er of barrier fanin reads. Default: 8 Set numb er of barrier fanout reads. Default: 8 Set debug-mode for process(es). Default: none Legal: `n,m,o..' = (list) or `n-m' = (range) or `all' Set debugger to start in debug-mode. Disable process timeout. Set display to use in deb ug-/manual-mode. Set dryrun-mode. Default: none Legal: `none' or `totalview' Define how to export environment. Default: export Legal: `expor t' = all or `mpi' = MP I_?? or `none' Set exact-match-mode. Set path to internal executables. Display availab le options. Set installa tion-directory. Handling of immedia tes. Default: lazy Legal: lazy, threaded, automatic Inherit userdefinable limits to processes. Initialise MPI_COMM_WORLD at startup (all channels are created).

-bar rier_fanin

-bar rier_fanout

-debug

-debugger -disable-timeout -display -dryrun

-environment

-exact_matc h -execpath -help -home -immediate_handling

-inherit_limits -init_comm_world

Table 2-5: Complete list of mpimon options

Scali Library User's Guide Version 3.0

13


Chapter 2 Using ScaMPI

mpimon option
-inter_adapters

Description
Set list of sci adapters for inter-communication. Defa ult: all Legal: `n,m,o..' = (list) or `n-m' = (range) or `all' Set threshold for inlining (in bytes) per inter-channel. Defa ult: 1030 Set buffer size (in bytes) per inter-cha nnel. Defa ult: 4K Legal: Powers of 2 Set chunk-size for inter-communication. Defa ult: 512k Legal: Multiplum of pages Set numb er of b uffers for eager inter-protocol. Defa ult: 2 Set buffer size (in bytes) for eager inter-protocol. Defa ult: 256K Legal: Powers of 2 Set threshold (in bytes) for eager inter-protocol. Defa ult: 32K Legal: Powers of 2 Set buffer-pool-size for inter-communication. Defa ult: 32M Legal: Multiplum of pages Set numb er of b uffers for tra nsporter inter-protocol. Defa ult: 4 Legal: Powers of 2 Set buffer size (in bytes) for tra nsporter inter-protocol. Defa ult: 256K Set threshold for inlining (in bytes) per intra-channel. Defa ult: 560 Set buffer size (in bytes) per intra -channel. Defa ult: 4K Legal: Powers of 2 Set chunk-size for intra-communication. Defa ult: 1M Legal: Multiplum of pages Set numb er of b uffers for eager intra -protocol. Defa ult: 2

-inter_channel_inline_threshold -inter_channel_size

-inter_chunk_size

-inter_eager_count

-inter_eager_size

-inter_eager_threshold

-inter_pool_size

-inter_transporter _count

-inter_transporter _size

-intra_channel_inline_threshold -intra_channel_size

-intra_chunk_size

-intra_eager_count

Table 2-5: Complete list of mpimon options

14

Scali Library User's G uide Version 3.0


2.3 Running ScaMPI programs

mpimon option
-intra_eager _size

Description
Set buffer size (in bytes) for eager intra-protocol. Default: 128K Legal: Powers of 2 Set threshold (in bytes) for eager intra-protocol. Default: 1M Legal: Powers of 2 Set buffer-pool-size for intra-communication. Default: 4M Legal: Multiplum of pages Set numb er of buffers for transporter intra -protocol. Default: 4 Legal: Powers of 2 Set buffer size (in bytes) for transporter intra -protocol. Default: 64K Set manual-mode for process(es). Default: none Legal: `n,m,o..' = (list) or `n-m' = (range) or `all' Read parameters from the named file. Default: none Ena ble sepa rate output for process(es). Filename: ScaMPIoutput_host_pid_rank Default: none Legal: `n,m,o..' = (list) or `n-m' = (range) or `all' Applica tion use Cra y ShMem library. Set debug-mode for submonitor(s). Default: none Legal: `n,m,o..' = (list) or `n-m' = (range) or `all' Set manual-mode for submonitor(s). Default: none Legal: `n,m,o..' = (list) or `n-m' = (range) or `all' Ena ble trace for submonitor(s). Default: none Legal: `n,m,o..' = (list) or `n-m' = (range) or `all' Ena ble statistics. Distrib ute standard in to process(es). Default: none Legal: `n,m,o..' = (list) or `n-m' = (range) or `all'

-intra_eager _thr eshold

-intra_pool_size

-intra_transpor ter_c ount

-intra_transpor ter_size

-manual

-read

-separate_output

-shmem -sm_debug

-sm_manual

-sm_trace

-statistic s -stdin

Table 2-5: Complete list of mpimon options

Scali Library User's Guide Version 3.0

15


Chapter 2 Using ScaMPI

mpimon option
-timeout