今時の並列計算機 - RIKEN R-CCS...PVASを使った並列計算の例 (1/3) 11 PVAS空間...

10
メニーコア向け並列実行モデル PVAS の紹介と Linux (x86_64/XeonPhi)PVASの使い方 AICSシステムソフトウェア研究室 堀 敦史 1 今時の並列計算機 ノード間は分散メモリ ノード内は共有メモリ 2 Core Core Core Memory Memory Node Network ここに注目

Transcript of 今時の並列計算機 - RIKEN R-CCS...PVASを使った並列計算の例 (1/3) 11 PVAS空間...

Page 1: 今時の並列計算機 - RIKEN R-CCS...PVASを使った並列計算の例 (1/3) 11 PVAS空間 親プロセス Master PVAS-Task0 PVAS-Task1 PVAS-Task2 PVAS-Task3 PVAS-Task4 PVAS-Task5

メニーコア向け並列実行モデル

PVAS の紹介とLinux (x86_64/XeonPhi)で

のPVASの使い方AICSシステムソフトウェア研究室

堀 敦史

1

今時の並列計算機•ノード間は分散メモリ•ノード内は共有メモリ

2

Core Core Core

Memory Memory

Node

Network

ここに注目➡ ︎

Page 2: 今時の並列計算機 - RIKEN R-CCS...PVASを使った並列計算の例 (1/3) 11 PVAS空間 親プロセス Master PVAS-Task0 PVAS-Task1 PVAS-Task2 PVAS-Task3 PVAS-Task4 PVAS-Task5

ノード内並列

3

Pros Cons

プロセス並列 排他制御少ない低速プロセス間

通信

スレッド並列高速スレッド間

通信排他制御多い

第3のノード内並列方式

4

利点 欠点

プロセス並列 排他制御少ない 低速通信

スレッド並列 高速通信 排他制御多い

PVAS並列高速通信

排他制御少ない馴染みがない

PVAS: Partitioned Virtual Address Space

Page 3: 今時の並列計算機 - RIKEN R-CCS...PVASを使った並列計算の例 (1/3) 11 PVAS空間 親プロセス Master PVAS-Task0 PVAS-Task1 PVAS-Task2 PVAS-Task3 PVAS-Task4 PVAS-Task5

PVAS(ピーヴァス)とは?• 複数のプロセスを同じアドレス空間に配置➡ 変数は基本的にプロセス固有➡ 他のプロセスの情報に高速アクセス可能

5

Linux Address Map

Multi-Thread

TEXT

DATA & BSS

HEAP

STACK0

STACK1

KERNEL

Process

TEXT

DATA & BSS

HEAP

STACK

KERNEL

LOW

HIGH

Addr

ess

PVAS Address Map

TEXT

HEAP

STACK

DATA & BSS

Export

PVASTask 1

KERNEL

PVASTask 0

PVASプログラミングに必要な最低限の知識• PVAS空間•複数のPVASタスクが共有するアドレス空間• PVDと呼ばれる識別子を持つ

• PVASタスク•プロセスとスレッドの中間的な性質• PVAS空間内でのみ動作• PVIDと呼ばれるユニークなIDを持つ

• Export領域•他のPVASタスクとの情報交換するための領域• PVASタスクのひとつだけ持つことができる

6

Page 4: 今時の並列計算機 - RIKEN R-CCS...PVASを使った並列計算の例 (1/3) 11 PVAS空間 親プロセス Master PVAS-Task0 PVAS-Task1 PVAS-Task2 PVAS-Task3 PVAS-Task4 PVAS-Task5

PVAS-Hello

7

PVAS空間親プロセス PVAS-Task0

PVAS-Task1PVAS-Task2PVAS-Task3PVAS-Task4PVAS-Task5PVAS-Task6PVAS-Task7PVAS-Task8PVAS-Task9

#include <pvas.h>

#include <sys/types.h>#include <sys/wait.h>#include <stdio.h>#include <errno.h>

#define N (10)

