Coder Social home page Coder Social logo

Build on Windows machine about redner HOT 17 CLOSED

tim37021 avatar tim37021 commented on May 22, 2024
Build on Windows machine

from redner.

Comments (17)

tim37021 avatar tim37021 commented on May 22, 2024 1

for M_PI is not defined:
#define _USE_MATH_DEFINES

And this line can't be compiled with MSVC. variadic macro here is non-standard. replace args VA_ARGS here to resolve error.

#define DISPATCH(use_gpu, f, args...) \

image

from redner.

mworchel avatar mworchel commented on May 22, 2024 1

Just FYI, I'm currently working on Windows compatibility. I added prebuild windows binaries to the dependencies, adapted the imports of embree and optix and implemented MSVC replacements for the GCC intrinsics. I was able to compile Redner using Visual Studio 2019 today and successfully interfaced with the renderer using the Python bindings.

from redner.

BachiLi avatar BachiLi commented on May 22, 2024

Thanks for the report!
I plan to handle windows build within a few months.
Testing CUDA support on windows might be tricky though due to me lacking machines.
Contribution is welcome any time ; )

from redner.

tim37021 avatar tim37021 commented on May 22, 2024

@BachiLi I am still working on it.
On my Windows machine with miniconda 3. After some modification to code and cmake script. I can successfully build a redner.dll now.
But fail to install redner into python 3.6 in conda environment.(pyredner is installed successfully)

from redner.

swordigo1995 avatar swordigo1995 commented on May 22, 2024

@tim37021 I also fail to import redner.dll into python3.6 in conda environment, in the same situation with yours. "ImportError: DLL load failed: The specified module could not be found." is reported by python.
Do you have any solution for this problem?

from redner.

BachiLi avatar BachiLi commented on May 22, 2024

I think it has to do with the fact that I did not link the Python libraries while building. This can cause problems on windows. For now you can try adding ${Python_LIBRARIES} in target_link_libraries() and see if it works. I'll take a look once I get a windows machine.

from redner.

tim37021 avatar tim37021 commented on May 22, 2024

@swordigo1995 other dependencies dlls(embree3.dll, tbb.dll, tbb_malloc.dll) are also missed when importing redner.

@BachiLi
how about including pybind11 in this repo as a submodule?
cmake script does not check pybind11 installation at all.
target_include_directores(redner pybind11/include)

btw, I've successfully built and tested on linux
conda python 3.7.1, CUDA 10 OptiX, Pytorch(CUDA 10)

from redner.

swordigo1995 avatar swordigo1995 commented on May 22, 2024

@tim37021 @BachiLi Thanks a lot for your advice!! 👍
I copied other dependencies to the same folder with redner.pyd when importing redner, and it works! But I got another error when it initializes redner.Scene class in the forward() func.
@tim37021 Do you have successfully test it on Windows? If not, I think it's time for me to setup a linux environment..

$ python tutorials/01_optimize_single_triangle.py
Traceback (most recent call last):
File "tutorials/01_optimize_single_triangle.py", line 97, in
img = render(0, *scene_args)
File "D:\Anaconda3\envs\redner\lib\site-packages\pyredner\render_pytorch.py", line 216, in forward
pyredner.get_use_gpu())
RuntimeError: Caught an unknown exception!

from redner.

tim37021 avatar tim37021 commented on May 22, 2024

@swordigo1995 I switched to linux quickly when I've failed on windows. On linux some modifications are still necessary to get it work. And you need to build pytorch on your own for using CUDA 10.

from redner.

ankur6ue avatar ankur6ue commented on May 22, 2024

Would be great to have a windows build working.. Not sure why windows always get the short shrift. Lots of ML practitioners still use windows, particularly those from a graphics background.

from redner.

BachiLi avatar BachiLi commented on May 22, 2024

Check out #11

from redner.

BachiLi avatar BachiLi commented on May 22, 2024

Just FYI, I'm currently working on Windows compatibility. I added prebuild windows binaries to the dependencies, adapted the imports of embree and optix and implemented MSVC replacements for the GCC intrinsics. I was able to compile Redner using Visual Studio 2019 today and successfully interfaced with the renderer using the Python bindings.

This is merged. GPU support still needs some work so not closing this issue yet. I also need to figure out a way to publish windows pip packages.

from redner.

mworchel avatar mworchel commented on May 22, 2024

This is merged. GPU support still needs some work so not closing this issue yet. I also need to figure out a way to publish windows pip packages.

Thanks for merging! I will look into GPU support the next weeks. At least in theory it shouldn't be too hard.

EDIT: Ok, the problem with using CUDA as language is that you cannot compile cpp files with NVCC that way. That's probably the issue you've run into.

EDIT 2: I was able to compile the GPU version on Windows and get it running. I figured, it would be easiest to modify the pybind scripts, so introducing a new function called pybind11_setup_module that does all the steps pybind11_add_module does, except for the add_library call. I don't like the idea of maintaining our own fork of pybind, so it's probably best to supply the code as extra CMake script.

from redner.

guanming001 avatar guanming001 commented on May 22, 2024

Thank you for the excellent work!

I am able to build and run the forward rendering examples on Windows successfully.
But it will be stuck at the backpropagation of the gradient step.

Are there any updates on how to run with GPU version on Windows?

from redner.

mworchel avatar mworchel commented on May 22, 2024

I am able to build and run the forward rendering examples on Windows successfully.

That's great news!

But it will be stuck at the backpropagation of the gradient step.

This is however not. Tbh, I didn't try the backprop samples under Windows yet but a functional backpropagation is also crucial for my use case. So I will probably also run into this issue soon, thanks for the warning.

Are there any updates on how to run with GPU version on Windows?

I managed to get the GPU version to compile under Windows and also built the python package. From what I've tested, deferred rendering works as expected but path tracing does not. Essentially something triggers a segmentation fault. I did dive deeper into the issue and traced it back to cudaDeviceSynchronize call failing in a thrust function. Unfortunately, this can be caused by any previous cuda call, so I wasn't yet able to pin down the exact location of the cause.

For now, I find a fully working CPU version more important, so I'll probably look into that first.

EDIT: You are right. Backpropagation does not work under Windows. Created an issue (#93).

from redner.

mworchel avatar mworchel commented on May 22, 2024

@guanming001 GPU support is now added for Windows builds. Unfortunately, path tracing currently does not work, but at least the albedo and deferred rendering operations (as well as backpropagation with these).

If you encounter weird linking issues (e.g. VS trying to link against optimized.lib), then try to patch pybind11 with these changes pybind/pybind11#2104. It's a bug on their side.

from redner.

BachiLi avatar BachiLi commented on May 22, 2024

Windows machines should be able to pip install redner-gpu and pip install redner from now on. TensorFlow is not supported yet due to some compilation issues (MSVC is not happy with the TensorFlow headers).

from redner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.