LuxCoreRender / LuxCore

LuxCore source repository
Apache License 2.0
1.15k stars 144 forks source link

Is there a way to make Embree dependency optional? #351

Closed Randrianasulu closed 4 years ago

Randrianasulu commented 4 years ago

Because right now it fails to build on non-x86 machine (e2k), and thus blocking LuxRender from even attempting at build.

Dade916 commented 4 years ago

There isn't a #define to disable Embree but it should be possible with a bit of hand work and patience:

1) compile with disabled OpenCL support (or do you need it ?).

2) you need to remove the following files from the project: https://github.com/LuxCoreRender/LuxCore/blob/master/include/luxrays/accelerators/embreeaccel.h and https://github.com/LuxCoreRender/LuxCore/blob/master/src/luxrays/accelerators/embreeaccel.cpp

3) try to compile and comment out any reference to the class defined in the above files.

LuxCore (for CPU) supports multiple types of accelerators so it can work without the one based on Embree. If you have doubt just ask here.

P.S. the E2k Russian CPU ?

Randrianasulu commented 4 years ago
  1. For benchmarking CPU itself OpenCL most likely not needed, but for anything serious (some of those machines can have relatively modern Radeon GPU) I think OpenCL will be useful.
  2. Ok, will try that (may be just if 0 whole files and see what broke)
  3. Yes, this is russian CPU, but I only have remote access to it. Will update this entry after re-attempting build with newest git. (I tried LuxRender 1.4 - from times before embree integration - it NEARLY compiles, up to bin/benchsimple executable, but smallluxgpu fails with some problems related to new OIIO [1], I think, and just naively removing this component from build result in linking errors ...but this is mostly historical code atm...)

[1] - this error looked similar for me https://developer.blender.org/T61489

Randrianasulu commented 4 years ago

I tried to remove all those cmake fatalities (apparently a lot of dependencies like tbb and such only needed for slg, and SLG itself is more like demo/prototyping tool?), and while some components compiled (on x86, still with embree3 installed in /usr/local) samples failed.

hack:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 020381006..5fddaa913 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -114,23 +114,23 @@ if (NOT OPENGL_FOUND AND LUXRAYS_ENABLE_OPENCL)
 endif()

 if ((NOT CUDA_FOUND AND LUXRAYS_ENABLE_CUDA) OR (LUXRAYS_ENABLE_CUDA AND NOT LUXRAYS_ENABLE_OPENCL))
-       MESSAGE(FATAL_ERROR "--> CUDA support requires to enable OpenCL support too")
+#      MESSAGE(FATAL_ERROR "--> CUDA support requires to enable OpenCL support too")
 endif()

 if (NOT EMBREE_FOUND)
-       MESSAGE(FATAL_ERROR "--> Could not locate required Intel Embree files - Please check ${EMBREE_SEARCH_PATH}")
+#      MESSAGE(FATAL_ERROR "--> Could not locate required Intel Embree files - Please check ${EMBREE_SEARCH_PATH}")
 endif()

 if (NOT OIDN_FOUND)
-       MESSAGE(FATAL_ERROR "--> Could not locate required Intel Oidn files - Please check ${OIDN_SEARCH_PATH}")
+#      MESSAGE(FATAL_ERROR "--> Could not locate required Intel Oidn files - Please check ${OIDN_SEARCH_PATH}")
 endif()

 if (NOT TBB_FOUND)
-       MESSAGE(FATAL_ERROR "--> Could not locate required Intel TBB files - Please check ${TBB_SEARCH_PATH}")
+#      MESSAGE(FATAL_ERROR "--> Could not locate required Intel TBB files - Please check ${TBB_SEARCH_PATH}")
 endif()

 if (NOT BLOSC_FOUND)
-       MESSAGE(FATAL_ERROR "--> Could not locate required C-BLOSC files - Please check ${BLOSC_SEARCH_PATH}")
+#      MESSAGE(FATAL_ERROR "--> Could not locate required C-BLOSC files - Please check ${BLOSC_SEARCH_PATH}")
 endif()

 ################################################################################
@@ -168,7 +168,7 @@ include_directories(${GENERATED_INCLUDE_DIR})

 add_subdirectory(src/luxrays)
-add_subdirectory(src/slg)
+#add_subdirectory(src/slg)
 add_subdirectory(src/luxcore)
 add_subdirectory(src/pyluxcoretools)

--

After all this hacking I have (again, on x86 machine): ls build/lib/ libbcd.a libglfw3.a libluxcore.a libluxrays.a libopensubdiv.a libslg-film.a libslg-kernels.a pyluxcoretools.zip

but no .so files yet

I assumed if I fail to build current LuxCore git (commit 4df092c49991bad0b2cc2db61a319b79d6ef2c6) on x86 - making it compile/work at e2k will be much harder task ..so, half-way to there at stage 1.

Randrianasulu commented 4 years ago

hm, so after a lot of fighting with build system I created executables on x86 machine (after installing c-blosc from git and libtbb 2020). This diff was used ...

see attached txt file because autoformat makes mess out of diff

But also I added a lot of those "-lblosc -lpython3.7m -latomic" to individual link.txt files

/dev/shm/LuxCore/build$ mcedit samples/luxcoreconsole/CMakeFiles/luxcoreconsole.dir/link.txt for example.

Is there way to disable this markdown formatting ? :/ odin_disable.txt

Dade916 commented 4 years ago

SLG lib is the implementation of LuxCore API so it is the true core of the library. This is the list of layers and compilation order:

1) LuxRays library 2) SLG (the 3 slg-* libraries) 3) LuxCore 4) Samples like luxcoreui, luxcoreconsole, etc.

Everything is statically linked by default so the end end result is executables and .a libraries.

TBB is used only by Embree and OIDN so you don't need it. BLOSC is required for volume rendering and OpenVDB (it can be removed with an operation similar to Embree, it is required only to read OpenVDB files).

Is there way to disable this markdown formatting ? :/

What do you mean ? What markdown ?

Theverat commented 4 years ago

Is there way to disable this markdown formatting?

Use three backticks (```) above and below your code blocks.

Randrianasulu commented 4 years ago

oidn_disable_python_3.7_hack.txt

currently using this hack for disabling OIDN (I use 32-bit Slackware as my main machine). I hope embree disabling can be done around same lines ...

Dade916 commented 4 years ago

I assume we can close this one.