odlgroup / odlcuda

C++ backend for ODL
GNU General Public License v3.0
5 stars 2 forks source link

installation with local odl #26

Closed mehrhardt closed 6 years ago

mehrhardt commented 6 years ago

I managed to install odlcuda with odl that comes from pip. However, that version is outdated so I would like to use odlcuda with the latest odl version. Following exactly the same installation steps as with the off-the-shelf odl version, my odl cannot find "cuda" as an implementation, e.g.

NotImplementedError: no corresponding data space available for space FunctionSpace(IntervalProd([-333.8016, -333.8016, 0. ], [ 333.8016 , 333.8016 , 257.96875]), out_dtype='float32') and implementation 'cuda'

This is all strange, because it does find my odl version within the installation and this odl version works perfectly fine without cuda. Also my system finds odlcuda as it shows up on auto-complete after import odl. Any ideas what might have gotten wrong here? What is the mechanism that tells odl that odlcuda is present?

kohr-h commented 6 years ago

Can you post the full traceback? I don't see where the error comes from.

mehrhardt commented 6 years ago

Not sure this is useful, but here it is:

Traceback (most recent call last):

File "", line 45, in A = nipet.hghlvl.mMR_odl.Operator_mMR(factors=factors, odlcuda=True)

File "/store/DAMTP/me404/repositories/git_NiftyPETx/nipet/hghlvl/mMR_odl.py", line 126, in init dtype=dtype_gpu)

File "/store/DAMTP/me404/repositories/git_myODL/odl/discr/lp_discr.py", line 1315, in uniform_discr **kwargs)

File "/store/DAMTP/me404/repositories/git_myODL/odl/discr/lp_discr.py", line 1226, in uniform_discr_fromintv **kwargs)

File "/store/DAMTP/me404/repositories/git_myODL/odl/discr/lp_discr.py", line 1143, in uniform_discr_fromspace dtype=dtype, **kwargs)

File "/store/DAMTP/me404/repositories/git_myODL/odl/discr/lp_discr.py", line 1004, in uniform_discr_frompartition ds_type = dspace_type(fspace, impl, dtype)

File "/store/DAMTP/me404/repositories/git_myODL/odl/discr/discretization.py", line 522, in dspace_type ''.format(space, impl))

NotImplementedError: no corresponding data space available for space FunctionSpace(IntervalProd([-333.8016, -333.8016, 0. ], [ 333.8016 , 333.8016 , 257.96875]), out_dtype='float32') and implementation 'cuda'

kohr-h commented 6 years ago

Sure it is: the error is raised here, and the reason is that fn_impl(impl) fails with impl='cuda'. This means that 'cuda' is not properly registered as an implementation.

Did you run pip install with odlcuda? I'm asking since that step does the entry point stuff that registers Fn implementations with ODL.

mehrhardt commented 6 years ago

Yes, I knew what the source of the error was but couldn't fix it myself.

I installed odlcuda as recommended by cmake ... and make ... pyinstall. This form of installation worked fine with odl installed via pip install odl but not with my pip install -e odlfolder installation.

You want me to try something else?

kohr-h commented 6 years ago

Probing for error sources:

I guess the way you install odlcuda is fine, it will run python setup.py install along the way IIRC.

mehrhardt commented 6 years ago
What's the output of odl.space.entry_points.fn_impl_names()?

odl.space.entry_points.fn_impl_names() Out[2]: ('numpy',)

Does import odlcuda work? Does fn_impl_names change after that?

import odlcuda Traceback (most recent call last):

File "", line 1, in import odlcuda

File "/home/me404/.conda/lib/python2.7/site-packages/odlcuda-0.5.0-py2.7.egg/odlcuda/init.py", line 23, in from . import odlcuda_

ImportError: cannot import name odlcuda_

At some point in the past, I could import odlcuda without the error. Not sure what is different now except the odl version.

kohr-h commented 6 years ago

From what I see there's no connection with odl in the error. You're not still in the odlcuda repo directory, are you?

mehrhardt commented 6 years ago

No, I am not. Any other ideas? @adler-j ?

adler-j commented 6 years ago

This is often some weird dependency error or something like that going on. Sadly it is very hard to debug remotely, but could you try running something like http://www.dependencywalker.com/ (or equivalent for your OS) and see if you can find if there are any missing dependencies?

adler-j commented 6 years ago

Also what OS is this run with?

adler-j commented 6 years ago

Also did you change from python 2 to python 3 (or the other way around)?

mehrhardt commented 6 years ago

This reminds me that there is another difference. This time I am doing everything with anaconda which I did not do before on this machine.

mehrhardt commented 6 years ago

I am on linux. Part of my problem is that I don't really now what to look for. How does (or should) odl find odlcuda?

adler-j commented 6 years ago

Well basically ODL does find odlcuda (the python package), but odlcuda cannot import odlcuda_ (the c++ package). I'm not quite sure why, but typically you have some dependency problem, e.g. you have two different versions of boost installed or boost is not added to your runtime path.

Apparently you can use ldd to find if you have any missing dependencies: https://askubuntu.com/questions/24270/dependency-walker-for-ubuntu

mehrhardt commented 6 years ago

I tried to remove both odl and odlcuda from my system and do a fresh install. Now I get a different error (see below). This is interesting as my base_ntuples.py contains only 'FnBase' and 'FnBaseVector' but not NtuplesBase. Both odl and odlcuda should be the most recent ones from github.

In [2]: import odlcuda

ImportError Traceback (most recent call last)

in () ----> 1 import odlcuda /home/me404/.local/lib/python2.7/site-packages/odlcuda-0.5.0-py2.7.egg/odlcuda/__init__.py in () 22 23 from . import odlcuda_ ---> 24 from . import cu_ntuples 25 from . import ufuncs 26 from . import util /home/me404/.local/lib/python2.7/site-packages/odlcuda-0.5.0-py2.7.egg/odlcuda/cu_ntuples.py in () 28 from odl.set.sets import RealNumbers, ComplexNumbers 29 from odl.set.space import LinearSpaceElement ---> 30 from odl.space.base_ntuples import ( 31 NtuplesBase, NtuplesBaseVector, FnBase, FnBaseVector) 32 from odl.space.weighting import ( ImportError: cannot import name NtuplesBase
adler-j commented 6 years ago

Now this is an actual bug, @kohr-h removed NtuplesBase recently, but apparently we have not updated odlcuda to this change. Could you fix this @kohr-h?

kohr-h commented 6 years ago

Just to give you a heads-up, I think I've done the necessary changes, but currently I'm failing to build the package. Will try harder.

mehrhardt commented 6 years ago

@kohr-h, that would be much appreciated!

kohr-h commented 6 years ago

Fixed, can you test the new master branch @mehrhardt?

mehrhardt commented 6 years ago

I will. The changes are only in odlcuda I assume?

mehrhardt commented 6 years ago

From what I can see so far, the error is fixed. I cannot fully test it at the moment because someone screw up my CUDA driver ...

mehrhardt commented 6 years ago

I can confirm that everything runs smoothly now!

kohr-h commented 6 years ago

That's what I want to hear 🎉