Creating a VM with a GPU

    This section provides guidelines for creating VMs with a GPU. For more information about VM configurations, see Graphics accelerators (GPUs).

    To create a VM:

    1. In the management console, select a folder to create a VM in.

    2. In the list of services, select Compute Cloud.

    3. Click Create VM.

    4. Under Basic parameters:

      • Enter a name and description for the VM.

        Note

        The VM name is used one time only when creating a VM, to generate the FQDN. If the FQDN is important to you, choose an appropriate name for the virtual machine at the creation stage. For more information about generating the FQDN, see Hostname and FQDN.

      • (optional) Select or create a service account. By using a service account, you can flexibly configure access rights for your resources.

      • Select the availability zone to host the VM in.

    5. Select one of the GPU-oriented images and OS version under Public images .

      For VMs with GPUs, special images of Windows (2016 Datacenter GPU, windows-2016-gvlk-gpu) and Ubuntu (16.04 lts GPU, ubuntu-1604-lts-gpu) are available with NVIDIA drivers installed. To use other images, install the necessary drivers on your own.

    6. (optional) Configure the boot disk under Disks:

      • Specify the necessary disk size.
      • Select the disk type. If you want to create an instance from an existing disk, go to Disks add a disk.
    7. Under Computing resources:

      • Choose the platform Intel Broadwell with NVIDIA Tesla v100.
      • Choose the configuration of the virtual machine.
        • Specify the required number of GPUs.
    8. Under Network settings:

      • Specify the subnet ID or select a cloud network from the list. If you don't have a network, click Create a new network to create one:
        • In the window that opens, enter a name for the new network and choose a subnet to connect the virtual machine to. Each network must have at least one subnet (if there's no subnet, create one). Then click Create.
      • In the Public IP field, choose a method for assigning an IP address:
        • Auto: Assign a random IP address from the Yandex.Cloud IP pool.
        • List: Select a public IP address from the list of previously reserved static addresses. For more information, see Making a dynamic public IP address static.
        • No address: Don't assign a public IP address.
      • (optional) Enable DDoS protection.
    9. Under Access, specify the data required to access the VM:

      • Enter the username in the Login field.

        Warning

        Don't use the username root or other names reserved by the operating system. To perform operations that require superuser permissions, use the command sudo.

      • In the SSH key field, paste the contents of the public key file.

    10. Click Create VM.

    The virtual machine appears in the list. When a VM is being created, it is assigned an IP address and hostname (FQDN).

    If you don't have the Yandex.Cloud command line interface yet, install it.

    The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

    1. View the description of the CLI command for creating a VM:

      $ yc compute instance create --help
      
    2. Prepare a pair of keys (public and private) for accessing the VM over SSH.

    3. Select a public image.

      To get a list of available images, run the following command:

      $ yc compute image list --folder-id standard-images
      +----------------------+----------------------------------+-----------------------+----------------------+--------+
      |          ID          |               NAME               |         FAMILY        |     PRODUCT IDS      | STATUS |
      +----------------------+----------------------------------+-----------------------+----------------------+--------+
      ...
      | fdv7ooobjfl3ts9gqp0q | windows-2016-gvlk-gpu-1548913814 | windows-2016-gvlk-gpu | dqnnc72gj2ist3ktjj1p | READY  |
      | fdv4f5kv5cvf3ohu4flt | ubuntu-1604-lts-gpu-1549457823   | ubuntu-1604-lts-gpu   | dqnnb6dc7640c5i968ro | READY  |
      ...
      +----------------------+----------------------------------+-----------------------+----------------------+--------+
      

      For VMs with GPUs, special images of Windows (2016 Datacenter GPU, windows-2016-gvlk-gpu) and Ubuntu (16.04 lts GPU, ubuntu-1604-lts-gpu) are available with NVIDIA drivers installed. To use other images, install the necessary drivers on your own.

    4. Create a VM in the default folder. Specify the following parameters:

      • Name of the instance.

        Note

        The VM name is used one time only when creating a VM, to generate the FQDN. If the FQDN is important to you, choose an appropriate name for the virtual machine at the creation stage. For more information about generating the FQDN, see Hostname and FQDN.

      • Availability zone.

      • ID of the platform, gpu-standard-v1 for Intel Broadwell with NVIDIA Tesla V100.

      • Number of vCPUs.

      • RAM.

      • Number of GPUs.

      • Image of the OS. ubuntu-1604-lts-gpu: Ubuntu 16.04.6 LTS with CUDA drivers.

      • Public IP. To create a VM without a public IP address, disable the nat-ip-version=ipv4 option.

      For example:

      $ yc compute instance create \
            --name gpu-instance \
            --zone ru-central1-a \
            --platform-id=gpu-standard-v1 \
            --cores=8 \
            --memory=96 \
            --gpus=1 \
            --network-interface subnet-name=default-ru-central1-a,nat-ip-version=ipv4 \
            --create-boot-disk image-folder-id=standard-images,image-family=ubuntu-1604-lts-gpu \
            --ssh-key ~/.ssh/id_rsa.pub
      

      This creates a VM named gpu-instance with a single GPU, 8 vCPUs, and 96 GB RAM:

      $ yc compute instance get --full gpu-instance
          ...
          name: gpu-instance
          zone_id: ru-central1-a
          platform_id: gpu-standard-v1
          resources:
            memory: "103079215104"
            cores: "8"
            core_fraction: "100"
            gpus: "1"
          status: RUNNING
          ...
      

    To create a VM, use the Create method for the Instance resource.

    When a VM is created, it is assigned an IP address and hostname (FQDN). This data can be used for SSH access.

    You can make a public IP address static. For more information, see Making a VM's public IP address static.

    See also