diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-02-15 10:18:38 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2019-02-15 10:56:20 +0300 |
commit | 9800837b987930e6152c2dc27cae5bd55873d306 (patch) | |
tree | 5a70a6bbf34c9141a6912675db86a166ab2ab420 /intern/cycles/util | |
parent | de0e456a6c7d6da065d275104bc2022b69874648 (diff) |
Cycles: Support multithreaded compilation of kernels
This patch implements a workaround to get the multithreaded compilation from D2231 working.
So far, it only works for Blender, not for Cycles Standalone. Also, I have only tested the Linux codepath in the helper function.
Depends on D2231.
Patch by lukasstockner97, jbakker, brecht
job | scene_name | compilation_time
----------+-----------------+------------------
Baseline | empty | 22.73
D2264 | empty | 13.94
Baseline | bmw | 56.44
D2264 | bmw | 41.32
Baseline | fishycat | 59.50
D2264 | fishycat | 45.19
Baseline | barbershop | 212.28
D2264 | barbershop | 169.81
Baseline | victor | 67.51
D2264 | victor | 53.60
Baseline | classroom | 51.46
D2264 | classroom | 39.02
Baseline | koro | 62.48
D2264 | koro | 49.03
Baseline | pavillion | 54.37
D2264 | pavillion | 38.82
Baseline | splash279 | 47.43
D2264 | splash279 | 37.94
Baseline | volume_emission | 145.22
D2264 | volume_emission | 121.10
This patch reduced compilation time as the split kernels and base
kernels are compiled in parallel. In cycles debug mode (256) you can set
unmark the opencl single program file, what reduces the compilation time
even further (bmw 17 seconds, barbershop 53 seconds).
Reviewers: brecht, dingto, sergey, juicyfruit, lukasstockner97
Reviewed By: brecht
Subscribers: Loner, jbakker, candreacchio, 3dLuver, LazyDodo, bliblubli
Differential Revision: https://developer.blender.org/D2264
Diffstat (limited to 'intern/cycles/util')
-rw-r--r-- | intern/cycles/util/util_system.cpp | 22 | ||||
-rw-r--r-- | intern/cycles/util/util_system.h | 4 |
2 files changed, 26 insertions, 0 deletions
diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp index fc6db1f6662..a79829a3dd9 100644 --- a/intern/cycles/util/util_system.cpp +++ b/intern/cycles/util/util_system.cpp @@ -22,6 +22,9 @@ #include <numaapi.h> +#include <OpenImageIO/sysutil.h> +OIIO_NAMESPACE_USING + #ifdef _WIN32 # if(!defined(FREE_WINDOWS)) # include <intrin.h> @@ -329,6 +332,25 @@ bool system_cpu_support_avx2() #endif +bool system_call_self(const vector<string>& args) +{ + /* Escape program and arguments in case they contain spaces. */ + string cmd = "\"" + Sysutil::this_program_path() + "\""; + + for(int i = 0; i < args.size(); i++) { + cmd += " \"" + args[i] + "\""; + } + + /* Quiet output. */ +#ifdef _WIN32 + cmd += " > nul"; +#else + cmd += " > /dev/null"; +#endif + + return (system(cmd.c_str()) == 0); +} + size_t system_physical_ram() { #ifdef _WIN32 diff --git a/intern/cycles/util/util_system.h b/intern/cycles/util/util_system.h index 1e7cf1d9f2a..2590b31a59d 100644 --- a/intern/cycles/util/util_system.h +++ b/intern/cycles/util/util_system.h @@ -18,6 +18,7 @@ #define __UTIL_SYSTEM_H__ #include "util/util_string.h" +#include "util/util_vector.h" CCL_NAMESPACE_BEGIN @@ -61,6 +62,9 @@ bool system_cpu_support_avx2(); size_t system_physical_ram(); +/* Start a new process of the current application with the given arguments. */ +bool system_call_self(const vector<string>& args); + CCL_NAMESPACE_END #endif /* __UTIL_SYSTEM_H__ */ |