enable gpu support in AWS Sagemaker

Viewed 735

I am trying to enable GPU on Sagemaker notebook. Although I am using an ml.p2.xlarge instance, when I try this in my notebook:

import tensorflow as tf
tf.test.is_gpu_available(cuda_only=False, min_cuda_compute_capability=None)

the output is False. Without a GPU, my training process will be pretty slow. How exactly can I activate and use the GPU in my Sagemaker notebook?

1 Answers

I presume you are using an _amazonei_ kernel in the Notebook? try using a different kernel, for example conda_tensorflow*

Kernels that have amazonei in their name are not GPU compatible, they are for used with Amazon Elastic Inference Accelerator.

  • Note 1 the P2 uses an old-generation K80 GPU ; you can access something more recent (and cheaper) in SageMaker Studio: the G4 notebook (that has a T4 card)

  • Note 2 according to TF documentation, the function you use is deprecated. Once you are on a GPU-compatible kernel, TF recommends using tf.config.list_physical_devices('GPU')

Related