From f91248e0ccdeb56b971f253cdf054050afdb8a7d Mon Sep 17 00:00:00 2001 From: Weixing Zhang Date: Fri, 18 Sep 2020 11:50:35 -0700 Subject: [PATCH] remove curand_generator_ related code since it is not used. (#5220) --- onnxruntime/core/providers/cuda/cuda_common.h | 4 ---- .../core/providers/cuda/cuda_execution_provider.cc | 7 ------- onnxruntime/core/providers/cuda/cuda_execution_provider.h | 8 -------- 3 files changed, 19 deletions(-) diff --git a/onnxruntime/core/providers/cuda/cuda_common.h b/onnxruntime/core/providers/cuda/cuda_common.h index af4f11284c..a1b1b64fe5 100644 --- a/onnxruntime/core/providers/cuda/cuda_common.h +++ b/onnxruntime/core/providers/cuda/cuda_common.h @@ -170,10 +170,6 @@ class CudaKernel : public OpKernel { } protected: - inline curandGenerator_t CurandGenerator() const { - return provider_->PerThreadCurandGenerator(); - } - template inline const T* GetConstOnes(size_t count) const { return provider_->template GetConstOnes(count); diff --git a/onnxruntime/core/providers/cuda/cuda_execution_provider.cc b/onnxruntime/core/providers/cuda/cuda_execution_provider.cc index cabd267a18..cc7f297f0f 100644 --- a/onnxruntime/core/providers/cuda/cuda_execution_provider.cc +++ b/onnxruntime/core/providers/cuda/cuda_execution_provider.cc @@ -60,7 +60,6 @@ CUDAExecutionProvider::PerThreadContext::PerThreadContext(OrtDevice::DeviceId de CUDA_CALL_THROW(cudaSetDevice(device_id)); CUBLAS_CALL_THROW(cublasCreate(&cublas_handle_)); CUDNN_CALL_THROW(cudnnCreate(&cudnn_handle_)); - CURAND_CALL_THROW(curandCreateGenerator(&curand_generator_, CURAND_RNG_PSEUDO_DEFAULT)); AllocatorCreationInfo default_memory_info( [](OrtDevice::DeviceId id) { @@ -91,12 +90,6 @@ CUDAExecutionProvider::PerThreadContext::~PerThreadContext() { } catch (const std::exception& ex) { LOGS_DEFAULT(ERROR) << "cudnnDestroy threw:" << ex.what(); } - - try { - CURAND_CALL_THROW(curandDestroyGenerator(curand_generator_)); - } catch (const std::exception& ex) { - LOGS_DEFAULT(ERROR) << "curandDestroyGenerator threw:" << ex.what(); - } } /* diff --git a/onnxruntime/core/providers/cuda/cuda_execution_provider.h b/onnxruntime/core/providers/cuda/cuda_execution_provider.h index 8fadece732..4507d87c17 100644 --- a/onnxruntime/core/providers/cuda/cuda_execution_provider.h +++ b/onnxruntime/core/providers/cuda/cuda_execution_provider.h @@ -52,9 +52,6 @@ class CUDAExecutionProvider : public IExecutionProvider { cudnnHandle_t PerThreadCudnnHandle() { return GetPerThreadContext().CudnnHandle(); } - curandGenerator_t PerThreadCurandGenerator() { - return GetPerThreadContext().CurandGenerator(); - } template const T* GetConstOnes(size_t count) { @@ -109,10 +106,6 @@ class CUDAExecutionProvider : public IExecutionProvider { return cudnn_handle_; } - curandGenerator_t CurandGenerator() const { - return curand_generator_; - } - cudaEvent_t& GetCurrentDeferredReleaseEvent() { return current_deferred_release_event_; } @@ -146,7 +139,6 @@ class CUDAExecutionProvider : public IExecutionProvider { private: cublasHandle_t cublas_handle_ = nullptr; cudnnHandle_t cudnn_handle_ = nullptr; - curandGenerator_t curand_generator_ = nullptr; // deferred release for temporary CPU pinned memory used in cudaMemcpyAsync // note that cudaEvent will be assigned at OnRunEnd() when PerThreadContext destory