Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<from enoki import *> imports only few names #69

Closed
lvjiahui opened this issue Mar 28, 2020 · 4 comments
Closed

<from enoki import *> imports only few names #69

lvjiahui opened this issue Mar 28, 2020 · 4 comments

Comments

@lvjiahui
Copy link

lvjiahui commented Mar 28, 2020

After I following the enoki document GPU Arrays(https://enoki.readthedocs.io/en/master/gpu.html#)

cd <path-to-enoki>
mkdir build
cmake -DENOKI_CUDA=ON -DENOKI_AUTODIFF=ON -DENOKI_PYTHON=ON ..
make

In python:

>>> from enoki import *

I find only few names imported, without FloatC, cuda_set_log_level.

['CPUBuffer',
 '__builtins__',
 '__cached__',
 '__doc__',
 '__file__',
 '__loader__',
 '__name__',
 '__package__',
 '__path__',
 '__spec__',
 '__version__',
 'allclose',
 'arange',
 'core',
 'e',
 'empty',
 'full',
 'inf',
 'linspace',
 'nan',
 'pi',
 'zero']

Did i miss something? Or the code only for demonstration?
Thanks!

@lvjiahui
Copy link
Author

lvjiahui commented Mar 28, 2020

By the way, I can find
libenoki-cuda.so
libenoki-autodiff.so
but no
enoki.cpyhon-37m-x86_64-linux-gnu.so (platform-dependent filename)

@lvjiahui
Copy link
Author

lvjiahui commented Mar 28, 2020

After some experiment, I change the __init__.py to

@@ -1 +1,6 @@
-__import__("enoki.core")
+from . import core
+from . import cuda
+from . import cuda_autodiff
+from . import dynamic
+from . import scalar
+__import__("enoki.core")

It seems to do the job, although I am not sure it is the best way

@Speierers
Copy link
Member

Hi @lvjiahui,
Thanks for pointing this out. Indeed the documentation isn't up-to-date.

The Enoki's Python library is now divided into different submodules:

enoki.scalar
enoki.dynamic
enoki.cuda
enoki.cuda_autodiff

Each one of those have their version of Float32, Vector3f, ...
Therefore, to get a CUDAArray in Python you could do the following:

from enoki.cuda import Float32 as FloatC

I will update the documentation.

@lvjiahui
Copy link
Author

The document is of high quality and instructive,Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants