|
@@ -21,12 +21,23 @@
|
|
* its own copy functions. Some of them have not been implemented here
|
|
* its own copy functions. Some of them have not been implemented here
|
|
* (synchronous functions, for example).
|
|
* (synchronous functions, for example).
|
|
*/
|
|
*/
|
|
|
|
+
|
|
#include <starpu.h>
|
|
#include <starpu.h>
|
|
#ifdef STARPU_USE_OPENCL
|
|
#ifdef STARPU_USE_OPENCL
|
|
#include <starpu_opencl.h>
|
|
#include <starpu_opencl.h>
|
|
#endif
|
|
#endif
|
|
#include "multiformat_types.h"
|
|
#include "multiformat_types.h"
|
|
|
|
|
|
|
|
+#ifndef STARPU_USE_CPU
|
|
|
|
+/* Without the CPU, there is no point in using the multiformat
|
|
|
|
+ * interface, so this test is pointless. */
|
|
|
|
+int
|
|
|
|
+main(void)
|
|
|
|
+{
|
|
|
|
+ return 77;
|
|
|
|
+}
|
|
|
|
+#else
|
|
|
|
+
|
|
static int ncpu = 0;
|
|
static int ncpu = 0;
|
|
static int ncuda = 0;
|
|
static int ncuda = 0;
|
|
static int nopencl = 0;
|
|
static int nopencl = 0;
|
|
@@ -35,7 +46,6 @@ static unsigned int nchunks = 1;
|
|
static struct point array_of_structs[N_ELEMENTS];
|
|
static struct point array_of_structs[N_ELEMENTS];
|
|
static starpu_data_handle_t array_of_structs_handle;
|
|
static starpu_data_handle_t array_of_structs_handle;
|
|
|
|
|
|
-#if STARPU_USE_CPU
|
|
|
|
static void
|
|
static void
|
|
multiformat_scal_cpu_func(void *buffers[], void *args)
|
|
multiformat_scal_cpu_func(void *buffers[], void *args)
|
|
{
|
|
{
|
|
@@ -48,7 +58,6 @@ multiformat_scal_cpu_func(void *buffers[], void *args)
|
|
for (i = 0; i < n; i++)
|
|
for (i = 0; i < n; i++)
|
|
aos[i].x *= aos[i].y;
|
|
aos[i].x *= aos[i].y;
|
|
}
|
|
}
|
|
-#endif /* STARPU_USE_CPU */
|
|
|
|
|
|
|
|
#ifdef STARPU_USE_CUDA
|
|
#ifdef STARPU_USE_CUDA
|
|
extern struct starpu_codelet cpu_to_cuda_cl;
|
|
extern struct starpu_codelet cpu_to_cuda_cl;
|
|
@@ -84,7 +93,6 @@ extern void multiformat_scal_cuda_func(void *buffers[], void *arg);
|
|
extern void multiformat_scal_opencl_func(void *buffers[], void *arg);
|
|
extern void multiformat_scal_opencl_func(void *buffers[], void *arg);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-#ifdef STARPU_USE_CPU
|
|
|
|
static struct starpu_codelet cpu_cl =
|
|
static struct starpu_codelet cpu_cl =
|
|
{
|
|
{
|
|
.where = STARPU_CPU,
|
|
.where = STARPU_CPU,
|
|
@@ -93,7 +101,6 @@ static struct starpu_codelet cpu_cl =
|
|
.modes = { STARPU_RW },
|
|
.modes = { STARPU_RW },
|
|
.name = "codelet_real"
|
|
.name = "codelet_real"
|
|
};
|
|
};
|
|
-#endif /* !STARPU_USE_CPU */
|
|
|
|
|
|
|
|
#ifdef STARPU_USE_CUDA
|
|
#ifdef STARPU_USE_CUDA
|
|
static struct starpu_codelet cuda_cl =
|
|
static struct starpu_codelet cuda_cl =
|
|
@@ -179,14 +186,12 @@ multiformat_divide_in_equal_chunks_filter_func(void *father,
|
|
/* The actual partitioning */
|
|
/* The actual partitioning */
|
|
mf_child->nx = length_first;
|
|
mf_child->nx = length_first;
|
|
|
|
|
|
-#if STARPU_USE_CPU
|
|
|
|
if (mf_father->cpu_ptr)
|
|
if (mf_father->cpu_ptr)
|
|
{
|
|
{
|
|
struct point *tmp = (struct point *) mf_father->cpu_ptr;
|
|
struct point *tmp = (struct point *) mf_father->cpu_ptr;
|
|
tmp += id * length_first;
|
|
tmp += id * length_first;
|
|
mf_child->cpu_ptr = tmp;
|
|
mf_child->cpu_ptr = tmp;
|
|
}
|
|
}
|
|
-#endif
|
|
|
|
}
|
|
}
|
|
|
|
|
|
static void
|
|
static void
|
|
@@ -216,18 +221,19 @@ create_and_submit_tasks(void)
|
|
{
|
|
{
|
|
task->cl = &cpu_cl;
|
|
task->cl = &cpu_cl;
|
|
}
|
|
}
|
|
- else if (i == 1)
|
|
|
|
|
|
+ else
|
|
|
|
+ if (i == 1)
|
|
{
|
|
{
|
|
-#if STARPU_USE_CUDA
|
|
|
|
|
|
+#ifdef STARPU_USE_CUDA
|
|
if (ncuda > 0)
|
|
if (ncuda > 0)
|
|
task->cl = &cuda_cl;
|
|
task->cl = &cuda_cl;
|
|
#endif /* !STARPU_USE_CUDA */
|
|
#endif /* !STARPU_USE_CUDA */
|
|
-#if STARPU_USE_OPENCL
|
|
|
|
|
|
+#ifdef STARPU_USE_OPENCL
|
|
if (ncuda == 0 && nopencl > 0)
|
|
if (ncuda == 0 && nopencl > 0)
|
|
task->cl = &opencl_cl;
|
|
task->cl = &opencl_cl;
|
|
#endif /* !STARPU_USE_OPENCL */
|
|
#endif /* !STARPU_USE_OPENCL */
|
|
}
|
|
}
|
|
-#if STARPU_USE_OPENCL
|
|
|
|
|
|
+#ifdef STARPU_USE_OPENCL
|
|
else /* i == 2 */
|
|
else /* i == 2 */
|
|
{
|
|
{
|
|
task->cl = &opencl_cl;
|
|
task->cl = &opencl_cl;
|
|
@@ -251,7 +257,6 @@ create_and_submit_tasks(void)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
static void
|
|
static void
|
|
print_it(void)
|
|
print_it(void)
|
|
{
|
|
{
|
|
@@ -279,6 +284,7 @@ check_it(void)
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
return EXIT_SUCCESS;
|
|
}
|
|
}
|
|
|
|
+
|
|
#ifdef STARPU_USE_OPENCL
|
|
#ifdef STARPU_USE_OPENCL
|
|
struct starpu_opencl_program opencl_program;
|
|
struct starpu_opencl_program opencl_program;
|
|
struct starpu_opencl_program opencl_conversion_program;
|
|
struct starpu_opencl_program opencl_conversion_program;
|
|
@@ -302,7 +308,6 @@ gpus_available()
|
|
int
|
|
int
|
|
main(void)
|
|
main(void)
|
|
{
|
|
{
|
|
-#ifdef STARPU_USE_CPU
|
|
|
|
int err;
|
|
int err;
|
|
struct starpu_conf conf =
|
|
struct starpu_conf conf =
|
|
{
|
|
{
|
|
@@ -363,9 +368,6 @@ main(void)
|
|
|
|
|
|
|
|
|
|
return check_it();
|
|
return check_it();
|
|
-#else
|
|
|
|
- /* Without the CPU, there is no point in using the multiformat
|
|
|
|
- * interface, so this test is pointless. */
|
|
|
|
- return EXIT_SUCCESS;
|
|
|
|
-#endif
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+#endif /* STARPU_USE_CPU */
|