pgi compiler 환경에서 mpich 설치하기

pgi compiler 환경에서 mpich 설치하기

1. 시스템 및 소프트웨어 환경

1.1 시스템은 x86기반 리눅스 클러스터로, MPI용 네트웍은 이더넷이며,

    운영체제는 CentOS 4.2 (RedHat EL4 update2 호환) 입니다.

1.2 패키지 버전

– PGI 6.0.8 Workstation Version ( http://www.pgroup.com/products/workpgi.htm : 상용 )

– MPICH 1.2.7p1 ( http://www-unix.mcs.anl.gov/mpi/mpich1/download.html : 오픈소스 )

* PGI 컴파일러는 이미 설치 되었다고 가정합니다.

* 이 문서의 작업 예는 root계정에서 실행하는 것입니다.

* vi를 실행하는것은, 그 이후에 나오는 코드를 해당 파일에 추가하거나,

  편집하는 것을 뜻합니다.

2. 사전 환경 확인

2.1 PGI 컴파일러가 정상적으로 설치 되었고, 환경변수가 적절히 세팅 되었는지

    확인합니다.

==========================================================================

# pgcc -V

pgcc 6.0-8 32-bit target on x86 Linux

Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.

Copyright 2000-2005, STMicroelectronics, Inc.  All Rights Reserved.

# pgf90 -V

pgf90 6.0-8 32-bit target on x86 Linux

Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.

Copyright 2000-2005, STMicroelectronics, Inc.  All Rights Reserved.

==========================================================================

2.2 위와 같이 실행되지 않는경우는, PGI가 설치되었는지 확인하고, 설치가 완료

    되면, 다음과 같이 환경변수를 세팅하여 줍니다.

==========================================================================

# vi ~/.bash_profile

————————————————————-

……

# for mpich

PATH=$PATH:/usr/local/mpich/bin

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mpich/lib

MANPATH=$MANPATH:/usr/local/mpich/man

export PATH MANPATH LD_LIBRARY_PATH

#PGI ENV. Setting

PGI=/usr/pgi

PATH=$PATH:$PGI/linux86/6.0/bin

MANPATH=$MANPATH:$PGI/linux86/6.0/man

LM_LICENSE_FILE=$LM_LICENSE_FILE:$PGI/license.dat

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PGI/linux86/6.0/lib

export PGI PATH MANPATH LM_LICENSE_FILE LD_LIBRARY_PATH

————————————————————-

# source ~/.bash_profile

==========================================================================

3. mpich 설치

3.1 다운로드 받은 mpich소스의 압축을 풀고, 해당 소스의 루트로 이동합니다.

==========================================================================

# tar xzf ./mpich.tar.gz

# cd mpich-1.2.7p1

==========================================================================

3.2 configuration및 make

==========================================================================

# ./configure –with-device=ch_p4 -prefix=/usr/local/mpich-1.2.7p1 -c++=pgCC \\

              -cc=pgcc -fc=pgf77 -clinker=pgcc -flinker=pgf77 -c++linker=pgCC \\

              -f90=pgf90 -f90inc=/usr/pgi/linux86/6.0/include -f90linker=pgf90 \\

              -f90libpath=/usr/pgi/linux86/6.0/lib -opt=”-fast” -rsh=ssh

# make

# make install

# ln -s /usr/local/mpich-1.2.7p1 /usr/local/mpich              

==========================================================================

* 위에서 심볼릭 링크를 사용하는 이유는, 혹 다른 버전의 mpich로 변경하더라도

링크만 변경해주면, 사용자들의 환경변수를 변경할 필요없이 사용하기 위해서 입니다.

3.3 설치 확인

==========================================================================

# mpicc -V

pgcc 6.0-8 32-bit target on x86 Linux

Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.

Copyright 2000-2005, STMicroelectronics, Inc.  All Rights Reserved.

/usr/lib/crt1.o(.text+0x18): In function `_start’:

: undefined reference to `main’

# mpif90 -V

pgf90 6.0-8 32-bit target on x86 Linux

Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.

Copyright 2000-2005, STMicroelectronics, Inc.  All Rights Reserved.

/usr/local/pgi/linux86/6.0/lib/f90main.o(.text+0x77): In function `main’:

: undefined reference to `MAIN_’

==========================================================================

*** 각 계산 노드에도 같은 위치에 인스톨 하거나, NFS등을 이용하여 같은 위치에

mpich및 PGI가 위치할 수 있도록 해야 합니다.

4. 예제 실행

4.1 mpich에 포함된 예제(cpi : 원주율 계산)를 컴파일 합니다.

==========================================================================

# cd /usr/local/mpich/examples

# make cpi

# ./cpi

Process 0 on master

pi is approximately 3.1416009869231254, Error is 0.0000083333333323

wall clock time = 0.000105

==========================================================================

4.2 mpirun을 통하여 실행합니다.

– 먼저 노드를 지정하기 위해, 머신파일을 생성합니다.

==========================================================================

# vi ./mf

——————————————–

node001

node002

——————————————–

==========================================================================

– cpu개수 2개, 머신파일 ./mf, 마스터노드에서는 실행하지 않는 옵션으로 mpirun을

  실행합니다.

==========================================================================

# mpirun -np 2 -machinefile ./mf -nolocal ./cpi

Process 0 on node001

Process 1 on node002

pi is approximately 3.1416009869231241, Error is 0.0000083333333309

wall clock time = 0.000546

==========================================================================

* 만일 노드당 2개의 cpu를 가지고 있으며, 총 4개의 cpu로 실행할 때는 다음과 같이

  합니다.

==========================================================================

# vi ./mf

——————————————–

node001

node001

node002

node002

——————————————–

# mpirun -np 4 -machinefile ./mf -nolocal ./cpi

==========================================================================

서진우

슈퍼컴퓨팅 전문 기업 클루닉스/ 상무(기술이사)/ 정보시스템감리사/ 시스존 블로그 운영자

You may also like...

3 Responses

  1. morning jazz 말해보세요:

    morning jazz

  1. 2022년 6월 20일

    3arrival

  2. 2023년 1월 26일

    1achievement

페이스북/트위트/구글 계정으로 댓글 가능합니다.