partnership & leadership for the nationwide ... second... ·...

99
Partnership & Leadership for the nationwide SuperComputing Infrastructure Unix/Linux 기본 활용법 PLSI 사용자 응용기술지원팀 PLSI 사용자 응용기술지원팀 정진우

Upload: dotu

Post on 20-Oct-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

Partnership & Leadership for the nationwide SuperComputing Infrastructure

Unix/Linux 기본 활용법

PLSI 사용자 응용기술지원팀

PLSI 사용자 응용기술지원팀정진우

Outline

PLSI 시스템 개요

PLSI 시스템 접속

Unix/Linux 시스템

PLSI 시스템 기본 사용법

VIM(VI) 텍스트 에디터 사용법

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

VIM(VI) 텍스트 에디터 사용법

Shell script 개요

컴파일

PLSI 시스템 개요

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

PLSI 사업과 PLSI 자원

PLSI 사업(PLSI Project)§ 국내 슈퍼컴퓨터 자원을 국가적 차원의 체계적인 연동과 관

리를 통해 효율적으로 사용할 수 있도록 지원하는 사업§ PLSI is a national project to support that Korean

national supercomputing resources can be used effectively through the systematic integration and management

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

PLSI 자원(PLSI Resources)§ PLSI 사업을 통하여 구축된 고성능 전용 네트워크 기반의

슈퍼컴퓨터 통합 인프라§ PLSI resources is an integrated supercomputing

infrastructure based on the dedicated high performance network built by PLSI project

PLSI 자원 현황

PLSI 자원 연동 구성§ 최소 1Gbps 수준의 전용 네트워크로 국내 주요 슈퍼컴퓨팅

센터의 컴퓨팅 자원을 연동§ 글로벌 파일 시스템 공유 및 글로벌 스케줄링이 가능

슈퍼컴 전용라인

KIST

슈퍼컴 전용 트래픽

서울대 UNIST건국대 서울시립대

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

부산대

서울

대전

Supercom_C3560

동명대

부경대

GIST

Supercom_C3560

Supercom_C4006Supercom_C4006

KISTI

광주 부산

Supercom_C3560

PLSI _C6509 Login NodeKREONET

FireWallIDS

ACL

ACL

ACL

ACL

ACL

ACL

SupercomC3560

ACL 울산

Supercom_C3560

ACL

KOBIC ACL

SupercomEx4200

Supercom

ACLACL

Supercom_EX4200

PLSI 자원 현황

PLSI 자원 통합 소프트웨어 스택§ 각 연동 시스템은 아래와 같은 통합 소프트웨어 스택이 모두 설치§ 이를 통해 연동된 시스템 어디서나 추가적인 인증이나 데이터 이전 과정 없이 단일 배치 작업 스케줄러§ 명령을 사용하여 작업의 제출․모니터링․제어 및 여러 시스템에 걸친 연계 작업의 원활한 수행이 가능

사용자

통합 작업 실행 환경 제공 (시스템 접속/컴파일/작업실행)

응용 소프트웨어[Fluent, Gaussian, VASP, GAMESS …]

병렬 API 라이브러리컴파일러/디버거

윈도우 클러스터 통합 구성 요소

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

Supercomputing Infrastructure

연동 네트워크 [1GbE]

IBM POWER5 server IBM PowerPC Cluster X86-64 Cluster IA-64 Cluster

AIX 5.3 CentOS 4/5 RHEL AS 3.4 SUSE ES9

GPFS-MCGPFS-MCLoadLeveler-MCLoadLeveler-MC

LDAPLDAP NagiosNagios

SSH/X11SSH/X11

MPI [MPICH/MVAPICH/OpenMPI) 컴파일러 [GCC/PGI/Intel/IBM/MS]

사용자 접속

글로벌 공유파일시스템

라이브러리/디버거

시스템

운영체제

프로그래밍 환경

글로벌 스케줄러

통합 모니터링통합 계정

이기종 시스템 환경

시스템 통합

Windows Server 2008

Remote DesktopRemote DesktopPLSI PortalPLSI Portal

통합 소프트웨어 스택

PLSI 시스템 접속

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

PLSI 사용자 포털 서비스 (PLSI User Portal Service)

URL : http://portal.plsi.or.kr개요§ 슈퍼컴퓨터의 자원 활용을 극대화하기 위해 개발된 웹 기반 통합

포털 서비스§ 사용자들의 슈퍼컴퓨터 연동자원 사용에 편의를 우선적으로 고려

주요 서비스 기능§ 온라인 계정신청 및 처리상태 조회

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

온라인 계정신청 및 처리상태 조회§ PLSI 연동 시스템의 H/W, S/W 정보 확인§ 연동 자원 및 작업 현황 모니터링 수행§ PLSI 연동 시스템간 사용자 작업 환경 제공§ 웹 기반의 SSH, SFTP 프로그램 제공§ 계정 및 과금 정보 확인§ 공지사항, FAQ, 기술지원 상담, 자료실 등의 고객서비스 지원

PLSI 포털 로그인

PlSI 계정과 연동, 동일한 ID/Pass 로 접속

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

PLSI 계정 로그인

SSH 접속

컴퓨팅 서비스 -> 쉘 접속 클릭

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

JRE 설치 및 애플릿 실행

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Xming - X11 forwarding 을 위한 XLancher

Site§ Download :

http://sourceforge.net/search/?type_of_search=soft&words=Xming

사용 방법§ 실행 파일 다운로드 받은 후 설치

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ 실행 파일 다운로드 받은 후 설치§ XLanuch 실행

Xming - X11 forwarding 을 위한 XLancher

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

» select “Multiple windows”

Xming - X11 forwarding 을 위한 XLancher

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Xming - X11 forwarding 을 위한 XLancher

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Xming - X11 forwarding 을 위한 XLancher

Xming 실행

§ GUI

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ X11(X or Xwindow)

PuTTY – ssh 원격 접속 클라이언트

Site§ Homepage :

• http://www.putty.nl/

