mpi-report-j.dvi

Size: px
Start display at page:

Download "mpi-report-j.dvi"

Transcription

1 MPI: ( ) MPI MPI

2 MPI: A Message-Passing Interface Standard Message Passing Interface Forum June, This workwas supported in part by ARPA and NSF under grant ASC-0, the National Science Foundation Science and Technology Center Cooperative Agreement No. CCR-0, and by the Commission of the European Community through Esprit project P (PPPE).

3 . : Message Passing Interface Forum MPI : Message Passing Interface Forum (MPIF) MPIF Message Passing Interface MPI Message Passing Interface Forum.0 MPI La TE X MPI mpi-comments@cs.utk.edu MPIF c, University oftennessee, Knoxville, Tennessee. Permission to copy without fee all or part of this material is granted, provided the University oftennessee copyright notice and the title of this document appear, and notice is given that copying is by permission of the UniversityofTennessee.

4 University of Tennessee c Koichi Konishi c Hitachi, Ltd. ( ) - c Shinji Hioki - c Atsushi Nakamura c Ryoichi Shibata - c Hirotaka Ogawa - c NEC Corporation ( ) - -, - c Masao Mori - c Toshio Tange c Naohiko Shimizu - c Hitoshi Yamauchi - c Hiroshi Ohtsuka c Satoru Kumamoto c Takayoshi Shoudai c Yoshihiro Mizoguchi

5 x xii MPI. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : MPI. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. Fortran : : : : : : : : : : : : : : :.. C : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :

6 . : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : :.. POSIX : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. Probe : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 0. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :

7 .. : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. MPI BCAST : : : : : : : : : : : : : : : : : : : : : : : : : : :. Gather : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. MPI GATHER MPI GATHERV : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. MPI SCATTER MPI SCATTER : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. MPI ALLGATHER, MPI ALLGATHERV : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. Reduce : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : :.. MINLOC MAXLOC : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : :.. All-Reduce : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. Reduce-Scatter : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. Scan : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 0.. MPI SCAN : : : : : : : : : : : : : : : : : : : : : : : : : : : 0. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : :.. MPI : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 0.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 0

8 .. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. # : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. # : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. ( ) # : : : : : : : : : : : : : : : : : : : : : : : 0.. # : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. Library Example # : : : : : : : : : : : : : : : : : : : : : : : : : : :.. # : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : 0.. : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 0.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. MPI : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : :

9 .. : MPI DIMS CREATE : : : : : : : : : : : : : : :.. ( ) : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : 0. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : MPI. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : :.. MPI : : : : : : : : : : : : : : : : : : : : : : : : : :.. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Bibliography A A. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : A. C Fortran : : : : : : : : : : : : : : : : A. C : : : : : : : : : : : : : : : : : : : : : A. C : : : : : : : : : : : : : : : : : : : : : : A. C : : : : : A. C : : : : : : : : : : : : : : : : A. C : : : : : : : : : : : : : : : : : : :

10 A. C : : : : : : : : : : : : : : : : : : A. Fortran : : : : : : : : : : : : : : : : : : A. Fortran : : : : : : : : : : : : : : : : : : : A. Fortran : : : : : : : A. Fortran : : : : : : : : : : : : : 0 A. Fortran : : : : : : : : : : : : : : : A. Fortran : : : : : : : : : : : : : : MPI Function Index

11 Message Passing Interface (MPI) JackDongarra, David Walker Ewing Lusk, Bob Knighten Marc Snir, William Gropp, Ewing Lusk Al Geist, Marc Snir, Steve Otto Steve Otto Rolf Hempel Ewing Lusk William Gropp James Cownie Tony Skjellum, Lyndon Clarke, Marc Snir, Richard Littleeld, MarkSears Steven Huss-Lederman MPI

12 Ed Anderson Robert Babb Joe Baron Eric Barszcz Scott Berryman Rob Bjornson Nathan Doss Anne Elster Jim Feeney Vince Fernando Sam Fineberg Jon Flower Daniel Frye Ian Glendinning Adam Greenberg Robert Harrison Leslie Hart Tom Haupt Don Heller Tom Henderson Alex Ho C.T. Howard Ho Gary Howell John Kapenga James Kohl Susan Krauss Bob Leary Arthur Maccabe Peter Madams Alan Mainwaring Oliver McBryan Phil McKinley Charles Mosher Dan Nessett Peter Pacheco Howard Palmer Paul Pierce Sanjay Ranka Peter Rigsbee Arch Robison Erich Schikuta Ambuj Singh Alan Sussman Robert Tomlinson Robert G. Voigt Dennis Weeks Stephen Wheat Steven Zenith anonymous FTP MPI ( ) ARPA NSF ESPRIT

13 ( ) (Hiroyuki Araki) NEC C&C (, ) (Hiroshi Ohtsuka) (,, ) (Hirotaka Ogawa) (Uichi Katsuta) ( ) (Satoru Kumamoto) (Koichi Konishi) NEC Research Institute (, ) (Nobutoshi Sagawa) (Ryoichi Shibata) (Naohiko Shimizu) ( ) (Takayoshi Shoudai) (Masanori Tamura) ( ) ( ) (Toshio Tange) NEC (Kenta Nakamura) ( ) (Atsushi Nakamura) (Takeshi Hayasaka) ( )

14 (Kei Harada) ( ) (Shinji Hioki) ( - ) (Yoshihiro Mizoguchi) (Maso Mori) (Hitoshi Yamauchi) (Jiro Kanayama) (Jun Nakano) IBM (Hideaki Murata) (Youichi Yabuki) ( )SRA NEC PHASE( ) NEC Research Institute ftp

15 Chapter MPI. MPI MPI IBM T. J. Watson Research Center [, ] Intel NX/ [] Express [] ncube Vertex [] p [, ] PARMACS [, ] Zipcode [, ] Chimp [, ] PVM [, ] Chameleon [] PICL [] MPI 0 MPI [] (Workshop on Standards for Message Passing in a Distributed Memory Environment) - (Center for Research on Parallel Computing)

16 Chapter MPI Dongarra Hempel Hey, Walker MPI [] MPI MPI MPI MPI High Performance Fortran Forum MPI MPI Supercomputing MPI MPI C Fortran

17 .. PVM NX Express p. Fortran C. MIMD SPMD MPI MPI MPI Unix MPI

18 Chapter MPI MPI MPI [, ]. Fortran C.

19 .. MPI. MPI MPI MPI send receive MPI MPI MPI MPI MPI

20 Chapter MPI A Fortran C MPI MPI MPI C Fortran

21 Chapter MPI MPI. MPI MPI. MPI

22 Chapter MPI.. MPI MPI MPI C C void copyintbuffer( int *pin, int *pout, int len ) { int i; for (i=0; i<len; ++i) *pout++ = *pin++; } int a[]; copyintbuffer ( a, a+, ); C MPI Fortran MPI ANSI C Fortran

23 ... MPI ( ) MPI... MPI MPI ( ) MPI MPI Fortran C Fortran C

24 Chapter MPI MPI MPI MPI.. MPI TYPE COMMIT MPI Wait Test.... MPI MPI C Fortran POSIX Fortran

25 .. MPI COMM GROUP.. MPI len

26 Chapter MPI len.. MPI MPI ERRHANDLER SET MPI ERRORS ARE FATAL MPI ERRORS RETURN.. MPI MPI ANY TAG MPI ANY TAG MPI MPI COMM WORLD Fortran MPI BOTTOM MPI MPI INIT() ) MPI MPI FINALIZE().. MPI ( Fortran <type> C (void *).. MPI

27 ... MPI Fortran ANSI C Fortran 0 C++ Fortran ANSI C Fortran 0 C++ PARAMETER( ) Fortran argument ( ) C parameter C argument (C ) Fortran.. Fortran MPI MPI MPI MPI Fortran MPI MPI SUCCESS Fortran MPI F ANSI Fortran ANSI Fortran Fortran

28 Chapter MPI double precision a integer b... call MPI_send(a,...) call MPI_send(b,...).: MPI MPI MPI. Fortran MPI SEND MPI FORTRAN PARAMETER mpif.h Fortran mpif.h MPI ADDRESS (INTEGER*) (INTEGER*) MPI Fortran MPI MPI BOTTOM.... C ANSI C MPI MPI

29 .. MPI sf mpi.h C MPI SUCCESS C void* MPI MPI Aint int MPI C. MPI MIMD MPI MPI MPI MPI MPI MPI ( ) MPI : C MPI Wtime MPI Wtick double

30 Chapter MPI MPI MPI MPI MPI MPI MPI MPI MPI MPI. MPI MPI MPI MPI

31 .. MPI MPI MPI MPI MPI MPI MPI. MPI MPI MPI MPI MPI MPI MPI

32 Chapter MPI. MPI MPI.. MPI Fortran date write ANSI C printf malloc MPI INIT MPI FINALIZE MPI MPI COMM WORLD ANSI C int rank; MPI_Init( argc, argv ); MPI_Comm_rank( MPI_COMM_WORLD, &rank ); if (rank == 0) printf( "Starting program\n" ); MPI_Finalize(); Fortran MPI MPI_Comm_rank( MPI_COMM_WORLD, &rank ); printf( "Output from task rank %d\n", rank );

33 .... POSIX MPI UNIX MPI MPI MPI MPI MPI MPI MPI UNIX SIGALRM MPI MPI MPI MPI MPI MPI MPI MPI MPI MPI MPI SIGALRM SIGFPE SIGIO MPI MPI Unix man.

34 Chapter. MPI (send) (receive) #include "mpi.h" main( argc, argv ) int argc; char **argv; { char message[]; int myrank; MPI_Status status; MPI_Init( &argc, &argv ); MPI_Comm_rank( MPI_COMM_WORLD, &myrank ); if (myrank == 0) /* 0 */ { strcpy(message,"hello, there"); MPI_Send(message, strlen(message), MPI_CHAR,,, MPI_COMM_WORLD); } else /* */ { MPI_Recv(message,, MPI_CHAR, 0,, MPI_COMM_WORLD, &status); printf("received :%s:\n", message); }

35 .. } MPI_Finalize(); 0 (myrank = 0) MPI SEND message 0 message ( :,.. ) (myrank = ) MPI RECV message...

36 Chapter MPI SEND(buf, count, datatype, dest, tag, comm) buf ( ) count ( ) datatype ( ) dest ( ) tag ( ) comm ( ) int MPI Send(void* buf, int count, MPI Datatype datatype, int dest, int tag, MPI Comm comm) MPI SEND(BUF, COUNT, DATATYPE, DEST, TAG, COMM, IERROR) <type> BUF(*) INTEGER COUNT, DATATYPE, DEST, TAG, COMM, IERROR... MPI SEND datatype count buf datatype count count 0 Fortran Fortran

37 .. MPI datatype MPI INTEGER MPI REAL MPI DOUBLE PRECISION MPI COMPLEX MPI LOGICAL MPI CHARACTER MPI BYTE MPI PACKED Fortran datatype INTEGER REAL DOUBLE PRECISION COMPLEX LOGICAL CHARACTER() C C types are listed below. MPI datatype MPI CHAR MPI SHORT MPI INT MPI LONG MPI UNSIGNED CHAR MPI UNSIGNED SHORT MPI UNSIGNED MPI UNSIGNED LONG MPI FLOAT MPI DOUBLE MPI LONG DOUBLE MPI BYTE MPI PACKED C datatype signed char signed short int signed int signed long int unsigned char unsigned short int unsigned int unsigned long int float double long double MPI BYTE MPI PACKED Fortran C MPI BYTE MPI PACKED.

38 Chapter MPI Fortran ANSI C MPI longlong int C MPI LONG LONG INT DOUBLE PRECISION Fortran MPI DOUBLE COMPLEX REAL* REAL* REAL* Fortran MPI REAL MPI REAL MPI REAL INTEGER* INTEGER* INTEGER* Fortran MPI INTEGER MPI INTEGER MPI INTEGER MPI MPI.... ID dest tag 0,...,UB UB MPI TAG UB MPI UB comm

39 .. \ " dest 0,..., n- n MPI MPI COMM WORLD MPI MPI COMM WORLD comm MPI COMM WORLD ID..

40 Chapter MPI RECV (buf, count, datatype, source, tag, comm, status) buf ( ) count ( ) datatype ( ) source ( ) tag ( ) comm ( ) status ( ) int MPI Recv(void* buf, int count, MPI Datatype datatype, int source, int tag, MPI Comm comm, MPI Status *status) MPI RECV(BUF, COUNT, DATATYPE, SOURCE, TAG, COMM, STATUS, IERROR) <type> BUF(*) INTEGER COUNT, DATATYPE, SOURCE, TAG, COMM, STATUS(MPI STATUS SIZE), IERROR. datatype count buf. MPI PROBE MPI status MPI

