Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to make JukeBox use more of my GPUs? #97

Open
ratsaby opened this issue May 31, 2020 · 1 comment
Open

Is it possible to make JukeBox use more of my GPUs? #97

ratsaby opened this issue May 31, 2020 · 1 comment

Comments

@ratsaby
Copy link

ratsaby commented May 31, 2020

I installed JukeBox and it is running straight from the Jupiter notebook.

I would like to know if it is possible to make the code use more than one GPU?

I am unfamiliar with PyTorch, but I could see in this regards, the following which seems to cause

JukeBox to run on a single GPU (whose ID is 0)

==================================
def setup_dist_from_mpi(
master_addr="127.0.0.1", backend="nccl", port=29500, n_attempts=5, verbose=False
):
if dist.is_available():
return _setup_dist_from_mpi(master_addr, backend, port, n_attempts, verbose)
else:
use_cuda = torch.cuda.is_available()
print(f'Using cuda {use_cuda}')

    mpi_rank = 0
    local_rank = 0

    device = torch.device("cuda", local_rank) if use_cuda else torch.device("cpu")
    torch.cuda.set_device(local_rank)

    return mpi_rank, local_rank, device

=====================================

Can you advise how can I make it use all my 4 GPUs ?

Thanks
J

@prafullasd
Copy link
Collaborator

prafullasd commented Jun 1, 2020

The usual way of running the sample.py script with multiple GPU's would be to launch with mpiexec -n {ngpus} python sample.py ...
(also make sure to change logdir here to {hps.name}_{dist.get_rank()}/level_{level} so the ranks dont overwrite each other)

For local jupyter notebooks, you can try running 4 separate notebooks, and for each notebook launch it with CUDA_VISIBLE_DEVICES={gpu_id} jupyter notebook so that it uses that specific GPU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants