

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 啟用 GPU 加速
<a name="gpu-acceleration-enabling"></a>

您可以在使用 AWS 管理主控台或 AWS CLI AWS SDK 建立或更新 OpenSearch 網域或 OpenSearch Serverless 集合時啟用 GPU 加速。

在網域或集合上啟用 GPU 加速後，此功能會在所有索引上預設為啟用。如果您需要在索引層級停用此功能，請參閱 [建立 GPU 加速向量索引](gpu-acceleration-creating-indexes.md)。

## 主控台
<a name="gpu-acceleration-console"></a>

下列程序使用 OpenSearch Serverless 管理主控台啟用 OpenSearch 網域和 OpenSearch Serverless 集合的 GPU 加速。

------
#### [ Create new domain ]

若要建立已啟用 GPU 加速的 OpenSearch 網域，請參閱 [建立 OpenSearch Service 網域](createupdatedomains.md#createdomains)。

------
#### [ Edit existing domain ]

1. 開啟 [OpenSearch Service](https://console.aws.amazon.com/aos/home ) 管理主控台。

1. 在導覽窗格中，選擇**網域**。

1. 選擇您的網域名稱以開啟網域詳細資訊頁面。

1. 選擇**動作**，然後選擇**編輯網域**。

1. 在**進階功能**區段中，選取**啟用 GPU 加速**。啟用此功能後，您的向量索引操作就會[加速](gpu-acceleration-vector-index.md#gpu-acceleration-write-operations)。

1. 選擇**儲存變更**。

------
#### [ Create new collection ]

若要建立已啟用 GPU 加速的 OpenSearch Serverless 集合，請參閱 [教學課程：Amazon OpenSearch Serverless 入門](serverless-getting-started.md)。在建立集合期間，請確定您選取**向量搜尋**集合類型，並在向量搜尋組態中啟用 GPU 加速。

------
#### [ Edit existing collection ]

1. 開啟 [OpenSearch Service](https://console.aws.amazon.com/aos/home ) 管理主控台。

1. 在導覽窗格中，選擇**集合**。

1. 選擇您的集合名稱以開啟集合詳細資訊頁面。

1. 在**部署選項**區段中，**編輯**向量 GPU 加速。

1. 停用或啟用 GPU 加速。

1. 選擇**儲存變更**。

------

### AWS CLI
<a name="gpu-acceleration-cli"></a>

------
#### [ Create new domain ]

下列 AWS CLI 範例會建立在美國東部 （維吉尼亞北部） 啟用 GPU 加速的 OpenSearch 網域。將*文字*取代為您自己的組態文字。

```
aws opensearch create-domain \
    --domain-name my-domain \
    --engine-version OpenSearch_3.1 \
    --cluster-config InstanceType=r6g.xlarge.search,\
        InstanceCount=1,\
        DedicatedMasterEnabled=true,\
        DedicatedMasterCount=3,\
        DedicatedMasterType=m6g.large.search \
    --ebs-options "EBSEnabled=true,\
        VolumeType=gp3,\
        VolumeSize=2000" \
    --encryption-at-rest-options '{"Enabled":true}' \
    --aiml-options '{"ServerlessVectorAcceleration": {"Enabled": true}}' \
    --node-to-node-encryption-options '{"Enabled":true}' \
    --domain-endpoint-options '{"EnforceHTTPS":true,\
        "TLSSecurityPolicy":"Policy-Min-TLS-1-0-2019-07"}' \
    --access-policies '{"Version": "2012-10-17",		 	 	 
        "Statement": [{
            "Effect": "Allow",
            "Principal": {"AWS": "*"},
            "Action": "es:*",
            "Resource": "arn:aws:es:us-east-1:123456789012:domain/my-domain/*"
        }]}' \
    --advanced-security-options '{
        "Enabled":true,
        "InternalUserDatabaseEnabled":true,
        "MasterUserOptions": {
            "MasterUserName":"USER_NAME",
            "MasterUserPassword":"PASSWORD"
        }}' \
    --region us-east-1
```

------
#### [ Edit existing domain ]

下列 AWS CLI 範例會啟用現有 OpenSearch 網域的 GPU 加速。將*文字*取代為您自己的組態文字。

```
aws opensearch update-domain-config \
    --domain-name my-domain \
    --cluster-config InstanceType=r7g.16xlarge.search,InstanceCount=3 \
    --aiml-options '{"ServerlessVectorAcceleration": {"Enabled": true}}'
```

------
#### [ Create new collection ]

下列 AWS CLI 範例會建立在美國東部 （維吉尼亞北部） 啟用 GPU 加速的 OpenSearch Serverless 集合。將*文字*取代為您自己的組態文字。

```
aws opensearchserverless create-collection \
    --name "my-collection" \
    --type "VECTORSEARCH" \
    --description "My vector collection with GPU acceleration" \
    --vector-options '{"ServerlessVectorAcceleration": "ENABLED"}' \
    --region us-east-1
```

------
#### [ Edit existing collection ]

下列 AWS CLI 範例會啟用現有 OpenSearch Serverless 集合的 GPU 加速。將*文字*取代為您自己的組態文字。

```
aws opensearchserverless update-collection \
    --id 07tjusf2h91cunochc \
    --vector-options '{"ServerlessVectorAcceleration": "ENABLED"}' \
    --region us-east-1
```

------