MPI usage

Similar documents
para02-2.dvi

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

untitled

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

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

untitled

WinHPC ppt

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

目 目 用方 用 用 方

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

コードのチューニング

NUMAの構成

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

120802_MPI.ppt

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

Microsoft PowerPoint - KHPCSS pptx

XcalableMP入門

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

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

スライド 1

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

コードのチューニング

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

MPI MPI MPI.NET C# MPI Version2

chap2.ppt

Microsoft PowerPoint _MPI-03.pptx

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

並列計算導入.pptx

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

01_OpenMP_osx.indd

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

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

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

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

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

<4D F736F F F696E74202D D F95C097F D834F E F93FC96E5284D F96E291E85F8DE391E52E >

ex01.dvi

演習準備

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

nakao

OpenMP¤òÍѤ¤¤¿ÊÂÎó·×»»¡Ê£±¡Ë

2 /83

2012年度HPCサマーセミナー_多田野.pptx

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

040312研究会HPC2500.ppt

86 8 MPIBNCpack 15 : int n, myid, numprocs, i; 16 : double pi, start_x, end_x; 17 : double startwtime = 0.0, endwtime; 18 : int namelen; 19 : char pro

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

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

02_C-C++_osx.indd

1.overview

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

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

OpenMP¤òÍѤ¤¤¿ÊÂÎó·×»»¡Ê£±¡Ë

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

XACC講習会

XMPによる並列化実装2

PowerPoint プレゼンテーション

2 2.1 Mac OS CPU Mac OS tar zxf zpares_0.9.6.tar.gz cd zpares_0.9.6 Mac Makefile Mekefile.inc cp Makefile.inc/make.inc.gfortran.seq.macosx make

内容に関するご質問は まで お願いします [Oakforest-PACS(OFP) 編 ] 第 85 回お試しアカウント付き並列プログラミング講習会 ライブラリ利用 : 科学技術計算の効率化入門 スパコンへのログイン テストプログラム起動 東京大学情報基盤セ

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

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

情報処理演習 II

Microsoft PowerPoint _MPI-01.pptx

ex01.dvi

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

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

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)

卒業論文

XACCの概要

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

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

MPI 超 入門 (FORTRAN 編 ) 東京大学情報基盤センター C 言語編は以下 /ohshima/seminars/t2k201111/ (MPI による並列アプリケーション開発入門 2)

untitled

(Microsoft PowerPoint \211\211\217K3_4\201i\216R\226{_\211\272\215\342\201j.ppt [\214\335\212\267\203\202\201[\203h])

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

スライド 1

about MPI

Intel® Compilers Professional Editions

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

Page 2 本資料は, 東北大学サイバーサイエンスセンターと NEC の共同により作成され, 大阪大学サイバーメディアセンターの環境で実行確認を行い, 修正を加えたものです. 無断転載等は, ご遠慮下さい.

スライド 1

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B

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

Microsoft PowerPoint - MPIprog-C [互換モード]

1.ppt

Microsoft Word - 計算科学演習第1回3.doc

SystemC言語概論

インテル® MPI ライブラリー・ランタイム環境入門ガイド

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,

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

スパコンに通じる並列プログラミングの基礎

double float

CPU Levels in the memory hierarchy Level 1 Level 2... Increasing distance from the CPU in access time Level n Size of the memory at each level 1: 2.2

スパコンに通じる並列プログラミングの基礎

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

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

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

smpp_resume.dvi

C

Transcription:

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 MPI GATHERV......................... 2 1.2.3 MPI ALLGATHER....................... 4 1.2.4 MPI ALLGATHERV....................... 4 1.2.5 MPI REDUCE.......................... 5 1.3 DO.......... 6 2 granurality 7 3 8 3.1........................... 8 4 8 A C 10 B MPI LINUX Machine 11 C MPI 11 1 ogawa@eedept.kobe-u.ac.jp i

1 MPI ( Message Passing Interface ) 1.1 MPI MPI Message Passing Interface CPU node 1PVM(Parallel Virtual Machine) MPI MPI CPU1 CPU2 CPU3 CPU N memory memory memory memory Giga-Bit Ether Net (or Faster Network) 1 MPI MPI (FORTRAN) C * integer myrank,nprocs,mpi_comm_world! necessary call mpi_init(ierr) call mpi_comm_size(mpi_comm_world,nprocs,ierr) call mpi_comm_rank(mpi_comm_world,myrank,ierr).. (Program Main Body). * C call mpi_finalize(ierr) end 1

(Program Main Body) myrank 1.2 1.2.1 MPI GATHER (root) (recvbuf) MPI SCATTER call mpi_gather(sendbuf, sendcount, sendtype, & recvbuf, recvcount, recvtype, root, mpi_comm_world, ierr) sendbuf () sendcount sendtype recvbuf ) recvcount recvtype root mpi comm world mpi comm world ierr ( ) 1 1.2.2 MPI GATHERV (root) 2

1 MPI INTEGER MPI REAL MPI DOUBLE PRECISION MPI COMPLEX MPI 2INTEGER MPI 2REAL MPI 2DOUBLE PRECISION {MPI INTEGER, MPI INTEGER} {MPI REAL, MPI REAL} {MPI DOUBLE PRECISION, MPI DOUBLE PRECISION} MPI GATHER ( MPI ALLGATHER call mpi_gatherv(sendbuf, sendcount, sendtype, & recvbuf, recvcount, displs, recvtype, root, mpi_comm_world,ierr) sendbuf () sendcount sendtype recvbuf ) recvcount i i+1 0 ) displs i recvbuf () i+1 0 ) root recvtype root mpi comm world mpi comm world ierr 3

