Specify a minimum CPU platform for compute instances (original) (raw)

Linux Windows

For machine types that can run on different CPU platforms, this page explains how to create or update a Compute Engine instance to use a specified CPU compatibility level instead of the default one.

Google data centers offer different generations of CPU processors. These processors support incremental features likeAdvanced Vector Extensions— for example, AVX2 and AVX-512. Also, some fundamental features like clock speed, NUMA splits, and memory access seek time can vary among the CPU processors. The term CPU platform refers to this CPU-based configuration.

Each machine series works with one or more CPU processors. For example, C4 instances can run on either Intel Emerald Rapids or Granite Rapids CPUs. If a machine series supports multiple CPUs, you can choose a _minimum CPU platform_when you create an instance. The value you can set for the minimum CPU depends on the machine type, and the region and zone you choose for your compute instances.

Choosing a specific CPU is useful if your workload is sensitive to CPU-specific features, like instruction sets (AVX2 instead of AVX-512), cache sizes, or clock speeds which can vary between CPU platforms.

However using the minimum CPU setting can limit which zones your compute instances can run in.

Before you begin

Required roles and permissions

To get the permissions that you need to change the minimum CPU platform, ask your administrator to grant you the following IAM roles on the project:

For more information about granting roles, see Manage access to projects, folders, and organizations.

You might also be able to get the required permissions through custom roles or other predefined roles.

When to select a minimum CPU platform

Each Compute Engine zone has a default CPU for each machine series. If you don't specify a value for the minimum CPU for your instance, then your compute instance uses the default CPU assigned to the machine type and zone.

Google recommends choosing a CPU platform compatibility level only in these cases:

Using the default CPU platform

If you don't specify a minimum CPU for your instance, then the minimum CPU is set to AUTOMATIC. This means that the instance uses the default CPU platform for the machine type.

On rare occasions, Google updates a CPU platform for a machine type and zone.

How selecting a minimum CPU platform works

When you specify a value for the minimum CPU, Compute Engine provides that CPU platform for your instance to use. Your compute instance continues to use that CPU platform unless you change it.

Your compute instance uses the specified CPU platform even after live migration during a maintenance operation.

Limitations

Availability of CPU platforms

The availability of CPU platforms varies across zones and is based on the hardware and machine series that is available in each zone. The following list shows the supported minimum CPU platforms and the valid syntax for each platform:

View available CPUs by zone

Some regions and zones support multiple CPU platforms for the same machine series. You can check which CPUs are available in a zone using gcloud CLI or REST.

If you're using sole-tenant nodes, each node uses the CPU platform corresponding to the node type that you defined in the node template.

gcloud

REST

Changes to default CPU platforms

On rare occasions, Google updates the default CPU platform for a machine series in a zone. When this happens, Google notifies you with a timeline and instructions for moving to the new platform.

If you specified a minimum CPU platform for your compute instance, the change to the default CPU platform has no impact on your instance. Compute Engine never provides a CPU platform that is older than the one specified by the minimum CPU property for an instance. However, if you don't specify a value for the minimum CPU, then the instance can run on a newer CPU platform if the default CPU platform is not available in the zone where the instance is located.

If Compute Engine moves your compute instance to a newer CPU platform, the cost of your compute instance doesn't change.

If the default CPU platform changes for a machine series, you can either:

Choose a CPU platform for a new instance

When you create a compute instance, if the machine series supports more than one CPU platform, then you can use the minimum CPU property to specify theCPU platform that you want the instance to use.

Console

  1. In the Google Cloud console, go to the Create an instance page.
    Go to Create an instance
  2. In the Machine configuration section, expand theAdvanced configurations section.
  3. In the CPU Platform list, select a platform for the instances's CPU.
  4. Continue with the rest of the instance creation process.

gcloud

REST

Change the CPU for an existing instance

To change the CPU for an existing compute instance, you must firststop the instance.

Console

  1. Go to the VM instances page.
    Go to VM instances
  2. If prompted, select your project and click Continue.
  3. Select the compute instance that you want to change.
  4. Click Stopto stop the compute instance. If there is no Stop option, clickMore actions > Stop.
  5. Click Edit.
  6. In the Machine configuration section, clickAdvanced configurations.
  7. From the CPU Platform drop-down menu, select an option.
  8. Save your changes.
  9. Select the compute instance that you changed.
  10. Click Start/Resume.

