SINGA-172 - Add CMake supporting for Cuda and Cudnn libs Add definition of CUDNN_MAJOR_VERSION
Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/e3da6a58 Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/e3da6a58 Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/e3da6a58 Branch: refs/heads/master Commit: e3da6a58fd76e630b84c4241fbe7cc0c433a4ab8 Parents: 0b4b2e2 Author: Wei Wang <[email protected]> Authored: Thu May 19 14:37:20 2016 +0800 Committer: Wei Wang <[email protected]> Committed: Thu May 19 15:10:57 2016 +0800 ---------------------------------------------------------------------- cmake/Cuda.cmake | 1 + src/core/device/device.cc | 2 +- src/model/layer/cudnn_dropout.cc | 2 +- src/model/layer/cudnn_dropout.h | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/e3da6a58/cmake/Cuda.cmake ---------------------------------------------------------------------- diff --git a/cmake/Cuda.cmake b/cmake/Cuda.cmake index 8780fc6..a9ddcb0 100644 --- a/cmake/Cuda.cmake +++ b/cmake/Cuda.cmake @@ -17,6 +17,7 @@ add_definitions(-DUSE_CUDA) include_directories(SYSTEM ${CUDNN_INCLUDE_DIR}) list(APPEND SINGA_LINKER_LIBS ${CUDNN_LIBRARIES}) add_definitions(-DUSE_CUDNN) + add_definitions(-DCUDNN_VERSION_MAJOR=${CUDNN_VERSION_MAJOR}) #endif() include_directories(SYSTEM ${CUDA_INCLUDE_DIRS}) http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/e3da6a58/src/core/device/device.cc ---------------------------------------------------------------------- diff --git a/src/core/device/device.cc b/src/core/device/device.cc index 73bb5c1..205601b 100644 --- a/src/core/device/device.cc +++ b/src/core/device/device.cc @@ -56,7 +56,7 @@ void Device::CopyDataToFrom(Blob* dst, Blob* src, size_t nBytes, [this, dst, src, nBytes, direct, dst_offset, src_offset](Context* ctx) { this->CopyToFrom( reinterpret_cast<char*>(dst->mutable_data()) + dst_offset, - reinterpret_cast<char*>(src->data()) + src_offset, nBytes, + reinterpret_cast<const char*>(src->data()) + src_offset, nBytes, direct, ctx); }, {src}, {dst}); http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/e3da6a58/src/model/layer/cudnn_dropout.cc ---------------------------------------------------------------------- diff --git a/src/model/layer/cudnn_dropout.cc b/src/model/layer/cudnn_dropout.cc index e049ade..65cd8e5 100644 --- a/src/model/layer/cudnn_dropout.cc +++ b/src/model/layer/cudnn_dropout.cc @@ -17,7 +17,7 @@ */ #ifdef USE_CUDNN // cudnn dropout is added in cudnn 5 -#if CUDNN_MAJOR_VERSION >= 5 +#if CUDNN_VERSION_MAJOR >= 5 #include "./cudnn_dropout.h" #include <cudnn.h> http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/e3da6a58/src/model/layer/cudnn_dropout.h ---------------------------------------------------------------------- diff --git a/src/model/layer/cudnn_dropout.h b/src/model/layer/cudnn_dropout.h index 647eed2..a7d00e0 100644 --- a/src/model/layer/cudnn_dropout.h +++ b/src/model/layer/cudnn_dropout.h @@ -20,7 +20,7 @@ #define SRC_MODEL_LAYER_CUDNN_DROPOUT_H_ #ifdef USE_CUDNN // cudnn dropout is added in cudnn 5 -#if CUDNN_MAJOR_VERSION >= 5 + #if CUDNN_VERSION_MAJOR >= 5 #include <cudnn.h> #include <utility> #include <string>
