Unified executable (for CPU-only, OpenCL and CUDA)

Discussion related to the LuxCore functionality, implementations and API.
Post Reply
User avatar
Dade
Developer
Posts: 4218
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Unified executable (for CPU-only, OpenCL and CUDA)

Post by Dade » Thu May 21, 2020 3:27 pm

Introduction

The aim of this project is to have an unified executable capable to work on any platform supporting: CPU-only, OpenCL and CUDA. This task was triggered by the problem that you can not directly use CUDA in a Blender add-on on Linux (i.e. calling cuInit() crashes Blender) but, at the end it offers many advantages.

Advantages

There has many advantages:

- CUDA works with Blender and Linux;
- a single executable instead of 3 different one;
- you can compile the LuxCore sources without having to use OpenCL or CUDA SDK;
- it may be possible to extend the same approach to Optix in the future (avoiding to have 4 different executable !);

Testing

I have done the very first test of runtime loading of CUDA on the "cuda_ocl_wranglers" branch, @Acasta69 and @u3dreal can you check if CUDA still works on Windows and MacOS.
If does I can go on, I have to change a not trivial amount of stuff because having/not having CUDA and OpenCL will become a run-time condition, not more compilation time #ifdef.
My first test has solved the problem of running CUDA on Linux with Blender (i.e. no more crash).
Support LuxCoreRender project with salts and bounties

acasta69
Developer
Posts: 304
Joined: Tue Jan 09, 2018 3:45 pm

Re: Unified executable (for CPU-only, OpenCL and CUDA)

Post by acasta69 » Thu May 21, 2020 5:15 pm

Dade wrote:
Thu May 21, 2020 3:27 pm
- you can compile the LuxCore sources without having to use OpenCL or CUDA SDK;
Do you mean this should work even if compiled with OpenCL "disabled"?
There is a problem, though:
https://dev.azure.com/LuxCoreRender/Lux ... ew=results
These errors happen with no-ocl compilation after your fix for Apple texture mapping.
I don't really understand: shouldn't "cl" files be ignored in that case?

Compiling with Cuda "enabled" is working as usual.
Support LuxCoreRender project with salts and bounties

Windows 10 64 bits, i7-4770 3.4 GHz, RAM 16 GB, GTX 970 4GB v445.87

User avatar
Dade
Developer
Posts: 4218
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Unified executable (for CPU-only, OpenCL and CUDA)

Post by Dade » Thu May 21, 2020 5:52 pm

acasta69 wrote:
Thu May 21, 2020 5:15 pm
Dade wrote:
Thu May 21, 2020 3:27 pm
- you can compile the LuxCore sources without having to use OpenCL or CUDA SDK;
Do you mean this should work even if compiled with OpenCL "disabled"?
Not for the moment, for the first test, use OpenCL and CUDA enabled.
acasta69 wrote:
Thu May 21, 2020 5:15 pm
There is a problem, though:
https://dev.azure.com/LuxCoreRender/Lux ... ew=results
These errors happen with no-ocl compilation after your fix for Apple texture mapping.
I don't really understand: shouldn't "cl" files be ignored in that case?

Compiling with Cuda "enabled" is working as usual.
I will check.
Support LuxCoreRender project with salts and bounties

User avatar
u3dreal
Developer
Posts: 381
Joined: Tue Dec 03, 2019 3:23 pm
Location: Ulm
Contact:

Re: Unified executable (for CPU-only, OpenCL and CUDA)

Post by u3dreal » Thu May 21, 2020 6:00 pm

All works fine here .. There was even a driver update a week ago. :)
check out my newest stuff http://q3de.com/research/
portfolio http://q3de.com/


MB Pro i7 2.3Ghz, IrisPro 1.5GB, GTX750m 2GB - High Sierra
Xeon X5650@4Ghz, 2x GTX 770 Phantom - High Sierra, Windows 10, Ubuntu 18.04

acasta69
Developer
Posts: 304
Joined: Tue Jan 09, 2018 3:45 pm

Re: Unified executable (for CPU-only, OpenCL and CUDA)

Post by acasta69 » Thu May 21, 2020 6:53 pm

Dade wrote:
Thu May 21, 2020 5:52 pm
Not for the moment, for the first test, use OpenCL and CUDA enabled.
Everything's ok with this.
Support LuxCoreRender project with salts and bounties

Windows 10 64 bits, i7-4770 3.4 GHz, RAM 16 GB, GTX 970 4GB v445.87

User avatar
Dade
Developer
Posts: 4218
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Unified executable (for CPU-only, OpenCL and CUDA)

Post by Dade » Thu May 21, 2020 8:30 pm

Ok, I will continue and extend the dynamic loading of libraries to OpenCL.
Support LuxCoreRender project with salts and bounties

Post Reply