Cudf: [QST] Choose specific GPU to use with cuDF

Created on 20 Nov 2019  路  5Comments  路  Source: rapidsai/cudf

In a machine with multiple GPUs is it possible to select which GPU to use for cuDF? In this case is it possible to start separate processes using different GPUs? Thanks

question

Most helpful comment

There's nothing stopping you from using the CUDA APIs in Numba or CuPy to set the device and cuDF will happily use it, but we've historically ran into issues with this approach because of libraries using cudaSetDevice(0) to initialize, so we've guided users to use CUDA_VISIBLE_DEVICES.

I.E.

import cupy
import cudf

cupy.cuda.Device(1).use()
df = cudf.DataFrame({'a': [1, 2, 3]})

All 5 comments

@bpleao cuDF will always target GPU 0. You can use the CUDA_VISIBLE_DEVICES environment variable to change what GPU cuDF thinks is GPU 0. You can learn more here: https://devblogs.nvidia.com/cuda-pro-tip-control-gpu-visibility-cuda_visible_devices/

It works! Thank you!

This is a poor way to resolve in multi-GPU environment when want dynamic control. Need to be able to specify in environment where accessing multiple GPUs one GPU at a time. E.g. for xgboost one can set gpu_id in multi-GPU case, but cudf always would be on 0, so there is inconsistency.

There's nothing stopping you from using the CUDA APIs in Numba or CuPy to set the device and cuDF will happily use it, but we've historically ran into issues with this approach because of libraries using cudaSetDevice(0) to initialize, so we've guided users to use CUDA_VISIBLE_DEVICES.

I.E.

import cupy
import cudf

cupy.cuda.Device(1).use()
df = cudf.DataFrame({'a': [1, 2, 3]})

@kkraus14 Thanks for the quick response and resolution!

Was this page helpful?
0 / 5 - 0 ratings