소스 검색

Fix device selection when issuing a gpu-gpu transfer from the source

Samuel Thibault 10 년 전
부모
커밋
fa816b7fb8
1개의 변경된 파일13개의 추가작업 그리고 2개의 파일을 삭제
  1. 13 2
      src/datawizard/copy_driver.c

+ 13 - 2
src/datawizard/copy_driver.c

@@ -127,8 +127,19 @@ static int copy_data_1_to_1_generic(starpu_data_handle_t handle,
 #if defined(STARPU_USE_CUDA) && defined(HAVE_CUDA_MEMCPY_PEER)
 	if ((src_kind == STARPU_CUDA_RAM) || (dst_kind == STARPU_CUDA_RAM))
 	{
-		int node = (dst_kind == STARPU_CUDA_RAM)?dst_node:src_node;
-		starpu_cuda_set_device(_starpu_memory_node_get_devid(node));
+		unsigned devid;
+		if ((src_kind == STARPU_CUDA_RAM) && (dst_kind == STARPU_CUDA_RAM))
+		{
+			/* GPU-GPU transfer, issue it from the device we are supposed to drive */
+			int worker = starpu_worker_get_id();
+			devid = starpu_worker_get_devid(worker);
+		}
+		else
+		{
+			unsigned node = (dst_kind == STARPU_CUDA_RAM)?dst_node:src_node;
+			devid = _starpu_memory_node_get_devid(node);
+		}
+		starpu_cuda_set_device(devid);
 	}
 #endif