fix ci bug: cudnn handler in multi card

test=develop
move-code
nhzlx 6 years ago
parent 3df7b98a0f
commit a1d11bb175

@ -212,6 +212,7 @@ class EigenCudaStreamDevice : public Eigen::StreamInterface {
CudnnHolder::CudnnHolder(const cudaStream_t* stream, const CUDAPlace& place)
: workspace_(nullptr), stream_(stream), place_(place) {
PADDLE_ENFORCE(cudaSetDevice(place_.device));
PADDLE_ENFORCE(dynload::cudnnCreate(&cudnn_handle_));
PADDLE_ENFORCE(dynload::cudnnSetStream(cudnn_handle_, *stream_));
}
@ -233,8 +234,6 @@ void CudnnHolder::ReallocateWorkspace(size_t required_workspace_len) {
paddle::memory::Allocator::kScratchpad);
}
std::once_flag CUDADeviceContext::init_cudnn_;
CUDADeviceContext::CUDADeviceContext(CUDAPlace place)
: place_(place), cudnn_holder_(nullptr) {
CUDADeviceGuard guard(place_.device);

@ -292,7 +292,7 @@ class CUDADeviceContext : public DeviceContext {
private:
CUDAPlace place_;
static std::once_flag init_cudnn_;
mutable std::once_flag init_cudnn_;
std::unique_ptr<Eigen::GpuDevice> eigen_device_;
std::unique_ptr<EigenCudaStreamDevice> eigen_stream_;

Loading…
Cancel
Save