§ Download : • http://putty.nl/latest/x86/putty.exe

§ Manual : • http://www.putty.nl/0.60/htmldoc/

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

• http://www.putty.nl/0.60/htmldoc/

사용 방법§ 웹 브라우저에 http://putty.nl/latest/x86/putty.exe 를 입

력 후 putty.exe를 다운로드

§ 다운로드 받은 putty.exe를 실행

PLSI 시스템 접속 - ssh 를 통한 접속 방법

SSH 접속 터미널 사용하여 로그인 노드로 접속한다.사용자 : 1022port로 신청서에 기술된 사용자 접속 허용 IP만 접속이허용된다.§ [Linux/unix 사용자]

로그인 주소 : login01.plsi.or.kr (150.183.146.110)

login02.plsi.or.kr (150.183.146.111)

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ [windows 사용자]• putty 나 SSH Secure Shell Client 등의 ssh 접속 유틸리티를 이용한

다.• 프로그램은 인터넷을 통해 무료로 다운 받을 수 있다.

$ssh -l plsiuser -p 1022 login01.plsi.or.kr

$ssh -l plsiuser -p 1022 login02.plsi.or.kr

PLSI 시스템 접속 - ssh 를 통한 접속 방법

login01.plsi.or.krlogin01.plsi.or.kr

10221022

PLSIPLSI

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ Host Name : 접속할 원격지 주소 입력• login01.plsi.or.kr

§ Port : 1022§ SSH 선택§ Saved Sessions : 설정 저장§ Open : 접속 실행

PLSI 시스템 접속 - ssh 를 통한 접속 방법

localhost:0.0localhost:0.0

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ 그래픽을 사용하기 위해선• SSH -> X11 탭에서 “Enable X11 forwarding” 체크• X display location : localhost:0.0

Unix/Linux 시스템

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

History

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Structure

KERNEL§ 운영체제의 핵심§ 시스템 자원들을 관리하는 부분

Shell§ 명령어 해석기§ 사용자와 시스템간의 명령의 전달

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ 사용자와 시스템간의 명령의 전달

File System§ 계층구조를 이루고 있음§ 정보들을 저장할 수 있는 장소§ 여러 유저가 하나의 시스템을 공유할 수 있도록 설계

Command structure

Command Options Arguments+ +

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

(e.g)§ ls§ ls –a§ ls –a /home

주요 commands

ls§ 디렉토리 내의 파일 목록을 보기 위한 명령

옵 션 의 미

-a 모든 파일 보기

-l 자세히 보기

-c 생성 시간 순으로 정렬해서 보기

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

-c 생성 시간 순으로 정렬해서 보기

-d 디렉토리만 보기

-k 파일의 크기를 KB단위로 표시하기

-t 변경시간 순으로 정렬해서 보기

-R 하위 디렉토리의 파일까지 보여주기

-h 파일크기 단위로 보기

주요 commands

cd§ 디렉토리 이동 명령

mkdir§ 새로운 디렉토리를 만들 때 사용

rmdir§ 디렉토리를 삭제할 때 사용

touch

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

touch § 파일이 존재할 경우 파일의 수정날짜 변경하며, 존재하지 않

을 경우 0kb 의 파일 생성

cp§ 파일 복사명령§ 속성을 유지할 경우 -a 옵션 추가

주요 commands

rm§ 파일이나 디렉토리를 삭제할 때

옵 션 의 미

-i 삭제할 때 확인

-f 강제 삭제

-r 디렉토리를 삭제할때 하위 디렉토리와 파일도 모두 삭제

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

mv§ 파일과 디렉토리의 이름을 변경하거나 경로를 옮길 때 사용§ -b 옵션 사용시 : 같은 파일이 있을 경우는 backup 파일을 생성

pwd§ 현재 디렉토리를 보여줌

-v rm 명령어 진행과정 출력

주요 commands

cat§ 텍스트로 작성된 파일 내용을 화면에 출력할 때§ 파일들을 취합할 때에도 사용한다

head, tail§ head : 처음 10줄 출력§ tail : 마지막 10줄 출력

more

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

more§ 텍스트 파일 내용을 페이지 단위로 한 화면씩 출력할 때

less§ 텍스트 파일 내용을 에디터 형식으로 보여줌

wc§ 줄 또는 단어 개수를 출력§ -l : 줄 개수, -w : 단어 개수

File 묶기 & 풀기

tar option§ c for create a tar file§ x extract the contents of tar file§ u for update§ r for relace§ v for verbose output§ f to specify a file name

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ f to specify a file name§ z to use gzip compression§ j to use bzip2 compression

