View the number of visible CPU cores


To view the number of visible CPU cores, use the gcloud CLI or the Compute Engine API.

gcloud

  1. Get information about the VM by using the gcloud compute instances describe command.

    gcloud compute instances describe VM_NAME \
        --zone=ZONE
    

    Replace the following:

    • VM_NAME: the name of the VM

    • ZONE: the zone that contains the VM

  2. In the output, the value of the visible-core-count field is the number of visible CPU cores. If the visible-core-count field doesn't appear in the output, then the VM has the default number of visible CPU cores.

REST

  1. Get information about the VM by using the following instances.get method.

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

    Replace the following:

    • PROJECT_ID: the ID of the project

    • ZONE: the zone that contains the VM

    • VM_NAME: the name of the VM

  2. In the output, the value of the visibleCoreCount field is the number of visible CPU cores.

What's next