Parcourir la source

starpu_get_handle_interface_id returns the identifier of the interface of a
handle.

Cédric Augonnet il y a 15 ans
Parent
commit
22e39e050a

+ 3 - 1
include/starpu-data-interfaces.h

@@ -149,7 +149,7 @@ uint32_t *starpu_get_bcsr_local_colind(starpu_data_handle);
 uint32_t *starpu_get_bcsr_local_rowptr(starpu_data_handle);
 uint32_t starpu_get_bcsr_r(starpu_data_handle);
 uint32_t starpu_get_bcsr_c(starpu_data_handle);
-size_t starpu_get_bcsr_elemsize(struct starpu_data_state_t *state);
+size_t starpu_get_bcsr_elemsize(starpu_data_handle);
 
 #define STARPU_BLAS_INTERFACE_ID	0
 #define STARPU_BLOCK_INTERFACE_ID	1
@@ -159,6 +159,8 @@ size_t starpu_get_bcsr_elemsize(struct starpu_data_state_t *state);
 #define STARPU_BCSCR_INTERFACE_ID	5
 #define STARPU_NINTERFACES_ID		6 /* number of data interfaces */
 
+unsigned starpu_get_handle_interface_id(starpu_data_handle);
+
 typedef union {
 	starpu_blas_interface_t blas;	/* dense BLAS representation */
 	starpu_block_interface_t block;	/* BLOCK interface for 3D dense blocks */

+ 1 - 0
src/Makefile.am

@@ -118,6 +118,7 @@ libstarpu_la_SOURCES = 						\
 	datawizard/footprint.c					\
 	datawizard/datastats.c					\
 	datawizard/user_interactions.c				\
+	datawizard/interfaces/data_interface.c			\
 	datawizard/interfaces/bcsr_interface.c			\
 	datawizard/interfaces/csr_interface.c			\
 	datawizard/interfaces/blas_filters.c			\

+ 1 - 1
src/datawizard/footprint.c

@@ -39,7 +39,7 @@ void compute_buffers_footprint(job_t j)
 
 inline uint32_t compute_data_footprint(data_state *state)
 {
-	uint32_t interfaceid = state->ops->interfaceid;
+	uint32_t interfaceid = (uint32_t)starpu_get_handle_interface_id(state);
 
 	return state->ops->footprint(state, interfaceid);
 }

+ 22 - 0
src/datawizard/interfaces/data_interface.c

@@ -0,0 +1,22 @@
+/*
+ * StarPU
+ * Copyright (C) INRIA 2008-2009 (see AUTHORS file)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU Lesser General Public License in COPYING.LGPL for more details.
+ */
+
+#include <datawizard/datawizard.h>
+
+unsigned starpu_get_handle_interface_id(data_state *handle)
+{
+	return handle->ops->interfaceid;
+}

+ 2 - 4
src/datawizard/interfaces/data_interface.h

@@ -17,8 +17,7 @@
 #ifndef __DATA_INTERFACE_H__
 #define __DATA_INTERFACE_H__
 
-#include <stdio.h>
-
+#include <starpu.h>
 #include <common/config.h>
 #include <datawizard/data_parameters.h>
 
@@ -27,7 +26,6 @@
 #include <gordon.h>
 #endif
 
-#include <starpu.h>
 
 struct starpu_data_state_t;
 
@@ -46,7 +44,7 @@ struct data_interface_ops_t {
 	int (*convert_to_gordon)(starpu_data_interface_t *interface, uint64_t *ptr, gordon_strideSize_t *ss); 
 #endif
 	/* an identifier that is unique to each interface */
-	uint32_t interfaceid;
+	unsigned interfaceid;
 };
 
 #endif // __DATA_INTERFACE_H__