diff options
author | Sam Gross <sgross@fb.com> | 2016-12-22 00:55:55 +0300 |
---|---|---|
committer | Sam Gross <sgross@fb.com> | 2016-12-22 00:55:55 +0300 |
commit | 3b42b47a834f57a3e712ce69552e9b0bca4b476d (patch) | |
tree | b6f4ce0f73859bb9b944dc5e8621470c86c6bade /init.c | |
parent | e63d033cddff79d9a6c1d61ffe96586a73288ef1 (diff) |
Enable the CUDA caching allocators by default
A few of us have been using this extensively without problems. This
avoids synchronizations due to cudaFree calls which makes it much easier
to write performant CUDA code.
Diffstat (limited to 'init.c')
-rw-r--r-- | init.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1003,8 +1003,9 @@ int luaopen_libcutorch(lua_State *L) THCState* state = THCState_alloc(); + /* Enable the caching allocator unless THC_CACHING_ALLOCATOR=0 */ char* thc_caching_allocator = getenv("THC_CACHING_ALLOCATOR"); - if (thc_caching_allocator && strcmp(thc_caching_allocator, "1") == 0) { + if (!thc_caching_allocator || strcmp(thc_caching_allocator, "0") != 0) { THCState_setDeviceAllocator(state, THCCachingAllocator_get()); state->cudaHostAllocator = &THCCachingHostAllocator; } |