Hi Ramana,

Sorry I had not posted the script that I am using earlier. 

Here it is:
*import theano        *
*        theano.test()*
*        import os*
*        import pygpu*
*        os.environ["DEVICE"] = "cuda0"*
*        print("Running pygpu tests")*
*        pygpu.test()*

So in this case I see the *ContextNotDefined* error. 

And if I run pygpu tests using - *DEVICE=cuda0 python -c "import 
pygpu;pygpu.test()"*, then it works fine. 

Any suggestion on what could be different between these two scenarios will 
be helpful. 

Regards
Deepali

On Wednesday, February 22, 2017 at 10:29:52 PM UTC+5:30, Ramana Subramanyam 
wrote:
>
> Hi, 
> This could probably because you didn't specify the device as a flag while 
> executing your script, and it could be CPU in your .theanorc file. Could 
> you change it to THEANO_FLAGS=device=cudaN theano.test() and try again ?
>
> Ramana
>
>
> I am using a script to which executes theano.test() and then it executes 
>> pygpu.test(). But I see the following error at the end:
>>
>> ======================================================================
>> ERROR: test_GpuArray (pygpu.tests.test_gpu_ndarray.TestPickle)
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>   File "/pathto/pygpu/tests/test_gpu_ndarray.py", line 744, in 
>> test_GpuArray
>>     pickle.dumps(pygpu.zeros((32,), context=ctx))
>>   File "/usr/lib/python2.7/pickle.py", line 1380, in dumps
>>     Pickler(file, protocol).dump(obj)
>>   File "/usr/lib/python2.7/pickle.py", line 224, in dump
>>     self.save(obj)
>>   File "/usr/lib/python2.7/pickle.py", line 292, in save
>>     rv = reduce(obj)
>>   File "/pathto/theano/gpuarray/type.py", line 811, in GpuArray_pickler
>>     ctx_name = _name_for_ctx(cnda.context)
>>   File "/pathto/gpuarray/type.py", line 105, in _name_for_ctx
>>     raise ContextNotDefined('context is not registered')
>> ContextNotDefined: context is not registered
>>
>> This error is not seen if pygpu.test() is executed by itself. Please 
>> advise.
>>
>

-- 

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

Reply via email to