AWS ParallelCluster のセットアップ
ParallelCluster のインストール
- Python のパッケージマネージャである
pip
コマンドを使用して、AWS ParallelCluster を Cloud9 上にインストールします。ここでは、ハンズオンのために、version 2.10.1 を指定してインストールしています。
pip3 install aws-parallelcluster==2.10.3 --user
- 以下のコマンドで ParallelCluster のバージョンを確認できます。
ParallelCluster の初期設定
SGE 編または、Slurm 編のいずれかを、ハンズオンオーナーの指示に従って実施してください。
出力は次のようになります。
逐次入力を求められます。
- リージョンは
ap-northeast-1
と入力してください(先程キーペアを作成した東京リージョンが ap-northeast-1
に対応しています)。
ParallelClusterの初期設定 (Slurm編)
Allowed values for AWS Region ID:
1. ap-east-1
2. ap-northeast-1
3. ap-northeast-2
4. ap-south-1
5. ap-southeast-1
6. ap-southeast-2
7. ca-central-1
8. eu-central-1
9. eu-north-1
10. eu-west-1
11. eu-west-2
12. eu-west-3
13. sa-east-1
14. us-east-1
15. us-east-2
16. us-west-1
17. us-west-2
AWS Region ID [ap-northeast-1]: ap-northeast-1 # リージョン指定
Allowed values for EC2 Key Pair Name:
1. ee-default-keypair
2. handson-key
EC2 Key Pair Name [ee-default-keypair]: guest01-key # キーペア指定
Allowed values for Scheduler:
1. sge
2. torque
3. slurm
4. awsbatch
Scheduler [slurm]: # ジョブスケジューラ指定 (Slurm)
Allowed values for Operating System:
1. alinux
2. alinux2
3. centos7
4. centos8
5. ubuntu1604
6. ubuntu1804
Operating System [alinux2]: centos7 # OS指定
Minimum cluster size (instances) [0]: # 最小の計算ノード数指定
Maximum cluster size (instances) [10]: # 最大の計算ノード数指定
Head node instance type [t2.micro]: # ヘッドノードのインスタンスタイプを指定
Compute instance type [t2.micro]: c5.xlarge # 計算ノードのインスタンスタイプを指定
Automate VPC creation? (y/n) [n]: y
Allowed values for Network Configuration:
1. Head node in a public subnet and compute fleet in a private subnet
2. Head node and compute fleet in the same public subnet
Network Configuration [Head node in a public subnet and compute fleet in a private subnet]: # マスターノードのみパブリックIPを付与
Beginning VPC creation. Please do not leave the terminal until the creation is finalized
Creating CloudFormation stack...
Do not leave the terminal until the process has finished
Stack Name: parallelclusternetworking-pubpriv-nnnnnnnnnnnnnn
ParallelClusterの初期設定 (SGE編)
Allowed values for AWS Region ID:
1. ap-east-1
2. ap-northeast-1
3. ap-northeast-2
4. ap-south-1
5. ap-southeast-1
6. ap-southeast-2
7. ca-central-1
8. eu-central-1
9. eu-north-1
10. eu-west-1
11. eu-west-2
12. eu-west-3
13. sa-east-1
14. us-east-1
15. us-east-2
16. us-west-1
17. us-west-2
AWS Region ID [us-east-1]: ap-northeast-1 # リージョン指定
Allowed values for EC2 Key Pair Name:
1. ee-default-keypair
2. handson-key
EC2 Key Pair Name [ee-default-keypair]: guest01-key # キーペア指定
Allowed values for Scheduler:
1. sge
2. torque
3. slurm
4. awsbatch
Scheduler [slurm]: sge # ジョブスケジューラ指定 (SGE)
Allowed values for Operating System:
1. alinux
2. alinux2
3. centos7
4. centos8
5. ubuntu1604
6. ubuntu1804
Operating System [alinux2]: centos7 # OS指定
Minimum cluster size (instances) [0]: # 最小の計算ノード数指定
Maximum cluster size (instances) [10]: # 最大の計算ノード数指定
Head node instance type [t2.micro]: # ヘッドノードのインスタンスタイプを指定
Compute instance type [t2.micro]: c5.xlarge # 計算ノードのインスタンスタイプを指定
Automate VPC creation? (y/n) [n]: y
Allowed values for Network Configuration:
1. Head node in a public subnet and compute fleet in a private subnet
2. Head node and compute fleet in the same public subnet
Network Configuration [Head node in a public subnet and compute fleet in a private subnet]: # マスターノードのみパブリックIPを付与
Creating CloudFormation stack...
Do not leave the terminal until the process has finished
Stack Name: parallelclusternetworking-pubpriv-nnnnnnnnnnnnnn
- ここまで初期設定が完了すると、ParallelCluster の設定ファイル
~/.parallelcluster/config
ファイルが作成されます。
- 各パラメータの詳細については下記ドキュメントを参照ください
- ParallelCluster の config ファイルを確認してみます
cat ~/.parallelcluster/config
config ファイルの例 (Slurm編)
[aws]
aws_region_name = ap-northeast-1
[aliases]
ssh = ssh {CFN_USER}@{MASTER_IP} {ARGS}
[global]
cluster_template = default
update_check = true
sanity_check = true
[cluster default]
key_name = guest01-key
scheduler = slurm
master_instance_type = t2.micro
base_os = centos7
vpc_settings = default
queue_settings = compute
[vpc default]
vpc_id = vpc-013d88bd2bd044a13
master_subnet_id = subnet-0dbe2e984a7c50a1c
compute_subnet_id = subnet-0d2e8694f577c481e
use_public_ips = false
[queue compute]
enable_efa = false
enable_efa_gdr = false
compute_resource_settings = default
[compute_resource default]
instance_type = c5.xlarge
config ファイルの例 (SGE編)
[aws]
aws_region_name = ap-northeast-1
[aliases]
ssh = ssh {CFN_USER}@{MASTER_IP} {ARGS}
[global]
cluster_template = default
update_check = true
sanity_check = true
[cluster default]
key_name = guest01-key
scheduler = sge
master_instance_type = t2.micro
base_os = centos7
vpc_settings = default
queue_settings = compute
[vpc default]
vpc_id = vpc-013d88bd2bd044a13
master_subnet_id = subnet-0dbe2e984a7c50a1c
compute_subnet_id = subnet-0d2e8694f577c481e
use_public_ips = false
[queue compute]
enable_efa = false
enable_efa_gdr = false
compute_resource_settings = default
[compute_resource default]
instance_type = c5.xlarge
- OS やインスタンスタイプが指定通りになっているか確認してください。
- このファイルに追加のオプションを記述することでクラスタのカスタマイズができます。
(オプション)NICE-DCV 設定の追加
この項目は、ハンズオンオーナーの指示がある場合に実施してください
~/.parallelcluster/
にある config
ファイルをエディタで開きます。エディタには Vim や Emacs などお好きなエディタを使える他、Cloud9 の IDE 上で編集することも可能です。
Vim での開き方
Vim はデフォルトでインストールされているため、そのまま利用できます。
vim ~/.parallelcluster/config
Emacs での開き方
Emacs はデフォルトでインストールされていませんが、インストールすると利用できます。
sudo yum install -y emacs
emacs ~/.parallelcluster/config
Cloud9 の IDE による開き方
Cloud9 の IDE 上で編集することもできます。以下のコマンドを実行します。
config
をクリックするとメニューが表示されるので、「Open」をクリックするとIDEで開くことができます。
同様の用途で c9
コマンドも利用できます。npm
コマンドでインストールすると使えるようになります。
npm install -g c9
c9 ~/.parallelcluster/config
ファイルを保存するときは左上メニューの「File」をクリックし、出てきたメニューで「Save」をクリックします。
[cluster default]
の下に以下の行を追加し、
ヘッドノードのインスタンスタイプを t2.micro
から g4dn.xlarge
に変更します。
master_instance_type = g4dn.xlarge
さらにファイル末尾に以下の 2 行を追加します。
[dcv dcv1]
enable = master
編集後のconfig
ファイル例は以下の様になります。
[aws]
aws_region_name = ap-northeast-1
[aliases]
ssh = ssh {CFN_USER}@{MASTER_IP} {ARGS}
[global]
cluster_template = default
update_check = true
sanity_check = true
[cluster default]
key_name = guest01-key
scheduler = slurm
master_instance_type = g4dn.xlarge
base_os = centos7
vpc_settings = default
queue_settings = compute
dcv_settings = dcv1
[vpc default]
vpc_id = vpc-013d88bd2bd044a13
master_subnet_id = subnet-0dbe2e984a7c50a1c
compute_subnet_id = subnet-0d2e8694f577c481e
use_public_ips = false
[queue compute]
enable_efa = false
enable_efa_gdr = false
compute_resource_settings = default
[compute_resource default]
instance_type = c5.xlarge
[dcv dcv1]
enable = master
これらの設定により、クラスタ作成時に、ヘッドノードでリモートデスクトップソフトウェアである NICE-DCV がセットアップされます。