Something similar to CUDA_VISIBLE_DEVICES

Hello there,

I hope everybody is doing great, is there a way to “hide” HPU devices similar to CUDA_VISIBLE_DEVICES?




Please refer to this doc.

Thanks a lot, I’ve tried it but it doesn’t seem to do the trick

import os

os.environ["HABANA_VISIBLE_DEVICES"] = "0,1"

print(hpu.device_count()) # prints 8

Thanks @Fra_Zuppi, will take a look and get back to you.

1 Like

Hey @Sayantan_S , any luck? :slight_smile:

Can you using -e HABANA_VISIBLE_DEVICES=6,7 --runtime=habana in your docker command and try hl-smi and see if you have 2 visible cards

This solution is for running the container, but how can we select the device within the container? In other words, how to select the device within the container?

Here is a reference

One can use HABANA_VISIBLE_DEVICES to create a docker that is limited to certain cards, and inside the docker one can use HABANA_VISIBLE_MODULES to select from cards available within that docker