int main( int argc, char **argv ) { extern char **environ; char *new_argv[3]; pid_t pid; int pvd, pvid, i, err;

if( argc < 2 ) { /* not PVAS task */ if( ( err = pvas_create( NULL, 0,

&pvd ) ) != 0 ) { _exit( 9 ); } new_argv[0] = argv[0]; new_argv[1] = "dummy"; new_argv[2] = NULL;

for( i=0; i<N; i++ ) { pvid = i; err = pvas_spawn( pvd, &pvid,

argv[0], new_argv, environ, &pid );

if( err != 0 ) _exit( 9 ); } do { /* wait for termination */ wait( NULL ); } while( errno != ECHILD );

err = pvas_destroy( pvd ); if( err != 0 ) _exit( 9 ); /* done ! */

} else { /* PVAS task */ if( pvas_get_pvid( &pvid ) != 0 ) { _exit( 9 ); } printf( "Hello, this is PVAS task ”

“at %d (pid=%d)\n", pvid, getpid() );

} return 0;}

PVASタスク•プロセスの親子関係は普通のプロセスと同じ• PVASタスクの終了を wait() で待てる

• pvas_spawn() で親プロセス(PVASタスク)のFDは継承される• printf() 等は普通に使える

•シグナルも普通のプロセスと同じ• Coreバインドも可能(sched_setaffinity)

8

Page 5: 今時の並列計算機 - RIKEN R-CCS...PVASを使った並列計算の例 (1/3) 11 PVAS空間 親プロセス Master PVAS-Task0 PVAS-Task1 PVAS-Task2 PVAS-Task3 PVAS-Task4 PVAS-Task5

PVASを使った並列計算の例

9

最初のプログラム

PVAS Master

PVAS Master

最初のプログラム

PVAS Slave 0PVAS Slave 0PVAS Slave 0PVAS Slave 0PVAS Slave 0PVAS Slave 0PVAS Slave 0PVAS Slave 0PVAS Slave 0PVAS Slave 0

制御フロー

PVASを使った並列計算の例

10

最初のプログラム

PVAS Master

PVAS Master

最初のプログラム

PVAS Slave 0PVAS Slave 0PVAS Slave 0PVAS Slave 0PVAS Slave 0PVAS Slave 0PVAS Slave 0PVAS Slave 0PVAS Slave 0PVAS Slave 0

データの配置配列 a[]

Page 6: 今時の並列計算機 - RIKEN R-CCS...PVASを使った並列計算の例 (1/3) 11 PVAS空間 親プロセス Master PVAS-Task0 PVAS-Task1 PVAS-Task2 PVAS-Task3 PVAS-Task4 PVAS-Task5

PVASを使った並列計算の例 (1/3)

11

PVAS空間親プロセス Master

PVAS-Task0PVAS-Task1PVAS-Task2PVAS-Task3PVAS-Task4PVAS-Task5PVAS-Task6PVAS-Task7PVAS-Task8PVAS-Task9

#include <pvas.h>

#include <sys/types.h>#include <sys/wait.h>#include <stdlib.h>#include <stdio.h>#include <errno.h>

#define N (10)#define M (100000)

typedef struct exp { my_barrier_t barrier0; my_barrier_t barrier1; float *a;} exp_t;

int main( int argc, char **argv ) { extern char **environ; pid_t pid; int pvd, pvid, err;

pvid = -1; err = pvas_get_pvid( &pvid ); if( err != 0 ) { /* not PVAS task */ if( ( err = pvas_create( NULL, 0,

&pvd ) ) != 0 ) _exit( 99 ); pvid = 0; err = pvas_spawn( pvd, &pvid,

argv[0], argv, environ, &pid );

if( err != 0 ) _exit( 99 ); do { /* wait for */ wait( NULL ); } while( errno != ECHILD ); /* done ! */

PVASを使った並列計算の例 (2/3)

12

PVAS空間親プロセス Master

PVAS-Task0PVAS-Task1PVAS-Task2PVAS-Task3PVAS-Task4PVAS-Task5PVAS-Task6PVAS-Task7PVAS-Task8PVAS-Task9

} else { /* PVAS task */ void *export; exp_t *exp; float *a, sum; int id, i;

if( pvid == 0 ) { /* Master */

a = (float*) malloc( sizeof(float) * M );

for( i=0; i<M; i++ ) a[i] = ((float) i) / 1000.0;

err = pvas_ealloc( sizeof(exp_t)); if( err != 0 ) _exit( 99 );

if( ( err = pvas_get_export_info( PVAS_MY_PVID, &export, NULL ) ) != 0 ) _exit( 99 );

exp = (exp_t*) export; exp->a = a;

my_barrier_init( &exp->barrier0, N+1 );

my_barrier_init( &exp->barrier1, N+1 );

for( i=0; i<N; i++ ) { id = i + 1; err = pvas_spawn(

PVAS_MY_SPACE, &id, argv[0], argv, environ, NULL);

if( err != 0 ) _exit( 99 ); } my_barrier_wait( &exp->barrier0 ); sum = 0.0; for( i=0; i<N; i++ ) { /* get export region of myself */ if( ( err = pvas_get_export_info(

i+1, &export, NULL ) ) != 0 ) _exit( 99 );

sum += *(float*)export; } my_barrier_wait( &exp->barrier1 );

/* wait for termination */ do { wait( &status ): } while( errno != ECHILD ); /* all child tasks are done ! */

printf( "sum = %f\n", sum );

typedef struct exp { my_barrier_t barrier0; my_barrier_t barrier1; float *a;} exp_t;

Page 7: 今時の並列計算機 - RIKEN R-CCS...PVASを使った並列計算の例 (1/3) 11 PVAS空間 親プロセス Master PVAS-Task0 PVAS-Task1 PVAS-Task2 PVAS-Task3 PVAS-Task4 PVAS-Task5

Export 領域

13

Export

barrier変数(1)

barrier変数(2)

配列 *a

Master PVAS task

配列 a[]

a[0]

a[1]

:

a[M-1]

Export

結果

Slave PVAS task

・配列a[]の1/N を計算・結果は自分のexport

 領域へ・計算の終了とMaster

 の集計終了で2回の barrier 同期

・配列a[]を初期化・barrier同期後,集計

N

PVASを使った並列計算の例 (3/3)

14

PVAS空間親プロセス Master

PVAS-Task0PVAS-Task1PVAS-Task2PVAS-Task3PVAS-Task4PVAS-Task5PVAS-Task6PVAS-Task7PVAS-Task8PVAS-Task9

} else { /* slave PVAS tasks */ int i0, ie;

/* get export region of master */ if( ( err = pvas_get_export_info(

0, &export, NULL ) ) != 0 ) {

_exit( 99 ); } exp = (exp_t*) export; a = exp->a;

id = pvid - 1; i0 = ( M / N ) * id; ie = i0 + ( M / N ); sum = 0.0; for( i=i0; i<ie; i++ ) sum += a[i];

err = pvas_ealloc( sizeof( float );if( err != 0 ) _exit( 99 );

/* get export region of myself */ err = pvas_get_export_info(

PVAS_MY_PVID,&export, NULL ) );

if( err != 0 ) _exit( 99 ); *(float*) export = sum; my_barrier_wait( &exp->barrier0 ); /* here, the main task gathers */ my_barrier_wait( &exp->barrier1 ); } } return 0;}

typedef struct exp { my_barrier_t barrier0; my_barrier_t barrier1; float *a;} exp_t;

Page 8: 今時の並列計算機 - RIKEN R-CCS...PVASを使った並列計算の例 (1/3) 11 PVAS空間 親プロセス Master PVAS-Task0 PVAS-Task1 PVAS-Task2 PVAS-Task3 PVAS-Task4 PVAS-Task5

PVASプログラミングの注意事項• PVASタスクから fork() はできない• 例えば system() は呼べない• 現在の実装上の都合• その代わりPVASタスクを “spawn” する• これは fork()+exec() のようなもの

• PVASタスクのコンパイル,リンクオプション• gcc -I/opt/pvas/include/ -L/opt/pvas/x86_64/lib

-lpvas -lpthread pvas-hello.c -o pvas-hello -fpie -pie• -fpie オプションでコンパイル• -pie オプションでリンク• 静的リンクは使えない

15

PVASの応用• 既に• MPIノード内通信の高速化(省メモリ化)• 連続領域の通信(1 Copy 通信)• 非連続領域の通信 MPI Datatype

• XcalableMP の実装• 今後• さらに省メモリな MPI 実装

• 誰か?• ツール(デバッガ,プロファイラなど)の開発

16

Page 9: 今時の並列計算機 - RIKEN R-CCS...PVASを使った並列計算の例 (1/3) 11 PVAS空間 親プロセス Master PVAS-Task0 PVAS-Task1 PVAS-Task2 PVAS-Task3 PVAS-Task4 PVAS-Task5

PVASの評価

17

Memory is Invaluable• Example

• OpenMPI Intra-Node Comm.• Shared Memory (SM)• KNEM (NEMESIS)• Vader (Xpmem)

• Vader is the fastest, but consumes a lot of memory

• Memory vs. Speed• High Performance and • Low memory consumption

• Page table size must be taken into account300MB = 5% of 6GB

5

BB

BB

BB

BB

BB

BB

BB

BBB

JJ

JJ

JJ

JJ

JJ

JJJJJJJ

HH

HH

HH

HHH

HH

HHHHHH

1

10

100

1,000

10,000

100,000300,000

0.1 1 10 100 1000 10000100000

IMB

Ping

Pong

Lat

ency

[use

c]

IMB PingPong Message Size [KByte]

B SM BTLJ SM-KNEM BTLH Vader BTL

B

B

BB

J

J

JJ

H

H

H

H0E+0

1E+3

2E+3

3E+3

Mem

ory

Usa

ge [M

Byte

]

Eager Protocol

Rendezvous ProtocolB

B

BB

J

J

JJ

H

H

H

H 0100200300400500600

0 60 120 180 240

Tota

l Pag

e Ta

ble

Size

[MBy

te]

IMB AlltoAll (2KiB) Number of ProcessesRendezvous Protocol

300MB

Better

BB

BB

BB

BB

BB

BB

BB

BBB

JJ

JJ

JJ

JJ

JJ

JJJJJJJ

HH

HH

HH

HH

HH

HH

HHHHH

FFFFFFFF

FFFFFFFFF

1

10

100

1,000

10,000

100,000400,000

0.1 1 10 100 1,000 10,000 100,000

IMB

Ping

Pong

Lat

ency

[use

c]

IMB PingPong Message Size [KByte]

B SM BTL

J SM-KNEM BTL

H Vader BTL

F PVAS BTL

B

B

BB

J

J

JJ

H

H

H

H

FF

FF0

1,000

2,000

3,000

Mem

ory

Usa

ge [M

Byte

]

B

B

BB

J

J

JJ

H

H

H

H FFFF 0100200300400500600

0 60 120 180 240

Tota

l Pag

e Ta

ble

Size

[MBy

te]

IMB AlltoAll (2KiB) Number of Processes

Partitioned Virtual Address Space (PVAS)

• “Process Boundary” can be considered as the source of low communication performance and high memory consumption.

• Get rid of “Process Boundary” !!

6

Linux Address Map

Multi-Thread

TEXT

DATA & BSS

HEAP

STACK0

STACK1

KERNEL

Process

TEXT

DATA & BSS

HEAP

STACK

KERNEL

LOW

HIGH

Addr

ess

PVAS !Address Map

TEXT

HEAP

STACK

DATA & BSS

Export

PVAS!Task 1

KERNEL

PVAS!Task 0

Pro

toty

pe

Better

250MB

Latency

7

IMB Exchange 60 Processes (Rendezvous)

SM

B

B

B

B

B

B

B

BBB

BB

BBBB

J

J

J

J

J

JJ

J

JJ

JJJJJJ

H

H

H

H

H

HH

H

HH

HHHHHH

F

FF

FFFFFFFFFFFF

FFFFFFF

FFFFFFFFF

ÉÉ

ÉÉ

ÉÉ

É

É

ÉÉ

É

ÉÉ

ÉÉÉ

ÇÇ

ÇÇ

ÇÇ

Ç

ÇÇ

Ç

Ç

ÇÇ

ÇÇ

Ç

ÅÅ

Å

Å

Å

ÅÅ

Å

ÅÅ

ÅÅÅÅ

100E-3

1E+0

10E+0

100E+0

1E+3

10E+3

100E+3

1E+6

100E+0 1E+3 10E+3 100E+3 1E+6 10E+6 100E+6

Late

ncy

[use

c]

Message Size [Byte]

B SM BTL

J SM-KNEM

H Vader BTL

F SCIF BTL

F PVAS BTL

É memcpy(ICC)

Ç memcpy(GCC)

Å Xeon (SCore,32)

SCIF: Out of Memory !!

Not MPI,Data Trans.

Better

SCIF

SM-KNEM

memcpy(ICC)

0.8 us

PVAS27 us

51

2 B

ytes

Xeon4.5 us

E5-2650 v2 2.60GHz 16(8x2) Cores

Newly Added

Towards Hybrid Architectures• Xeon Phi core is 10 times slower than Xeon core

• Role Sharing (Amdahl's law)• Many-core for Throughput -> Parallel Part• Multi-core for Low-Latency -> Serial Part

• Multiple PVAS (M-PVAS)

8

Linux Address Map

Multi-Thread

TEXT

DATA & BSS

HEAP

STACK0

STACK1

KERNEL

Process

TEXT

DATA & BSS

HEAP

STACK

KERNEL

LOW

HIGH

Addr

ess

PVAS Address Map

PVAS Task 0!on Many-CorePVAS Task 0!on Many-Core

PVAS Task 1!on Many-Core

PVAS Task 0!on Multi-Core

PVAS Task 1!on Multi-Core

LOW

HIGH

Addr

ess

Multiple PVAS!Address Map

Man

y-C

ore

Mut

li-C

ore

TEXT

HEAP

STACK

DATA & BSS

Export

PVAS!Task 1

KERNEL

PVAS!Task 0

Many-Core!KERNEL

Multi-Core!KERNEL

BBBBBBBBBBBBBBBB

JJJJJJJJJJJJJJJJ

H

H

HH

H

HH

H

HHHH

HH

H

H

-0

10

800

850

900

950

0 20 40 60 80 100 120 140

Roun

dTrip

Lat

ency

[use

c]

Data Size [Byte]

B M-PVAS (Xeon→Xeon Phi→Xeon)

J M-PVAS (Xeon Phi→Xeon→Xeon Phi)

H Intel Offloading

mo

re t

han

100 t

imes

CREST領域会議 2013/10/11

PVAS [島田@PGAS’12、島田@MES’13 他]• PVAS (Partitioned Virtual Address Space) ⇒プロセスとスレッドの「いいとこ取り」⇒Linux カーネルにパッチ

• メニーコアCPUにおけるコア間通信の高速化⇒ノード内「通信」はメモリアクセスと等価⇒OMPにおいてデフォルトをprivate とするのとほぼ同じ⇒PGAS系言語で特に有効

9

PVAS Address MapLOW

HIGH

KERNEL

PVAS Task 0 TEXT

HEAP

STACK

Addr

ess

DATA & BSS

Export

PVAS Task 1

RIKEN AICSCREST中間評価

PVAS - VM ops [島田@MES’13]‣ In this benchmark, multiple tasks executes mmap, memset, and munmap operations 1000 times in parallel

‣ mmap and munmap operations update the memory region tree‣ mmap allocates 1MB of memory‣ Page fault handling operations incurred by memset update the page table tree

10

RIKEN AICSCREST中間評価

PVAS を用いたノード内通信の評価

11

1E+0

10E+0

100E+0

1E+3

10E+3

10E+

0

100E

+0

1E+3

10E+

3

100E

+3

1E+6

10E+

6

Band

wid

th [M

B/s]

0.1

1

10

100

100010

E+0

100E

+0

1E+3

10E+

3

100E

+3

1E+6

10E+

6

Late

ncy

[us]

NEMESIS-Redezvous NEMESIS-Eager PVAS

100E-3

1E+0

10E+0

100E+0

1E+3

10E+3

100E+3

1E+0

10E+

0

100E

+0

1E+3

10E+

3

100E

+3

1E+6

10E+

6

100E

+6

Band

wid

th [M

B/s]

0.0001

0.001

0.01

0.1

1

10

100

1E+0

10E+

0

100E

+0

1E+3

10E+

3

100E

+3

1E+6

10E+

6

100E

+6

Late

ncy

[us]

GASNSET-Shmem GASNET-AM PVAS

MP

ICO

ne S

ided

[島田@PGAS’12]RIKEN AICSCREST中間評価

NPB (XcalableMP) での評価

12

gasnet-am gasnet-shmem pvas05

1015202530354045

Elaps

ed T

ime

(sec)

CLASS C

Comm.

Calc.

gasnet-am gasnet-shmem pvas02468

1012141618

Elaps

ed T

ime(

sec)

CLASS Bgasnet-am gasnet-shmem pvas

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

Elaps

ed T

ime

(sec)

CLASS A

Fig. 11. CG benchmark test result (NP = 8)

gasnet-am gasnet-shmem pvas0

0.05

0.1

0.15

0.2

0.25

0.3

Elaps

ed T

Ime

(sec)

CLASS Agasnet-am gasnet-shmem pvas

00.10.20.30.40.50.60.70.80.9

Elaps

ed T

Ime

(sec)

CLASS Bgasnet-am gasnet-shmem pvas

0

0.5

1

1.5

2

2.5

3

3.5

4

Elaps

ed T

Ime

(sec)

CLASS C

Comm.

Calc.

Fig. 12. IS benchmark test result (NP = 8)

the shared memory by calling the gasnet_attach() andthe GASNet get/put operations performs a memory copyto/from its region. Thus, its communication performance canbe thought to be equivalent to that of PVAS. While withGASNet-AM, the ping-pong buffer is statically allocated, andthe get/put operations are done by the GASNet AM (ActiveMessages) protocols which employs memory copy via sharedmemory strategy.

Figure 9 and 10 show the ping-pong latency and band-width performance, respectively. The coarray implementationevaluation results obtained using the PVAS scheme werecomparable with those obtained via GASNet-Shmem imple-mentation. Intra-node communication took place via just onememory copy in both implementations. Therefore, their accessspeeds to the remote coarray were almost the same. While theGASNet-AM communication performance was somewhat lowdue to the AM protocol overhead.

D. NAS Parallel Benchmarks

The performance of the NAS Parallel Benchmarks imple-mented by the XcalableMP coarray function [17] was alsomeasured (Figure 11 and 12). The conjugate gradient (CG)and integer sort (IS) are performed using problem sizes ofclass A, B and C, where A is the smallest and C is the largest.Benchmarks are executed with eight processes in a node.

Each bar in those graphs shows the total elapsed time. Theupper part of each bar represents the calculation time in theprogram, while the lower part of the bar represents the timeof intra-node communication. In all cases, the performanceresults of the coarray implementation using the PVAS scheme

were found to be comparable with the GASNet Shmemimplementation, while the GANSNet AM implementation tookmuch longer. These results are in close agreement with theping-pong benchmark evaluation results, discussed above.

E. Discussion

As shown in Figure 9 and 10, the performance of intra-nodecommunication utilizing GASNet depends on how the access-ing memory region is allocated. In contrast, PVAS provides acoherent way for accessing other PVAS process regions thatcan always achieve optimum communication performance.

In our PVAS process model, the elimination of processboundaries is the key to implementing high-performance intra-node communication. Process boundaries are introduced bymodern OS kernels to guarantee the independence of eachprocess, and to ensure that no matter what failures occur in anyindividual process, the other processes can survive. However,in most parallel applications, when a process dies due to anerroneous execution, the remaining processes participating inthe parallel computations are unable to proceed. Thus, all ofthe stalled processes should be terminated by the job (process)management system so that other parallel job executions canproceed. In the same fashion, since erroneous behavior of aPVAS process would result in the termination of the entirePVAS process group in any case, the elimination of processprotection boundaries is unlikely to cause critical problems.

However, the possibility does exist that a software bugmight cause one PVAS process to rewrite a memory regionbelonging to another PVAS process. In such cases, the alteredprocess may survive, produce incorrect output, assert an error

CG (NP=8)

IS (NP=8) [島田@PGAS’12]

情報処理学会研究報告IPSJ SIG Technical Report

0

500

1000

1500

2000

2500

3000

3500

0 20 40 60 80 100 120 140

Mop

/s

Number of Processes(Threads)!

XMP-MPI

XMP-PVAS

MPI

OMP

XMP-MPI-NOALLOC

図 11 NPB-CG の性能

0

5

10

15

20

25

32 64 128 32 64 128 32 64 128 32 64 128

XMP-MPI XMP-MPI-NOALLOC XMP-PVAS MPI

Tim

e (s

)!

gmove

reduction

図 12 NPB-CG の反復回数 32 回による通信時間

0

500

1000

1500

2000

2500

3000

3500

4000

4500

0 20 40 60 80 100 120 140

Mop

/s

Number of Processes(Threads)!

XMP

MPI

OMP

図 13 NPB-CG の通信を省いた計算時間

では,通信のための pack/unpackとMPI通信が発生した.PVASを使用することで,pack/unpackを省き,MPI通信を memcpy1回に置き換えた.その結果,3次元ステンシル計算の 2次元分割では,袖通信の通信時間を 45%に減少させることができた.CGの 2次元分割では,重複して持たせたベクトルの転置の通信時間を 34%程度に減少させることができた.姫野ベンチマークでは,MPI,OpenMP,XMPの性能が同程度であり,プロセス数によっては,XMP-PVASを使用するこで,MPIよりも性能を引き出すことができた.NPB-CG では,MPI と XMP が OpenMP よりも高い性能を得ており,MPIや XMPを使用することが望まれる.

XMPは gmove通信と reduction通信によって,性能が低下した.PVASを使用することで,gmove通信の時間を抑えることができ,MPIとの性能差を縮めることができた.PVASを用いることで,reductionの通信時間を抑えることができれば,さらにMPIとの性能差を縮めることができる.現在の設計,実装では,MIC内並列化に対応しているが,

MIC間,ノード間通信に対応していない.そこで,今後は,大規模計算に対応できるように,複数MIC,複数ノードを対象とした設計,実装を行い,性能測定を行う.また,他の通信として,reduction通信の設計を行う予定である.

参考文献[1] PGAS: Partitioned Global Address Space,

http://www.pgas.org/.[2] XcalableMP: XcalableMP仕様書,http://www.

xcalablemp.org/download/spec/xmp-spec-1.2.pdf.[3] XcalableMP: Omni Compiler Project,

http://omni-compiler.org/index.html.[4] A.Shimada, B.Gerofi, A.Hori and Y.Ishikawa:

Proposing a New Task Model Towards Many-coreArchitecture, Proceedings of the First InternationalWorkshop on Many-core Embedded Systems, MES ’13(2013).

[5] 島田明男, 堀敦史, 石川裕:新しいタスクモデルによるMPIノード内通信の高性能化,情報処理学会研究報告,Vol. 2014-OS-130, No. 18, pp. 1–8 (2014).

[6] Intel: Intel Xeon Phi Coprocessor 7100 Series,http://ark.intel.com/ja/products/series/75809.

[7] M.Ikei and M.Sato: A PGAS Execution Model forEfficient Stencil Computation on Many-CoreProcessors., CCGRID, pp. 305–314 (2014).

[8] OpenMPI: Open Source High Performance Computing,http://www.open-mpi.org/.

[9] 姫野ベンチマーク:姫野ベンチマーク,http://www.open-mpi.org/.

[10] NPB: NAS Parallel Benchmarks,http://www.nas.nasa.gov/publications/npb.html.

[11] SNU-NPB: SNU NPB Suite,http://aces.snu.ac.kr/software/snu-npb/.

[12] M.Nakao, J.Lee, T.Boku and M.Sato: XcalableMPImplementation and Performance of NAS ParallelBenchmarks, Proceedings of the Fourth Conference onPartitioned Global Address Space Programming Model,PGAS ’10, pp. 11:1–11:10 (2010).

6ⓒ 2015 Information Processing Society of Japan

Vol.2015-HPC-148 No.222015/3/3

XMP (gmove) のPVAS実装,大川他(筑波大)IPSJ-SIGHPC, 3月,2015

情報処理学会論文誌 Vol.0 No.0 1–16 (??? 1959)

0"

0.2"

0.4"

0.6"

0.8"

1"

1.2"

1.4"

4800"x"4800" 9600"x"9600"

Elap

sed(TIme((sec)�

Matrix(Size�

SM"

PVAS"

0"

5"

10"

15"

20"

25"

4800"x"4800" 9600"x"9600"

Performan

ce(Im

provem

ent((%)�

Matrix(Size�

図 13 fft2d datatype の実行結果Fig. 13 fft2d datatype results

め,通信遅延の低減による実行性能の改善率は約 4%から約 6%にとどまっていると考えられる.

5.3 課題DDTBenchによる測定の結果,通信に用いるデータ型や送受信するデータサイズによっては,PVASによって高速化したMPIノード内通信の方が,共有メモリを用いる既存の実装よりも,不連続なデータの送受信において,却って通信遅延が増加してまうケースがあることがわかった.これは,MPIプログラムを実行する際に,MPIノード内通信にどの実装を用いるか,ユーザが選択可能にすることで解決できると考える.これから実行するMPIプログラムが,どのようなデータ型を用いて通信をおこなうかを考慮して,PVASによる実装を用いるか,共有メモリによる既存の実装を用いるかを,ユーザが選択すればよい.また,通信に使用するデータ型の内容をMPIライブラリが解析し,PVASによる実装と共有メモリによる既存の実装のどちらを用いるのが適切かを自動的に判別して切り替えることも可能であると考える.現状の実装では,ユーザがMPIプログラムの実行時に,MPIノード内通信に使用する実装を選択する方式を採用しているが,将来的には,MPIライブラリが自動的に使用する実装を切り替える方式もサポートする予定である.

0"

2000"

4000"

6000"

8000"

10000"

12000"

14000"

CLASS"A" CLASS"B" CLASS"C"

Mop

s/total�

Problem.Size�

SM"

PVAS"

0"

1"

2"

3"

4"

5"

6"

7"

8"

9"

10"

CLASS"A" CLASS"B" CLASS"C"

Performan

ce.Im

provem

ent.(%)�

Problem.Size�

図 14 NAS LU の実行結果Fig. 14 NAS LU results

6. 関連研究6.1 MPIのスレッド実装通常 MPIは,1プロセスを 1MPIプロセスとして並列計算処理を実行させるプログラミングモデルになっている.しかし,MPI の実装の中には,1 スレッドを 1MPI

プロセスとして並列計算処理を実行させるものも存在する [9][29][21].同一ノード内に存在するスレッドは,同一アドレス空間で動作するため,PVASタスクモデルを用いる場合と同様に,アドレス空間の境界越しにデータを送受信するオーバヘッドなしにMPIノード内通信を実現することができる.しかし,1スレッドを 1MPIプロセスとしてプログラミングをおこなう場合,MPIプロセス間でグローバル変数が共有されてしまい,既存のMPIのプログラミングモデルを大きく逸脱してしまうという問題がある.また,MPIライブラリ内の管理オブジェクトがMPIプロセス間で共有されるため排他制御が必要になり,慎重にMPIライブラリを実装しないと,排他制御のオーバヘッドで実行性能が低下してしまう問題がある.

6.2 OSカーネルによるデータコピーノード内通信をおこなう方法の一つとして,OSカーネルによるデータコピーが挙げられる.この方式では,OS

カーネルが送信バッファから受信バッファに直接データ

c⃝ 1959 Information Processing Society of Japan 13

• x86_64 と Xeon Phi (KNC) で動作PVAS-RPMダウンロード

The K Software

(p)NetCDF

PRDMA

MPICH

FT-MPI

EARTH updated '16/2/19

CARP updated '16/3/16

Partitioned Virtual Address Space

Multiple PVAS

GDB for McKernel (Download, 26 MB)

Operating System updated '15/7/3

Communication updated '15/10/2

File I/O updated '15/8/5

Fault Resilience updated '15/10/9

Yutaka Ishikawa

Atsushi Hori

Toyohisa Kameyama

Masayuki Hatanaka

Yuichi Tsujita

Kazumi Yoshinaga

Norio Yamaguchi

Balazs Gerofi

Masamichi Takagi

Takahiro Ogura

Liao Jianwei

Withdrawing Members

Akio Shimada( 2015 March 31 )

Yoshiyuki Ohno( 2014 March 31 )

Toshihiro Konda( 2012 April )

Post K Project

K Computer

Hori CREST

Miyoshi CREST updated '15/6/26

SCALE

XFEL updated '15/5/18

Publication List

Links

調達関連(written in Japanese)

http://www-sys-aics.riken.jp

Preliminary Evaluation

Evaluation environment

PVAS was implemented on the top of Linux kernel.Intel Xeon 2.93 GHz, 6 cores x 2 sockets

Intra-node communication

Nemesis which is low-level communication layer of MPICH2 was modified toleverage PVAS intra-node communication.Original Nemesis uses shared memory on intra-node communication, it resultsin two memory copies.Modified Nemesis directly copies the data from sender-buffer to receiver-buffer.Ping-pong communication using PVAS implementation shows bestperformance when message size is larger than 4KB (Fig.3).

VM operation

VM operation benchmark was evaluated by using hand-made microbenchmark.In this benchmark, multiple tasks execute mmap, memset and munmapoperations 1000 times over parallel degrees.PVAS and multi-process implementation show good performance even if thenumber of tasks increases (Fig.4).

Download pvas 1.1 rpm files (293MB)

Download PVAS (678MB)

Document

Sample code

ページの一番下

Page 10: 今時の並列計算機 - RIKEN R-CCS...PVASを使った並列計算の例 (1/3) 11 PVAS空間 親プロセス Master PVAS-Task0 PVAS-Task1 PVAS-Task2 PVAS-Task3 PVAS-Task4 PVAS-Task5

RPM インストール後• Reboot(PVASパッチのLinux)

• /opt/pvas 以下にインストールされる•コンパイル&実行

•是非使ってみたいという人は,[email protected] まで.PVASマシンのアカウント作ります.

19

$ uname -aLinux wallaby11.aics-sys.riken.jp 2.6.32-279.14.1.el6.pvas-1.1.x86_64 #1 SMP Wed Feb 3 17:22:32 JST 2016 x86_64 x86_64 x86_64 GNU/Linux

$ gcc myprog.c -fpie -pie -o myprog -I/opt/pvas/include -L/opt/pvas/x86_64/lib -lpvas -lpthread$ export LD_LIBRARY_PATH=/opt/pvas/x86_64/lib:$LD_LIBRARY_PATH$ ./myprog