Prechádzať zdrojové kódy

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

Samuel Thibault 10 rokov pred
rodič
commit
fa816b7fb8
1 zmenil súbory, kde vykonal 13 pridanie a 2 odobranie
  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