EFA 対応 FSx Lustre を使用したクラスターの作成 - AWS ParallelCluster

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

EFA 対応 FSx Lustre を使用したクラスターの作成

このチュートリアルでは、EFA 対応の FSx Lustre ファイルシステムを共有ストレージとして使用するクラスターを作成します。EFA を有効にして FSx Lustre ファイルシステムを使用すると、パフォーマンスが最大 8 倍向上します。EFA 対応ファイルシステムが必要なものかどうかを確認するには、FSx for Lustre ユーザーガイド」の「EFA 対応ファイルシステムの使用」を参照してください。

を使用すると AWS ParallelCluster、 AWS ParallelCluster イメージとクラスターを作成または更新したときに作成された AWS リソースに対してのみ料金が発生します。詳細については、「AWS が使用する サービス AWS ParallelCluster」を参照してください。

要件

セキュリティグループを作成する

クラスターとファイルシステムがデプロイされる同じ VPC に 2 つのセキュリティグループを作成します。1 つはクラスターノードで実行されているクライアント用、もう 1 つはファイルシステム用です。

# Create security group for the FSx client aws ec2 create-security-group \ --group-name Fsx-Client-SecurityGroup \ --description "Allow traffic for the FSx Lustre client" \ --vpc-id vpc-cluster \ --region region # Create security group for the FSx file system aws ec2 create-security-group \ --group-name Fsx-FileSystem-SecurityGroup \ --description "Allow traffic for the FSx Lustre File System" \ --vpc-id vpc-cluster \ --region region

チュートリアルの残りの部分では、 sg-clientsg-file-systemがそれぞれクライアントとファイルシステムのセキュリティグループ ID であることを前提としています。

EFA の必要に応じて、ファイルシステムへのすべてのアウトバウンドトラフィックを許可するように、クライアントのセキュリティグループを設定します。

# Allow all outbound traffic from the client to the file system aws ec2 authorize-security-group-egress \ --group-id sg-client \ --protocol -1 \ --port -1 \ --source-group sg-file-system \ --region region

EFA の必要に応じて、ファイルシステムのセキュリティグループを設定して、そのシステム内のすべてのインバウンド/アウトバウンドトラフィックとクライアントからのすべてのインバウンドトラフィックを許可します。

# Allow all inbound traffic within this security group aws ec2 authorize-security-group-ingress \ --group-id sg-file-system \ --protocol -1 \ --port -1 \ --source-group sg-file-system \ --region region # Allow all outbound traffic within this security group aws ec2 authorize-security-group-egress \ --group-id sg-file-system \ --protocol -1 \ --port -1 \ --source-group sg-file-system \ --region region # Allow all inbound traffic from the client aws ec2 authorize-security-group-ingress \ --group-id sg-file-system \ --protocol -1 \ --port -1 \ --source-group sg-client \ --region region # Allow all outbound traffic to the client aws ec2 authorize-security-group-egress \ --group-id sg-file-system \ --protocol -1 \ --port -1 \ --source-group sg-client \ --region region

ファイルシステムを作成する

コンピューティングノードがあるのと同じアベイラビリティーゾーン (AZ) 内にファイルシステムを作成し、次のコードで を ID subnet-compute-nodesに置き換えます。これは、EFA がファイルシステムと連携できるようにするために必要です。ファイルシステムの作成の一環として、EfaEnable プロパティを使用して EFA を有効にすることに注意してください。

aws fsx create-file-system \ --file-system-type LUSTRE \ --storage-capacity 38400 \ --storage-type SSD \ --subnet-ids subnet-compute-nodes \ --security-group-ids sg-file-system \ --lustre-configuration DeploymentType=PERSISTENT_2,PerUnitStorageThroughput=125,EfaEnabled=true,MetadataConfiguration={Mode=AUTOMATIC} \ --region region

前のコマンドで返されたファイルシステム ID を書き留めます。チュートリアルの残りの部分では、 をこのファイルシステム ID fs-idに置き換えます。

クラスターを作成する

  1. YAML 設定ファイルに次の設定が設定された AWS ParallelCluster クラスターを作成します。

    1. Ubuntu 22.04 など、サポートされている OS に基づく AMI。

    2. コンピューティングノードは、g6.16xlarge などの Nitro v4+ を持つ EFA でサポートされているインスタンスタイプを使用する必要があります。

      • コンピューティングノードは、ファイルシステムと同じ AZ に存在する必要があります。

      • コンピューティングノードでは、Efa/Enabled を true に設定する必要があります。

      • コンピューティングノードは、OnNodeStart カスタムアクションconfigure-efa-fsx-lustre-client.shとして設定スクリプトを実行する必要があります。スクリプトは、FSx の公式ドキュメントで提供されており、お客様の便宜上、パブリックバケットで提供されています。これは、コンピューティングノードで FSx Lustre クライアントを設定して EFA を使用できるようにすることを目的としています。

  2. クラスター設定ファイル を作成しますconfig.yaml

    Region: region Image: Os: ubuntu2204 HeadNode: InstanceType: c5.xlarge Networking: SubnetId: subnet-xxxxxxxxxx AdditionalSecurityGroups: - sg-client Ssh: KeyName: my-ssh-key Scheduling: Scheduler: slurm SlurmQueues: - Name: q1 ComputeResources: - Name: cr1 Instances: - InstanceType: g6.16xlarge MinCount: 1 MaxCount: 3 Efa: Enabled: true Networking: SubnetIds: - subnet-xxxxxxxxxx # Subnet in the same AZ where the file system is AdditionalSecurityGroups: - sg-client PlacementGroup: Enabled: false CustomActions: OnNodeStart: Script: https://us-east-1-aws-parallelcluster.s3.us-east-1.amazonaws.com/scripts/fsx-lustre-efa/configure-efa-fsx-lustre-client.sh SharedStorage: - MountDir: /fsx Name: my-fsxlustre-efa-external StorageType: FsxLustre FsxLustreSettings: FileSystemId: fs-id

    次に、その設定を使用してクラスターを作成します。

    pcluster create-cluster \ --cluster-name fsx-efa-tutorial \ --cluster-configuration config.yaml \ --region region

EFA で FSx が動作していることを検証する

Lustre ネットワークトラフィックが EFA を使用していることを確認するには、特定のネットワークインターフェイスのネットワークトラフィックを表示できる Lustre lnetctl ツールを使用します。この目的を達成するには、コンピューティングノードで次のコマンドを実行します。

# Take note of the number of packets flowing through the interface, # which are specified in statistics:send_count and statistics:recv_count sudo lnetctl net show --net efa -v # Generate traffic to the file system echo 'Hello World' > /fsx/hello-world.txt # Take note of the number of packets flowing through the interface, # which are specified in statistics:send_count and statistics:recv_count sudo lnetctl net show --net efa -v

機能が機能している場合、インターフェイスを通過するパケットの数は増加すると予想されます。