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