Commit 5bd1f6b5 by Ting PAN

Fix syntax error on compiling without cuda

1 parent ddc5f3c2
......@@ -102,8 +102,8 @@ class CUDAContext {
}
inline static void Memset(size_t nbytes, void* ptr) { cudaMemset(ptr, 0, nbytes); }
template<class DstContext, class SrcContext>
template<class DstContext, class SrcContext>
inline static void Memcpy(size_t nbytes, void* dst, const void* src) {
CUDA_CHECK(cudaMemcpy(dst, src, nbytes, cudaMemcpyDefault));
}
......@@ -188,16 +188,19 @@ static inline cudnnHandle_t& cudnn_handle() {
#endif
#else // WITH_CUDA
class CUDAContext{
class CUDAContext {
public:
CUDAContext(const DeviceOption& option) { LOG(FATAL) << "CUDA was not compiled."; }
CUDAContext(const int gpu_id = 0) { LOG(FATAL) << "CUDA was not compiled."; }
CUDAContext(const DeviceOption& option) { CUDA_NOT_COMPILED; }
CUDAContext(const int gpu_id = 0) { CUDA_NOT_COMPILED; }
void SwitchToDevice() { CUDA_NOT_COMPILED; }
void FinishDeviceCompution() { CUDA_NOT_COMPILED; }
template<class DstContext, class SrcContext>
static void Memcpy(size_t nbytes, void* dst, const void* src) {
LOG(FATAL) << "CUDA was not compiled.";
}
static void Memcpy(size_t nbytes, void* dst, const void* src) { CUDA_NOT_COMPILED; }
};
#endif // WITH_CUDA
} // namespace dragon
......
......@@ -106,6 +106,11 @@ class DeviceGuard {
} // namespace dragon
#else
#define CUDA_NOT_COMPILED \
LOG(FATAL) << "CUDA was not compiled.";
#endif // WITH_CUDA
#endif // DRAGON_UTILS_CUDA_DEVICE_H_
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!