NavigationContentFooter
Jump toSuggest an edit

GPU Instances - Quickstart

Reviewed on 26 February 2024Published on 25 March 2022

Before you start

To complete the actions presented below, you must have:

Scaleway GPU Instances are virtual compute instances equipped with dedicated high-end Nvidia graphical processing unit (GPUs). They are ideal for data processing, artificial intelligence, rendering and video encoding. After you have created your GPU Instance, you can connect to it via SSH and run one of our ready-made Docker images to access a preinstalled environment with all your favorite AI libraries and tools preinstalled. In addition to this, GPU Instances have all the features of our regular Instances, including flexible IPs, security groups, Private Networks, backups and more. When you are done using your GPU Instance, you can easily delete it from the Scaleway console.

How to create a GPU Instance

  1. Navigate to Instances under the Compute section in the side menu of the Scaleway console. This action will direct you to the Instance dashboard.
  2. Click *+ Create Instance to proceed to the Instance creation page.
  3. Follow these steps to configure your GPU Instance:
    • Availability Zone: Choose the geographical region, represented by the Availability Zone, where your Instance will be deployed.
    • Instance Type (GPU): Select the desired GPU Instance type, considering factors such as processing power, memory, storage options, and bandwidth. Refer to our guide on choosing the right GPU Instance type for more information.
    • Image: Pick an operating system image suitable for your GPU Instance. For example, select Ubuntu Jammy GPU OS 12, which comes with preinstalled Nvidia drivers and an Nvidia Docker environment. You have the flexibility to customize your working environment using Docker with our provided Docker images or your own containers.
    • Volumes: Optionally, add storage volumes for your Instance. You can adjust settings such as block and local storage volumes according to your requirements.
      Note
      • The recommended minimum volume size for GPU OS images is 125 GB.
      • If your GPU Instance supports scratch storage, the scratch volume displays but can not be edited. Learn more about scratch storage.
    • Network Configuration: Choose between a routed public IP or a NAT public IP for your Instance. We recommend using a routed public IP. You can allocate IPv4 and IPv6 addresses as needed, with a maximum of 5 IPs per Instance.
    • Instance Name and Tags: Assign a name to your Instance for easy identification. You can also add tags to organize your Instances efficiently.
    • Advanced Options: Configure cloud-init settings if required, or leave them at default values.
    • SSH Keys: Verify the SSH keys that will grant you access to your Instance.
    • Estimated Cost: Review the estimated cost of your GPU Instance based on the selected specifications.
  4. Once you have completed the configuration, click on Create Instance to initiate the creation process. You will receive a notification once the GPU Instance is ready for use.

How to connect to your GPU Instance

See our documentation on how to connect to your Instance via SSH.

How to launch a Docker container

To access a preinstalled working environment with all your favorite Python packages, you need to launch a Docker container.

Tip

If you created your GPU Instance with one of the legacy Ubuntu Bionic ML OS images, once you connect to your Instance you are already in a preinstalled ready-to-use Python environment, managed with conda. You do not need to follow the steps for launching a Docker container.

  1. Choose one of our Docker AI images (eg Tensorflox, Pytorch, Jax) based on your needs.
  2. Run the following command to launch the Docker container. In the following example, we launch a container based on the Tensorflow image:
    docker run --runtime=nvidia -it --rm -p 8888:8888 -p 6006:6006 rg.fr-par.scw.cloud/scw-ai/tensorflow:latest /bin/bash

How to use the preinstalled environment

When you run your Docker container as shown above, the container launches, and you are taken to its ai directory, where the Pipenv virtual environment is already activated.

Tip

Use the command pipenv graph to see a list of all installed packages and their versions, as well as all the dependencies of each package. For more help with pipenv, see our dedicated documentation.

Launching an application in your local browser

Some applications, such as Jupyter Lab, Tensorboard and Code Server, require a browser to run. You can launch these from the ai virtual environment of your Docker container, and view them in the browser of your local machine. This is thanks to the possibility to add port mapping arguments when launching a container with the docker run command. In our example, we added the port mapping arguments -p 8888:8888 -p 6006:6006 when we launched our container, mapping 8888:8888 for Jupyter Lab and 6006:6006 for Tensorboard.

Tip

Code Server runs in Jupyter Lab via Jupyter Hub, so does not need port mapping in this case. You can add other port mapping arguments for other applications as you wish.

  1. Launch an application. Here, we launch Jupyter Lab:

    jupyter-lab

    Within the output, you should see something similar to the following:

    [I 2022-04-06 11:38:40.554 ServerApp] Serving notebooks from local directory: /home/jovyan/ai
    [I 2022-04-06 11:38:40.554 ServerApp] Jupyter Server 1.15.6 is running at:
    [I 2022-04-06 11:38:40.554 ServerApp] http://7d783f7cf615:8888/lab?token=e0c21db2665ac58c3cf124abf43927a9d27a811449cb356b
    [I 2022-04-06 11:38:40.555 ServerApp] or http://127.0.0.1:8888/lab?token=e0c21db2665ac58c3cf124abf43927a9d27a811449cb356b
    [I 2022-04-06 11:38:40.555 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
    Tip

    Jupyter Lab is launched automatically when you run any Scaleway container image. You will see a message upon start up telling how to access the notebook in your browser. To override Jupyter Lab being launched automatically in this way, add /bin/bash to the end of your docker run command, e.g. docker run --runtime=nvidia -it --rm -p 8888:8888 -p 6006:6006 rg.fr-par.scw.cloud/scw-ai/pytorch:latest /bin/bash. This preempts the launch of Jupyter Lab at container startup, and replaces it with the specified command, in this case a bash shell.

  2. On your local computer, open a browser window and enter the following URL. Replace <ip-address> with the IP address of your Scaleway GPU Instance, and <my-token> with the token shown displayed in the last lines of terminal output after the jupyter-lab command

    <ip-address>:8888/lab?token=<my-token>
    Tip

    You can find the IP address of your Instance in the Scaleway console. In the side menu, click Instances to see a list of your Instances. The IP address of each of them is shown in the list that displays.

    Jupyter Lab now displays in your browser. You can use the Notebook, Console, or other features as required:

    You can display the GPU Dashboard in Jupyter Lab to view information about CPU and GPU resource usage. This is accessed via the System Dashboards icon on the left side menu (third icon from the top).

  3. Use CTRL+C in the terminal window of your GPU Instance / Docker container to close down the Jupyter server when you have finished.

Exiting the preinstalled environment and the Docker container

When you are in the activated Pipenv virtual environment, your command line prompt will normally be prefixed by the name of the environment. Here, for example, from (ai) jovyan@d73f1fa6bf4d:~/ai we see that we are in the activated ai environment, and from jovyan@d73f1fa6bf4d:~/ai that we are in the ~/ai directory of our container:

  1. Type exit the following command to leave the preinstalled ai environment.

    You are now outside the preinstalled virtual environment.

  2. Type exit again to exit the Docker container.

    Your prompt should now look similar to the following. You are still connected to your GPU Instance, but you have left the Docker container:

    root@scw-name-of-instance:~#
  3. Type exit once more to disconnect from your GPU Instance.

Docs APIScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCarreer
© 2023-2024 – Scaleway