AWS 활용 튜토리얼
AWS ParallelCluster
AWS ParallelCluster
  • AWS ParallelCluster
  • 키페어 생성
  • Cloud9 환경 만들기
  • v3
    • 구축
      • ParallelCluster 란?
      • Cluster 구축
      • Cluster 업데이트
      • Cluster 설정 관련 팁
    • 사용
      • 준비하기
      • Snakemake 설치
      • Snakemake 사용
        • 예제1
        • 예제2
        • 예제3
    • 기타
      • FAQ
      • Slurm
Powered by GitBook
On this page
  • 참고 튜토리얼
  • 사전 필요사항
  • Cluster 생성 방법
  1. v3
  2. 구축

Cluster 구축

PreviousParallelCluster 란?NextCluster 업데이트

Last updated 2 years ago

참고 튜토리얼

사전 필요사항

  • Python3이 설치된 환경 (ex. EC2, Cloud9 등)

    • EC2를 사용한다면 적절한 role 설정이 필요합니다. (, )

    • Cloud9의 경우 IAM user가 Cluster 생성을 위한 role을 가지고 있는 경우 가능합니다.

  • EC2 에서 key pair 생성

    • Cluster의 head node에 접속을 할 때 필요합니다.

Cluster 생성 방법

Python3가 설치된 환경에서 아래 명령어로 pcluster tool을 설치합니다.

  • 경우에 따라서 virtual env 등 별도의 python 환경을 만들어서 진행하는 것을 추천합니다.

python -m pip install "aws-parallelcluster" --user

버전을 확인 해 봅니다.

pcluster version

설정파일을 생성합니다.

pcluster configure --config hpc-cluster.yaml

생성된 설정파일은 적절하게 수정 해 줍니다. 아래와 같은 형태를 갖게 됩니다.

Region: ap-northeast-2
Image:
  Os: alinux2
HeadNode:
  InstanceType: t3.large
  Networking:
    SubnetId: subnet-0aecd06bb2da5c5e7
  Ssh:
    KeyName: pcluster-head-key-pair
Scheduling:
  Scheduler: slurm
  SlurmQueues:
  - Name: process-queue
    ComputeResources:
    - Name: t3xlarge
      Instances:
      - InstanceType: t3.xlarge
      MinCount: 0
      MaxCount: 5
    Networking:
      SubnetIds:
      - subnet-0aecd06bb2da5c5e7

아래 명령어로 설정파일을 활용하여 cluster 를 생성합니다. 생성에는 클러스터 설정마다 다르지만 5분 이상 걸리게 됩니다.

pcluster create-cluster --cluster-name hpc-cluster \
    --cluster-configuration hpc-cluster.yaml \
    --region ap-northeast-2

생성 중이나 완료 시에 아래 명령어로 상태를 확인할 수 있습니다.

pcluster describe-cluster --cluster-name hpc-cluster

클러스터 생성이 완료되면 아래 명령어를 사용하여 접속할 수 있습니다.

  • 이 때 미리 만들어둔 key pair를 사용합니다.

  • key pair는 400 권한을 가지도록 합니다.

pcluster ssh --cluster-name hpc-cluster -i pcluster-node-key.pem

클러스터에 접속 후 slurm 상태를 체크할 수 있습니다.

sinfo
squeue

slurm job을 실행해 볼 수도 있습니다. (hellojob.sh으로 저장)

#!/bin/bash
sleep 10
echo "Hello World from $(hostname)"
sbatch hellojob.sh
  • slurm job 을 제출했을 때, compute node가 존재하지 않으면 provisioning 시간이 걸리게 됩니다. 하지만 이미 node가 존재하는 경우 곧바로 job이 실행이 되게 됩니다.

  • 따라서, queue에 job이 있을 때만 compute node 가 동작하도록 하여 비용을 최적화 할 수 있습니다.

클러스터 생성이 완료되었습니다!

queue에 job이 일정 시간 동안 idle이면 node는 자동으로 terminate 됩니다. (기본으로 10분, 설정은 참고)

https://docs.aws.amazon.com/parallelcluster/latest/ug/tutorials-running-your-first-job-on-version-3.html
기본 권한
클러스터 생성권한
여기