Accéder au contenu.
Menu Sympa

starpu-devel - [Starpu-devel] Patch request for the multiformat interface

Objet : Developers list for StarPU

Archives de la liste

[Starpu-devel] Patch request for the multiformat interface


Chronologique Discussions 
  • From: Nathalie Furmento <nathalie.furmento@labri.fr>
  • To: "starpu-devel@lists.gforge.inria.fr" <starpu-devel@lists.gforge.inria.fr>
  • Subject: [Starpu-devel] Patch request for the multiformat interface
  • Date: Wed, 29 Feb 2012 11:42:34 +0100
  • List-archive: <http://lists.gforge.inria.fr/pipermail/starpu-devel>
  • List-id: "Developers list. For discussion of new features, code changes, etc." <starpu-devel.lists.gforge.inria.fr>

All,

Here a patch for the multiformat interface. It enables the cuda and opencl fields even when these drivers are not enabled. I do not think it is a good idea to have the API depending too much on what is enabled or not.

(starpu_codelet always defines the pointer for cuda and opencl functions, the other public datatypes should follow the same rules).

I am not sure if the patch is covering all the needed updates in src, that should be checked).

Let me know if you disagree with applying the patch.

Cheers,

Nathalie

Index: include/starpu_data_interfaces.h
===================================================================
--- include/starpu_data_interfaces.h (révision 5892)
+++ include/starpu_data_interfaces.h (copie de travail)
@@ -350,27 +350,19 @@
struct starpu_multiformat_data_interface_ops
{
size_t cpu_elemsize;
-#ifdef STARPU_USE_OPENCL
size_t opencl_elemsize;
struct starpu_codelet *cpu_to_opencl_cl;
struct starpu_codelet *opencl_to_cpu_cl;
-#endif
-#ifdef STARPU_USE_CUDA
size_t cuda_elemsize;
struct starpu_codelet *cpu_to_cuda_cl;
struct starpu_codelet *cuda_to_cpu_cl;
-#endif
};

struct starpu_multiformat_interface
{
void *cpu_ptr;
-#ifdef STARPU_USE_CUDA
void *cuda_ptr;
-#endif
-#ifdef STARPU_USE_OPENCL
void *opencl_ptr;
-#endif
uint32_t nx;
struct starpu_multiformat_data_interface_ops *ops;
};
@@ -378,15 +370,8 @@
void starpu_multiformat_data_register(starpu_data_handle_t *handle, uint32_t
home_node, void *ptr, uint32_t nobjects, struct
starpu_multiformat_data_interface_ops *format_ops);

#define STARPU_MULTIFORMAT_GET_CPU_PTR(interface) (((struct
starpu_multiformat_interface *)(interface))->cpu_ptr)
-
-#ifdef STARPU_USE_CUDA
#define STARPU_MULTIFORMAT_GET_CUDA_PTR(interface) (((struct
starpu_multiformat_interface *)(interface))->cuda_ptr)
-#endif
-
-#ifdef STARPU_USE_OPENCL
#define STARPU_MULTIFORMAT_GET_OPENCL_PTR(interface) (((struct
starpu_multiformat_interface *)(interface))->opencl_ptr)
-#endif
-
#define STARPU_MULTIFORMAT_GET_NX(interface) (((struct
starpu_multiformat_interface *)(interface))->nx)

enum starpu_data_interface_id
starpu_handle_get_interface_id(starpu_data_handle_t handle);
Index: src/core/sched_policy.c
===================================================================
--- src/core/sched_policy.c (révision 5892)
+++ src/core/sched_policy.c (copie de travail)
@@ -357,31 +357,23 @@
{
case STARPU_CPU_RAM:
STARPU_ASSERT(0);
-#ifdef STARPU_USE_CUDA
case STARPU_CUDA_RAM:
conversion_task->cl = mf_ops->cuda_to_cpu_cl;
break;
-#endif
-#ifdef STARPU_USE_OPENCL
case STARPU_OPENCL_RAM:
conversion_task->cl = mf_ops->opencl_to_cpu_cl;
break;
-#endif
default:
fprintf(stderr, "Oops : %u\n", handle->mf_node);
STARPU_ASSERT(0);
}
break;
-#ifdef STARPU_USE_CUDA
case STARPU_CUDA_RAM:
conversion_task->cl = mf_ops->cpu_to_cuda_cl;
break;
-#endif
-#ifdef STARPU_USE_OPENCL
case STARPU_OPENCL_RAM:
conversion_task->cl = mf_ops->cpu_to_opencl_cl;
break;
-#endif
case STARPU_SPU_LS: /* Not supported */
default:
STARPU_ASSERT(0);
Index: src/datawizard/interfaces/multiformat_interface.c
===================================================================
--- src/datawizard/interfaces/multiformat_interface.c (révision 5892)
+++ src/datawizard/interfaces/multiformat_interface.c (copie de travail)
@@ -174,24 +174,16 @@
uint32_t nobjects,
struct
starpu_multiformat_data_interface_ops *format_ops)
{
-#ifdef STARPU_USE_OPENCL
_starpu_codelet_check_deprecated_fields(format_ops->cpu_to_opencl_cl);
_starpu_codelet_check_deprecated_fields(format_ops->opencl_to_cpu_cl);
-#endif
-#ifdef STARPU_USE_CUDA
_starpu_codelet_check_deprecated_fields(format_ops->cpu_to_cuda_cl);
_starpu_codelet_check_deprecated_fields(format_ops->cuda_to_cpu_cl);
-#endif

struct starpu_multiformat_interface multiformat =
{
.cpu_ptr = ptr,
-#ifdef STARPU_USE_CUDA
.cuda_ptr = NULL,
-#endif
-#ifdef STARPu_USE_OPENCL
.opencl_ptr = NULL,
-#endif
.nx = nobjects,
.ops = format_ops
};
@@ -211,12 +203,8 @@

return ((multiformat_a->nx == multiformat_b->nx)
&& (multiformat_a->ops->cpu_elemsize ==
multiformat_b->ops->cpu_elemsize)
-#ifdef STARPU_USE_CUDA
&& (multiformat_a->ops->cuda_elemsize ==
multiformat_b->ops->cuda_elemsize)
-#endif
-#ifdef STARPU_USE_OPENCL
&& (multiformat_a->ops->opencl_elemsize ==
multiformat_b->ops->opencl_elemsize)
-#endif
);
}

Index: src/datawizard/interfaces/data_interface.c
===================================================================
--- src/datawizard/interfaces/data_interface.c (révision 5895)
+++ src/datawizard/interfaces/data_interface.c (copie de travail)
@@ -482,16 +482,12 @@
mf_ops = (struct
starpu_multiformat_data_interface_ops *)
handle->ops->get_mf_ops(format_interface);
switch (node_kind)
{
-#ifdef STARPU_USE_CUDA
case STARPU_CUDA_RAM:
cl = mf_ops->cuda_to_cpu_cl;
break;
-#endif
-#ifdef STARPU_USE_OPENCL
case STARPU_OPENCL_RAM:
cl = mf_ops->opencl_to_cpu_cl;
break;
-#endif
case STARPU_CPU_RAM: /* Impossible ! */
case STARPU_SPU_LS: /* Not supported */
default:



Archives gérées par MHonArc 2.6.19+.

Haut de le page