gcloud

  1. To stop a compute instance, use thegcloud compute instances stop command:
    gcloud compute instances stop INSTANCE_NAME
    --zone=ZONE
    Replace the following:
    • INSTANCE_NAME: the name of the compute instance that you want to specify a minimum CPU platform for
    • ZONE: the name of the zone where you created your compute instance—for example, europe-west1-b
  2. To specify a minimum CPU platform, use thegcloud compute instances update command, and provide the --min-cpu-platform flag:
    gcloud compute instances update INSTANCE_NAME \
    --zone=ZONE \
    --min-cpu-platform="PLATFORM"
    Replace the following:
    • INSTANCE_NAME: the name of the compute instance to update
    • ZONE: the name of the zone where you created your compute instance
    • PLATFORM: the friendly name of the CPU platform that you want the compute instance to use—for example, Intel Granite Rapids.
  3. To start the updated compute instance, use thegcloud compute instances start command:
    gcloud compute instances start INSTANCE_NAME
    --zone=ZONE

REST

  1. To stop a compute instance, construct a POST request using theinstances.stop method:
    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/stop
    Replace the following:
    • PROJECT_ID: the ID of the project
    • ZONE: the zone where your compute instance is located
    • INSTANCE_NAME: the name of the compute instance that you want to specify a minimum CPU platform for
  2. To set the minimum CPU platform, construct a POST request to thesetMinCpuPlatform methodand set the minCpuPlatform property in the request body:
    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/setMinCpuPlatform
    {
    "minCpuPlatform": "PLATFORM"
    }
    Replace PLATFORM with the friendly name of the minimum CPU platform that you want the compute instance to use—for example, Intel Skylake.
  3. To restart the compute instance, construct a POST request using theinstances.start method:
    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/start

Reset to the default CPU

To go back to using the default CPU, you must stop the compute instance if it's running.

Console

  1. Go to the VM instances page.
    Go to VM instances
  2. If prompted, select your project and click Continue.
  3. Select the instance that you want to change.
  4. Click Stop.
  5. To edit the instance, click Edit.
  6. In the Machine configuration section, clickAdvanced configurations.
  7. Change the CPU Platform option to Automatic.
  8. Select the instance that you changed.
  9. Click Start/Resume.

gcloud

  1. To stop a compute instance, use thegcloud compute instances stop command:
    gcloud compute instances stop INSTANCE_NAME
    Replace INSTANCE_NAME with the name of the compute instance that you want to change.
  2. To reset the minimum CPU platform, use thegcloud compute instances update commandand set the --min-cpu-platform flag to AUTOMATIC:
    gcloud compute instances update INSTANCE_NAME \
    --min-cpu-platform="AUTOMATIC"
  3. To start the updated compute instance, use thegcloud compute instances start command:
    gcloud compute instances start INSTANCE_NAME

REST

  1. To stop a compute instance, construct a POST request using theinstances.stop method:
    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/stop
    Replace the following:
    • PROJECT_ID: the ID of the project
    • ZONE: the zone where your compute instance is located
    • INSTANCE_NAME: the name of the compute instance that you want to change
  2. To reset the minimum CPU platform, construct a POST request to the setMinCpuPlatformmethod. In the request body, set the minCpuPlatform property value to AUTOMATIC.
    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/setMinCpuPlatform
    {
    "minCpuPlatform": "AUTOMATIC"
    }
  3. To restart the updated instance, construct a POST request using theinstances.start method:
    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/start

Use a CPU platform compatibility level in instance templates

If you usemanaged instance groups, you can set a CPU platform compatibility level for all compute instances in the group.

To do this, create aninstance templateand set the minCpuPlatform property.

Console

  1. Go to the Instance templates page.
    Go to Instance templates
  2. If prompted, select your project and click Continue.
  3. Click Create instance template.
  4. In the Machine configuration section, clickAdvanced configurations.
  5. From the CPU Platform drop-down menu, select an option.
  6. Continue with the instance template creation process.

gcloud

REST

What's next