Afficher le nombre de cœurs de processeur visibles
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Linux
Windows
Ce document explique comment afficher le nombre de cœurs de processeur visibles pour une instance de machine virtuelle (VM).
Lorsque vous affichez les détails d'une VM, vous pouvez vérifier si la VM dispose du nombre par défaut de cœurs de processeur visibles ou si ce nombre a été personnalisé. La réduction du nombre de cœurs de processeur visibles pour une VM peut contribuer à réduire les coûts de licence sans réduire les limites de performances des disques persistants.
Toutefois, la réduction du nombre de cœurs de processeur visibles peut affecter les performances réseau.
Avant de commencer
Si ce n'est pas déjà fait, configurez l'authentification.
L'authentification valide votre identité pour accéder aux services et aux API Google Cloud . Pour exécuter du code ou des exemples depuis un environnement de développement local, vous pouvez vous authentifier auprès de Compute Engine en sélectionnant l'une des options suivantes :
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and
APIs, you don't need to set up authentication.
gcloud
Installez la Google Cloud CLI.
Une fois que la Google Cloud CLI est installée, initialisez-la en exécutant la commande suivante :
Pour utiliser les exemples API REST de cette page dans un environnement de développement local, vous devez utiliser les identifiants que vous fournissez à la gcloud CLI.
Installez la Google Cloud CLI.
Une fois que la Google Cloud CLI est installée, initialisez-la en exécutant la commande suivante :
La page des détails de la VM s'ouvre, et l'onglet Détails est sélectionné.
Dans la section Configuration de la machine, vérifiez la valeur de Cœurs visibles personnalisés. Si aucune valeur n'est affichée, la VM dispose du nombre par défaut de cœurs de processeur visibles.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eThis document provides instructions on how to check if a virtual machine (VM) has the default number of visible CPU cores or if it has been customized.\u003c/p\u003e\n"],["\u003cp\u003eReducing the number of visible CPU cores can help decrease licensing costs, but it might impact network performance and overall VM performance.\u003c/p\u003e\n"],["\u003cp\u003eYou can view the number of visible CPU cores through the Google Cloud console, by using the \u003ccode\u003egcloud compute instances describe\u003c/code\u003e command, or by making a \u003ccode\u003eGET\u003c/code\u003e request to the \u003ccode\u003einstances.get\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eIf the \u003ccode\u003evisibleCoreCount\u003c/code\u003e field is present in the output, the VM has a customized number of visible CPU cores; otherwise, it has the default number.\u003c/p\u003e\n"],["\u003cp\u003eTo view the details of the VM, the required permission is \u003ccode\u003ecompute.instances.get\u003c/code\u003e, granted by the \u003ccode\u003eCompute Instance Admin (v1)\u003c/code\u003e role.\u003c/p\u003e\n"]]],[],null,["# View the number of visible CPU cores\n\nLinux Windows\n\n*** ** * ** ***\n\nThis document describes how to view the number of visible CPU cores for a\nvirtual machine (VM) instance.\n\nWhen you\n[view the details of a VM](/compute/docs/instances/view-vm-details), you\ncan verify if the VM has the default number of visible CPU cores, or if this\nnumber has been customized. Reducing the number of visible CPU cores for a VM\ncan help reduce licensing costs without reducing Persistent Disk performance limits.\nHowever, reducing the number of visible CPU cores might affect network\nperformance.\n| **Note:** Reducing the number of visible CPU cores for a VM might impact the performance of the VM. For more information, see [Performance considerations](/compute/docs/instances/customize-visible-cores#performance_considerations).\n\nBefore you begin\n----------------\n\n- If you haven't already, set up [authentication](/compute/docs/authentication). Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:\n\n Select the tab for how you plan to use the samples on this page: \n\n ### Console\n\n\n When you use the Google Cloud console to access Google Cloud services and\n APIs, you don't need to set up authentication.\n\n ### gcloud\n\n 1.\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n After installation,\n [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command:\n\n ```bash\n gcloud init\n ```\n\n\n If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n | **Note:** If you installed the gcloud CLI previously, make sure you have the latest version by running `gcloud components update`.\n 2. [Set a default region and zone](/compute/docs/gcloud-compute#set_default_zone_and_region_in_your_local_client).\n\n ### REST\n\n\n To use the REST API samples on this page in a local development environment, you use the\n credentials you provide to the gcloud CLI.\n 1. [Install](/sdk/docs/install) the Google Cloud CLI. After installation, [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command: \n\n ```bash\n gcloud init\n ```\n 2. If you're using an external identity provider (IdP), you must first [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n\n For more information, see\n [Authenticate for using REST](/docs/authentication/rest)\n in the Google Cloud authentication documentation.\n\n### Required roles\n\n\nTo get the permission that\nyou need to view the details of a VM,\n\nask your administrator to grant you the\n\n\n[Compute Instance Admin (v1)](/iam/docs/roles-permissions/compute#compute.instanceAdmin.v1) (`roles/compute.instanceAdmin.v1`)\nIAM role on the VM or project.\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nThis predefined role contains the\n` compute.instances.get`\npermission,\nwhich is required to\nview the details of a VM.\n\n\nYou might also be able to get\nthis permission\nwith [custom roles](/iam/docs/creating-custom-roles) or\nother [predefined roles](/iam/docs/roles-overview#predefined).\n\nView the number of visible CPU cores for a VM\n---------------------------------------------\n\nTo determine if the number of visible CPU cores was customized for a VM, select\none of the following options: \n\n### Console\n\n1. In the Google Cloud console, go to the **VM instances** page.\n\n [Go to VM instances](https://console.cloud.google.com/compute/instances)\n2. In the **Name** column, click the name of\n the VM.\n\n The details page of the VM opens and the **Details** tab is selected.\n3. In the **Machine configuration** section, check the value for\n **Custom visible cores** . If there is no value displayed, then the VM\n has the\n [default number of visible CPU cores](/compute/docs/instances/customize-visible-cores).\n\n### gcloud\n\nTo view the details of the VM, use the\n[`gcloud compute instances describe` command](/sdk/gcloud/reference/compute/instances/describe). \n\n gcloud compute instances describe \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e \\\n --zone=\u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: the name of the VM.\n\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone where the VM is located.\n\nIf the number of visible CPU cores for the VM was customized, then\nthe output contains the `visibleCoreCount` field as follows: \n\n advancedMachineFeatures:\n visibleCoreCount: \u003cvar translate=\"no\"\u003eVISIBLE_CORE_COUNT\u003c/var\u003e\n ...\n\nIf the output doesn't contain the `visibleCoreCount` field, then\nthe VM has the\n[default number of visible CPU cores](/compute/docs/instances/customize-visible-cores).\n\n### REST\n\nTo view the details of the VM, make a `GET` request to the\n[`instances.get` method](/compute/docs/reference/rest/v1/instances/get). \n\n GET https://compute.googleapis.com/compute/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/zones/\u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e/instances/\u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of the project where the VM is\n located.\n\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone where the VM is located.\n\n- \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: the name of the VM.\n\nIf the number of visible CPU cores for the VM was customized, then\nthe output contains the `visibleCoreCount` field as follows: \n\n {\n ...\n \"advancedMachineFeatures\": {\n visibleCoreCount: \u003cvar translate=\"no\"\u003eVISIBLE_CORE_COUNT\u003c/var\u003e\n },\n ...\n }\n\nIf the output doesn't contain the `visibleCoreCount` field, then\nthe VM has the\n[default number of visible CPU cores](/compute/docs/instances/customize-visible-cores).\n\nWhat's next\n-----------\n\n- [Customize the number of visible cores](/compute/docs/instances/customize-visible-cores)\n- [Set the number of threads per core](/compute/docs/instances/set-threads-per-core)"]]