41 .. source tag comm source MPI ANY SOURCE / tag MPI ANY TAG / comm source= MPI ANY SOURCE tag= MPI ANY TAG tag source MPI ANY SOURCE source f0,...,n-g[fmpi ANY SOURCEg n \ " \ " =... MPI..

42 Chapter MPI RECV status status MPI C status MPI SOURCE MPI TAG MPI ERROR status.mpi SOURCE status.mpi TAG status.mpi ERROR Fortran status MPI STATUS SIZE INTEGER MPI SOURCE MPI TAG MPI ERROR status(mpi SOURCE) status(mpi TAG) status(mpi ERROR).. MPI ERR IN STATUS MPI WAIT MPI \ " MPI GET COUNT MPI GET COUNT(status, datatype, count) status ( ) datatype ( ) count ( ) int MPI Get count(mpi Status status, MPI Datatype datatype, int *count) MPI GET COUNT(STATUS, DATATYPE, COUNT, IERROR) INTEGER STATUS(MPI STATUS SIZE), DATATYPE, COUNT, IERROR

43 .. datatype datatype status.. MPI GET COUNT MPI UNDEFINED count tag source MPI ANY TAG \ " datatype MPI GET COUNT MPI PROBE buf count datatype source dest tag comm status MPI SEND MPI RECV......

44 Chapter MPI INTEGER MPI INTEGER MPI REAL MPI REAL. MPI PACKED MPI INTEGER INTEGER Fortran Fortran C.. MPI BYTE MPI PACKED. MPI PACKED MPI BYTE ( MPI BYTE ) ( MPI BYTE ) MPI BYTE MPI PACKED. CALL MPI_COMM_RANK(comm, rank, ierr) IF(rank.EQ.0) THEN CALL MPI_SEND(a(),, MPI_REAL,, tag, comm, ierr) ELSE CALL MPI_RECV(b(),, MPI_REAL, 0, tag, comm, status, ierr) END IF a b Fortran a() (equiv-

45 .. alence ) a b. CALL MPI_COMM_RANK(comm, rank, ierr) IF(rank.EQ.0) THEN CALL MPI_SEND(a(),, MPI_REAL,, tag, comm, ierr) ELSE CALL MPI_RECV(b(),, MPI_BYTE, 0, tag, comm, status, ierr) END IF. CALL MPI_COMM_RANK(comm, rank, ierr) IF(rank.EQ.0) THEN CALL MPI_SEND(a(),, MPI_BYTE,, tag, comm, ierr) ELSE CALL MPI_RECV(b(), 0, MPI_BYTE, 0, tag, comm, status, ierr) END IF a b MPI BYTE MPI SEND MPI buf Fortran CHARACTER MPI BYTE Fortran CHARACTER

46 Chapter MPI CHARACTER MPI CHARACTER CHARACTER Fortran CHARACTER Fortran. Fortran CHARACTER CHARACTER* a CHARACTER* b CALL MPI_COMM_RANK(comm, rank, ierr) IF(rank.EQ.0) THEN CALL MPI_SEND(a,, MPI_CHARACTER,, tag, comm, ierr) ELSE CALL MPI_RECV(b(:),, MPI_CHARACTER, 0, tag, comm, status, ierr) END IF b 0 a MPI CHARACTER Fortran (. ) MPI CHARACTER MPI MPI MPI CHARACTER Fortran CHARACTER MPI

47 .... MPI REAL INTEGER IEEE MPI MPI MPI MPI BYTE MPI CHARACTER MPI CHAR EBCDIC ASCII MPI.. a b REAL a

48 Chapter b XDR MPI C Fortran C Fortran MPI MPI MPI Fortran MPI INT MPI CHAR \C MPI " C Fortran... :

49 .. MPI.. MPI MPI MPI : MPI MPI. MPI.

50 Chapter B S R MPI BSEND (buf, count, datatype, dest, tag, comm) buf ( ) count ( ) datatype ( ) dest ( ) tag ( ) comm ( ) int MPI Bsend(void* buf, int count, MPI Datatype datatype, int dest, int tag, MPI Comm comm) MPI BSEND(BUF, COUNT, DATATYPE, DEST, TAG, COMM, IERROR) <type> BUF(*) INTEGER COUNT, DATATYPE, DEST, TAG, COMM, IERROR

51 .. MPI SSEND (buf, count, datatype, dest, tag, comm) buf ( ) count ( ) datatype ( ) dest ( ) tag ( ) comm ( ) int MPI Ssend(void* buf, int count, MPI Datatype datatype, int dest, int tag, MPI Comm comm) MPI SSEND(BUF, COUNT, DATATYPE, DEST, TAG, COMM, IERROR) <type> BUF(*) INTEGER COUNT, DATATYPE, DEST, TAG, COMM, IERROR MPI RSEND (buf, count, datatype, dest, tag, comm) buf ( ) count ( ) datatype ( ) dest ( ) tag ( ) comm ( ) int MPI Rsend(void* buf, int count, MPI Datatype datatype, int dest, int tag, MPI Comm comm) MPI RSEND(BUF, COUNT, DATATYPE, DEST, TAG, COMM, IERROR) <type> BUF(*) INTEGER COUNT, DATATYPE, DEST, TAG, COMM, IERROR

52 Chapter MPI : : : :

53 ... MPI : MPI ANY SOURCE MPI CANCEL MPI WAITANY. CALL MPI_COMM_RANK(comm, rank, ierr) IF (rank.eq.0) THEN CALL MPI_BSEND(buf, count, MPI_REAL,, tag, comm, ierr) CALL MPI_BSEND(buf, count, MPI_REAL,, tag, comm, ierr)

54 Chapter ELSE! CALL MPI_RECV(buf, count, MPI_REAL, 0, MPI_ANY_TAG, comm, status, ierr) CALL MPI_RECV(buf, count, MPI_REAL, 0, tag, comm, status, ierr) END IF. CALL MPI_COMM_RANK(comm, rank, ierr) IF (rank.eq.0) THEN CALL MPI_BSEND(buf, count, MPI_REAL,, tag, comm, ierr) CALL MPI_SSEND(buf, count, MPI_REAL,, tag, comm, ierr) ELSE! CALL MPI_RECV(buf, count, MPI_REAL, 0, tag, comm, status, ierr) CALL MPI_RECV(buf, count, MPI_REAL, 0, tag, comm, status, ierr) END IF 0 MPI

55 .. MPI MPI MPI MPI.. CALL MPI_COMM_RANK(comm, rank, ierr) IF (rank.eq.0) THEN CALL MPI_SEND(sendbuf, count, MPI_REAL,, tag, comm, ierr) CALL MPI_RECV(recvbuf, count, MPI_REAL,, tag, comm, status, ierr) ELSE! CALL MPI_RECV(recvbuf, count, MPI_REAL, 0, tag, comm, status, ierr)

56 Chapter CALL MPI_SEND(sendbuf, count, MPI_REAL, 0, tag, comm, ierr) END IF. CALL MPI_COMM_RANK(comm, rank, ierr) IF (rank.eq.0) THEN CALL MPI_RECV(recvbuf, count, MPI_REAL,, tag, comm, status, ierr) CALL MPI_SEND(sendbuf, count, MPI_REAL,, tag, comm, ierr) ELSE! CALL MPI_RECV(recvbuf, count, MPI_REAL, 0, tag, comm, status, ierr) CALL MPI_SEND(sendbuf, count, MPI_REAL, 0, tag, comm, ierr) END IF. CALL MPI_COMM_RANK(comm, rank, ierr) IF (rank.eq.0) THEN CALL MPI_SEND(sendbuf, count, MPI_REAL,, tag, comm, ierr) CALL MPI_RECV(recvbuf, count, MPI_REAL,, tag, comm, status, ierr) ELSE! CALL MPI_SEND(sendbuf, count, MPI_REAL, 0, tag, comm, ierr) CALL MPI_RECV(recvbuf, count, MPI_REAL, 0, tag, comm, status, ierr) END IF count

57 .. \ ". \ " \ ".. MPI BUFFER ATTACH( buer, size) buer size int MPI Buffer attach( void* buffer, int size)

58 Chapter MPI BUFFER ATTACH( BUFFER, SIZE, IERROR) <type> BUFFER(*) INTEGER SIZE, IERROR MPI MPI BUFFER DETACH( buer, size) buer ( ) size ( ) ( ) int MPI Buffer detach( void** buffer, int* size) MPI BUFFER DETACH( BUFFER, SIZE, IERROR) <type> BUFFER(*) INTEGER SIZE, IERROR MPI. #define BUFFSIZE 000 int size char *buff; MPI_Buffer_attach( malloc(buffsize),buffsize); /* 000 MPI_Bsend */ MPI_Buffer_detach( &buff, &size); /* 0 */ MPI_Buffer_attach( buff, size); /* 000 */ MPI Buer attach MPI Buer detach void* MPI Buer attach

59 .. MPI Buer detach void* void* void** char** &bu MPI Buer detach void** MPI MPI MPI MPI MPI MPI.... pending message entries=pme

60 Chapter PME n n MPI BSEND count,datatype,comm MPI PACK SIZE( count, datatype, comm, size ). MPI MPI BSEND OVERHEAD n PME MPI PACK.

61 .. MPI \ " MPI \ " \ "

62 Chapter.... B S R I( immediate

63 .. MPI ISEND(buf, count, datatype, dest, tag, comm, request) buf count datatype dest tag comm request int MPI Isend(void* buf, int count, MPI Datatype datatype, int dest, int tag, MPI Comm comm, MPI Request *request) MPI ISEND(BUF, COUNT, DATATYPE, DEST, TAG, COMM, REQUEST, IERROR) <type> BUF(*) INTEGER COUNT, DATATYPE, DEST, TAG, COMM, REQUEST, IERROR MPI IBSEND(buf, count, datatype, dest, tag, comm, request) buf count datatype dest tag comm request int MPI Ibsend(void* buf, int count, MPI Datatype datatype, int dest, int tag, MPI Comm comm, MPI Request *request) MPI IBSEND(BUF, COUNT, DATATYPE, DEST, TAG, COMM, REQUEST, IERROR) <type> BUF(*) INTEGER COUNT, DATATYPE, DEST, TAG, COMM, REQUEST, IERROR

64 0 Chapter MPI ISSEND(buf, count, datatype, dest, tag, comm, request) buf count datatype dest tag comm request int MPI Issend(void* buf, int count, MPI Datatype datatype, int dest, int tag, MPI Comm comm, MPI Request *request) MPI ISSEND(BUF, COUNT, DATATYPE, DEST, TAG, COMM, REQUEST, IERROR) <type> BUF(*) INTEGER COUNT, DATATYPE, DEST, TAG, COMM, REQUEST, IERROR MPI IRSEND(buf, count, datatype, dest, tag, comm, request) buf count datatype dest tag comm request int MPI Irsend(void* buf, int count, MPI Datatype datatype, int dest, int tag, MPI Comm comm, MPI Request *request) MPI IRSEND(BUF, COUNT, DATATYPE, DEST, TAG, COMM, REQUEST, IERROR)

65 .. <type> BUF(*) INTEGER COUNT, DATATYPE, DEST, TAG, COMM, REQUEST, IERROR MPI IRECV (buf, count, datatype, source, tag, comm, request) buf count datatype dest tag comm request int MPI Irecv(void* buf, int count, MPI Datatype datatype, int source, int tag, MPI Comm comm, MPI Request *request) MPI IRECV(BUF, COUNT, DATATYPE, SOURCE, TAG, COMM, REQUEST, IERROR) <type> BUF(*) INTEGER COUNT, DATATYPE, SOURCE, TAG, COMM, REQUEST, IERROR request.. MPI WAIT MPI TEST

66 Chapter MPI REQUEST NULL. tag = MPI ANY TAG source = MPI ANY SOURCE MPI GET- COUNT MPI GET ELEMENTS count = 0 MPI WAIT(request, status) request status int MPI Wait(MPI Request *request, MPI Status *status) MPI WAIT(REQUEST, STATUS, IERROR) INTEGER REQUEST, STATUS(MPI STATUS SIZE), IERROR MPI WAIT request MPI WAIT MPI REQUEST NULL MPI WAIT status.. MPI TEST CANCELLED. request MPI WAIT status

67 .. MPI IBSEND MPI WAIT MPI BUFFER ATTACH. MPI CANCEL MPI WAIT MPI TEST(request, ag, status) request ag status int MPI Test(MPI Request *request, int *flag, MPI Status *status) MPI TEST(REQUEST, FLAG, STATUS, IERROR) LOGICAL FLAG INTEGER REQUEST, STATUS(MPI STATUS SIZE), IERROR MPI TEST request ag = true MPI REQUEST NULL ag = false MPI TEST.. MPI TEST CANCELLED. MPI TEST request ag = true status

68 Chapter MPI WAIT MPI TEST MPI TEST MPI TEST MPI TEST MPI WAIT ag = true status Wait Test. MPI WAIT CALL MPI_COMM_RANK(comm, rank, ierr) IF(rank.EQ.0) THEN CALL MPI_ISEND(a(),, MPI_REAL,, tag, comm, request, ierr) **** **** CALL MPI_WAIT(request, status, ierr) ELSE CALL MPI_IRECV(a(),, MPI_REAL, 0, tag, comm, request, ierr) **** **** CALL MPI_WAIT(request, status, ierr) END IF MPI REQUEST FREE(request) request int MPI Request free(mpi Request *request) MPI REQUEST FREE(REQUEST, IERROR) INTEGER REQUEST, IERROR request MPI REQUEST NULL

69 .. MPI REQUEST FREE MPI REQUEST FREE MPI WAIT MPI TEST MPI REQUEST FREE MPI REQUEST FREE. MPI REQUEST FREE CALL MPI_COMM_RANK(MPI_COMM_WORLD, rank) IF(rank.EQ.0) THEN DO i=, n CALL MPI_ISEND(outval,, MPI_REAL,, 0, req, ierr) CALL MPI_REQUEST_FREE(req, ierr) CALL MPI_IRECV(inval,, MPI_REAL,, 0, req, ierr) CALL MPI_WAIT(req, status, ierr) END DO ELSE! CALL MPI_IRECV(inval,, MPI_REAL, 0, 0, req, ierr) CALL MPI_WAIT(req, status) DO I=, n- CALL MPI_ISEND(outval,, MPI_REAL, 0, 0, req, ierr) CALL MPI_REQUEST_FREE(req, ierr) CALL MPI_IRECV(inval,, MPI_REAL, 0, 0, req, ierr) CALL MPI_WAIT(req, status, ierr) END DO CALL MPI_ISEND(outval,, MPI_REAL, 0, 0, req, ierr) CALL MPI_WAIT(req, status)

70 Chapter END IF..... CALL MPI_COMM_RANK(comm, rank, ierr) IF (RANK.EQ.0) THEN CALL MPI_ISEND(a,, MPI_REAL,, 0, comm, r, ierr) CALL MPI_ISEND(b,, MPI_REAL,, 0, comm, r, ierr) ELSE! CALL MPI_IRECV(a,, MPI_REAL, 0, MPI_ANY_TAG, comm, r, ierr) CALL MPI_IRECV(b,, MPI_REAL, 0, 0, comm, r, ierr) END IF CALL MPI_WAIT(r,status) CALL MPI_WAIT(r,status) MPI WAIT MPI WAIT. CALL MPI_COMM_RANK(comm, rank, ierr) IF (RANK.EQ.0) THEN CALL MPI_SSEND(a,, MPI_REAL,, 0, comm, ierr)

71 .. CALL MPI_SEND(b,, MPI_REAL,,, comm, ierr) ELSE! CALL MPI_IRECV(a,, MPI_REAL, 0, 0, comm, r, ierr) CALL MPI_RECV(b,, MPI_REAL, 0,, comm, ierr) CALL MPI_WAIT(r, status, ierr) END IF MPI MPI TEST ag = true MPI TEST ag = true.. MPI WAITANY MPI TESTANY MPI WAITALL MPI TESTALL MPI WAITSOME MPI TESTSOME MPI WAITANY (count, array of requests, index, status) count array of requests index status int MPI Waitany(int count, MPI Request *array of requests, int *index, MPI Status *status) MPI WAITANY(COUNT, ARRAY OF REQUESTS, INDEX, STATUS, IERROR)

72 Chapter INTEGER COUNT, ARRAY OF REQUESTS(*), INDEX, STATUS(MPI STATUS SIZE), IERROR index status C 0 Fortran MPI REQUEST NULL array of requests index = MPI UNDEFINED status MPI WAITANY(count, array of requests, index, status) MPI WAIT(&array of requests[i], status) i index MPI UNDEFINED index MPI WAITANY MPI WAIT MPI TESTANY(count, array of requests, index, ag, status) count array of requests requests index MPI UNDEFINED ag status int MPI Testany(int count, MPI Request *array of requests, int *index, int *flag, MPI Status *status) MPI TESTANY(COUNT, ARRAY OF REQUESTS, INDEX, FLAG, STATUS, IERROR) LOGICAL FLAG INTEGER COUNT, ARRAY OF REQUESTS(*), INDEX, STATUS(MPI STATUS SIZE), IERROR ag = true index status

73 .. MPI REQUEST NULL Fortran ag = false MPI UNDEFINED index status ag = false index = MPI UNDEFINED status MPI TESTANY(count, array of requests, index, status) i=0,,..., count- ag = true MPI TEST(&array of requests[i], ag, status) index i MPI UNDEFINED MPI TESTANY MPI TEST ag = true MPI TESTANY MPI WAITANY MPI WAITANY MPI TESTANY Wait Test MPI WAITALL( count, array of requests, array of statuses) count array of requests array of statuses int MPI Waitall(int count, MPI Request *array of requests, MPI Status *array of statuses) MPI WAITALL(COUNT, ARRAY OF REQUESTS, ARRAY OF STATUSES, IERROR) INTEGER COUNT, ARRAY OF REQUESTS(*) INTEGER ARRAY OF STATUSES(MPI STATUS SIZE,*), IERROR array of statuses i

74 0 Chapter i MPI REQUEST NULL MPI WAITALL(count, array of requests, array of statuses) i=0,..., count- MPI WAIT(&array of request[i], &array of statuses[i]) MPI WAITALL MPI WAIT MPI WAITALL MPI WAITALL MPI ERR IN STATUS MPI SUCCESS MPI ERR PENDING MPI WAITALL MPI SUCCESS MPI TESTALL(count, array of requests, ag, array of statuses) count array of requests ag array of statuses int MPI Testall(int count, MPI Request *array of requests, int *flag, MPI Status *array of statuses) MPI TESTALL(COUNT, ARRAY OF REQUESTS, FLAG, ARRAY OF STATUSES, IERROR) LOGICAL FLAG INTEGER COUNT, ARRAY OF REQUESTS(*), ARRAY OF STATUSES(MPI STATUS SIZE,*), IERROR

75 .. ag = true MPI REQUEST NULL ag = false MPI TESTALL MPI WAITALL MPI WAITSOME(incount, array of requests, outcount, array of indices, array of statuses) incount array of requests array of requests outcount array of indices array of statuses int MPI Waitsome(int incount, MPI Request *array of requests, int *outcount, int *array of indices, MPI Status *array of statuses) MPI WAITSOME(INCOUNT, ARRAY OF REQUESTS, OUTCOUNT, ARRAY OF INDICES, ARRAY OF STATUSES, IERROR) INTEGER INCOUNT, ARRAY OF REQUESTS(*), OUTCOUNT, ARRAY OF INDICES(*), ARRAY OF STATUSES(MPI STATUS SIZE,*), IERROR array of requests outcount array of requests outcount array of requests Fortran array of status outcount MPI REQUEST NULL outcount=mpi UNDEFINED

76 Chapter MPI WAITSOME outcount array of indices array of statuses MPI ERR IN STATUS MPI SUCCESS MPI TESTSOME(incount, array of requests, outcount, array of indices, array of statuses) incount array of requests array of requests outcount array of indices array of statuses int MPI Testsome(int incount, MPI Request *array of requests, int *outcount, int *array of indices, MPI Status *array of statuses) MPI TESTSOME(INCOUNT, ARRAY OF REQUESTS, OUTCOUNT, ARRAY OF INDICES, ARRAY OF STATUSES, IERROR) INTEGER INCOUNT, ARRAY OF REQUESTS(*), OUTCOUNT, ARRAY OF INDICES(*), ARRAY OF STATUSES(MPI STATUS SIZE,*), IERROR MPI WAITSOME outcount = 0 outcount=mpi UNDEFIN MPI TESTSOME MPI WAIT- SOME MPI WAITSOME MPI TESTSOME

77 .. MPI TESTSOME MPI WAITSOME MPI TESTSOME MPI TESTANY MPI WAITSOME MPI WAITSOME MPI WAITANY MPI TESTSOME. CALL MPI_COMM_SIZE(comm, size, ierr) CALL MPI_COMM_RANK(comm, rank, ierr) IF(rank > 0) THEN! DO WHILE(.TRUE.) CALL MPI_ISEND(a, n, MPI_REAL, 0, tag, comm, request, ierr) CALL MPI_WAIT(request, status, ierr) END DO ELSE! 0 -- DO i=, size- CALL MPI_IRECV(a(,i), n, MPI_REAL, 0, tag, comm, request_list(i), ierr) END DO DO WHILE(.TRUE.) CALL MPI_WAITANY(size-, request_list, index, status, ierr) CALL DO_SERVICE(a(,index))! CALL MPI_IRECV(a(, index), n, MPI_REAL, 0, tag, comm, request_list(index), ierr) END DO

78 Chapter END IF. MPI WAITSOME CALL MPI_COMM_SIZE(comm, size, ierr) CALL MPI_COMM_RANK(comm, rank, ierr) IF(rank > 0) THEN! DO WHILE(.TRUE.) CALL MPI_ISEND(a, n, MPI_REAL, 0, tag, comm, request, ierr) CALL MPI_WAIT(request, status, ierr) END DO ELSE! 0 -- DO i=, size- CALL MPI_IRECV(a(,i), n, MPI_REAL, 0, tag, comm, request_list(i), ierr) END DO DO WHILE(.TRUE.) CALL MPI_WAITSOME(size, request_list, numdone, index_list, status_list, ierr) DO i=, numdone CALL DO_SERVICE(a(, index_list(i))) CALL MPI_IRECV(a(, index_list(i)), n, MPI_REAL, 0, tag, comm, request_list(i), ierr) END DO END DO END IF. Probe MPI PROBE MPI IPROBE probe status

79 .. Probe MPI CANCEL MPI IPROBE(source, tag, comm, ag, status) source MPI ANY SOURCE( ) tag MPI ANY TAG ( ) comm ( ) ag ( ) status ( ) int MPI Iprobe(int source, int tag, MPI Comm comm, int *flag, MPI Status *status) MPI IPROBE(SOURCE, TAG, COMM, FLAG, STATUS, IERROR) LOGICAL FLAG INTEGER SOURCE, TAG, COMM, STATUS(MPI STATUS SIZE), IERROR MPI IPROBE(source, tag, comm, ag, status) source tag,comm ag = true MPI RECV(..., source, tag, comm, status) MPI RECV() status ag = false status.. MPI IPROBE ag = true probe probe MPI IPROBE status probe MPI PROBE source MPI ANY SOURCE tag MPI ANY TAG probe

80 Chapter comm probe probe MPI PROBE(source, tag, comm, status) source MPI ANY SOURCE ( ) tag MPI ANY TAG ( ) comm ( ) status ( ) int MPI Probe(int source, int tag, MPI Comm comm, MPI Status *status) MPI PROBE(SOURCE, TAG, COMM, STATUS, IERROR) INTEGER SOURCE, TAG, COMM, STATUS(MPI STATUS SIZE), IERROR MPI PROBE MPI IPROBE MPI MPI PROBE MPI IPROBE MPI PROBE probe probe MPI PROBE MPI IPROBE MPI IPROBE ag = true. probe CALL MPI_COMM_RANK(comm, rank, ierr) IF (rank.eq.0) THEN CALL MPI_SEND(i,, MPI_INTEGER,, 0, comm, ierr) ELSE IF(rank.EQ.) THEN CALL MPI_SEND(x,, MPI_REAL,, 0, comm, ierr) ELSE! DO i=, CALL MPI_PROBE(MPI_ANY_SOURCE, 0,

81 .. Probe comm, status, ierr) IF (status(mpi_source) = 0) THEN 0 CALL MPI_RECV(i,, MPI_INTEGER, 0, 0, status, ierr) ELSE 0 CALL MPI_RECV(x,, MPI_REAL,, 0, status, ierr) END IF END DO END IF. has a problem. CALL MPI_COMM_RANK(comm, rank, ierr) IF (rank.eq.0) THEN CALL MPI_SEND(i,, MPI_INTEGER,, 0, comm, ierr) ELSE IF(rank.EQ.) THEN CALL MPI_SEND(x,, MPI_REAL,, 0, comm, ierr) ELSE DO i=, CALL MPI_PROBE(MPI_ANY_SOURCE, 0, comm, status, ierr) IF (status(mpi_source) = 0) THEN 0 CALL MPI_RECV(i,, MPI_INTEGER, MPI_ANY_SOURCE, 0, status, ierr) ELSE 0 CALL MPI_RECV(x,, MPI_REAL, MPI_ANY_SOURCE, 0, status, ierr) END IF END DO END IF 0 0 source MPI ANY SOURCE. MPI PROBE probe

82 Chapter MPI PROBE(source, tag, comm, status) MPI RECV(..., source, tag, comm, status) s t c probe MPI ANY TAG probe c s probe t c s MPI CANCEL(request) request ( ) int MPI Cancel(MPI Request *request) MPI CANCEL(REQUEST, IERROR) INTEGER REQUEST, IERROR MPI CANCEL MPI REQUEST FREE MPI WAIT MPI TEST MPI WAIT MPI WAIT busy wait MPI TEST MPI CANCEL. MPI CANCEL MPI WAIT MPI TEST

83 .. Probe MPI TEST CANCELLED(status, ag) status ag ( ) int MPI Test cancelled(mpi Status status, int *flag) MPI TEST CANCELLED(STATUS, FLAG, IERROR) LOGICAL FLAG INTEGER STATUS(MPI STATUS SIZE), IERROR ag = true count tag status ag = false MPI TEST CANCELLED \eager" MPI CANCEL

84 0 Chapter. \ " MPI SEND INIT(buf, count, datatype, dest, tag, comm, request) buf ( ) count ( ) datatype ( ) dest ( ) tag ( ) comm ( ) request ( ) int MPI Send init(void* buf, int count, MPI Datatype datatype, int dest, int tag, MPI Comm comm, MPI Request *request) MPI SEND INIT(BUF, COUNT, DATATYPE, DEST, TAG, COMM, REQUEST, IERROR) <type> BUF(*)

85 .. INTEGER REQUEST, COUNT, DATATYPE, DEST, TAG, COMM, REQUEST, IERROR MPI BSEND INIT(buf, count, datatype, dest, tag, comm, request) buf ( ) count ( ) datatype ( ) dest ( ) tag ( ) comm ( ) request ( ) int MPI Bsend init(void* buf, int count, MPI Datatype datatype, int dest, int tag, MPI Comm comm, MPI Request *request) MPI BSEND INIT(BUF, COUNT, DATATYPE, DEST, TAG, COMM, REQUEST, IERROR) <type> BUF(*) INTEGER REQUEST, COUNT, DATATYPE, DEST, TAG, COMM, REQUEST, IERROR MPI SSEND INIT(buf, count, datatype, dest, tag, comm, request) buf ( ) count ( ) datatype ( ) dest ( ) tag ( ) comm ( ) request ( ) int MPI Ssend init(void* buf, int count, MPI Datatype datatype, int dest, int tag, MPI Comm comm, MPI Request *request)

86 Chapter MPI SSEND INIT(BUF, COUNT, DATATYPE, DEST, TAG, COMM, REQUEST, IERROR) <type> BUF(*) INTEGER COUNT, DATATYPE, DEST, TAG, COMM, REQUEST, IERROR MPI RSEND INIT(buf, count, datatype, dest, tag, comm, request) buf ( ) count ( ) datatype ( ) dest ( ) tag ( ) comm ( ) request ( ) int MPI Rsend init(void* buf, int count, MPI Datatype datatype, int dest, int tag, MPI Comm comm, MPI Request *request) MPI RSEND INIT(BUF, COUNT, DATATYPE, DEST, TAG, COMM, REQUEST, IERROR) <type> BUF(*) INTEGER COUNT, DATATYPE, DEST, TAG, COMM, REQUEST, IERROR MPI RECV INIT(buf, count, datatype, source, tag, comm, request) buf ( ) count ( ) datatype ( ) source MPI ANY SOURCE ( ) tag MPI ANY TAG ( ) comm ( ) request ( ) int MPI Recv init(void* buf, int count, MPI Datatype datatype, int source,

87 .. int tag, MPI Comm comm, MPI Request *request) MPI RECV INIT(BUF, COUNT, DATATYPE, SOURCE, TAG, COMM, REQUEST, IERROR) <type> BUF(*) INTEGER COUNT, DATATYPE, SOURCE, TAG, COMM, REQUEST, IERROR MPI RECV INIT buf MPI START MPI START(request) request int MPI Start(MPI Request *request) MPI START(REQUEST, IERROR) INTEGER REQUEST, IERROR request. MPI SEND INIT MPI START MPI ISEND MPI BSEND INIT MPI START MPI IBSEND

88 Chapter MPI STARTALL(count, array of requests) count ( ) array of requests ( ) int MPI Startall(int count, MPI Request *array of requests) MPI STARTALL(COUNT, ARRAY OF REQUESTS, IERROR) INTEGER COUNT, ARRAY OF REQUESTS(*), IERROR array of requests MPI STARTALL(count, array of requests) i=0,..., count- MPI START (&array of requests[i]), MPI START MPI STARTALL MPI WAIT MPI TEST.. MPI START MPI STARTALL MPI REQUEST FREE.. MPI REQUEST FREE Create (Start Complete) Free ; 0 MPI START MPI START

89 ... probe MPI SENDRECV(sendbuf, sendcount, sendtype, dest, sendtag, recvbuf, recvcount, recvtype, source, recvtag, comm, status) sendbuf ( ) sendcount ( ) sendtype ( ) dest ( ) sendtag ( ) recvbuf ( ) recvcount ( ) recvtype ( ) source ( ) recvtag ( ) comm ( ) status ( ) int MPI Sendrecv(void *sendbuf, int sendcount, MPI Datatype sendtype,

90 Chapter int dest, int sendtag, void *recvbuf, int recvcount, MPI Datatype recvtype, int source, MPI Datatype recvtag, MPI Comm comm, MPI Status *status) MPI SENDRECV(SENDBUF, SENDCOUNT, SENDTYPE, DEST, SENDTAG, RECVBUF, RECVCOUNT, RECVTYPE, SOURCE, RECVTAG, COMM, STATUS, IERROR) <type> SENDBUF(*), RECVBUF(*) INTEGER SENDCOUNT, SENDTYPE, DEST, SENDTAG, RECVCOUNT, RECVTYPE, SOURCE, RECVTAG, COMM, STATUS(MPI STATUS SIZE), IERROR MPI SENDRECV REPLACE(buf, count, datatype, dest, sendtag, source, recvtag, comm, status) buf ( ) count ( ) datatype ( ) dest ( ) sendtag ( ) source ( ) recvtag ( ) comm ( ) status ( ) int MPI Sendrecv replace(void* buf, int count, MPI Datatype datatype, int dest, int sendtag, int source, int recvtag, MPI Comm comm, MPI Status *status) MPI SENDRECV REPLACE(BUF, COUNT, DATATYPE, DEST, SENDTAG, SOURCE, RECVTAG, COMM, STATUS, IERROR) <type> BUF(*)

91 .. INTEGER COUNT, DATATYPE, DEST, SENDTAG, SOURCE, RECVTAG, COMM, STATUS(MPI STATUS SIZE), IERROR \ ". \ " MPI PROC NULL MPI PROC NULL MPI PROC NULL MPI PROC NULL source = MPI PROC NULL source = MPI PROC NULL tag = MPI ANY TAG count = 0. ( ) ( ) - MPI

92 Chapter MPI MPI MPI A ( ) ( ) ( ) T ypemap = f(type 0 ;disp 0 );:::;(type n0 ;disp n0 )g; type i disp i T ypesig = ftype 0 ;:::;type n0 g buf n i buf + disp i type i n T ypesig MPI SEND(buf,, datatype,...) buf datatype datatype MPI RECV(buf,, datatype,...) buf datatype.. count

93 .... MPI INT f(int; 0)g(int,0) int 0 T ypemap = f(type 0 ;disp 0 );:::;(type n0 ;disp n0 )g; lb(t ypemap) = min j disp j ; ub(t ypemap) = max(disp j + sizeof(type j )); j extent(t ypemap) = ub(t ypemap) 0 lb(t ypemap) +: (.) type i k i extent(t ypemap) max i k i. Type = f(double; 0); (char; )g ( 0 double char ) double ( () ) double.. union.. Contiguous MPI TYPE CONTIGUOUS MPI TYPE CONTIGUOUS(count, oldtype, newtype) count ( ) oldtype ( ) newtype ( ) int MPI Type contiguous(int count, MPI Datatype oldtype, MPI Datatype *newtype)

94 0 Chapter MPI TYPE CONTIGUOUS(COUNT, OLDTYPE, NEWTYPE, IERROR) INTEGER COUNT, OLDTYPE, NEWTYPE, IERROR newtype oldtype count. oldtype f(double; 0); (char; )g; count = newtype f(double; 0); (char; ); (double; ); (char; ); (double; ); (char; )g; double char 0; ; ; ; ; oldtype f(type 0 ; disp 0 );:::;(type n0 ;disp n0 )g; ex newtype count n f(type 0 ; disp 0 );:::;(type n0 ;disp n0 ); (type 0 ; disp 0 + ex);:::;(type n0 ;disp n0 + ex); :::; (type 0 ; disp 0 + ex (count 0 )); :::; (type n0 ; disp n0 + ex (count 0 ))g: Vector MPI TYPE VECTOR MPI TYPE VECTOR( count, blocklength, stride, oldtype, newtype) count ( ) blocklength ( ) stride ( ) oldtype ( ) newtype ( ) int MPI Type vector(int count, int blocklength, int stride, MPI Datatype oldtype, MPI Datatype *newtype)

95 .. MPI TYPE VECTOR(COUNT, BLOCKLENGTH, STRIDE, OLDTYPE, NEWTYPE, IERROR) INTEGER COUNT, BLOCKLENGTH, STRIDE, OLDTYPE, NEWTYPE, IERROR. f(double; 0); (char; )g; oldtype MPI TYPE VECTOR(,,, oldtype, newtype) f(double; 0); (char; ); (double; ); (char; ); (double; ); (char; ); (double; ); (char; ); (double; 0); (char; ); (double; ); (char; )g: ( ). MPI TYPE VECTOR(,, -, oldtype, newtype) f(double; 0); (char; ); (double; 0); (char; 0); (double; 0); (char; 0)g: oldtype f(type 0 ; disp 0 );:::;(type n0 ;disp n0 )g; ex blocklength bl count bl n f(type 0 ; disp 0 );:::;(type n0 ;disp n0 ); (type 0 ; disp 0 + ex); :::; (type n0 ; disp n0 + ex); :::; (type 0 ; disp 0 +(bl 0 ) ex); :::; (type n0 ; disp n0 +(bl 0 ) ex); (type 0 ; disp 0 + stride ex);:::;(type n0 ;disp n0 + stride ex);:::; (type 0 ; disp 0 +(stride + bl 0 ) ex); :::; (type n0 ;disp n0 +(stride + bl 0 ) ex); ::::; (type 0 ; disp 0 + stride (count 0 ) ex); :::; (type n0 ; disp n0 + stride (count 0 ) ex); :::; (type 0 ; disp 0 +(stride (count 0 ) + bl 0 ) ex); :::;

96 Chapter (type n0 ; disp n0 +(stride (count 0 ) + bl 0 ) ex)g: MPI TYPE CONTIGUOUS(count, oldtype, newtype) MPI TYPE VECTOR(count,,, oldtype, newtype) MPI TYPE VECTOR(, count, n, oldtype, newtype), n ) Hvector MPI TYPE HVECTOR stride MPI TYPE VECTOR.. ( H "heterogeneous"( ) ) MPI TYPE HVECTOR( count, blocklength, stride, oldtype, newtype) count ( ) blocklength ( ) stride ( ) oldtype ( ) newtype ( ) int MPI Type hvector(int count, int blocklength, MPI Aint stride, MPI Datatype oldtype, MPI Datatype *newtype) MPI TYPE HVECTOR(COUNT, BLOCKLENGTH, STRIDE, OLDTYPE, NEWTYPE, IERROR) INTEGER COUNT, BLOCKLENGTH, STRIDE, OLDTYPE, NEWTYPE, IERROR oldtype f(type 0 ; disp 0 );:::;(type n0 ;disp n0 )g; ex blocklength bl countbln f(type 0 ; disp 0 );:::;(type n0 ;disp n0 ); (type 0 ; disp 0 + ex); :::; (type n0 ; disp n0 + ex); :::; (type 0 ; disp 0 +(bl 0 ) ex); :::; (type n0 ; disp n0 +(bl 0 ) ex); (type 0 ; disp 0 + stride); :::; (type n0 ; disp n0 + stride);:::;

97 .. (type 0 ; disp 0 + stride +(bl 0 ) ex); :::; (type n0 ; disp n0 + stride +(bl 0 ) ex); ::::; (type 0 ; disp 0 + stride (count 0 )); :::; (type n0 ;disp n0 + stride (count 0 )); :::; (type 0 ; disp 0 + stride (count 0 )+(bl 0 ) ex); :::; (type n0 ; disp n0 + stride (count 0 ) + (bl 0 ) ex)g: INDEXED MPI TYPE INDEXED ( ) MPI TYPE INDEXED( count, array of blocklengths, array of displacements, oldtype, newtype) count { array of displacements array of blocklengths ( ) array of blocklengths ( ) array of displacements oldtype ( ) oldtype ( ) newtype ( ) int MPI Type indexed(int count, int *array of blocklengths, int *array of displacements, MPI Datatype oldtype, MPI Datatype *newtype) MPI TYPE INDEXED(COUNT, ARRAY OF BLOCKLENGTHS, ARRAY OF DISPLACEMENTS, OLDTYPE, NEWTYPE, IERROR) INTEGER COUNT, ARRAY OF BLOCKLENGTHS(*), ARRAY OF DISPLACEMENTS(*), OLDTYPE, NEWTYPE, IERROR

98 Chapter. f(double; 0); (char; )g; oldtype B = (, ) D = (, 0) MPI TYPE INDEXED(, B, D, oldtype, newtype) f(double; ); (char; ); (double; 0); (char; ); (double; ); (char; ); (double; 0); (char; )g: 0 oldtype f(type 0 ; disp 0 );:::;(type n0 ;disp n0 )g; ex B array of blocklength D array of displacements n P count0 i=0 B[i] f(type 0 ; disp 0 + D[0] ex); :::; (type n0 ;disp n0 + D[0] ex);:::; (type 0 ; disp 0 +(D[0]+B[0] 0 ) ex);:::;(type n0 ; disp n0 +(D[0]+B[0] 0 ) ex);:::; (type 0 ; disp 0 + D[count 0 ] ex);:::;(type n0 ;disp n0 + D[count 0 ] ex);:::; (type 0 ; disp 0 +(D[count 0 ]+B[count 0 ] 0 ) ex);:::; (type n0 ; disp n0 +(D[count 0 ]+B[count 0 ] 0 ) ex)g: MPI TYPE VECTOR(count, blocklength, stride, oldtype, newtype) MPI TYPE INDEXED(count, B, D, oldtype, newtype) D[j] =j stride; j =0; :::; count 0 ; B[j] =blocklength; j =0;:::;count 0 :

99 .. Hindexed MPI TYPE HINDEXED array of displacements oldtype MPI TYPE INDEXED MPI TYPE HINDEXED( count, array of blocklengths, array of displacements, oldtype, newtype) count { array of displacements array of blocklengths ( ) array of blocklengths ( ) array of displacements ( ) oldtype ( ) newtype ( ) int MPI Type hindexed(int count, int *array of blocklengths, MPI Aint *array of displacements, MPI Datatype oldtype, MPI Datatype *newtype) MPI TYPE HINDEXED(COUNT, ARRAY OF BLOCKLENGTHS, ARRAY OF DISPLACEMENTS, OLDTYPE, NEWTYPE, IERROR) INTEGER COUNT, ARRAY OF BLOCKLENGTHS(*), ARRAY OF DISPLACEMENTS(*), OLDTYPE, NEWTYPE, IERROR oldtype f(type 0 ; disp 0 );:::;(type n0 ;disp n0 )g; ex B array of blocklength D array of displacements n P count0 i=0 B[i] f(type 0 ; disp 0 + D[0]);:::;(type n0 ; disp n0 + D[0]);:::; (type 0 ; disp 0 + D[0]+(B[0] 0 ) ex); :::; (type n0 ; disp n0 + D[0]+(B[0] 0 ) ex); :::; (type 0 ; disp 0 + D[count 0 ]); :::; (type n0 ;disp n0 + D[count 0 ]);:::;

100 Chapter (type 0 ; disp 0 + D[count 0 ]+(B[count 0 ] 0 ) ex);:::; (type n0 ; disp n0 + D[count 0 ]+(B[count 0 ] 0 ) ex)g: Struct MPI TYPE STRUCT MPI TYPE STRUCT(count, array of blocklengths, array of displacements, array of types, newtype) count { array of displacements array of blocklengths array of types ( ) array of blocklength ( ) array of displacements ( ) array of types ( ) newtype ( ) int MPI Type struct(int count, int *array of blocklengths, MPI Aint *array of displacements, MPI Datatype *array of types, MPI Datatype *newtype) MPI TYPE STRUCT(COUNT, ARRAY OF BLOCKLENGTHS, ARRAY OF DISPLACEMENTS, ARRAY OF TYPES, NEWTYPE, IERROR) INTEGER COUNT, ARRAY OF BLOCKLENGTHS(*), ARRAY OF DISPLACEMENTS(*), ARRAY OF TYPES(*), NEWTYPE, IERROR. type f(double; 0); (char; )g; B=(,,) D = (0,, ) T = (MPI FLOAT, type, MPI CHAR) MPI TYPE STRUCT(, B, D, T, newtype) f(oat; 0); (oat; ); (double; ); (char; ); (char; ); (char; ); (char; )g:

101 .. MPI FLOAT 0 type MPI CHAR (oat ) array of types argt T[i] typemap i = f(type i 0 ;dispi 0); :::; (type i n i 0 ; dispi n i 0)g; ex i B array of blocklength D array of displacements c count P c0 i=0 B[i] n i f(type 0 0 ; disp0 0 + D[0]);:::;(type 0 n 0 ; disp 0 n 0 + D[0]); :::; (type 0 0 ; disp0 0 + D[0]+(B[0] 0 ) ex 0);:::;(type 0 n 0 ;disp 0 n 0 + D[0]+(B[0] 0 ) ex 0 );:::; (type c0 0 ; disp c0 0 + D[c 0 ]); :::; (type c0 nc0 ;dispc0 nc0 + D[c 0 ]);:::; (type c0 0 ; disp c0 0 + D[c 0 ]+(B[c 0 ] 0 ) exc0);:::; (type c0 nc0 ; dispc0 nc0 + D[c 0 ]+(B[c 0 ] 0 ) ex c0)g: MPI TYPE HINDEXED( count, B, D, oldtype, newtype) MPI TYPE STRUCT( count, B, D, T, newtype) T oldtype MPI BOTTOM buf MPI BOTTOM MPI ADDRESS MPI ADDRESS(location, address) location ( ) address ( ) int MPI Address(void* location, MPI Aint *address)

102 Chapter MPI ADDRESS(LOCATION, ADDRESS, IERROR) <type> LOCATION(*) INTEGER ADDRESS, IERROR ( ). MPI ADDRESS REAL A(0,0) INTEGER I, I, DIFF CALL MPI_ADDRESS(A(,), I, IERROR) CALL MPI_ADDRESS(A(,), I, IERROR) DIFF = I - I! DIFF 0*REAL I, I C MPI ADDRESS & & ANSI C ( ) MPI ADDRESS C MPI TYPE EXTENT(datatype, extent) datatype ( ) extent ( ) int MPI Type extent(mpi Datatype datatype, int *extent) MPI TYPE EXTENT(DATATYPE, EXTENT, IERROR) INTEGER DATATYPE, EXTENT, IERROR datatype.

103 .. MPI TYPE SIZE(datatype, size) datatype ( ) size ( ) int MPI Type size(mpi Datatype datatype, int *size) MPI TYPE SIZE(DATATYPE, SIZE, IERROR) INTEGER DATATYPE, SIZE, IERROR MPI TYPE SIZE datatype datatype MPI TYPE COUNT(datatype, count) datatype count int MPI Type count(mpi Datatype datatype, int *count) MPI TYPE COUNT(DATATYPE, COUNT, IERROR) INTEGER DATATYPE, COUNT, IERROR..... C MPI LB MPI UB (extent(mpi LB) =extent(mpi UB) =0)

104 0 Chapter. D = (-, 0, ); T = (MPI LB, MPI INT, MPI UB) B=(,,) MPI TYPE STRUCT(, B, D, T, type) (- ( )) 0 f(lb, -), (int, 0), (ub, )g MPI TYPE CONTIGUOUS(, type, type) f(lb, -), (int, 0), (int,), (ub, )g (ub ub ub lb lb lb ) T ypemap = f(type 0 ;disp 0 );:::;(type n0 ;disp n0 )g; T ypemap lb(t ypemap) = < : min j disp j min j fdisp j such that type j = lbg Similarly, the upper bound of T ypemap is dened to be ub(t ypemap) = < : max j disp j + sizeof(type j ) max j fdisp j such thattype j = ubg extent(t ypemap) =ub(t ypemap) 0 lb(t ypemap) + type i lb otherwise ub otherwise k i extent(t ypemap) max i k i MPI TYPE LB( datatype, displacement) datatype ( ) displacement ( ) int MPI Type lb(mpi Datatype datatype, int* displacement) MPI TYPE LB( DATATYPE, DISPLACEMENT, IERROR)

105 .. INTEGER DATATYPE, DISPLACEMENT, IERROR MPI TYPE UB( datatype, displacement) datatype ( ) displacement ( ) int MPI Type ub(mpi Datatype datatype, int* displacement) MPI TYPE UB( DATATYPE, DISPLACEMENT, IERROR) INTEGER DATATYPE, DISPLACEMENT, IERROR.. MPI TYPE COMMIT(datatype) datatype ( ) int MPI Type commit(mpi Datatype *datatype) MPI TYPE COMMIT(DATATYPE, IERROR) INTEGER DATATYPE, IERROR

106 Chapter MPI TYPE FREE(datatype) datatype ( ) int MPI Type free(mpi Datatype *datatype) MPI TYPE FREE(DATATYPE, IERROR) INTEGER DATATYPE, IERROR datatype datatype MPI DATATYPE NULL datatype. MPI TYPE COMMIT INTEGER type, type CALL MPI_TYPE_CONTIGUOUS(, MPI_REAL, type, ierr)! CALL MPI_TYPE_COMMIT(type, ierr)! type type = type! type! (type ) CALL MPI_TYPE_VECTOR(,,, MPI_REAL, type, ierr)! CALL MPI_TYPE_COMMIT(type, ierr)! type.. MPI SEND(buf, count, datatype,...) count > count

±é½¬£²¡§£Í£Ð£É½éÊâ

±é½¬£²¡§£Í£Ð£É½éÊâ 2012 8 7 1 / 52 MPI Hello World I ( ) Hello World II ( ) I ( ) II ( ) ( sendrecv) π ( ) MPI fortran C wget http://www.na.scitec.kobe-u.ac.jp/ yaguchi/riken2012/enshu2.zip unzip enshu2.zip 2 / 52 FORTRAN

More information

para02-2.dvi

para02-2.dvi 2002 2 2002 4 23 : MPI MPI 1 MPI MPI(Message Passing Interface) MPI UNIX Windows Machintosh OS, MPI 2 1 1 2 2.1 1 1 1 1 1 1 Fig. 1 A B C F Fig. 2 A B F Fig. 1 1 1 Fig. 2 2.2 Fig. 3 1 . Fig. 4 Fig. 3 Fig.

More information

MPI usage

MPI usage MPI (Version 0.99 2006 11 8 ) 1 1 MPI ( Message Passing Interface ) 1 1.1 MPI................................. 1 1.2............................... 2 1.2.1 MPI GATHER.......................... 2 1.2.2

More information

C/C++ FORTRAN FORTRAN MPI MPI MPI UNIX Windows (SIMD Single Instruction Multipule Data) SMP(Symmetric Multi Processor) MPI (thread) OpenMP[5]

C/C++ FORTRAN FORTRAN MPI MPI MPI UNIX Windows (SIMD Single Instruction Multipule Data) SMP(Symmetric Multi Processor) MPI (thread) OpenMP[5] MPI ( ) snozawa@env.sci.ibaraki.ac.jp 1 ( ) MPI MPI Message Passing Interface[2] MPI MPICH[3],LAM/MPI[4] (MIMDMultiple Instruction Multipule Data) Message Passing ( ) (MPI (rank) PE(Processing Element)

More information

Microsoft PowerPoint MPI.v...O...~...O.e.L.X.g(...Q..)

Microsoft PowerPoint MPI.v...O...~...O.e.L.X.g(...Q..) MPI プログラミング Information Initiative Center, Hokkaido Univ. MPI ライブラリを利用した分散メモリ型並列プログラミング 分散メモリ型並列処理 : 基礎 分散メモリマルチコンピュータの構成 プロセッサエレメントが専用のメモリ ( ローカルメモリ ) を搭載 スケーラビリティが高い 例 :HITACHI SR8000 Interconnection

More information

2 T 1 N n T n α = T 1 nt n (1) α = 1 100% OpenMP MPI OpenMP OpenMP MPI (Message Passing Interface) MPI MPICH OpenMPI 1 OpenMP MPI MPI (trivial p

2 T 1 N n T n α = T 1 nt n (1) α = 1 100% OpenMP MPI OpenMP OpenMP MPI (Message Passing Interface) MPI MPICH OpenMPI 1 OpenMP MPI MPI (trivial p 22 6 22 MPI MPI 1 1 2 2 3 MPI 3 4 7 4.1.................................. 7 4.2 ( )................................ 10 4.3 (Allreduce )................................. 12 5 14 5.1........................................

More information

WinHPC ppt

WinHPC ppt MPI.NET C# 2 2009 1 20 MPI.NET MPI.NET C# MPI.NET C# MPI MPI.NET 1 1 MPI.NET C# Hello World MPI.NET.NET Framework.NET C# API C# Microsoft.NET java.net (Visual Basic.NET Visual C++) C# class Helloworld

More information

120802_MPI.ppt

120802_MPI.ppt CPU CPU CPU CPU CPU SMP Symmetric MultiProcessing CPU CPU CPU CPU CPU CPU CPU CPU CPU CPU CPU CPU CP OpenMP MPI MPI CPU CPU CPU CPU CPU CPU CPU CPU CPU CPU MPI MPI+OpenMP CPU CPU CPU CPU CPU CPU CPU CP

More information

Microsoft PowerPoint - 演習1:並列化と評価.pptx

Microsoft PowerPoint - 演習1:並列化と評価.pptx 講義 2& 演習 1 プログラム並列化と性能評価 神戸大学大学院システム情報学研究科横川三津夫 yokokawa@port.kobe-u.ac.jp 2014/3/5 RIKEN AICS HPC Spring School 2014: プログラム並列化と性能評価 1 2014/3/5 RIKEN AICS HPC Spring School 2014: プログラム並列化と性能評価 2 2 次元温度分布の計算

More information

MPI () MPIMessage Passing Interface MPI MPI OpenMP 7 ( ) 1

MPI () MPIMessage Passing Interface MPI MPI OpenMP 7 ( ) 1 7 MPI / 7 (2014 05 21 ) MPI () MPIMessage Passing Interface MPI MPI OpenMP 7 (2014 05 21 ) 1 (MPI) 7 (2014 05 21 ) 2 (OpenMP) 7 (2014 05 21 ) 3 (MPI + OpenMP) 7 (2014 05 21 ) 4 MPI (1) MPI1 OpenMP 1 pragma

More information

Microsoft PowerPoint - KHPCSS pptx

Microsoft PowerPoint - KHPCSS pptx KOBE HPC サマースクール 2018( 初級 ) 9. 1 対 1 通信関数, 集団通信関数 2018/8/8 KOBE HPC サマースクール 2018 1 2018/8/8 KOBE HPC サマースクール 2018 2 MPI プログラム (M-2):1 対 1 通信関数 問題 1 から 100 までの整数の和を 2 並列で求めなさい. プログラムの方針 プロセス0: 1から50までの和を求める.

More information

main() {... } main() { main() { main() {......... } } } main() { main() { main() {......... } } } main() { if(rank==)... } main() { if(rank==)... } main() { if(rank==x)... } P(N) P(N) / P(M) * ( M / N

More information

86

86 86 86 86 main() {... } main() { main() { main() {......... } } } 86 main() { main() { main() {......... } } } main() { if(rank==)... } main() { if(rank==)... } main() { if(rank==x)... } 86 P(N) P(N) /

More information

目 目 用方 用 用 方

目 目 用方 用 用 方 大 生 大 工 目 目 用方 用 用 方 用 方 MS-MPI MPI.NET MPICH MPICH2 LAM/MPI Ver. 2 2 1 2 1 C C++ Fortan.NET C# C C++ Fortan 用 行 用 用 用 行 用 言 言 言 行 生 方 方 一 行 高 行 行 文 用 行 If ( rank == 0 ) { // 0 } else if (rank == 1) {

More information

NUMAの構成

NUMAの構成 メッセージパッシング プログラミング 天野 共有メモリ対メッセージパッシング 共有メモリモデル 共有変数を用いた単純な記述自動並列化コンパイラ簡単なディレクティブによる並列化 :OpenMP メッセージパッシング 形式検証が可能 ( ブロッキング ) 副作用がない ( 共有変数は副作用そのもの ) コストが小さい メッセージパッシングモデル 共有変数は使わない 共有メモリがないマシンでも実装可能 クラスタ

More information

演習準備 2014 年 3 月 5 日神戸大学大学院システム情報学研究科森下浩二 1 RIKEN AICS HPC Spring School /3/5

演習準備 2014 年 3 月 5 日神戸大学大学院システム情報学研究科森下浩二 1 RIKEN AICS HPC Spring School /3/5 演習準備 2014 年 3 月 5 日神戸大学大学院システム情報学研究科森下浩二 1 演習準備の内容 神戸大 FX10(π-Computer) 利用準備 システム概要 ログイン方法 コンパイルとジョブ実行方法 MPI 復習 1. MPIプログラムの基本構成 2. 並列実行 3. 1 対 1 通信 集団通信 4. データ 処理分割 5. 計算時間計測 2 神戸大 FX10(π-Computer) 利用準備

More information

untitled

untitled RIKEN AICS Summer School 3 4 MPI 2012 8 8 1 6 MPI MPI 2 allocatable 2 Fox mpi_sendrecv 3 3 FFT mpi_alltoall MPI_PROC_NULL 4 FX10 /home/guest/guest07/school/ 5 1 A (i, j) i+j x i i y = Ax A x y y 1 y i

More information

スライド 1

スライド 1 目次 2.MPI プログラミング入門 この資料は, スーパーコン 10 で使用したものである. ごく基本的な内容なので, 現在でも十分利用できると思われるものなので, ここに紹介させて頂く. ただし, 古い情報も含まれているので注意が必要である. 今年度版の解説は, 本選の初日に配布する予定である. 1/20 2.MPI プログラミング入門 (1) 基本 説明 MPI (message passing

More information

Microsoft PowerPoint _MPI-03.pptx

Microsoft PowerPoint _MPI-03.pptx 計算科学演習 Ⅰ ( 第 11 回 ) MPI を いた並列計算 (III) 神戸大学大学院システム情報学研究科横川三津夫 yokokawa@port.kobe-u.ac.jp 2014/07/03 計算科学演習 Ⅰ:MPI を用いた並列計算 (III) 1 2014/07/03 計算科学演習 Ⅰ:MPI を用いた並列計算 (III) 2 今週の講義の概要 1. 前回課題の解説 2. 部分配列とローカルインデックス

More information

スライド 1

スライド 1 計算科学演習 MPI 基礎 学術情報メディアセンター情報学研究科 システム科学専攻中島浩 目次 プログラミングモデル SPMD 同期通信 / 非同期通信 MPI 概論 プログラム構造 Communicator & rank データ型 タグ 一対一通信関数 1 次元分割並列化 : 基本 基本的考え方 配列宣言 割付 部分領域交換 結果出力 1 次元分割並列化 : 高速化 通信 計算のオーバーラップ 通信回数削減

More information

スライド 1

スライド 1 Parallel Programming in MPI part 2 1 1 Today's Topic ノンブロッキング通信 Non-Blocking Communication 通信の完了を待つ間に他の処理を行う Execute other instructions while waiting for the completion of a communication. 集団通信関数の実装 Implementation

More information

Microsoft PowerPoint - 講義:コミュニケータ.pptx

Microsoft PowerPoint - 講義:コミュニケータ.pptx コミュニケータとデータタイプ (Communicator and Datatype) 2019 年 3 月 15 日 神戸大学大学院システム情報学研究科横川三津夫 2019/3/15 Kobe HPC Spring School 2019 1 講義の内容 コミュニケータ (Communicator) データタイプ (Datatype) 演習問題 2019/3/15 Kobe HPC Spring School

More information

スライド 1

スライド 1 計算科学演習 MPI 基礎 学術情報メディアセンター 情報学研究科 システム科学専攻 中島浩 目次 プログラミングモデル SPMD 同期通信 / 非同期通信 MPI 概論 プログラム構造 Communicator & rank データ型 タグ 一対一通信関数 1 次元分割並列化 : 基本 基本的考え方 配列宣言 割付 部分領域交換 結果出力 1 次元分割並列化 : 高速化 通信 計算のオーバーラップ

More information

chap2.ppt

chap2.ppt 2. メッセージ通信計算 2.1 メッセージ通信プログラミングの基本 プログラミングの選択肢 特別な並列プログラミング言語を設計する occam (Inmos, 1984, 1986) 既存の逐次言語の文法 / 予約語をメッセージ通信を処理できるように拡張する 既存の逐次言語を用い メッセージ通信のための拡張手続のライブラリを用意する どのプロセスを実行するのか メッセージ通信のタイミング 中身を明示的に指定する必要がある

More information

Microsoft PowerPoint - 講義:片方向通信.pptx

Microsoft PowerPoint - 講義:片方向通信.pptx MPI( 片方向通信 ) 09 年 3 月 5 日 神戸大学大学院システム情報学研究科計算科学専攻横川三津夫 09/3/5 KOBE HPC Spring School 09 分散メモリ型並列計算機 複数のプロセッサがネットワークで接続されており, れぞれのプロセッサ (PE) が, メモリを持っている. 各 PE が自分のメモリ領域のみアクセス可能 特徴数千から数万 PE 規模の並列システムが可能

More information

nakao

nakao Fortran+Python 4 Fortran, 2018 12 12 !2 Python!3 Python 2018 IEEE spectrum https://spectrum.ieee.org/static/interactive-the-top-programming-languages-2018!4 Python print("hello World!") if x == 10: print

More information

コードのチューニング

コードのチューニング ハイブリッド並列 八木学 ( 理化学研究所計算科学研究機構 ) 謝辞 松本洋介氏 ( 千葉大学 ) KOBE HPC Spring School 2017 2017 年 3 月 14 日神戸大学計算科学教育センター MPI とは Message Passing Interface 分散メモリのプロセス間の通信規格(API) SPMD(Single Program Multi Data) が基本 -

More information

演習 II 2 つの講義の演習 奇数回 : 連続系アルゴリズム 部分 偶数回 : 計算量理論 部分 連続系アルゴリズム部分は全 8 回を予定 前半 2 回 高性能計算 後半 6 回 数値計算 4 回以上の課題提出 ( プログラム + 考察レポート ) で単位

演習 II 2 つの講義の演習 奇数回 : 連続系アルゴリズム 部分 偶数回 : 計算量理論 部分 連続系アルゴリズム部分は全 8 回を予定 前半 2 回 高性能計算 後半 6 回 数値計算 4 回以上の課題提出 ( プログラム + 考察レポート ) で単位 演習 II ( 連続系アルゴリズム ) 第 1 回 : MPI 須田研究室 M2 本谷徹 motoya@is.s.u-tokyo.ac.jp 2012/10/05 2012/10/18 補足 訂正 演習 II 2 つの講義の演習 奇数回 : 連続系アルゴリズム 部分 偶数回 : 計算量理論 部分 連続系アルゴリズム部分は全 8 回を予定 前半 2 回 高性能計算 後半 6 回 数値計算 4 回以上の課題提出

More information

MPI コミュニケータ操作

MPI コミュニケータ操作 コミュニケータとデータタイプ 辻田祐一 (RIKEN AICS) 講義 演習内容 MPI における重要な概念 コミュニケータ データタイプ MPI-IO 集団型 I/O MPI-IO の演習 2 コミュニケータ MPI におけるプロセスの 集団 集団的な操作などにおける操作対象となる MPI における集団的な操作とは? 集団型通信 (Collective Communication) 集団型 I/O(Collective

More information

コードのチューニング

コードのチューニング MPI による並列化実装 ~ ハイブリッド並列 ~ 八木学 ( 理化学研究所計算科学研究センター ) KOBE HPC Spring School 2019 2019 年 3 月 14 日 MPI とは Message Passing Interface 分散メモリのプロセス間の通信規格(API) SPMD(Single Program Multi Data) が基本 - 各プロセスが 同じことをやる

More information

¥Ñ¥Ã¥±¡¼¥¸ Rhpc ¤Î¾õ¶·

¥Ñ¥Ã¥±¡¼¥¸ Rhpc ¤Î¾õ¶· Rhpc COM-ONE 2015 R 27 12 5 1 / 29 1 2 Rhpc 3 forign MPI 4 Windows 5 2 / 29 1 2 Rhpc 3 forign MPI 4 Windows 5 3 / 29 Rhpc, R HPC Rhpc, ( ), snow..., Rhpc worker call Rhpc lapply 4 / 29 1 2 Rhpc 3 forign

More information

44 6 MPI 4 : #LIB=-lmpich -lm 5 : LIB=-lmpi -lm 7 : mpi1: mpi1.c 8 : $(CC) -o mpi1 mpi1.c $(LIB) 9 : 10 : clean: 11 : -$(DEL) mpi1 make mpi1 1 % mpiru

44 6 MPI 4 : #LIB=-lmpich -lm 5 : LIB=-lmpi -lm 7 : mpi1: mpi1.c 8 : $(CC) -o mpi1 mpi1.c $(LIB) 9 : 10 : clean: 11 : -$(DEL) mpi1 make mpi1 1 % mpiru 43 6 MPI MPI(Message Passing Interface) MPI 1CPU/1 PC Cluster MPICH[5] 6.1 MPI MPI MPI 1 : #include 2 : #include 3 : #include 4 : 5 : #include "mpi.h" 7 : int main(int argc,

More information

untitled

untitled Fortran90 ( ) 17 12 29 1 Fortran90 Fortran90 FORTRAN77 Fortran90 1 Fortran90 module 1.1 Windows Windows UNIX Cygwin (http://www.cygwin.com) C\: Install Cygwin f77 emacs latex ps2eps dvips Fortran90 Intel

More information

演習準備

演習準備 演習準備 2014 年 3 月 5 日神戸大学大学院システム情報学研究科森下浩二 1 演習準備の内容 神戸大 FX10(π-Computer) 利用準備 システム概要 ログイン方法 コンパイルとジョブ実行方法 MPI 復習 1. MPIプログラムの基本構成 2. 並列実行 3. 1 対 1 通信 集団通信 4. データ 処理分割 5. 計算時間計測 2 神戸大 FX10(π-Computer) 利用準備

More information

4th XcalableMP workshop 目的 n XcalableMPのローカルビューモデルであるXMPのCoarray機能を用 いて Fiberミニアプリ集への実装と評価を行う PGAS(Pertitioned Global Address Space)言語であるCoarrayのベ ンチマ

4th XcalableMP workshop 目的 n XcalableMPのローカルビューモデルであるXMPのCoarray機能を用 いて Fiberミニアプリ集への実装と評価を行う PGAS(Pertitioned Global Address Space)言語であるCoarrayのベ ンチマ 4th XcalableMP workshop 目的 n XcalableMPのローカルビューモデルであるXMPのCoarray機能を用 いて Fiberミニアプリ集への実装と評価を行う PGAS(Pertitioned Global Address Space)言語であるCoarrayのベ ンチマークとして整備することも考慮している n Coarrayによる並列化に関する知見を得る 1 n n l

More information

Microsoft PowerPoint - 演習2:MPI初歩.pptx

Microsoft PowerPoint - 演習2:MPI初歩.pptx 演習 2:MPI 初歩 - 並列に計算する - 2013 年 8 月 6 日 神戸大学大学院システム情報学研究科計算科学専攻横川三津夫 MPI( メッセージ パッシング インターフェース ) を使おう! [ 演習 2 の内容 ] はじめの一歩課題 1: Hello, world を並列に出力する. 課題 2: プロセス 0 からのメッセージを受け取る (1 対 1 通信 ). 部分に分けて計算しよう課題

More information

Sae x Sae x 1: 1. {x (i) 0 0 }N i=1 (x (i) 0 0 p(x 0) ) 2. = 1,, T a d (a) i (i = 1,, N) I, II I. v (i) II. x (i) 1 = f (x (i) 1 1, v(i) (b) i (i = 1,

Sae x Sae x 1: 1. {x (i) 0 0 }N i=1 (x (i) 0 0 p(x 0) ) 2. = 1,, T a d (a) i (i = 1,, N) I, II I. v (i) II. x (i) 1 = f (x (i) 1 1, v(i) (b) i (i = 1, ( ) 1 : ( ) Sampling/Imporance resampling (SIR) Kiagawa (1993, 1996), Gordon(1993) EnKF EnKF EnKF 1CPU 1core 2 x = f (x 1, v ) y = h (x, w ) (1a) (1b) PF p(x y 1 ) {x (i) 1 }N i=1, p(x y ) {x (i) }N i=1

More information

ex01.dvi

ex01.dvi ,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) double

More information

XcalableMP入門

XcalableMP入門 XcalableMP 1 HPC-Phys@, 2018 8 22 XcalableMP XMP XMP Lattice QCD!2 XMP MPI MPI!3 XMP 1/2 PCXMP MPI Fortran CCoarray C++ MPIMPI XMP OpenMP http://xcalablemp.org!4 XMP 2/2 SPMD (Single Program Multiple Data)

More information

Microsoft PowerPoint - S1-ref-F.ppt [互換モード]

Microsoft PowerPoint - S1-ref-F.ppt [互換モード] 課題 S1 解説 Fortran 言語編 RIKEN AICS HPC Summer School 2014 中島研吾 ( 東大 情報基盤センター ) 横川三津夫 ( 神戸大 計算科学教育センター ) MPI Programming 課題 S1 (1/2) /a1.0~a1.3, /a2.0~a2.3 から局所ベクトル情報を読み込み, 全体ベクトルのノルム ( x ) を求めるプログラムを作成する

More information

MPI MPI MPI.NET C# MPI Version2

MPI MPI MPI.NET C# MPI Version2 MPI.NET C# 2 2009 2 27 MPI MPI MPI.NET C# MPI Version2 MPI (Message Passing Interface) MPI MPI Version 1 1994 1 1 1 1 ID MPI MPI_Send MPI_Recv if(rank == 0){ // 0 MPI_Send(); } else if(rank == 1){ // 1

More information

Microsoft PowerPoint 並列アルゴリズム04.ppt

Microsoft PowerPoint 並列アルゴリズム04.ppt 並列アルゴリズム 2005 年後期火曜 2 限 青柳睦 Aoyagi@cc.kyushu-u.ac.jp http://server-500.cc.kyushu-u.ac.jp/ 11 月 8 日 ( 火 ) 5. MPI の基礎 6. 並列処理の性能評価 1 もくじ 1. 序並列計算機の現状 2. 計算方式およびアーキテクチュアの分類 3. 並列計算の目的と課題 4. 数値計算における各種の並列化

More information

講義の流れ 並列プログラムの概要 通常のプログラムと並列プログラムの違い 並列プログラム作成手段と並列計算機の構造 OpenMP による並列プログラム作成 処理を複数コアに分割して並列実行する方法 MPI による並列プログラム作成 ( 午後 ) プロセス間通信による並列処理 処理の分割 + データの

講義の流れ 並列プログラムの概要 通常のプログラムと並列プログラムの違い 並列プログラム作成手段と並列計算機の構造 OpenMP による並列プログラム作成 処理を複数コアに分割して並列実行する方法 MPI による並列プログラム作成 ( 午後 ) プロセス間通信による並列処理 処理の分割 + データの ( 財 ) 計算科学振興財団 大学院 GP 大学連合による計算科学の最先端人材育成 第 1 回社会人向けスパコン実践セミナー資料 29 年 2 月 17 日 13:15~14:45 九州大学情報基盤研究開発センター 南里豪志 1 講義の流れ 並列プログラムの概要 通常のプログラムと並列プログラムの違い 並列プログラム作成手段と並列計算機の構造 OpenMP による並列プログラム作成 処理を複数コアに分割して並列実行する方法

More information

58 7 MPI 7 : main(int argc, char *argv[]) 8 : { 9 : int num_procs, myrank; 10 : double a, b; 11 : int tag = 0; 12 : MPI_Status status; 13 : 1 MPI_Init

58 7 MPI 7 : main(int argc, char *argv[]) 8 : { 9 : int num_procs, myrank; 10 : double a, b; 11 : int tag = 0; 12 : MPI_Status status; 13 : 1 MPI_Init 57 7 MPI MPI 1 1 7.1 Bcast( ) allocate Bcast a=1 PE0 a=1 PE1 a=1 PE2 a=1 PE3 7.1: Bcast 58 7 MPI 7 : main(int argc, char *argv[]) 8 : { 9 : int num_procs, myrank; 10 : double a, b; 11 : int tag = 0; 12

More information

ex01.dvi

ex01.dvi ,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) { double

More information

Microsoft PowerPoint _MPI-01.pptx

Microsoft PowerPoint _MPI-01.pptx 計算科学演習 Ⅰ MPI を いた並列計算 (I) 神戸大学大学院システム情報学研究科谷口隆晴 yaguchi@pearl.kobe-u.ac.jp この資料は昨年度担当の横川先生の資料を参考にさせて頂いています. 2016/06/23 MPI を用いた並列計算 (I) 1 講義概要 分散メモリ型計算機上のプログラミング メッセージ パシング インターフェイス (Message Passing Interface,MPI)

More information

Chapter 1 1-1 2

Chapter 1 1-1 2 Chapter 1 1-1 2 create table ( date, weather ); create table ( date, ); 1 weather, 2 weather, 3 weather, : : 31 weather -- 1 -- 2 -- 3 -- 31 create table ( date, ); weather[] -- 3 Chapter 1 weather[] create

More information

paper+.dvi

paper+.dvi Vol. 40 No. 5 May 1999 MPI y y y MPI MPI/MBCF MPI/MBCF write eager 2 write eager FIFO 2 MPI/MBCF round-trip time peak bandwidth NAS Parallel Benchmarks Implementation and Evaluation of a High Performance

More information

並列計算導入.pptx

並列計算導入.pptx 並列計算の基礎 MPI を用いた並列計算 並列計算の環境 並列計算 複数の計算ユニット(PU, ore, Pなど を使用して 一つの問題 計算 を行わせる 近年 並列計算を手軽に使用できる環境が急速に整いつつある >通常のP PU(entral Processing Unit)上に計算装置であるoreが 複数含まれている Intel ore i7 シリーズ: 4つの計算装置(ore) 通常のプログラム

More information

<4D F736F F F696E74202D C097F B A E B93C782DD8EE682E890EA97705D>

<4D F736F F F696E74202D C097F B A E B93C782DD8EE682E890EA97705D> 並列アルゴリズム 2005 年後期火曜 2 限青柳睦 Aoyagi@cc.kyushu-u.ac.jp http//server-500.cc.kyushu-u.ac.jp/ 11 月 29( 火 ) 7. 集団通信 (Collective Communication) 8. 領域分割 (Domain Decomposition) 1 もくじ 1. 序並列計算機の現状 2. 計算方式およびアーキテクチュアの分類

More information

Microsoft Word - Sample_CQS-Report_English_backslant.doc

Microsoft Word - Sample_CQS-Report_English_backslant.doc ***** Corporation ANSI C compiler test system System test report 2005/11/16 Japan Novel Corporation *****V43/NQP-DS-501-1 Contents Contents......2 1. Evaluated compiler......3 1.1. smp-compiler compiler...3

More information

lexex.dvi

lexex.dvi (2018, c ) http://istksckwanseiacjp/ ishiura/cpl/ 4 41 1 mini-c lexc,, 2 testlexc, lexc mini-c 1 ( ) mini-c ( ) (int, char, if, else, while, return 6 ) ( ) (+, -, *, /, %, &, =, ==,!=, >, >=,

More information

エラー処理・分割コンパイル・コマンドライン引数

エラー処理・分割コンパイル・コマンドライン引数 L10(2017-12-05 Tue) : Time-stamp: 2017-12-17 Sun 11:59 JST hig. recv/send http://hig3.net ( ) L10 (2017) 1 / 21 IP I swallow.math.ryukoku.ac.jp:13 = 133.83.83.6:13 = : IP ( = ) (well-known ports), :. :,.

More information

<4D F736F F F696E74202D C097F B A E B93C782DD8EE682E890EA97705D>

<4D F736F F F696E74202D C097F B A E B93C782DD8EE682E890EA97705D> 並列アルゴリズム 2005 年後期火曜 2 限 青柳睦 Aoyagi@cc.kyushu-u.ac.jp http://server-500.cc.kyushu-u.ac.jp/ 10 月 18( 火 ) 4. 数値計算における各種の並列化 5. MPI の基礎 1 講義の概要 並列計算機や計算機クラスターなどの分散環境における並列処理の概論 MPI および OpenMP による並列計算 理工学分野の並列計算アルゴリズム

More information

IP L09( Tue) : Time-stamp: Tue 14:52 JST hig TCP/IP. IP,,,. ( ) L09 IP (2017) 1 / 28

IP L09( Tue) : Time-stamp: Tue 14:52 JST hig TCP/IP. IP,,,. ( )   L09 IP (2017) 1 / 28 L09(2017-11-21 Tue) : Time-stamp: 2017-11-21 Tue 14:52 JST hig TCP/IP. IP,,,. http://hig3.net L09 (2017) 1 / 28 9, IP, - L09 (2017) 2 / 28 C (ex. ) 1 TCP/IP 2 3 ( ) ( L09 (2017) 3 / 28 50+5, ( )50+5. (

More information

(Basic Theory of Information Processing) Fortran Fortan Fortan Fortan 1

(Basic Theory of Information Processing) Fortran Fortan Fortan Fortan 1 (Basic Theory of Information Processing) Fortran Fortan Fortan Fortan 1 17 Fortran Formular Tranlator Lapack Fortran FORTRAN, FORTRAN66, FORTRAN77, FORTRAN90, FORTRAN95 17.1 A Z ( ) 0 9, _, =, +, -, *,

More information

untitled

untitled I 9 MPI (II) 2012 6 14 .. MPI. 1-3 sum100.f90 4 istart=myrank*25+1 iend=(myrank+1)*25 0 1 2 3 mpi_recv 3 isum1 1 isum /tmp/120614/sum100_4.f90 program sum100_4 use mpi implicit none integer :: i,istart,iend,isum,isum1,ip

More information

かし, 異なったプロセス間でデータを共有するためには, プロセス間通信や特殊な共有メモリ領域を 利用する必要がある. このためマルチプロセッサマシンの利点を最大に引き出すことができない. こ の問題はマルチスレッドを用いることで解決できる. マルチスレッドとは,1 つのプロセスの中に複 数のスレッド

かし, 異なったプロセス間でデータを共有するためには, プロセス間通信や特殊な共有メモリ領域を 利用する必要がある. このためマルチプロセッサマシンの利点を最大に引き出すことができない. こ の問題はマルチスレッドを用いることで解決できる. マルチスレッドとは,1 つのプロセスの中に複 数のスレッド 0 並列計算について 0.1 並列プログラミングライブラリのメッセージパッシングモデル並列プログラムにはメモリモデルで分類すると, 共有メモリモデルと分散メモリモデルの 2 つに分けられる. それぞれ次のような特徴がある. 共有メモリモデル複数のプロセスやスレッドが事項する主体となり, 互いに通信や同期を取りながら計算が継続される. スレッド間の実行順序をプログラマが保証してやらないと, 思った結果が得られない.

More information

r07.dvi

r07.dvi 19 7 ( ) 2019.4.20 1 1.1 (data structure ( (dynamic data structure 1 malloc C free C (garbage collection GC C GC(conservative GC 2 1.2 data next p 3 5 7 9 p 3 5 7 9 p 3 5 7 9 1 1: (single linked list 1

More information

課題 S1 解説 Fortran 編 中島研吾 東京大学情報基盤センター

課題 S1 解説 Fortran 編 中島研吾 東京大学情報基盤センター 課題 S1 解説 Fortran 編 中島研吾 東京大学情報基盤センター 内容 課題 S1 /a1.0~a1.3, /a2.0~a2.3 から局所ベクトル情報を読み込み, 全体ベクトルのノルム ( x ) を求めるプログラムを作成する (S1-1) file.f,file2.f をそれぞれ参考にする 下記の数値積分の結果を台形公式によって求めるプログラムを作成する

More information

ohp07.dvi

ohp07.dvi 19 7 ( ) 2019.4.20 1 (data structure) ( ) (dynamic data structure) 1 malloc C free 1 (static data structure) 2 (2) C (garbage collection GC) C GC(conservative GC) 2 2 conservative GC 3 data next p 3 5

More information

CS

CS 性能並列計算法特論 第 10 回 情報基盤研究開発センター 野謙 2017 年 7 11 ( ) 成績評価 その他の連絡事項 出席点 5 割 + 期末試験 ( レポート作成 )5 割 講義資料は毎回配布予定です 席した場合, 各 でダウンロードしてください http://mercury.cc.kyushu-u.ac.jp/lecture_2017/ PDF 版をその週の 曜の朝までには公開予定 講義開始後約

More information

smpp_resume.dvi

smpp_resume.dvi 2 MPI sin@mikilab.doshisha.ac.jp MPIMPI(Message Passing Interface) MPI UNIX WindowsMac OS, MPI MPI MPI 2 MPI i j j i MPI 34. MPI PVM MPI PVM MPI PVM(Parallel Virtual Machine) PVM MPI MPI PVM MPI MPI Message

More information

OpenMP (1) 1, 12 1 UNIX (FUJITSU GP7000F model 900), 13 1 (COMPAQ GS320) FUJITSU VPP5000/64 1 (a) (b) 1: ( 1(a))

OpenMP (1) 1, 12 1 UNIX (FUJITSU GP7000F model 900), 13 1 (COMPAQ GS320) FUJITSU VPP5000/64 1 (a) (b) 1: ( 1(a)) OpenMP (1) 1, 12 1 UNIX (FUJITSU GP7000F model 900), 13 1 (COMPAQ GS320) FUJITSU VPP5000/64 1 (a) (b) 1: ( 1(a)) E-mail: {nanri,amano}@cc.kyushu-u.ac.jp 1 ( ) 1. VPP Fortran[6] HPF[3] VPP Fortran 2. MPI[5]

More information

O(N) ( ) log 2 N

O(N) ( ) log 2 N 2005 11 21 1 1.1 2 O(N) () log 2 N 1.2 2 1 List 3-1 List 3-3 List 3-4? 3 3.1 3.1.1 List 2-1(p.70) 1 1 10 1 3.1.2 List 3-1(p.70-71) 1 1 2 1 2 2 1: 1 3 3.1.3 1 List 3-1(p.70-71) 2 #include stdlib.h

More information

~~~~~~~~~~~~~~~~~~ wait Call CPU time 1, latch: library cache 7, latch: library cache lock 4, job scheduler co

~~~~~~~~~~~~~~~~~~ wait Call CPU time 1, latch: library cache 7, latch: library cache lock 4, job scheduler co 072 DB Magazine 2007 September ~~~~~~~~~~~~~~~~~~ wait Call CPU time 1,055 34.7 latch: library cache 7,278 750 103 24.7 latch: library cache lock 4,194 465 111 15.3 job scheduler coordinator slave wait

More information

DKA ( 1) 1 n i=1 α i c n 1 = 0 ( 1) 2 n i 1 <i 2 α i1 α i2 c n 2 = 0 ( 1) 3 n i 1 <i 2 <i 3 α i1 α i2 α i3 c n 3 = 0. ( 1) n 1 n i 1 <i 2 < <i

DKA ( 1) 1 n i=1 α i c n 1 = 0 ( 1) 2 n i 1 <i 2 α i1 α i2 c n 2 = 0 ( 1) 3 n i 1 <i 2 <i 3 α i1 α i2 α i3 c n 3 = 0. ( 1) n 1 n i 1 <i 2 < <i 149 11 DKA IEEE754 11.1 DKA n p(x) = a n x n + a n 1 x n 1 + + a 0 (11.1) p(x) = 0 (11.2) p n (x) q n (x) = x n + c n 1 x n 1 + + c 1 x + c 0 q n (x) = 0 (11.3) c i = a i a n (i = 0, 1,..., n 1) (11.3)

More information

Microsoft PowerPoint - MPIprog-F2.ppt [互換モード]

Microsoft PowerPoint - MPIprog-F2.ppt [互換モード] MPI によるプログラミング概要 ( その ) Fortran 言語編 RIKEN AICS HPC Summer School 01 中島研吾 ( 東大 情報基盤センター ) 横川三津夫 ( 神戸大学 計算科学教育センター ) 1 概要 MPI とは MPI の基礎 :Hello World 全体データと局所データ グループ通信 (Collective Communication) 1 対 1 通信

More information

情報処理演習 II

情報処理演習 II 2004 年 6 月 15 日 長谷川秀彦 情報処理演習 II Parallel Computing on Distributed Memory Machine 1. 分散メモリ方式並列計算の基礎 複数の CPU がそれぞれのメモリを持ち 独立に動作するコンピュータを分散メモリ方式並列コンピュータ 正確には Distributed Memory Parallel Computer という これには複数の

More information

情報処理概論(第二日目)

情報処理概論(第二日目) 1 並列プログラミング超入門講習会 九州大学情報基盤研究開発センター MPI コース 2 並列計算機の構成 計算ノード ネットワーク CPU コア メモリ アクセラレータ (GPU 等 ) 例 : スーパーコンピュータシステム ITO サブシステム B ノード数 CPU 数 / ノードコア数 / CPU GPU 数 / ノード 128 2 18 4 MPI (Message Passing Interface)

More information

第8回講義(2016年12月6日)

第8回講義(2016年12月6日) 2016/12/6 スパコンプログラミング (1) (Ⅰ) 1 行列 - 行列積 (2) 東京大学情報基盤センター准教授塙敏博 2016 年 12 月 6 日 ( 火 ) 10:25-12:10 2016/11/29 講義日程 ( 工学部共通科目 ) 1. 9 月 27 日 ( 今日 ): ガイダンス 2. 10 月 4 日 l 並列数値処理の基本演算 ( 座学 ) 3. 10 月 11 日 : スパコン利用開始

More information

XMPによる並列化実装2

XMPによる並列化実装2 2 3 C Fortran Exercise 1 Exercise 2 Serial init.c init.f90 XMP xmp_init.c xmp_init.f90 Serial laplace.c laplace.f90 XMP xmp_laplace.c xmp_laplace.f90 #include int a[10]; program init integer

More information

115 9 MPIBNCpack 9.1 BNCpack 1CPU X = , B =

115 9 MPIBNCpack 9.1 BNCpack 1CPU X = , B = 115 9 MPIBNCpack 9.1 BNCpack 1CPU 1 2 3 4 5 25 24 23 22 21 6 7 8 9 10 20 19 18 17 16 X = 11 12 13 14 15, B = 15 14 13 12 11 16 17 18 19 20 10 9 8 7 6 21 22 23 24 25 5 4 3 2 1 C = XB X dmat1 B dmat2 C dmat

More information

r08.dvi

r08.dvi 19 8 ( ) 019.4.0 1 1.1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( ) 1 next 1 prev 1 head cur tail head cur prev

More information

For_Beginners_CAPL.indd

For_Beginners_CAPL.indd CAPL Vector Japan Co., Ltd. 目次 1 CAPL 03 2 CAPL 03 3 CAPL 03 4 CAPL 04 4.1 CAPL 4.2 CAPL 4.3 07 5 CAPL 08 5.1 CANoe 5.2 CANalyzer 6 CAPL 10 7 CAPL 11 7.1 CAPL 7.2 CAPL 7.3 CAPL 7.4 CAPL 16 7.5 18 8 CAPL

More information

Fundamental MPI 1 概要 MPI とは MPI の基礎 :Hello World 全体データと局所データタ グループ通信 (Collective Communication) 1 対 1 通信 (Point-to-Point Communication)

Fundamental MPI 1 概要 MPI とは MPI の基礎 :Hello World 全体データと局所データタ グループ通信 (Collective Communication) 1 対 1 通信 (Point-to-Point Communication) MPI 超 入門 (FORTRAN 編 ) 東京大学情報基盤センター Fundamental MPI 1 概要 MPI とは MPI の基礎 :Hello World 全体データと局所データタ グループ通信 (Collective Communication) 1 対 1 通信 (Point-to-Point Communication) Fundamental MPI 2 MPI とは (1/2)

More information

Copyright 2002-2003 SATO International All rights reserved. http://www.satoworldwide.com/ This software is based in part on the work of the Independen

Copyright 2002-2003 SATO International All rights reserved. http://www.satoworldwide.com/ This software is based in part on the work of the Independen SATO Label Gallery SATO International Pte Ltd Version : BSI-021227-01 Copyright 2002-2003 SATO International All rights reserved. http://www.satoworldwide.com/ This software is based in part on the work

More information

MPI

MPI 筑波大学計算科学研究センター CCS HPC サマーセミナー MPI 建部修見 tatebe@cs.tsukuba.ac.jp 筑波大学大学院システム情報工学研究科計算科学研究センター 分散メモリ型並列計算機 (PC クラスタ ) 計算ノードはプロセッサとメモリで構成され, 相互結合網で接続 ノード内のメモリは直接アクセス 他ノードとはネットワーク通信により情報交換 いわゆるPCクラスタ 相互結合網

More information

課題 S1 解説 C 言語編 中島研吾 東京大学情報基盤センター

課題 S1 解説 C 言語編 中島研吾 東京大学情報基盤センター 課題 S1 解説 C 言語編 中島研吾 東京大学情報基盤センター 内容 課題 S1 /a1.0~a1.3, /a2.0~a2.3 から局所ベクトル情報を読み込み, 全体ベクトルのノルム ( x ) を求めるプログラムを作成する (S1-1) file.f,file2.f をそれぞれ参考にする 下記の数値積分の結果を台形公式によって求めるプログラムを作成する

More information

Microsoft PowerPoint - MPIprog-C2.ppt [互換モード]

Microsoft PowerPoint - MPIprog-C2.ppt [互換モード] MPI によるプログラミング概要 ( その ) C 言語編 RIKEN AICS HPC Summer School 01 中島研吾 ( 東大 情報基盤センター ) 横川三津夫 ( 神戸大学 計算科学教育センター ) 1 概要 MPI とは MPI の基礎 :Hello World 全体データと局所データ グループ通信 (Collective Communication) 1 対 1 通信 (Peer-to-Peer

More information

untitled

untitled Copyright - Zac Poonen (1999) This book has been copyrighted to prevent misuse. It should not be reprinted or translated without written permission from the author. Permission is however given for any

More information

ohp08.dvi

ohp08.dvi 19 8 ( ) 2019.4.20 1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: 2 (2) NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( 2) 3 (3) head cur tail head cur prev data

More information

1 # include < stdio.h> 2 # include < string.h> 3 4 int main (){ 5 char str [222]; 6 scanf ("%s", str ); 7 int n= strlen ( str ); 8 for ( int i=n -2; i

1 # include < stdio.h> 2 # include < string.h> 3 4 int main (){ 5 char str [222]; 6 scanf (%s, str ); 7 int n= strlen ( str ); 8 for ( int i=n -2; i ABC066 / ARC077 writer: nuip 2017 7 1 For International Readers: English editorial starts from page 8. A : ringring a + b b + c a + c a, b, c a + b + c 1 # include < stdio.h> 2 3 int main (){ 4 int a,

More information

11042 計算機言語7回目 サポートページ:

11042 計算機言語7回目  サポートページ: 11042 7 :https://goo.gl/678wgm November 27, 2017 10/2 1(print, ) 10/16 2(2, ) 10/23 (3 ) 10/31( ),11/6 (4 ) 11/13,, 1 (5 6 ) 11/20,, 2 (5 6 ) 11/27 (7 12/4 (9 ) 12/11 1 (10 ) 12/18 2 (10 ) 12/25 3 (11

More information

tuat1.dvi

tuat1.dvi ( 1 ) http://ist.ksc.kwansei.ac.jp/ tutimura/ 2012 6 23 ( 1 ) 1 / 58 C ( 1 ) 2 / 58 2008 9 2002 2005 T E X ptetex3, ptexlive pt E X UTF-8 xdvi-jp 3 ( 1 ) 3 / 58 ( 1 ) 4 / 58 C,... ( 1 ) 5 / 58 6/23( )

More information

ohp03.dvi

ohp03.dvi 19 3 ( ) 2019.4.20 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void int main(int argc, char *argv[]) {... 2 (2) argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0

More information

Fundamental MPI 1 概要 MPI とは MPI の基礎 :Hello World 全体データと局所データタ グループ通信 (Collective Communication) 1 対 1 通信 (Point-to-Point Communication)

Fundamental MPI 1 概要 MPI とは MPI の基礎 :Hello World 全体データと局所データタ グループ通信 (Collective Communication) 1 対 1 通信 (Point-to-Point Communication) MPI 超 入門 (C 言語編 ) 東京大学情報基盤センター FOTRAN 編は以下 http://nkl.cc.u-tokyo.ac.jp/seminars/t2kfvm/mpiprogf.pdf tokyo pdf Fundamental MPI 1 概要 MPI とは MPI の基礎 :Hello World 全体データと局所データタ グループ通信 (Collective Communication)

More information

<4D F736F F F696E74202D C097F B A E B93C782DD8EE682E890EA97705D>

<4D F736F F F696E74202D C097F B A E B93C782DD8EE682E890EA97705D> 並列アルゴリズム 2005 年後期火曜 2 限 青柳睦 Aoyagi@cc.kyushu-u.ac.jp http://server-500.cc.kyushu-u.ac.jp/ 10 月 11 日 ( 火 ) 1. 序並列計算機の現状 2. 計算方式およびアーキテクチュアの分類 ( 途中から ) 3. 並列計算の目的と課題 4. 数値計算における各種の並列化 1 講義の概要 並列計算機や計算機クラスターなどの分散環境における並列処理の概論

More information

HPCセミナー

HPCセミナー 並列プログラミング技法 (MPI 詳説 ) 高度情報科学技術研究機構神戸センター 宮内敦 0 本日の講義内容 MPIの基礎知識 MPI 関数各論 並列性能評価 具体的な問題への応用 1 2 MPI の基礎知識 1. MPI 規格 (MPI standard) 2. MPI ライブラリ 3 MPI 規格 (MPI standard) とは プロセス並列を前提としたプロセス間のメッセージ交換に関する標準仕様

More information

r03.dvi

r03.dvi 19 ( ) 019.4.0 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void... argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0 a a \0 b b b \0 c c c \0 1: // argdemo1.c ---

More information

Fundamental MPI 1 概要 MPI とは MPI の基礎 :Hello World 全体データと局所データ グループ通信 (Collective Communication) 1 対 1 通信 (Point-to-Point Communication)

Fundamental MPI 1 概要 MPI とは MPI の基礎 :Hello World 全体データと局所データ グループ通信 (Collective Communication) 1 対 1 通信 (Point-to-Point Communication) MPI 超 入門 (C 言語編 ) 東京大学情報基盤センター FORTRAN 編は以下 http://www.cspp.cc.u-tokyo.ac.jp /ohshima/seminars/t2k201111/ (MPI による並列アプリケーション開発入門 2) Fundamental MPI 1 概要 MPI とは MPI の基礎 :Hello World 全体データと局所データ グループ通信 (Collective

More information

第5回お試しアカウント付き並列プログラミング講習会

第5回お試しアカウント付き並列プログラミング講習会 qstat -l ID (qstat -f) qscript ID BATCH REQUEST: 253443.batch1 Name: test.sh Owner: uid=32637, gid=30123 Priority: 63 State: 1(RUNNING) Created at: Tue Jun 30 05:36:24 2009 Started at: Tue Jun 30 05:36:27

More information

:30 12:00 I. I VI II. III. IV. a d V. VI

:30 12:00 I. I VI II. III. IV. a d V. VI 2017 2017 08 03 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF X [ S ] a S S ; X X X, S [, a, ], ; BNF X (parse tree) (1) [a;a] (2) [[a]] (3) [a;[a]] (4) [[a];a] : [a] X 2 222222

More information

C ( ) C ( ) C C C C C 1 Fortran Character*72 name Integer age Real income 3 1 C mandata mandata ( ) name age income mandata ( ) mandat

C ( ) C ( ) C C C C C 1 Fortran Character*72 name Integer age Real income 3 1 C mandata mandata ( ) name age income mandata ( ) mandat C () 14 5 23 C () C C C C C 1 Fortran Character*72 name Integer age Real income 3 1 C 1.1 3 7 mandata mandata () name age income mandata () mandata1 1 #include struct mandata char name[51];

More information

1 OpenCL OpenCL 1 OpenCL GPU ( ) 1 OpenCL Compute Units Elements OpenCL OpenCL SPMD (Single-Program, Multiple-Data) SPMD OpenCL work-item work-group N

1 OpenCL OpenCL 1 OpenCL GPU ( ) 1 OpenCL Compute Units Elements OpenCL OpenCL SPMD (Single-Program, Multiple-Data) SPMD OpenCL work-item work-group N GPU 1 1 2 1, 3 2, 3 (Graphics Unit: GPU) GPU GPU GPU Evaluation of GPU Computing Based on An Automatic Program Generation Technology Makoto Sugawara, 1 Katsuto Sato, 1 Kazuhiko Komatsu, 2 Hiroyuki Takizawa

More information

DS-30

DS-30 NPD4633-00 JA ...6... 6... 6... 6... 6... 7... 7... 7... 7... 8... 8...9...10...11...11...13 Document Capture Pro Windows...13 EPSON Scan Mac OS X...14 SharePoint Windows...16 Windows...16...17 Document

More information

ES-D400/ES-D200

ES-D400/ES-D200 NPD4564-00 ...4...7 EPSON Scan... 7...11 PDF...12 / EPSON Scan...14 EPSON Scan...14 EPSON Scan...15 EPSON Scan...15 EPSON Scan...16 Epson Event Manager...17 Epson Event Manager...17 Epson Event Manager...17

More information

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション AICS 公開ソフトウェア講習会 15 回 表題通信ライブラリと I/O ライブラリ 場所 AICS R104-2 時間 2016/03/23 ( 水 ) 13:30-17:00 13:30-13:40 全体説明 13:40-14:10 PRDMA 14:10-14:40 MPICH 14:40-15:10 PVAS 15:10-15:30 休憩 15:30-16:00 Carp 16:00-16:30

More information

ES-D400/ES-D350

ES-D400/ES-D350 NPD4650-00 ...4 EPSON Scan... 4 Document Capture Pro Windows... 7 EPSON Scan...10 EPSON Scan...10...14 PDF...15 / EPSON Scan...17 EPSON Scan...17 EPSON Scan...18 EPSON Scan...18 Document Capture Pro Windows...19

More information

GT-X830

GT-X830 NPD5108-00 ...5... 5... 6... 8...11 EPSON Scan...11 PDF...16 OCR...16...17...17...20 /...20...20...22...23...23...24...25...25...26...27 PDF...30...31 / EPSON Scan...34 EPSON Scan...34 EPSON Scan...36

More information