[ Web Proxy ]
URL:
Viewing: https://cloud.google.com/compute/docs/enable-pmu-in-vms [Back]  [Original]

Enable the PMU in Compute Engine instances  |  Google Cloud Documentation Skip to main content
Google Cloud Documentation [Google Cloud Documentation]
Send feedback

Enable the PMU in Compute Engine instances Stay organized with collections Save and categorize content based on your preferences.

This document explains how to enable the performance monitoring unit (PMU) in A4X, C4A, C4, or M4 Compute Engine instances. After you enable the PMU, you can use it to optimize performance-sensitive workloads, such as high performance computing (HPC) or machine learning (ML), by identifying and addressing application bottlenecks.

To learn more about the requirements and limitations that you apply when you enable the PMU in a compute instance, see PMU overview.

Before you begin

Required roles

To get the permissions that you need to enable the PMU in a new or existing compute instance, ask your administrator to grant you the Compute Instance Admin (v1) (roles/compute.instanceAdmin.v1) IAM role on your project. For more information about granting roles, see Manage access to projects, folders, and organizations.

This predefined role contains the permissions required to enable the PMU in a new or existing compute instance. To see the exact permissions that are required, expand the Required permissions section:

Required permissions

The following permissions are required to enable the PMU in a new or existing compute instance:

You might also be able to get these permissions with custom roles or other predefined roles.

Enable the PMU in compute instances

To enable the PMU in one or more compute instances, use one of the following methods:

After you've enabled the PMU in one or more compute instances, you can install and use performance-monitoring software on the compute instances.

Enable the PMU in an existing compute instance

Before you enable the PMU in an existing compute instance, you must verify that the compute instance uses a supported machine series and CPU platform. To verify the machine series and CPU platform that your compute instance uses, view the details of the compute instance.

If your compute instance doesn't use a supported machine series, then replace the compute instance's machine type. You can do this either by migrating your workload to a new compute instance that uses a supported machine type, or by changing the machine type for supported configurations:

You don't have to stop the compute instance to enable the PMU. However, to make the change effective, you must restart the compute instance as described in this section.

To enable the PMU in an existing compute instance, select one of the following options:

gcloud

  1. Create an empty YAML file.

  2. To export the properties of a compute instance into the YAML file that you've just created, use the gcloud compute instances export command:

    gcloud compute instances export INSTANCE_NAME \
        --destination=YAML_FILE \
        --zone=ZONE
    

    Replace the following:

    • INSTANCE_NAME: the name for the compute instance.

    • YAML_FILE: the path to the YAML file that you created in the previous step.

    • ZONE: the zone where the compute instance exists.

  3. In the YAML configuration file, in the advancedMachineFeatures field, add the performanceMonitoringUnit field. If the advancedMachineFeatures field doesn't exist, then add it as well:

    advancedMachineFeatures:
      performanceMonitoringUnit: PMU_TYPE
    

    Replace PMU_TYPE with one of the following values:

    • Architectural PMU type: ARCHITECTURAL

    • Standard PMU type: STANDARD

    • Enhanced PMU type: ENHANCED

  4. To update the compute instance and restart it, use the gcloud compute instances update-from-file command with the --most-disruptive-allowed-action flag set to RESTART:

    gcloud compute instances update-from-file INSTANCE_NAME \
        --most-disruptive-allowed-action=RESTART \
        --source=YAML_FILE \
        --zone=ZONE
    

    Replace YAML_FILE with the path to the YAML file with the configuration data that you modified in the previous step.

REST

  1. To view the properties of an existing compute instance, make a GET request to the instances.get method:

    GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME
    

    Replace the following:

    • PROJECT_ID: the ID of the project where you created the compute instance.

    • ZONE: the zone where the compute instance exists.

    • INSTANCE_NAME: the name for the compute instance.

  2. To update the compute instance and restart it, make a PUT request to the instances.update method as follows:

    • In the request URL, include the mostDisruptiveAllowedAction query parameter set to RESTART.

    • For the request body, use the GET request output from the previous step. However, in the advancedMachineFeatures field, you must add the performanceMonitoringUnit field to enable the PMU. If the advancedMachineFeatures field doesn't exist in the request output, then add it as well:

    The PUT request is similar to the following:

    PUT https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME?mostDisruptiveAllowedAction=RESTART
    
    {
      "advancedMachineFeatures": {
        "performanceMonitoringUnit": "PMU_TYPE"
      },
      ...
    }
    

    Replace PMU_TYPE with one of the following values:

    • Architectural PMU type: ARCHITECTURAL

    • Standard PMU type: STANDARD

    • Enhanced PMU type: ENHANCED

For more information about updating the properties of a compute instance, see Update instance properties.

Enable the PMU while creating a compute instance