묶기 & 풀기 예제§ tar cvzf archive.tar.gz ./* : 현재 위치의 모든 파일은 묶기§ tar xvzf archive.tar.gz : tar 파일을 풀기

Some special directories

.§ (.) means the current directory

..§ (..) means the parent of the current directory

~§ Home directories can also be referred to by the tilde

(~) character.

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

(~) character.

사용 예§ cd ..§ ls ~/test

Some special directories

절대 경로 (Absolute Path)§ /(root directory)를 기준

상대 경로 (Relative Path)§ .(current directory)를 기준

(e.g) zeus→mars§ cd /home/mars§ cd ../mars

home

/ (root)

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ cd ../mars

dooley zeus mars

File name을 나타내는 와일드카드문자

* : 모든 문자열§ 문자열의 길이가 0, 즉 문자열이 아니거나 길어도 됨§ rm * : 모든 파일 삭제§ rm a* : a로 시작하는 이름을 가진 모든 파일 삭제§ rm bet*as

? : 어떤문자(문자열X, 한글자)

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

? : 어떤문자(문자열X, 한글자)§ ls *.txt : 현재 directory내의 txt로 끝나는 파일 나열§ ls *.t?t : 확장자가 t?t 인 세글자 파일들 나열§ ls *t?

리다이렉팅

리눅스에서 지원하는 가장 강력한 명령어 방식§ 명령어나 프로그램의 결과를 스크린에 보여주는 것처럼 파

일로 방향전환을 하는 기능§ 파일을 입력 또는 출력으로 사용§ 명령의 결과를 다른 명령의 입력으로 사용할 수 있다. § 프로그램의 결과를 파일로

• test.x > test.out

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

• test.x > test.out• cal > October.txt

§ 파일의 내용을 명령의 입력으로 사용• test.x < input.dat > output.dat• mail mark < letter

파이프

명령어 간의 파이프 ‘|’§ 어떤 명령어의 결과가 다른 명령어의 입력이 되도록 해준다

• who | grep “mark”• who명령어는 시스템에 접속한 사용자가 누구인지, 어떤 터미

널이 사용되고 있으며 언제 로그인 했는지를 살펴보는 명령어• grep은 주어진 패턴과 일치하는 line만을 골라내어 보여주는

명령어 (주요옵션 –i:ignore , -v:Not match)위 명령어는 ‘who’로 나열되는 사용자중 mark가 있는지를 보

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

• 위 명령어는 ‘who’로 나열되는 사용자중 mark가 있는지를 보여줌

File 검색

find 명령어§ 하드 디스크의 파일(파일명, 디렉터리명)을 찾는 명령어

• find [path…] [expression]• Expression 부분을 이용하여 상세 검색이 가능하고, 유닉스마

다 다른 문법을 가지고 있음 : man 페이지 참고• find ~/ -name ‘*.txt’• 홈 디렉터리 또는 그 하위 디렉터리에서 txt로 끝나는 파일들

을 나열해 준다.

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

을 나열해 준다. • find ~/ -name ‘*.txt’ –ls : ls 형식으로 출력• find / -name ‘et*’ –type d • 전체 하드 디스크에서 디렉터리 이름이 et로 시작하는 모든 디

렉터리 찾기 (옵션 순서에 주의)

링크

링크 생성§ ln [option] …. TARGET [LINK_NAME]§ 홈 디렉터리에 있는 실행파일 또는 inputfile들을 link § 스크레치 디렉터리에서 작업가능§ ln –s /phome01/plsiuser/file1 /pwork01/plsiuser/file1

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

유용한 기본 응용프로그램

bc§ 텍스트 기반의 계산기§ -l : 수학함수 사용

gnuplot§ 그래프 출력 프로그램

ps2pdf§ Postscript 형식의 파일을 pdf로 변환

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ Postscript 형식의 파일을 pdf로 변환

evince§ Pdf 뷰어 프로그램

gthumb§ 이미지 뷰어 프로그램

유용한 기본 응용프로그램

vim(vi)§ 텍스트 기반의 텍스트 에디터

gedit§ GUI 기반의 텍스트 에디터

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

PLSI 시스템 기본 사용법

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

사용자 환경

통합 login 노드§ 기본 shell 작업§ 기본 shell 환경 변경§ 작업 제출§ 모니터링

각 시스템 login 노드§ 환경변수 설정 (module)

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ 환경변수 설정 (module)§ 컴파일 작업§ 디버깅 작업§ 간단한 실행 테스트

각 시스템 computing 노드§ 작업 스케줄러를 통한 작업 실행

패스워드 변경

통합 login nodes ONLYPLSI 계정신청 후 발급받은 패스워드는 로그인 후 반드시 변경.사용자 패스워드를 변경하기 위해서는 passwd 명령을 사용. § passwd 명령어 입력 후 Enter.§ 기존 password를 입력 후 Enter.§ 변경할 password를 입력 후 Enter.

[p019keg@login01 ~]$ passwdChanging password for user p019kegEnter login(LDAP) password:New UNIX password:

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

패스워드의 유효 기간은 60일 임. 변경하지 않은 패스워드는 60일이 경과하면 만료됨.

패스워드 정책§ 사용자 password 길이를 8 character 이상 설정§ 사용자 password 변경 기간을 2개월로 설정§ 새로운 패스워드는 이전 패스워드와 비교하여 2문자 이상 달라야 함§ 특수문자가 최소 2개 이상 포함되어야 함§ 최대 허용 로그인 재시도 회수 :10회

사용자 shell 변경 (option)

통합 login nodes ONLY기본 shell은 bash 임.사용자가 선호 하는 shell로 변경하기 위해서는 ldapchsh 명령을 사용shell 변경 후 Execution platforms에 로그인하면 변경한 shell이 적용§ ldapchsh 명령어 입력 후 Enter.§ password를 입력 후 Enter.

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ password를 입력 후 Enter.§ 변경할 shell를 입력 후 Enter.

[p019keg@login01 ~]$ ldapchshChanging shell for p019kegpassword:New shell [/bin/bash]:

/bin/csh/bin/ksh/bin/zsh 중 한가지 입력

환경변수 설정 개요

Execution platforms ONLY

Execution platform 중 한가지 시스템으로 로그인 되어 있어야 함

환경 변수 설정이란 자신이 사용하고자 하는 애플리케이션(컴파일러, 라이브러리, 응용 소프트웨어 등)을 자신의 홈 디렉터리에서 직접 실행할 수 있도록 PATH를 등록하는 작업 임.

기본적으로 모든 애플리케이션이나 라이브러리 등의 경로가 환경 변

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

기본적으로 모든 애플리케이션이나 라이브러리 등의 경로가 환경 변수에 모두 포함되어 있지 않고 사용자가 일일이 자신이 필요한 경로를 설정해야 하는 이유는 불필요한 설정을 하지 않고 사용자가 필요한 부분만 경량화 시키기 위함.

PLSI 자원 환경에서는 수작업으로 .bashrc등과 같은 환경변수 파일을수정하는 대신 module이라는 유틸리티를 이용하여 미리 만들어진 환경 변수 모듈을 로드 함으로서 환경 변수가 쉽게 설정되는 환경 제공.

module 사용법

(예시) hamela 시스템에서 ifort(인텔 포트란)을 사용하려 한다.우선 ifort가 실행 가능한 상태인지 확인

- ifort에 대한 모듈의 존재 여부 확인

환경 변수 설정이정상적으로 되지않은 상태에서

ifort가 없다는 메시지가 뜬다

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

모듈 로드

Module 명령어$ module avail$ module load [모듈명]

platform 별 module name

표에 없는 platforms은 별도의 환경변수 설정이 필요 없음Platforms Module names Platforms Module names Platforms Module names

blacs/gnu64blacs/ibmcmp64blacs/ibmcmp64gccblas/gnu64blas/ibmcmp64fftw/fftw-3.2.2fftw-lib/ibmcmp64goto/gotogsl/gsl-0.2.5ibm/ibmcmpibm/ibmmath-essl-4.2ibm/ibmmath-pessl-3.2

Cheetah-mg01

intel/intel_11.0mpi/gcc/mpich2-1.0.8p1 mpi/intel/mpich-1.2.7p1 mpi/intel/openmpi-1.2.9mpi/gcc/mpich-1.2.7p1 mpi/gcc/openmpi-1.2.9 mpi/intel/mpich2-1.0.8p1

pdaisy

intel/intel-11.0openmpi/openmpimvapich/mvapich-gnumvapich/mvapich-intelabaqus/abaqusansys/ansysstarcd/startcd-v406ansys-cfx/ansys-cfxfluent/fluentnamd/namd

intel/intel_9.1.052

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

node393node394

ibm/ibmmath-pessl-3.2lapack/gnu64lapack/ibmcmp64scalapack/gnu64scalapack/ibmcmp64scalapack/ibmcmp64gccgm/gm-2.0.19lam-mpi/lam-mpi-7.1-gmlam-mpi/lam-mpi-7.1-ipmpich-gm-ssh/mpich-1.2.6-gnu64mpich-gm-ssh/mpich-1.2.6-ibmcmp64mpich-gm-ssh/mpich-1.2.6-ibmcmp64gccpvm/gnu64-sshpvm/ibmcmp64-sshvasp/vasp-4.6netcdf/ibmcmp64

hamelahamelb

intel/intel_9.1.052fftw/fftw-2.1.5fftw/fftw-3.2netcdf/netcdfgm/gmmpich-gm/llspawn/mpich-gm_gnumpich-gm/llspawn/mpich-gm_intelmpich-gm/ssh/mpich-gm_intellammps/lammpsnamd/namd-2.7b1vasp/vasp

kigi-lg01kigi-lg02

intel/intel_9.1.052fftw/fftw-2.1.5fftw/fftw-3.2netcdf/netcdfgm/gmmpich-gm/llspawn/mpich-gm_gnumpich-gm/llspawn/mpich-gm_intelmpich-gm/ssh/mpich-gm_intellammps/lammpsnamd/namd-2.7b1vasp/vasp

kobic

intel/intel_11mpi/gcc/mpich-1.2.7p1mpi/intel/mpich-1.2.7p1mpi/gcc/openmpi-1.2.9

Execution platforms에서 다음 명령어로 확인$ module avail

파일 시스템

글로벌 파일 시스템§ IBM GPFS 파일 시스템 기반으로 login nodes 뿐만 아니라 모든

Execution platforms이 공유 함

§ /phome01 – 홈 디렉터리, 계정당 6GB§ /pwork01 – 스크래치 디렉터리

• 사용자 ID 당 1TB, 7일 이상 액세스 하지 않은 파일 자동삭제

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

파일 시스템

로컬 파일 시스템- Execution platforms이 각각 보유한 로컬 파일 시스템이며 platform끼

리 공유하지 않음- 글로벌 병렬 파일 시스템 보다 고성능 IO가 요구될때 사용- 7일 이상 액세스 하지 않은 파일 자동삭제

§ /gpfs1, /gpfs2, /gpfs3, /gpfs4 : pgaia, pgaiab, pgaiac§ /work : porion01, porion02§ /scr : master-mpi§ /scratch2 : pdaisy

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ /scratch2 : pdaisy§ /work01 : hamela, hamelb§ /work01 : kigi-lg01, kigi-lg02§ /work : unist_smp1, unist_smp2

/phome01과 /pwork01는 Door nodes 및 모든 platforms에 공유

VIM(VI) 텍스트 에디터사용법

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

VI 에디터란?

vi editor

§ early form of word processing

§ not especially easy to use

§ HOWEVER--exists on all UNIX systems

§ approximately 100 commands

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ approximately 100 commands

파일 열기

open a file

§ $ vi file (편집모드)

§ $ view file (읽기모드)

modes

§ 입력모드

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ 입력모드

• 입력하는 모든 것이 편집버퍼에 입력됨

• 입력모드에서 빠져나올 때(명령행모드로 변경시): “ESC” key

§ 명령행 모드

• 입력하는 모든것이 명령어 해석됨

명령모드 & 입력모드

Command Insert

entered insert command (i, I, a, A, o, O, R)

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

CommandMode

InsertMode

entered <ESC>

이동 및 화면 제어

기본 단위 커서 이동

h 커서를 한 문자 왼쪽으로 이동

j 커서를 아래 줄 같은 컬럼으로 이동

k 커서를 위 줄 같은 컬럼으로 이동

I 커서를 한 문자 오른쪽으로 이동

<ENTER> 커서를 다음 줄의 첫 문자로 이동 (10ENTER)

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

방향키

화면 단위 커서 이동

H 화면의 맨 위쪽으로 커서 이동

M 화면의 중간 줄로 커서 이동

L 화면의 맨 아래 줄로 커서 이동

화면 커서 이동

Cursor Movement

§ go to line nn: :nn<Enter>, nnG

h j k l

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

h j k l

~~~~~~~~

Ctrl-D

Ctrl-F

Ctrl-U

Ctrl-B

이동 및 화면 제어

단어, 문장, 절 단위 이동

W 다음 단어의 첫 문자로 커서 이동

b 커서가 위치한 앞 방향의 단어로 커서 이동

e 커서가 위치한 단어의 끝으로 커서 이동

) 다음 문장으로 커서 이동

} 다음 절로 커서 이동

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

( )와 반대

{ }와 반대

0 현재 줄의 첫 문자로 커서 이동

^ 현재 줄의 처음으로 커서 이동 (탭이나 공백이 아닌)

$ 현재 줄의 마지막으로 커서 이동

이동 및 화면 제어

단어, 문장, 절 단위 이동

^F 한 화면 아래로 이동

^B 한 화면 위로 이동

^D 반 화면 아래로 이동

^U 반 화면 위로 이동

:$ 마지막 줄로 이동

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

G nG : 줄 번호 n으로 이동

1G : 편집 버퍼의 첫 줄로 이동하기

G : 편집 버퍼의 마지막 줄로 이동하기

편집 모드

데이터 첨가, 삽입, 치환, 해제

a 현재 커서 위치 오른쪽부터 데이터 첨가

i 현재 커서 위치의 왼쪽부터 데이터 첨가

o 현재 줄 아래 줄을 공백 줄로 만듦

A 현재 줄의 마지막에 데이터 첨가

I 현재 줄의 첫 문자 앞에 문자 삽입

O 현재 줄의 윗 줄을 공백 줄로 만듦

r 현재 커서가 위치한 한 문자 치환

R 현재 커서 위치에서 <esc>키를 칠 때까지 문자 치환

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

R 현재 커서 위치에서 <esc>키를 칠 때까지 문자 치환

cw 현재 커서 위치의 단어를 다른 단어로 치환

C 현재 커서의 위치부터 그 줄의 마지막까지 치환

s 현재 커서의 문자를 치환

S 현재 커서의 줄을 치환

cc 현재 커서가 위치한 줄을 다른 내용으로 치환

~ 현재 커서 위치의 한 문자를 소문자, 대문자로 전환

<ESC> 데이터 입력 모드에서 벗어남

편집 모드

데이터 삭제

x 현재 커서가 위치한 한 문자삭제

X 현재 커서가 위치한 앞 문자를 삭제

dw 현재 커서가 위치한 오른쪽 단어 삭제

db 현재 커서가 위치한 왼쪽 단어 삭제

dd 현재 커서가 위치한 줄 삭제

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

D 현재 커서가 위치한 곳에서 오른쪽의 내용삭제

명령의 취소 및 반복

u 바로 앞의 행한 명령 취소

U 한 줄 내에서 행한 명령 취소

. 바로 앞에 행한 명령 재수행

편집 모드

데이터 이동과 복사

yw 현재 커서가 위치한 단어를 버퍼에 복사

yy 현재 줄이 버퍼에 복사

10yy : 10줄을 복사

nY 현재 커서 위치로부터 n 줄 만큼 복사

p 현재 커서 오른쪽 또는 아래 줄에 버퍼 내용 복사

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

p 현재 커서 오른쪽 또는 아래 줄에 버퍼 내용 복사

P 현재 커서의 왼쪽 또는 위 줄에 버퍼 내용 복사

줄의 결합

J 현재 줄과 다음 줄을 연결

명령 실행 모드

vi 종료

:x

ZZ

파일을 디스크에 저장한 후 vi를 벗어난다

:wq 파일을 디스크에 저장한 후 vi를 벗어난다

:wq 파일명 기존 파일명을 새로운 파일명에 저장하고 vi 벗어남

:q! 파일을 디스크에 저장하지 않고 vi에서 벗어남

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

:q! 파일을 디스크에 저장하지 않고 vi에서 벗어남

기타 명령어

:set nu vi 상태에 있는 파일에 줄 번호를 부여

:set nonu 파일에 있는 줄 번호 취소

명령 실행 모드

vi 옵션들

-t tag tag를 포함하는 파일과 위치에 편집

-r 파일명 지정한 파일을 복구

-Wn 생략시의 윈도우 크기를 n으로 한다

-R 읽기 전용 모드(파일의 overwrite 방지)

+명령어 편집전에 지정한 ex 명령어 수행

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

+명령어 편집전에 지정한 ex 명령어 수행

-L 모든 파일의 이름이 출력

-C 명령어 지정된 편집기의 명령어를 실행함으로써 편집 시작

view 파일명 파일을 vi의 읽기 전용모드로 화면에 표시

vi file1 file2 file3

파일 편집을 위해 3개 파일을 vi로 부른다.

명령 실행 모드

파일 관련 명령어

검색 관련키

/검색어 커서가 위치한 행포함 아래로 해당 검색어 검색

?검색어 커서가 위치한 행 포함 위로 해당 검색어 검색

n or / 커서의 위치를 검색한 검색어의 다음 위치로 이동

N 커서의 위치를 검색한 검색어의 이전 위치로 이동

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

:w 파일명변경한 파일 내용 저장(:w 파일명 -> 해당파일명으로저장) (1,5w 파일명 -> 1-5행까지 해당파일로 저장)

:q Vi 종료

:e 파일명Vi 실행후 특정 파일을 불러들여 편집

:e# 편집했던 이전 파일을 다시 연다

:r 파일명특정 파일을 불러들임(1,5r 파일명 -> 해당파일의 1-5행까지만 불러들임)

명령 실행 모드

치환 관련 명령

:s/pattern/replace 현재 줄에서 치환

:%s/old/new/g파일 내의 특정 단어를 새로운 단어로 치환(문장 치환 시해당 문장을 “ ”으로 묶음)

:%s/^old/new/g파일 내의 특정 단어로 시작하는 단어만 새로운 단어로치환(해당 단어가 중간에 포함된 단어 제외)

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

:%s/old$/new/g파일 내의 특정 단어로 끝나는 단어만 새로운 단어로 치환(해당 단어가 중간에 포함된 단어 제외)

:%s/aaa//g파일 내의 aaa라는 단어를 삭제(문장 삭제시 해당 문장을 “”으로 묶음)

:10,50s/old/new/g파일 내의 10행에서 50행사이의 특정 단어를 새로운 단어로 치환(문장 치환 시 해당 문장을 “ ”으로 묶음)

추가 사용법

vi 환경에서 Shell 명령을 수행§ 명령모드에서 “:!”을 입력하고 원하는 Shell command 입력

§ 명령을 수행한 후에(enter를 치면) vi 편집기(명령모드)로복귀

:!ls Shell로 돌아가 ‘ls’ 명령 수행

:!pwd 현재 작업 directory 보여줌

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

여러 파일의 열기/편집/저장§ vi file1 file2 § vi *.txt § :n 다음파일로 이동, :N 이전파일로 이동

Shell Script Programming

Shell Script 개요

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

SuperComputing Infrastructure

Shell Script 개요

Shell Script 개요소개

• Shell script programming 목적– Unix/Linux 시스템의 기본 명령어를 반복적으로 사용하고자 할

때 사용

– Shell script 는 shell 에서 제공하는 기능을 순차적으로 사용하기 위해서 프로그램 처럼 동작하도록 script로 만드는 것

– 필요에 따라서 shell용 연산자와 옵션들을 사용할 수 있다.

• 주요 Shell

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

SuperComputing Infrastructure

• 주요 Shell– bash (Bourne-Again Shell)

– ksh (Korn Shell)

– csh (C Shell)

Shell Script 개요소개

• Shell script programming 목적– Unix/Linux 시스템의 기본 명령어를 반복적으로 사용하고자 할

때 사용

– Shell script 는 shell 에서 제공하는 기능을 순차적으로 사용하기 위해서 프로그램 처럼 동작하도록 script로 만드는 것

– 필요에 따라서 shell용 연산자와 옵션들을 사용할 수 있다.

• 주요 Shell

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

SuperComputing Infrastructure

• 주요 Shell– bash (Bourne-Again Shell)

– ksh (Korn Shell)

– csh (C Shell)

Shell Script 개요작성 방법

• Shell script 작성– 시스템 콜, 여러 프로그래밍 도구들, 유틸리티, 실행파일 등을

묶어서 작성

– 모든 종류의 Unix/Linux 명령어, 유틸리티, 도구 사용 가능

– 분기문 또는 순환문 등의 shell 내부 명령어를 사용 가능

• 실행 권한

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

SuperComputing Infrastructure

– Shell script 파일을 실행하기 위해서는 읽기/실행 권한을 가지고 있어야 한다.

– 실행 권한이 없고 읽기 권한이 있는 경우에는 ‘sh filename.sh’와 같이 sh 명령을 통해 실행이 가능하다.

– 읽기 권한이 없는 경우는 script 내용을 읽어드릴 수 없기 때문에 실행 자체가 불가능하다.

Shell Script 개요구조

• Shell script 구조– 첫 줄에 사용 shell 명시 (ex. #!/bin/bash)

– 실행 부분

– 프로그램 종료를 위해 exit 0 (생략 가능)

• ‘hello’를 출력하는 예제

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

SuperComputing Infrastructure

• ‘hello’를 출력하는 예제

#!/bin/bash

echo hello

exit 0

Shell Script 개요작성 및 실행 방법

• GIST 시스템 접속– ssh kigi-lg01

• 소스 코드 파일 작성– vi hello.sh

– gedit hello.sh

• 권한 변경

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

SuperComputing Infrastructure

• 권한 변경– chmod u+rx hello.sh

• 실행– ./hello.sh

Shell Script 개요명령어 실행 성공/실패 확인

• $?– 명령어 실행이 성공하면 ‘$?’에 0이 저장된다.

– 명령어 실행이 실패한 경우는 종료 상태 값이 ‘$?’에 저장된다.

– 명령어 실행의 성공 여부에 따라 다른 동작을 하게 만들고자 할유용하게 사용할 수 있다.

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

SuperComputing Infrastructure

• $? 사용 예제#!/bin/bash

echo helloecho $?

ech helloecho $?

exit 0

Shell Script 개요주석 처리

• 주석– #으로 시작하는 줄은 주석으로 처리

– 첫 칸에 오는 경우 그 줄 전체가 주석으로 처리

– 명령어 다음에 오는 경우는 #을 기준으로 오른쪽 주석처리

– 단, #! 은 사용 shell을 나타내므로 주석처리가 아니다.

• 주석 처리 예제

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

SuperComputing Infrastructure

• 주석 처리 예제

#!/bin/bash

# print ‘hello’echo helloecho $? # ‘$?’ is 0

ech helloecho $? # ‘$?’ is not 0

exit 0

Shell Script 개요명령어 구분자

• 명령어 구분자– 세미콜론(;)을 사용하여 명령어를 구분한다.

– 한 줄에 2개 이상의 명령어를 사용하고자 할 때 사용한다.

– 이중 세미콜론(;;)은 case문의 종료를 나타낸다.

• 명령어 구분자 예제

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

SuperComputing Infrastructure

• 명령어 구분자 예제

#!/bin/bash

# print ‘hello’echo hello ; echo worldecho $? # ‘$?’ is 0

ech helloecho $? # ‘$?’ is not 0

exit 0

Shell Script 개요변수 할당과 치환

• Shell script에서의 변수– 변수 이름이 variable 이라면 변수의 값은 $variable 로 표현.

– variable에 값을 할당 할때는 ‘=‘ 연산자를 사용한다. (ex. variable=0)

• 변수 할당 예제

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

SuperComputing Infrastructure

#!/bin/bash

# print ‘hello’variable1=worldecho hello $varialbe1

variable2=$?echo variable2 # ‘$?’ is 0

exit 0

Shell Script 개요변수 타입

• Shell script에서의 변수 타입– 최초에 변수 타입이 꼭 정해져 있지 않다.

– 할당 시 그 값의 타입에 따라 변수 타입이 정해진다.

– 타입이 다른 변수 간의 할당이나 연산은 하지 않는 것이 좋다.

• 변수 할당 예제

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

SuperComputing Infrastructure

• 변수 할당 예제#!/bin/bash

# print ‘hello’variable1=worldecho hello $varialbe1

variable2=$?echo variable2 # ‘$?’ is 0

exit 0

Shell Script 개요할당 연산자

• 할당 (assignment; = )– 변수값을 초기화 하거나 변경

– Shell에서는 산술식과 문자열을 할당해 주는 역할을 모두 수행한다.

– 할당 연산자 앞에는 빈 칸이 들어가면 안 된다.

– 테스트 문에서 사용되는 비교 연산자와 다른 의미

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

SuperComputing Infrastructure

• 할당 연산자 예제

#!/bin/bash

color=rednum=12

echo $num apples are $color

exit 0

Shell Script 개요산술 연산자

• 기본 산술 연산자– 더하기 : +

– 빼기 : -

– 곱하기 : *

– 나누기 : /

– 누승(exponentiation) : **

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

SuperComputing Infrastructure

• 산술 연산자 예제

#!/bin/bash

let “a=5”let “b=6”let “c=a+b**2”

echo “5 + 6^2 = $c”

exit 0

Shell Script 개요산술 연산자 & 논리 연산자

• 그 밖의 산술 연산자– 상수값 만큼 증가 : +=

– 상수값 만큼 감소 : -=

– 상수값 만큼 곱합 : *=

– 상수값 만큼 나눔 : /=

– 상수값으로 나눈 나머지 값 : %=

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

SuperComputing Infrastructure

• 논리 연산자– and (논리) : &&

– or (논리) : ||

Shell Script 개요숫자 상수 표현

• 숫자 상수 표기 방법– 10 진수 : 64

– 8진수 (0으로 시작) : 0100

– 16진수 (0X로 시작) : 0X40

– 다른 진법 (진수#숫자, 진수는 2~32) : 32#20

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

SuperComputing Infrastructure

• 숫자 상수 표기 방법 예제

#!/bin/bash

let “a=64”let “b=0100”let “c=0X40”let “d=32#20”

echo $a $b $c $d

exit 0

Shell Script 개요테스트

• if/then/else/fi– if 문장의 명령어 목록의 종료 상태($?)가 0인 경우 then 문장을

실행한다.

– if 문장의 [ expression ] 이 0인 경우 then 문장을 실행한다.

– 그렇지 않은 경우는 else 문장을 실행한다.

• 테스트 예제

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

SuperComputing Infrastructure

#!/bin/bash

let “a=1”let “b=$a”

if [ $a -eq $b ]then echo “a = b”else echo “a != b”fi

exit 0

Shell Script 개요파일 테스트 연산자

• 파일 테스트 연산자 조건이 맞으면 0 리턴– 존재하는 파일 : -e

– 보통파일(디렉터리나 디바이스 제외) : -f

– 파일 크기가 0 아님 : -s

– 디렉토리 : -d

– 심볼릭 링크 : -L

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

SuperComputing Infrastructure

– 읽기 권한 : -r

– 쓰기 권한 : -w

– 실행 권한 : -x

– 소유주 : -O

– 소유 그룹 : -G

– f1이 f2보다 최신임 : f1 –nt f2

– f1이 f2보다 예전 것임 : f1 –ef f2

Shell Script 개요비교 연산자

• 정수 비교– 같음 : [ $a –eq $b ]

– 같지 않음 : [ $a –ne $b]

– 더 큼 : [ $a –gt $b ]

– 더 크거나 같음 : [ $a –ge $b ]

– 더 작음 : [ $a –lt $b]

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

SuperComputing Infrastructure

– 더 작거나 같음 : [ $a –lt $b ]

#!/bin/bash

let “a=1”let “b=2”

if [ $a -lt $b ]then echo “a = b”else echo “a != b”fi

exit 0

Shell Script 개요순환문

• for / in / do / done

• 순환문 구조

#!/bin/bash

for arg in [list]docommands …

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

SuperComputing Infrastructure

– arg 는 루프 인덱스에 해당

– list는 arg 에 할당되는 값의 목록

– arg 값이 변화 되면서 반복적으로 commands 수행

commands …done

exit 0

Shell Script 개요순환문 예제

• 순환문을 이용한 파일 관리 예제

#!/bin/bash

OFILES=“porion pgaiahamelkigi”

for file in $OFILESdotouch $filedone

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

Partnership & Leadershipfor the nationwide

SuperComputing Infrastructure

kigi”

NFILES=“porionpgaiapdaisyhamelkigicheetah”

for file in $NFILESdo if [ -e $file ]then mv $file ${file}_oldelse touch ${file}_new

fidone

exit 0

컴파일

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

컴파일 개요

컴파일의 의미§ 사용자가 작성한 소스 코드를 컴퓨터가 실행 가능하도록 바

이너리화 하는 과정.§ 큰 의미에서는 이미 작성해 놓은 라이브러리를 포함 시키는

것 까지 포함.컴파일러§ 컴파일 작업을 수행해 주는 역할을 한다.§ 사용하는 언어의 종류에 따라 표준화 되어 있으며, 제작 업

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ 사용하는 언어의 종류에 따라 표준화 되어 있으며, 제작 업체별로 여러 가지 버전이 존재한다.

대표적인 C 컴파일러§ icc (Intel), xlc (IBM), gcc (GNU)

대표적인 Fortran 컴파일러§ ifort (Intel), xlf (IBM), gfortran (GNU)

컴파일 환경 설정

환경변수 확인

Execution platforms ONLY

Execution platform 중 한가지 시스템으로 로그인 되어 있어야 함

사용자가 원하는 컴파일러가 사용할 준비가 되었는지 확인ex> which ifort

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ ex> which ifort

특히 MPI 라이브러리를 사용할 경우 module 유틸리티를 이용하여필요한 라이브러리를 로드 해야 함§ 예를 들어 부산대 시스템에서 intel 컴파일러로 설치된 mvapich를 사용

한다면 아래와 같이 모듈을 불러오면 된다.§ $ module load mvapich/mvapich-intel

Serial code 컴파일

OpenMP 지시어나 MPI 라이브러리를 사용하지 않는 일반적인 사용자코드 컴파일

Platform별 바이너리 호환이 되지 않으므로 반드시 해당 platform으로로그인하여 수행함

컴파일러 종류§ 다양한 컴파일러가 설치되어 있으므로 사용자의 용도에 맞게 선택§ Fortran : xlf, ifort, gfortan§ C : xlc, icc, gcc

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ C : xlc, icc, gcc§ C++ : xlC, ifort, g++

컴파일러 사용 예§ exam.f90 이라는 이름의 포트란 소스 코드를 인텔 포트란 컴파일러

를 이용하여 컴파일 한다. –o 옵션을 이용하여 exam 이란 실행파일을 동시에 생성한다.

§ $ ifort –o exam exam.f90

Serial code 컴파일

일반적인 리눅스 시스템에서는 Intel 컴파일러를 제공하고있으며, IBM AIX 시스템에서는 XL 컴파일러를 제공하고있다. 최적화 성능을 얻기 위해서는 Intel 컴파일러(리눅스시스템) 또는 XL 컴파일러(IBM AIX 시스템)를 사용할 것을 권장 한다.

설치된 컴파일러를 사용하기 위해서는 컴파일 관련 모듈

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

설치된 컴파일러를 사용하기 위해서는 컴파일 관련 모듈을 로드 해야 한다. § 예를 들어 부산대 시스템(pdaisy)에서 intel 컴파일러를 사

용하고 싶다면 아래와 같이 모듈을 불러오면 된다.§ $ module load intel/intel-11.0

OpenMP code 컴파일

OpenMP 지시어가 포함된 사용자 코드 컴파일

Platform별 바이너리 호환이 되지 않으므로 반드시 해당 platform으로 로그인하여 수행함.

컴파일러 종류§ 다양한 컴파일러가 설치되어 있으므로 사용자의 용도에 맞게 선택§ Fortran : xlf,_r, ifort -openmp, gfortan –fopenmp

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ C : xlc_r , icc -openmp, gcc –fopenmp§ C++ : xlC_r, ifort -openmp, g++ -fopenmp

컴파일러 사용 예§ exam.f90 이라는 이름의 포트란 소스 코드를 인텔 포트란 컴파일러를 이

용하여 컴파일 한다. –o 옵션을 이용하여 exam이란 실행파일을 동시에생성한다 . 추가로 –openmp 또는 –fopenmp 옵션을 사용하면OpenMP 병렬실행 파일이 생성됨.

§ $ ifort –o exam –openmp exam.f90

MPI code 컴파일

MPI 라이브러리를 사용하여 작성한 사용자 코드 컴파일

Platform별 바이너리 호환이 되지 않으므로 반드시 해당platform으로 로그 인하여 수행함

컴파일러 종류§ 다양한 컴파일러가 설치되어 있으므로 사용자의 용도에 맞게 선택§ Fortran : mpif77, mpif90§ C : mpicc

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ C : mpicc§ C++ : mpiCC

컴파일러 사용 예§ exam.f90 이라는 이름의 포트란 소스 코드를 MPI 컴파일러를 이

용하여 컴파일 한다. –o 옵션을 이용하여 exam이란 실행파일을동시에 생성 한다.

§ $ mpif90 –o exam exam.f90

MPI code 컴파일

MPI 라이브러리를 사용할 때에도 환경 설정이 필요하다. 예를 들어 부산대 시스템에서 intel 컴파일러로 설치된mvapich를 사용한다면 아래와 같이 모듈을 불러오면 된다.§ $ module load mvapich/mvapich-intel

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

예제 1

dotp.f (1/2)

program dotproduct

implicit none

real, dimension(3,3) :: a, b, cinteger :: i,j,k

c = 0.0

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

do i = 1,3read *,a(i,1),a(i,2),a(i,3)enddo

do i = 1,3read *,b(i,1),b(i,2),b(i,3)enddo

예제 1

dotp.f (2/2)do i = 1,3do j = 1,3do k = 1,3c(i,j) = c(i,j) + a(j,k)*b(k,j)enddo

enddoenddoprint *, 'A = 'do i = 1,3

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

do i = 1,3print*,a(i,1),a(i,2),a(i,3)enddoprint *, 'B = 'do i = 1,3print *,b(i,1),b(i,2),b(i,3)enddoprint *, ‘C = 'do i = 1,3print *,c(i,1),c(i,2),c(i,3)enddoend program dotproduct

예제 1

dotp.inp

1.0 2.0 3.04.0 5.0 6.07.0 8.0 9.01.0 1.0 1.02.0 2.0 2.03.0 3.0 3.0

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

예제 1

GIST 시스템 접속§ ssh kigi-lg01

컴파일 환경 설정§ module load intel/intel_9.1.052

소스 코드 파일 작성§ vi dotp.f§ gedit dotp.f

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ gedit dotp.f

소스 코드 파일 작성§ vi dotp.inp§ gedit dotp.inp

예제 1

컴파일§ ifort –o dotp.x dotp.f

실행§ ./dotp.x < dotp.inp§ ./dotp.x < dotp.inp > dotp.out

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

예제 2

plot.f

program plotimplicit none

integer i, jreal x, y, zy=-1.0

do i=1,200

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

do i=1,200x=-1.0do j=1,200z=x**2-y**2print*, x, y, zx=x+0.01

end doy=y+0.01enddo

end program plot

예제 2

GIST 시스템 접속§ ssh kigi-lg01

컴파일 환경 설정§ module load intel/intel_9.1.052

소스 코드 파일 작성§ vi plot.f§ gedit plot.f

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ gedit plot.f

컴파일§ ifort –o plot.x plot.f

실행§ ./plot.x > plot.out

예제 2

gnuplot 실행§ gnuplot

그래프 출력§ splot ‘plot.out’

그림으로 출력§ set terminal png§ set output ‘plot.png’

PLSI 사용자 응용기술지원팀Partnership & Leadership

for the nationwideSuperComputing Infrastructure

§ set output ‘plot.png’§ replot

gnuplot 종료§ exit

그림 보기§ gthumb plot.png