提交 5ec9a5ce authored 作者: f0k's avatar f0k

Removed gpu.release_gil config flag again, releasing GIL by default now

上级 45f4b7a9
...@@ -26,6 +26,21 @@ ...@@ -26,6 +26,21 @@
//if you want this to work. //if you want this to work.
#define PRECHECK_ERROR 0 #define PRECHECK_ERROR 0
//If true, we release the GIL around blocking GPU calls, to allow other Python
//threads to run in the meantime. For a single-threaded program, the overhead
//is neglectible (about 20ms for 1 million GIL release/reclaim cycles). Can
//still be overridden on compilation with -DRELEASE_GIL=0 in nvcc.flags.
#ifndef RELEASE_GIL
#define RELEASE_GIL 1
#endif
#if RELEASE_GIL
#define CNDA_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
#define CNDA_END_ALLOW_THREADS Py_END_ALLOW_THREADS
#else
#define CNDA_BEGIN_ALLOW_THREADS
#define CNDA_END_ALLOW_THREADS
#endif
///////////////////////// /////////////////////////
// Alloc and Free // Alloc and Free
///////////////////////// /////////////////////////
......
...@@ -68,14 +68,6 @@ typedef float real; ...@@ -68,14 +68,6 @@ typedef float real;
#define CNDA_THREAD_SYNC cudaThreadSynchronize(); #define CNDA_THREAD_SYNC cudaThreadSynchronize();
#endif #endif
// Define shortcuts to implement the config.gpu.release_gil flag
#ifdef RELEASE_GIL
#define CNDA_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
#define CNDA_END_ALLOW_THREADS Py_END_ALLOW_THREADS
#else
#define CNDA_BEGIN_ALLOW_THREADS
#define CNDA_END_ALLOW_THREADS
#endif
#ifndef SHARED_SIZE #ifndef SHARED_SIZE
#define SHARED_SIZE (16*1024) #define SHARED_SIZE (16*1024)
......
...@@ -30,12 +30,6 @@ AddConfigVar('nvcc.compiler_bindir', ...@@ -30,12 +30,6 @@ AddConfigVar('nvcc.compiler_bindir',
StrParam(""), StrParam(""),
in_c_key=False) in_c_key=False)
AddConfigVar('gpu.release_gil',
"If True, theano will release the GIL when waiting for "
"GPU operations, allowing other Python threads to run",
BoolParam(False),
in_c_key=True)
user_provided_cuda_root = True user_provided_cuda_root = True
...@@ -159,8 +153,6 @@ class NVCC_compiler(object): ...@@ -159,8 +153,6 @@ class NVCC_compiler(object):
flags = [flag for flag in config.nvcc.flags.split(' ') if flag] flags = [flag for flag in config.nvcc.flags.split(' ') if flag]
if config.nvcc.fastmath: if config.nvcc.fastmath:
flags.append('-use_fast_math') flags.append('-use_fast_math')
if config.gpu.release_gil:
flags.append('-DRELEASE_GIL')
cuda_ndarray_cuh_hash = hash_from_file( cuda_ndarray_cuh_hash = hash_from_file(
os.path.join(os.path.split(__file__)[0], 'cuda_ndarray.cuh')) os.path.join(os.path.split(__file__)[0], 'cuda_ndarray.cuh'))
flags.append('-DCUDA_NDARRAY_CUH=' + cuda_ndarray_cuh_hash) flags.append('-DCUDA_NDARRAY_CUH=' + cuda_ndarray_cuh_hash)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论