|
@@ -203,15 +203,14 @@ static int copy_cuda_to_ram_async(void *src_interface, unsigned src_node, void *
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
-
|
|
|
#ifdef STARPU_USE_OPENCL
|
|
|
-static int copy_ram_to_opencl(void *src_interface, unsigned src_node,
|
|
|
- void *dst_interface, unsigned dst_node)
|
|
|
+static int copy_ram_to_opencl_async(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, void *_event)
|
|
|
{
|
|
|
struct starpu_complex_interface *src_complex = src_interface;
|
|
|
struct starpu_complex_interface *dst_complex = dst_interface;
|
|
|
-
|
|
|
+ cl_event *event = (cl_event *)_event;
|
|
|
cl_int err;
|
|
|
+ int ret;
|
|
|
|
|
|
err = starpu_opencl_copy_ram_to_opencl(src_complex->real,
|
|
|
src_node,
|
|
@@ -219,10 +218,12 @@ static int copy_ram_to_opencl(void *src_interface, unsigned src_node,
|
|
|
dst_node,
|
|
|
src_complex->nx * sizeof(src_complex->real[0]),
|
|
|
0,
|
|
|
- NULL,
|
|
|
- NULL);
|
|
|
+ event,
|
|
|
+ &ret);
|
|
|
if (STARPU_UNLIKELY(err != CL_SUCCESS))
|
|
|
STARPU_OPENCL_REPORT_ERROR(err);
|
|
|
+ if (ret == 0)
|
|
|
+ event = NULL;
|
|
|
|
|
|
err = starpu_opencl_copy_ram_to_opencl(src_complex->imaginary,
|
|
|
src_node,
|
|
@@ -230,31 +231,39 @@ static int copy_ram_to_opencl(void *src_interface, unsigned src_node,
|
|
|
dst_node,
|
|
|
src_complex->nx * sizeof(src_complex->imaginary[0]),
|
|
|
0,
|
|
|
- NULL,
|
|
|
- NULL);
|
|
|
+ event,
|
|
|
+ &ret);
|
|
|
if (STARPU_UNLIKELY(err != CL_SUCCESS))
|
|
|
STARPU_OPENCL_REPORT_ERROR(err);
|
|
|
|
|
|
- return 0;
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+static int copy_ram_to_opencl(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node)
|
|
|
+{
|
|
|
+ return copy_ram_to_opencl_async(src_interface, src_node, dst_interface, dst_node, NULL);
|
|
|
}
|
|
|
|
|
|
-static int copy_opencl_to_ram(void *src_interface, unsigned src_node,
|
|
|
- void *dst_interface, unsigned dst_node)
|
|
|
+static int copy_opencl_to_ram_async(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, void *_event)
|
|
|
{
|
|
|
struct starpu_complex_interface *src_complex = src_interface;
|
|
|
struct starpu_complex_interface *dst_complex = dst_interface;
|
|
|
-
|
|
|
+ cl_event *event = (cl_event *)_event;
|
|
|
cl_int err;
|
|
|
+ int ret;
|
|
|
+
|
|
|
err = starpu_opencl_copy_opencl_to_ram((cl_mem) src_complex->real,
|
|
|
src_node,
|
|
|
dst_complex->real,
|
|
|
dst_node,
|
|
|
src_complex->nx * sizeof(src_complex->real[0]),
|
|
|
0,
|
|
|
- NULL,
|
|
|
- NULL);
|
|
|
+ event,
|
|
|
+ &ret);
|
|
|
if (STARPU_UNLIKELY(err != CL_SUCCESS))
|
|
|
STARPU_OPENCL_REPORT_ERROR(err);
|
|
|
+ if (ret == 0)
|
|
|
+ event = NULL;
|
|
|
|
|
|
err = starpu_opencl_copy_opencl_to_ram((cl_mem) src_complex->imaginary,
|
|
|
src_node,
|
|
@@ -262,14 +271,20 @@ static int copy_opencl_to_ram(void *src_interface, unsigned src_node,
|
|
|
dst_node,
|
|
|
src_complex->nx * sizeof(src_complex->imaginary[0]),
|
|
|
0,
|
|
|
- NULL,
|
|
|
- NULL);
|
|
|
+ event,
|
|
|
+ &ret);
|
|
|
if (STARPU_UNLIKELY(err != CL_SUCCESS))
|
|
|
STARPU_OPENCL_REPORT_ERROR(err);
|
|
|
|
|
|
- return 0;
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+static int copy_opencl_to_ram(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node)
|
|
|
+{
|
|
|
+ return copy_opencl_to_ram_async(src_interface, src_node, dst_interface, dst_node, NULL);
|
|
|
}
|
|
|
#endif
|
|
|
+
|
|
|
static struct starpu_data_copy_methods complex_copy_methods =
|
|
|
{
|
|
|
#ifdef STARPU_USE_CUDA
|
|
@@ -281,7 +296,8 @@ static struct starpu_data_copy_methods complex_copy_methods =
|
|
|
#ifdef STARPU_USE_OPENCL
|
|
|
.ram_to_opencl = copy_ram_to_opencl,
|
|
|
.opencl_to_ram = copy_opencl_to_ram,
|
|
|
-#warning implement the asynchronous functions
|
|
|
+ .ram_to_opencl_async = copy_ram_to_opencl_async,
|
|
|
+ .opencl_to_ram_async = copy_opencl_to_ram_async,
|
|
|
#endif
|
|
|
};
|
|
|
|