提交 080a11fe authored 作者: Frederic's avatar Frederic

Fix visiblity and windows problems in cnmem (tested only on Linux)

上级 f68df7f4
...@@ -190,10 +190,6 @@ if compile_cuda_ndarray and cuda_available: ...@@ -190,10 +190,6 @@ if compile_cuda_ndarray and cuda_available:
os.makedirs(tmpdir) os.makedirs(tmpdir)
compiler = nvcc_compiler.NVCC_compiler() compiler = nvcc_compiler.NVCC_compiler()
if sys.platform == 'darwin' and config.lib.cnmem:
raise Exception(
"Currently CNMeM isn't supported on Mac due to"
" problems with symbols on Mac.")
compiler.compile_str( compiler.compile_str(
'cuda_ndarray', 'cuda_ndarray',
code, code,
...@@ -201,7 +197,6 @@ if compile_cuda_ndarray and cuda_available: ...@@ -201,7 +197,6 @@ if compile_cuda_ndarray and cuda_available:
include_dirs=[cuda_path], include_dirs=[cuda_path],
libs=[config.cublas.lib], libs=[config.cublas.lib],
preargs=['-O3'] + compiler.compile_args(), preargs=['-O3'] + compiler.compile_args(),
hide_symbols=config.lib.cnmem,
) )
from cuda_ndarray.cuda_ndarray import * from cuda_ndarray.cuda_ndarray import *
except Exception as e: except Exception as e:
......
...@@ -41,8 +41,12 @@ ...@@ -41,8 +41,12 @@
#define CNMEM_API __declspec(dllimport) #define CNMEM_API __declspec(dllimport)
#endif #endif
#else #else
#ifdef CNMEM_DLLEXPORT
#define CNMEM_API __attribute__((visibility ("default")))
#else
#define CNMEM_API #define CNMEM_API
#endif #endif
#endif
#define CNMEM_VERSION 100 // It corresponds to 1.0.0 #define CNMEM_VERSION 100 // It corresponds to 1.0.0
...@@ -249,7 +253,7 @@ cnmemStatus_t CNMEM_API cnmemPrintMemoryState(FILE *file, cudaStream_t stream); ...@@ -249,7 +253,7 @@ cnmemStatus_t CNMEM_API cnmemPrintMemoryState(FILE *file, cudaStream_t stream);
/** /**
* \brief Converts a cnmemStatus_t value to a string. * \brief Converts a cnmemStatus_t value to a string.
*/ */
const char* cnmemGetErrorString(cnmemStatus_t status); const char* CNMEM_API cnmemGetErrorString(cnmemStatus_t status);
/* ********************************************************************************************* */ /* ********************************************************************************************* */
......
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
#include "cuda_ndarray.cuh" #include "cuda_ndarray.cuh"
#ifndef CNMEM_DLLEXPORT
#define CNMEM_DLLEXPORT
#endif
#include "cnmem.h" #include "cnmem.h"
#include "cnmem.cpp" #include "cnmem.cpp"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论