Multiple contexts on 1 GPU

21 views
Skip to first unread message

aaronbgr...@gmail.com

unread,
Dec 7, 2017, 3:00:19 PM12/7/17
to theano-dev
Hello,

If I am understanding the documentation correctly, adding:
     contexts=dev0->cuda0;dev1->cuda0;dev2->cuda0;dev3->cuda0

to ~/.theanorc should cause theano.gpuarray.type.listcontexts() to return:
     ['dev3', 'dev2', 'dev1', 'dev0', None]

, with the None element being optional, depending on whether device=cuda is also in .theanorc.

Is that correct?

(I am writing some multi-GPU software for a system with 4 GPUs. However, I am prototyping the software on my laptop, which only has 1 GPU. The 4-GPU system gets turned back on again as soon as some work to my apartment is finished.)

With contexts set as above, listcontexts() returns ['dev0', None] rather than the output above.

When I add
     if name not in list_contexts():
         reg_context(name, context)

at line 163 of theano/gpuarray/__init__.py (and import list_contexts at the top of the file), then I get the expected result of ['dev3', 'dev2', 'dev1', 'dev0', None] and my simulation runs fine, with results that match the results of my single-GPU simulation.

Looking at the code in __init__.py, I'm pretty sure that one would not run into this issue if there were one device per context, which is the normal way that one would want to use Theano.

Did I miss something here? If not, how do I go about getting this change incorporated into the next release?

Thanks for your help.

Best,
Aaron

Frédéric Bastien

unread,
Dec 7, 2017, 4:16:53 PM12/7/17
to thean...@googlegroups.com
The multi-GPU in 1 context was experimental. As we stop developing Theano, we won't put time to make it more usable.

You can make a PR to Theano, with your change. But i'm not sure if we will take such changes.

Best,
Frédéric

--

---
You received this message because you are subscribed to the Google Groups "theano-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aaron Greenblatt

unread,
Dec 7, 2017, 4:18:08 PM12/7/17
to thean...@googlegroups.com
All right - thank you.

Best,
Aaron

To unsubscribe from this group and stop receiving emails from it, send an email to theano-dev+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--

---
You received this message because you are subscribed to the Google Groups "theano-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-dev+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages