|
@@ -16,10 +16,16 @@
|
|
|
|
|
|
#include <starpu.h>
|
|
#include <starpu.h>
|
|
#include "complex_interface.h"
|
|
#include "complex_interface.h"
|
|
|
|
+#ifdef STARPU_USE_OPENCL
|
|
|
|
+#include <starpu_opencl.h>
|
|
|
|
+#endif
|
|
|
|
|
|
#ifdef STARPU_USE_CUDA
|
|
#ifdef STARPU_USE_CUDA
|
|
extern void copy_complex_codelet_cuda(void *descr[], __attribute__ ((unused)) void *_args);
|
|
extern void copy_complex_codelet_cuda(void *descr[], __attribute__ ((unused)) void *_args);
|
|
#endif
|
|
#endif
|
|
|
|
+#ifdef STARPU_USE_OPENCL
|
|
|
|
+extern void copy_complex_codelet_opencl(void *buffers[], void *args);
|
|
|
|
+#endif
|
|
|
|
|
|
void compare_complex_codelet(void *descr[], __attribute__ ((unused)) void *_args)
|
|
void compare_complex_codelet(void *descr[], __attribute__ ((unused)) void *_args)
|
|
{
|
|
{
|
|
@@ -72,6 +78,9 @@ struct starpu_codelet cl_copy =
|
|
#ifdef STARPU_USE_CUDA
|
|
#ifdef STARPU_USE_CUDA
|
|
.cuda_funcs = {copy_complex_codelet_cuda, NULL},
|
|
.cuda_funcs = {copy_complex_codelet_cuda, NULL},
|
|
#endif
|
|
#endif
|
|
|
|
+#ifdef STARPU_USE_OPENCL
|
|
|
|
+ .opencl_funcs = {copy_complex_codelet_opencl, NULL},
|
|
|
|
+#endif
|
|
.nbuffers = 2,
|
|
.nbuffers = 2,
|
|
.modes = {STARPU_R, STARPU_W}
|
|
.modes = {STARPU_R, STARPU_W}
|
|
};
|
|
};
|
|
@@ -83,6 +92,10 @@ struct starpu_codelet cl_compare =
|
|
.modes = {STARPU_R, STARPU_R}
|
|
.modes = {STARPU_R, STARPU_R}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+#ifdef STARPU_USE_OPENCL
|
|
|
|
+struct starpu_opencl_program opencl_program;
|
|
|
|
+#endif
|
|
|
|
+
|
|
int main(int argc, char **argv)
|
|
int main(int argc, char **argv)
|
|
{
|
|
{
|
|
int ret = 0;
|
|
int ret = 0;
|
|
@@ -98,6 +111,11 @@ int main(int argc, char **argv)
|
|
if (ret == -ENODEV) return 77;
|
|
if (ret == -ENODEV) return 77;
|
|
STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
|
|
STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
|
|
|
|
|
|
|
|
+#ifdef STARPU_USE_OPENCL
|
|
|
|
+ ret = starpu_opencl_load_opencl_from_file("examples/interface/complex_kernels.cl",
|
|
|
|
+ &opencl_program, NULL);
|
|
|
|
+ STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_load_opencl_from_file");
|
|
|
|
+#endif
|
|
starpu_complex_data_register(&handle1, 0, &real, &imaginary, 1);
|
|
starpu_complex_data_register(&handle1, 0, &real, &imaginary, 1);
|
|
starpu_complex_data_register(&handle2, 0, ©_real, ©_imaginary, 1);
|
|
starpu_complex_data_register(&handle2, 0, ©_real, ©_imaginary, 1);
|
|
|
|
|
|
@@ -141,10 +159,16 @@ int main(int argc, char **argv)
|
|
|
|
|
|
starpu_task_wait_for_all();
|
|
starpu_task_wait_for_all();
|
|
|
|
|
|
|
|
+#ifdef STARPU_USE_OPENCL
|
|
|
|
+ starpu_opencl_unload_opencl(&opencl_program);
|
|
|
|
+#endif
|
|
starpu_shutdown();
|
|
starpu_shutdown();
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
enodev:
|
|
enodev:
|
|
|
|
+#ifdef STARPU_USE_OPENCL
|
|
|
|
+ starpu_opencl_unload_opencl(&opencl_program);
|
|
|
|
+#endif
|
|
starpu_data_unregister(handle1);
|
|
starpu_data_unregister(handle1);
|
|
starpu_data_unregister(handle2);
|
|
starpu_data_unregister(handle2);
|
|
starpu_shutdown();
|
|
starpu_shutdown();
|