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

Similar documents
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

120802_MPI.ppt


86

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

para02-2.dvi

MPI usage

Microsoft PowerPoint - KHPCSS pptx

Microsoft PowerPoint _MPI-03.pptx

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

NUMAの構成

演習準備


コードのチューニング

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

スライド 1

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

Microsoft PowerPoint _MPI-01.pptx

コードのチューニング

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

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,

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

untitled

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

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

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

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

スライド 1

スライド 1

目 目 用方 用 用 方

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

スライド 1

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

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

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

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

並列計算プログラミング超入門

並列計算導入.pptx

untitled

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

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

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

chap2.ppt

MPI

MPI コミュニケータ操作

MPI MPI MPI.NET C# MPI Version2

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

WinHPC ppt

01_OpenMP_osx.indd

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

Microsoft PowerPoint - 高速化WS富山.pptx

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

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

CS

nakao

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

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

2 /83

untitled

MPI によるプログラミング概要 Fortran 編 中島研吾 東京大学情報基盤センター

Microsoft PowerPoint - 第10回講義(2015年12月22日)-1 .pptx

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

untitled

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション

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

GNU開発ツール

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

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

Excel97関数編

Microsoft PowerPoint - 阪大CMSI pptx

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

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

MPI によるプログラミング概要 C 言語編 中島研吾 東京大学情報基盤センター

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

040312研究会HPC2500.ppt

05-opt-system.ppt

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

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

情報処理演習 II

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

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

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

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

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

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

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

Microsoft PowerPoint - sales2.ppt

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

XcalableMP入門

Microsoft PowerPoint - 06-S2-ref-F.pptx

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

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

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

paper+.dvi

3. :, c, ν. 4. Burgers : u t + c u x = ν 2 u x 2, (3), ν. 5. : u t + u u x = ν 2 u x 2, (4), c. 2 u t 2 = c2 2 u x 2, (5) (1) (4), (1 Navier Stokes,.,

Microsoft PowerPoint - scls_biogrid_lecture_v2.pptx

untitled

JAMSTECR, October MPI Message Passing Interface JAMSTEC NEC SX- IBM RS /SP PC MPI MPI_SENDRECV SX- SP PCC MPI MPI, Performance of MPI on parallel comp

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

Transcription:

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) ) 1 (AMachine(CPU,OS,,) ) (amemory x(i) ) (x(i)+α) (BMachine(CPU,OS,,) ) (network) (bmemory) (amemory) (bmemory) amemory x(i) x(i) bmemory x(i) +α x(i) +α AMachine(CPU,OS,,) network BMachine(CPU,OS,,) 1 CPU ( OS) ( ) MPI 1

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

3 CANS MPI FORTRAN i-n 3 CANS1D 3.1 main.f cans(or cans-current)/cans1d/mdp_shktb main.f MPI include "mpif.h" c------ c for MPI call mpi_init(merr) call mpi_comm_size(mpi_comm_world,npe,merr) call mpi_comm_rank(mpi_comm_world,myrank,merr) call mpi_allreduce(dt,dtg,1,mpi_double_precision,mpi_min &,mpi_comm_world,merr) call mpi_finalize(merr) main.f (CANS ) include "mpif.h" call mpi_init(merr) include "mpif.h" mpif.h ( ) 3

MPI 1 mpi_init MPI merr call mpi_finalize(merr) mpi_init merr MPI MPI call mpi_comm_size(mpi_comm_world,npe,merr) call mpi_comm_rank(mpi_comm_world,myrank,merr) call mpi_allreduce(dt,dtg,1,mpi_double_precision,mpi_min &,mpi_comm_world,merr) mpi_comm_size npe mpi_comm_rank myrank mpi_comm_world npe,myrank myrank 0,1,2,,, 0 mpi_allreduce 4 dt (mip_min) dtg mpi_min 4 mpi allreduce dt dtg (mpi min) 1 include "/opt/usr/local/mpi/mpif.h" 4

CFL 3.2 exc h.f cans(or cans-current)/cans1d/commonmpi /exc_h.f MPI c========= subroutine exc_h(margin,ro,pr,vx,ix,myrank,npe) c========= c--------- c from PE(myrank) to PE(myrank+1) for new da(1) c--------- mright= myrank+1 mleft = myrank-1 if (myrank.eq.npe-1) mright = mpi_proc_null if (myrank.eq.0 ) mleft = mpi_proc_null do i=1,margin bufsnd(i,1)=ro(ix-2*margin+i) bufsnd(i,2)=pr(ix-2*margin+i) bufsnd(i,3)=vx(ix-2*margin+i) enddo call mpi_sendrecv & (bufsnd,mmx,mpi_double_precision,mright,1 &,bufrcv,mmx,mpi_double_precision,mleft,1 &,mpi_comm_world,mstatus,merr) if (myrank.ne.0) then do i=1,margin ro(i)=bufrcv(i,1) pr(i)=bufrcv(i,2) vx(i)=bufrcv(i,3) enddo endif 5 mpi sendrecv 5

5 mright= myrank+1 mleft = myrank-1 if (myrank.eq.npe-1) mright = mpi_proc_null if (myrank.eq.0 ) mleft = mpi_proc_null mright,mleft +1,-1 myrank,h=0,npe-1 ( ) mpi_proc_null call mpi_sendrecv & (bufsnd,mmx,mpi_double_precision,mright,1 &,bufrcv,mmx,mpi_double_precision,mleft,1 &,mpi_comm_world,mstatus,merr) bufsnd,bufrcv 6 mpi_sendrecv ro pr vx ro pr vx 6 4 MPI MPI 6