1.2.3 MPI ALLGATHER MPI GATHER MPI BCAST call mpi_allgather(sendbuf, sendcount, sendtype, & recvbuf, recvcount, recvtype, mpi_comm_world,ierr) sendbuf () sendcount sendtype recvbuf ) recvcount recvtype mpi comm world ierr 1.2.4 MPI ALLGATHERV MPI ALLGATHER ( MPI ALLGATHER call mpi_allgatherv(sendbuf, sendcount, sendtype, & recvbuf, recvcount, displs, recvtype, mpi_comm_world,ierr) 4

sendbuf () sendcount sendtype recvbuf ) recvcount i i+1 0 ) displs i recvbuf () i+1 0 ) recvtype mpi comm world ierr c c do irank=0,nprocs-1 call para_range(1,iemax,nprocs,irank,jsta,jend) jjlen(irank)=ild*(iwm-1)*(jend-jsta+1) idisp(irank)=ild*(iwm-1)*(jsta-1) end do call para_range(1,iemax,nprocs,myrank,ista,iend) call mpi_allgatherv(adedmmy(1,ista),jjlen(myrank), & MPI_DOUBLE_PRECISION,ADE,JJLEN,IDISP, & MPI_DOUBLE_PRECISION,MPI_COMM_WORLD,IERR) 1.2.5 MPI REDUCE MPI REDUCE 2 call mpi_reduce(sumi,sumall,1,mpi_double_precision, & mpi_sum,0,mpi_comm_world,ierr) 5

2 MPI REDUCE MPI SUM( ) MPI PROD( ) MPI MAX() MPI MIN() MPI MAXLOC( ) MP MINLOC( ) MPI INTEGER MPI REAL MPI DOUBLE PRECISION MPI COMPLEX MPI INTEGER MPI REAL MPI DOUBLE PRECISION MPI 2INTEGER MPI 2REAL MPI 2DOUBLE PRECISION sumi () sumall ) 1 comm mpi double precision mpi sum 0 comm mpi comm world ierr 1.3 DO c c c subroutine para_range(n1,n2,nprocs,irank,ista,iend) iwork = (n2-n1)/nprocs + 1 ista = min(irank*iwork+n1,n2+1) iend = min(ista+iwork-1,n2) end 6

2 granurality 2 DO MAIN PROGRAM DO II = 1, 8 CALL SUB1(II) CALL SUB2(SUM) A(II) = SUM SUBTOUTINE SUB1(II) CALL SUB3(II) SUBROUTINE SUB3(II) DO I1 = 1, 100 A(II) = I1 * II DO I2 = 1, 100 B(I2) = A(I2-1) + A(I2+1) SUBROUTINE SUB2(SUM) CALL SUB4(SUM) SUBROUTINE SUB4(SUM) DO I1 = 1, 100 B(I1) = B(I1) + 1.0 SUM = 0.0 DDO I2 = 1, 100 SUM = SUM+B(I2) 2 Single CPU Source Code 2 2 3 DO DO 7

MAIN PROGRAM DO II = ISTART, IEND CALL SUB1(II) CALL SUB2(SUM) A(II) = SUM parallelization in the highest level SUBTOUTINE SUB1(II) CALL SUB3(II) SUBROUTINE SUB3(II) DO I1 = 1, 100 A(II) = I1 * II DO I2 = 1, 100 B(I2) = A(I2-1) + A(I2+1) SUBROUTINE SUB2(SUM) CALL SUB4(SUM) SUBROUTINE SUB4(SUM) DO I1 = 1, 100 B(I1) = B(I1) + 1.0 SUM = 0.0 DDO I2 = 1, 100 SUM = SUM+B(I2) 3 2 3 MPICH [?] 3.1 fortran 77/90 mpif77, c/c++ mpicc (ifc, icc) ( intel fortran compiler (ifc) c/c++ compiler (icc) ) % mpif77 -o exec_file foo.f [-O3 -tpp7 -xw -static] # foo.f exec_file % mpif77 -c foo.f [-O3 -tpp7 -xw -static] # % mpif77 foo.o -o exec_file # 4, mpirun % mpirun -np 8 exec_file 8

# exec_file 8 CPU % bsub -o logfile.out -q normal -n 8 "mpijob mpirun exec_file " # LSF bsub exec_file 8 CPU 9

A C C C, C++) mpi gather FORTRAN #include "mpi.h" /* include header file */ void main(int argc, char **argv) { int myrank, error, buffer mpi_status status; mpi_init(argc, argv); mpi_comm_rank(mpi_comm_world, &myrank); (main program body) mpi_finalize(); /* necessary */ } 10

B MPI LINUX Machine W. Gropp and E. Lusk, Installation and User s Guide ti MPICH, a Portable Implementaiton of MPI Version 1.2.5 The ch shmem device for Shared Memory Processors, Mathematics and Computer Science Division, University of Chicago and Argonne National laboratory. http//www.mcs.anl.gov/mpi/mpich/index.html http//www.epm.ornl.gov/pvm/pvm home.html C MPI MPI 11