1 / 20

Special Lectures on Parallel Programming

Special Lectures on Parallel Programming. 김 재 삼 2005 년 8 월. Memory - Hierarchy. Typical Capacity. Typical Access Time. Registers. < 1 KB. 1 nsec. Cache. L1+L2 = 640 K. 2 nsec. Main Memory. 512~1024 MB. 10 nsec. Cost = 0.04 cent/KB. Magnetic Disks. 8 msec. 100~400 GB.

oneida
Download Presentation

Special Lectures on Parallel Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Special Lectures on Parallel Programming 김 재 삼 2005년 8월

  2. Memory - Hierarchy Typical Capacity Typical Access Time Registers < 1 KB 1 nsec Cache L1+L2 = 640 K 2 nsec Main Memory 512~1024 MB 10 nsec Cost = 0.04 cent/KB Magnetic Disks 8 msec 100~400 GB Cost = 0.03 cent/KB Magnetic Tapes > 1 TB 100 sec

  3. $INIT ON C23456 1 2 3 4 5 6 | PROGRAM CARTESIAN INCLUDE 'mpif.h' INTEGER DIMS(2),COM2D,COORDS(2),SRC,DEST,GOORDS(2) LOGICAL PERI(2),REORDER CHARACTER*80 DUMMY C CALL ENVIRON(NODENUM,NPROC) ID = NODENUM IF (ID .EQ. 0) OPEN(10,FILE='test0',STATUS='UNKNOWN') IF (ID .EQ. 1) OPEN(11,FILE='test1',STATUS='UNKNOWN') IF (ID .EQ. 2) OPEN(12,FILE='test2',STATUS='UNKNOWN') IF (ID .EQ. 3) OPEN(13,FILE='test3',STATUS='UNKNOWN') IF (ID .EQ. 4) OPEN(14,FILE='test4',STATUS='UNKNOWN') IF (ID .EQ. 5) OPEN(15,FILE='test5',STATUS='UNKNOWN') MJMP = 2 GOORDS(1) = 1 GOORDS(2) = 2 DIMS(1) = 3 DIMS(2) = 2 PERI(1) = .TRUE. PERI(2) = .TRUE. REORDER = .FALSE. CALL MPI_CART_CREATE(0,2,DIMS,PERI,REORDER,COM2D,IERR) CALL MPI_CART_COORDS(COM2D,NODENUM,2,COORDS,IERR) CALL MPI_CART_RANK(COM2D,GOORDS,NUMBER,IERR) IF (NODENUM .EQ. 0) PRINT *, NUMBER CALL MPI_CART_SHIFT(COM2D,0,MJMP,SRC,DEST,IERR) DO I=0,5 IF (NODENUM .EQ. I) THEN WRITE( * ,100) NODENUM,COORDS(1),COORDS(2),SRC,DEST ENDIF C CALL MPI_BARRIER(0,IERR) ENDDO

  4. IF (ID .EQ. 0) WRITE(10,100) ID,COORDS(1),COORDS(2),SRC,DEST IF (ID .EQ. 1) WRITE(11,100) ID,COORDS(1),COORDS(2),SRC,DEST IF (ID .EQ. 2) WRITE(12,100) ID,COORDS(1),COORDS(2),SRC,DEST IF (ID .EQ. 3) WRITE(13,100) ID,COORDS(1),COORDS(2),SRC,DEST IF (ID .EQ. 4) WRITE(14,100) ID,COORDS(1),COORDS(2),SRC,DEST IF (ID .EQ. 5) WRITE(15,100) ID,COORDS(1),COORDS(2),SRC,DEST C 100 FORMAT('NODE',I3,' is at (',I2,',',I2,'). from',I3,' and to',I3) CALL MPI_FINALIZE(IER) STOP END C ---------------------------- End of MAIN ---------------------------- SUBROUTINE ENVIRON(NODENUM,NPROC) INCLUDE 'mpif.h' CALL MPI_INIT(IER) CALL MPI_COMM_RANK(0,NODENUM,IER) CALL MPI_COMM_SIZE(0,NPROC,IER) RETURN END C ---------------------------- End of ENVIRON ------------------------

More Related