From 954d680b4022be31108fde1ef12e84b52e6fadbd Mon Sep 17 00:00:00 2001 From: qiaolongfei Date: Mon, 6 Aug 2018 19:49:41 +0800 Subject: [PATCH] fix test_parallel_do.py --- paddle/fluid/platform/profiler.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/paddle/fluid/platform/profiler.cc b/paddle/fluid/platform/profiler.cc index fe811e0250..7c8d8a5964 100644 --- a/paddle/fluid/platform/profiler.cc +++ b/paddle/fluid/platform/profiler.cc @@ -110,6 +110,8 @@ Event::Event(EventType type, std::string name, uint32_t thread_id, has_cuda_ = dev_ctx ? platform::is_gpu_place(dev_ctx->GetPlace()) : false; if (has_cuda_) { auto* cuda_dev_ctx = static_cast(dev_ctx); + PADDLE_ENFORCE(cudaSetDevice( + boost::get(cuda_dev_ctx->GetPlace()).device)); PADDLE_ENFORCE(cudaGetDevice(&device_)); PADDLE_ENFORCE(cudaEventCreate(&event_)); auto stream = cuda_dev_ctx->stream(); -- GitLab