4.1 mpi comm size mpi comm size(communicator,size,ierr) communicator integer mpi_comm_world size integer merr integer ex. call mpi_comm_size(mpi_comm_world,npe,merr) 4.2 mpi comm rank mpi comm rank(communicator,rank,ierr) 0 rank size-1 communicator integer mpi_comm_world rank integer merr integer ex.call mpi_comm_rank(mpi_comm_world,myrank,merr) 4.3 mpi send mpi send(buf,count,datatype,dest,tag,comm,ierr) buf dest integer tag integer ex. call mpi_send( x,1,mpi_real,0,itag,mpi_comm_world,merr) 4.4 mpi recv mpi recv(buf,count,datatype,dest,tag,comm,status,ierr) mpi send status buf dest integer tag integer status integer ex. call mpi_recv( x,1,mpi_real,i,itag,mpi_comm_world,mstatus,merr) 7

4.5 mpi isend mpi_send mpi_isend mpi_wait 2 mpi isend(buf,count,datatype,dest,tag,comm,ireq,ierr) mpi send ireq buf dest integer tag integer ireq integer ex. call mpi_isend( x,1,mpi_real,0,itag,mpi_comm_world,ireq,merr) 4.6 mpi irecv mpi_recv mpi_irecv mpi_wait 3 mpi irecv(buf,count,datatype,dest,tag,comm,ireq,ierr) mpi recv status ireq buf dest integer tag integer ireq integer ex. call mpi_irecv( x,1,mpi_real,i,itag, mpi_comm_world,ireq,merr) 4.7 mpi wait mpi wait(ireq,status,ierr) ireq,status ireq integer status integer ex. call mpi_wait(ireq, mstatus, merr) 2 isend irecv recv mpi wait 3 isend irecv isend send mpi wait 8

4.8 mpi sendrecv mpi sendrecv(buf1,count1,datatype1,dest1,tag1,buf2,count2,datatype2,dest2,tag2,comm,status,ierr) buf1 count1 integer datatype1 integer dest1 integer tag1 integer buf2 count2 integer datatype2 integer dest2 integer tag2 integer status integer ex. call mpi_sendrecv(x,1,mpi_real,0,1,x0,1,mpi_real,i,1,mpi_comm_world,mstatus,merr) 4.9 mpi reduce mpi reduce(buf1,buf2,count,datatype,op,dest,comm,ierr) op buf1 buf2 op integer dest integer ex. call mpi_reduce(dt,dtg,1,mpi_double_precision,mpi_min,0,mpi_comm_world,merr) 4.10 mpi allreduce mpi allreduce(buf1,buf2,count,datatype,op,comm,ierr) op mpi reduce dest buf1 buf2 op integer ex. call mpi_allreduce(dt,dtg,1,mpi_double_precision,mpi_min,mpi_comm_world,merr) 9

4.11 mpi bcast mpi bcast(buf,count,datatype,dest,comm,ierr) buf dest integer ex. call mpi_bcast(x,1,mpi_real,0,mpi_comm_world,merr) 4.12 mpi gather mpi gatherv,mpi allgather,mpi allgatherv mpi gather(buf1,count1,datatype1,buf2,count2,datatype2,dest,comm,ierr) buf1 count1 integer datatype1 integer buf2 count2 integer datatype2 integer dest integer ex. call mpi_gather(x,1,mpi_real,x0,1,0,mpi_comm_world,merr) 4.13 mpi scatter mpi bcast mpi scatterv mpi scatter(buf1,count1,datatype1,buf2,count2,datatype2,dest,comm,ierr) buf1 count1 integer datatype1 integer buf2 count2 integer datatype2 integer dest integer ex. call mpi_scatter(x,1,mpi_real,x0,1,0,mpi_comm_world,merr) 10

mpi_bcast x2 mpi_gather x2 x3 x4 x5 x3 x4 x5 mpi_scatter x2 x3 x4 x5 x2 x3 mpi_allgather x2 x3 x4 x5 x2 x3 x4 x5 x4 x2 x3 x4 x5 x5 x2 x3 x4 x5 7 mpi bcast,mpi gather,mpi scatter,mpi allgather 4.14 datatype byte MPI integer,integer*4 4 mpi_integer real,real*4 4 mpi_real double precision,real*8 8 mpi_real8, mpi_double_precision complex 8 mpi_complex double complex,complex*16 16 mpi_comple6 character 1 mpi_character byte 1 mpi_byte logical,logical*4 4 mpi_logical 11

4.15 MPI (op) mpi reduce,mpi allreduce mpi op create mpi sum mpi_integer,mpi_real,mpi_real8,mpi_complex mpi pro mpi_integer,mpi_real,mpi_real8,mpi_complex mpi max mpi_integer,mpi_real,mpi_real8 mpi min mpi_integer,mpi_real,mpi_real8 mpi maxloc mpi_2integer,mpi_2real,mpi_2double_precision mpi minloc mpi_2integer,mpi_2real,mpi_2double_precision mpi land mpi_logical mpi lor mpi_logical mpi lxor xor( ) mpi_logical mpi band mpi_integer,mpi_byte mpi bor mpi_integer,mpi_byte mpi bxor xor mpi_integer,mpi_byte 5 Unix MPI mpif77 (or mpif90) test.f mpirun -np n( ) a.out (ex. mpirun -np 2./a.out) C-c ps kill -9 ( ) or killall -9 a.out http//www.env.sci.ibaraki.ac.jp/ snozawa/mpi/ 6 [1] http//www.env.sci.ibaraki.ac.jp/ snozawa/mpi/summer03/ [2] http//www.mpi-forum.org/ [3] http//www-unix.mcs.anl.gov/mpi/mpich/ [4] http//www.lam-mpi.org/ [5] http//www.openmp.org/ 12