You can create a compute instance that has the PMU enabled only in a zone that contains a supported CPU platform. For a list of available CPUs by zone, see Available regions and zones.

To create a compute instance that has the PMU enabled, select one of the following options:

gcloud

To create a compute instance that has the PMU enabled, use the gcloud compute instances create command with the --performance-monitoring-unit flag:

gcloud compute instances create INSTANCE_NAME \
    --machine-type=MACHINE_TYPE \
    --performance-monitoring-unit=PMU_TYPE \
    --zone=ZONE

Replace the following:

REST

To create a compute instance that has the PMU enabled, make a POST request to the instances.insert method. In the request body, include the performanceMonitoringUnit field:

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances

{
  "name": "INSTANCE_NAME",
  "machineType": "zones/ZONE/machineTypes/MACHINE_TYPE",
  "disks": [
    {
      "boot": true,
      "initializeParams": {
        "sourceImage": "projects/IMAGE_PROJECT/global/images/IMAGE"
      }
    }
  ],
  "networkInterfaces": [
    {
      "network": "global/networks/default"
    }
  ],
  "advancedMachineFeatures": {
    "performanceMonitoringUnit": "PMU_TYPE"
  }
}

Replace the following:

For more information about creating a compute instance, see Create and start a Compute Engine instance.

Enable the PMU while creating compute instances in bulk

You can create compute instances in bulk that have the PMU enabled only in a zone that contains a supported CPU platform. For a list of available CPUs by zone, see Available regions and zones.

To create compute instances in bulk that have the PMU enabled, select one of the following options:

gcloud

To create compute instances in bulk that have the PMU enabled, use the gcloud compute instances bulk create command with the --performance-monitoring-unit flag.

For example, to create compute instances in bulk in a single zone and specify a name pattern, run the following command:

gcloud compute instances bulk create \
    --count=COUNT \
    --machine-type=MACHINE_TYPE \
    --name-pattern="NAME_PATTERN" \
    --performance-monitoring-unit=PMU_TYPE \
    --zone=ZONE

Replace the following:

REST

To create compute instances in bulk that have the PMU enabled, make a POST request to the instances.bulkInsert method. In the request body, include the performanceMonitoringUnit field.

For example, to create compute instances in bulk in a single zone and specify a name pattern, make a POST request as follows:

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/bulkInsert

{
  "count": COUNT,
  "namePattern": "NAME_PATTERN",
  "instanceProperties": {
    "machineType": "MACHINE_TYPE",
    "disks": [
      {
        "boot": true,
        "initializeParams": {
          "sourceImage": "projects/IMAGE_PROJECT/global/images/IMAGE"
        }
      }
    ],
    "networkInterfaces": [
      {
        "network": "global/networks/default"
      }
    ],
    "advancedMachineFeatures": {
      "performanceMonitoringUnit": "PMU_TYPE"
    }
  }
}

Replace the following:

For more information about creating compute instances in bulk, see Create VMs in bulk.

Enable the PMU while creating an instance template

If you want to create a regional instance template that specifies to enable the PMU, then ensure that at least one zone within the selected region contains a supported CPU platform. For a list of available CPUs by zone, see Available regions and zones.

After you create an instance template that specifies to enable the PMU, you can use the template to do the following:

To create an instance template that specifies to enable the PMU, select one of the following options:

gcloud

To create an instance template that specifies to enable the PMU, use the gcloud compute instance-templates create command with the --performance-monitoring-unit flag.

For example, use the following command to create a regional instance template. If you want to create a global instance template, then use the same command without the --instance-template-region flag.

gcloud compute instance-templates create INSTANCE_TEMPLATE_NAME \
    --instance-template-region=REGION \
    --machine-type=MACHINE_TYPE \
    --performance-monitoring-unit=PMU_TYPE

Replace the following:

REST

To create an instance template that specifies to enable the PMU, make a POST request to one of the following methods:

In the request body, include the performanceMonitoringUnit field.

For example, to create a regional instance template that specifies to enable the PMU, make a POST request as follows:

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/instanceTemplates

{
  "name": "INSTANCE_TEMPLATE_NAME",
  "properties": {
    "disks": [
      {
        "boot": true,
        "initializeParams": {
          "sourceImage": "projects/IMAGE_PROJECT/global/images/IMAGE"
        }
      }
    ],
    "machineType": "MACHINE_TYPE",
    "networkInterfaces": [
      {
        "network": "global/networks/default"
      }
    ],
    "advancedMachineFeatures": {
      "performanceMonitoringUnit": "PMU_TYPE"
    }
  }
}

Replace the following:

For more information about creating an instance template, see Create instance templates.

What's next

Send feedback

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-08-12 UTC.

Need to tell us more? [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-08-12 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page