Excellent! That helped and I can now run the code (as well as my own ...).

Quick question: How would I convince theano to NOT use the GPU but rather 
stick to the CPU (that is, to not use cuda at all)? Or would I run into the 
same issue again then?

Many thanks for your help! Much appreciated.

Thomas

On Thursday, 23 February 2017 17:09:35 UTC-5, Ramana Subramanyam wrote:
>
> Hi, 
> I tried training your code and it works fine on my system. Try upgrading 
> to CUDA 8 and run the code. 
>
> Ramana
>
> On Thursday, February 23, 2017 at 11:08:23 PM UTC+1, Ramana Subramanyam 
> wrote:
>>
>>
>> Hi,
>>
>> I use theano on 10.12, Sierra as well. What version of nvcc do you use? 
>> XCode 7.3 supports only CUDA 8. You don't need to change versions of XCode 
>> or CLT. I use the same versions of these softwares as you. 
>>
>> Ramana
>>
>> Folks --
>>>
>>> I am stuck in version hell I suppose and need some help for running 
>>> theano on my Mac.
>>>
>>> Here is the config:
>>> Mac OS: 10.12.3 (16D32)
>>>
>>> python 2.7 (I use anaconda but I have tried the /usr-version that comes 
>>> with the OS as well -- same result)
>>>
>>> theano: Theano (0.9.0rc1)
>>> lasagne: Lasagne (0.2.dev1)
>>> numpy: numpy (1.12.0)
>>>
>>> Xcode: Version 7.3 (7D175)
>>> clang: 
>>> Apple LLVM version 7.3.0 (clang-703.0.29)
>>> Target: x86_64-apple-darwin16.4.0
>>> Thread model: posix
>>>
>>> Unfortunately, I cannot downgrade XCode (clang) because I need it for 
>>> other projects.
>>>
>>> So, here is what happens. I am working on LSTM models and have narrowed 
>>> my version problem down as follows: Using the code provided here: 
>>> http://colinraffel.com/talks/hammer2015recurrent.pdf (python file 
>>> attached) calls to theano.function (line 154 in the attached) result in the 
>>> following error message (excerpt):
>>>
>>> ======/ SNIP /============
>>> Problem occurred during compilation with the command line below:
>>> /usr/bin/clang++ -dynamiclib -g -O3 -fno-math-errno -Wno-unused-label 
>>> -Wno-unused-variable -Wno-write-strings -march=haswell 
>>> -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -undefined 
>>> dynamic_lookup 
>>> -I/Users/thomas/anaconda/lib/python2.7/site-packages/numpy/core/include 
>>> -I/Users/thomas/anaconda/include/python2.7 
>>> -I/Users/thomas/anaconda/lib/python2.7/site-packages/theano/gof 
>>> -L/Users/thomas/anaconda/lib -fvisibility=hidden -o 
>>> /Users/thomas/.theano/compiledir_Darwin-16.4.0-x86_64-i386-64bit-i386-2.7.13-64/tmp5GtYpU/39a151e745f8754653c9e8ca5ea9cf75.so
>>>  
>>> /Users/thomas/.theano/compiledir_Darwin-16.4.0-x86_64-i386-64bit-i386-2.7.13-64/tmp5GtYpU/mod.cpp
>>> /Users/thomas/.theano/compiledir_Darwin-16.4.0-x86_64-i386-64bit-i386-2.7.13-64/tmp5GtYpU/mod.cpp:894:21:
>>>  
>>> warning: comparison of array 'outputs' equal to a null pointer is always 
>>> false [-Wtautological-pointer-compare]
>>>                 if (outputs == NULL) {
>>>                     ^~~~~~~    ~~~~
>>> /Users/thomas/.theano/compiledir_Darwin-16.4.0-x86_64-i386-64bit-i386-2.7.13-64/tmp5GtYpU/mod.cpp:919:54:
>>>  
>>> error: arithmetic on a pointer to void
>>>                                     PyArray_DATA(V3) + data_offset,
>>>                                     ~~~~~~~~~~~~~~~~ ^
>>> 1 warning and 1 error generated.
>>>
>>> Traceback (most recent call last):
>>>   File "lstm_baseline.py", line 154, in <module>
>>>     train = theano.function([l_in.input_var, target_values, 
>>> l_mask.input_var], cost, updates=updates)
>>>   File 
>>> "/Users/thomas/anaconda/lib/python2.7/site-packages/theano/compile/function.py",
>>>  
>>> line 326, in function
>>>     output_keys=output_keys)
>>>   File 
>>> "/Users/thomas/anaconda/lib/python2.7/site-packages/theano/compile/pfunc.py",
>>>  
>>> line 486, in pfunc
>>>     output_keys=output_keys)
>>> ======/ SNAP /============
>>>
>>> later on in theoutput:
>>> ======/ SNIP /============
>>> Exception: ('The following error happened while compiling the node', 
>>> Split{4}(Assert{msg='Theano Assert failed!'}.0, TensorConstant{1}, 
>>> MakeVector{dtype='int64'}.0), '\n', "Compilation failed (return status=1): 
>>> /Users/thomas/.theano/compiledir_Darwin-16.4.0-x86_64-i386-64bit-i386-2.7.13-64/tmp5GtYpU/mod.cpp:894:21:
>>>  
>>> warning: comparison of array 'outputs' equal to a null pointer is always 
>>> false [-Wtautological-pointer-compare].                 if (outputs == 
>>> NULL) {.                     ^~~~~~~    ~~~~. 
>>> /Users/thomas/.theano/compiledir_Darwin-16.4.0-x86_64-i386-64bit-i386-2.7.13-64/tmp5GtYpU/mod.cpp:919:54:
>>>  
>>> error: arithmetic on a pointer to void.                                     
>>> PyArray_DATA(V3) + data_offset,.                                     
>>> ~~~~~~~~~~~~~~~~ ^. 1 warning and 1 error generated.. ", '[*1 -> 
>>> Split{4}(<TensorType(float64, matrix)>, TensorConstant{1}, 
>>> <TensorType(int64, vector)>), *1::1, *1::2, *1::3]')
>>> ======/ SNAP /============
>>>
>>>
>>> Now, I know that this code works because we have it up and running on 
>>> another Mac with the same configuration APART from the clang version, which 
>>> there is:
>>> Apple LLVM version 7.0.2 (clang-700.1.81)
>>> Target: x86_64-apple-darwin14.5.0
>>> Thread model: posix
>>>
>>> The code also runs fine on a recent Ubuntu box.
>>>
>>> ==> So, it looks like the newer clang version is to blame for being more 
>>> pedantic (?) with comparisons to NULL pointers (in the generated C code). 
>>> Now, this behaviour is a little tricky to debug (to say the least). I have 
>>> quadruple checked the Python code and it looks fine. The fact that it is 
>>> running on two other of out machines and that the original author of it 
>>> (Colin Raffel -- all kudos to him for the tutorial code) is using it in his 
>>> tutorial tells me that my suspicion is not entirely wrong.
>>>
>>> I tried installing an older version of the command line tools for XCode 
>>> (essentially the c-compiler) on my box to run it in parallel to the current 
>>> version (which I need for other projects) but that did not work out. 
>>> According to the apple developer forum I would need to install the complete 
>>> (!) version of an older XCode package, which is not really an option.
>>>
>>>
>>> So, does anyone have a clue / experience / advise on this?
>>>
>>> Many thanks!
>>> Thomas
>>>
>>

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to