Explorar o código

bcsr: Add missing interface macros

Samuel Thibault %!s(int64=4) %!d(string=hai) anos
pai
achega
bbad97d7c7
Modificáronse 2 ficheiros con 34 adicións e 10 borrados
  1. 24 0
      include/starpu_data_interfaces.h
  2. 10 10
      tests/datawizard/bcsr.c

+ 24 - 0
include/starpu_data_interfaces.h

@@ -1963,6 +1963,11 @@ size_t starpu_bcsr_get_elemsize(starpu_data_handle_t handle);
  */
  */
 #define STARPU_BCSR_GET_NNZ(interface)        (((struct starpu_bcsr_interface *)(interface))->nnz)
 #define STARPU_BCSR_GET_NNZ(interface)        (((struct starpu_bcsr_interface *)(interface))->nnz)
 /**
 /**
+   Return the number of block rows in the matrix designated
+   by \p interface.
+ */
+#define STARPU_BCSR_GET_NROW(interface)        (((struct starpu_bcsr_interface *)(interface))->nrow)
+/**
    Return a pointer to the non-zero values of the matrix
    Return a pointer to the non-zero values of the matrix
    designated by \p interface.
    designated by \p interface.
  */
  */
@@ -1996,6 +2001,25 @@ size_t starpu_bcsr_get_elemsize(starpu_data_handle_t handle);
  */
  */
 #define STARPU_BCSR_GET_ROWPTR_DEV_HANDLE(interface) (((struct starpu_bcsr_interface *)(interface))->rowptr)
 #define STARPU_BCSR_GET_ROWPTR_DEV_HANDLE(interface) (((struct starpu_bcsr_interface *)(interface))->rowptr)
 /**
 /**
+   Return the base of the indexing (0 or 1 usually) in the matrix designated
+   by \p interface.
+ */
+#define STARPU_BCSR_GET_FIRSTENTRY(interface)        (((struct starpu_bcsr_interface *)(interface))->firstentry)
+/**
+   Return the height of blocks in the matrix designated
+   by \p interface.
+ */
+#define STARPU_BCSR_GET_R(interface)        (((struct starpu_bcsr_interface *)(interface))->r)
+/**
+   Return the width of blocks in the matrix designated
+   by \p interface.
+ */
+#define STARPU_BCSR_GET_C(interface)        (((struct starpu_bcsr_interface *)(interface))->c)
+/**
+   Return the size of elements in the matrix designated by \p interface.
+ */
+#define STARPU_BCSR_GET_ELEMSIZE(interface)        (((struct starpu_bcsr_interface *)(interface))->elemsize)
+/**
    Return the offset in the arrays (coling, rowptr, nzval) of the
    Return the offset in the arrays (coling, rowptr, nzval) of the
    matrix designated by \p interface, to be used with the device handles.
    matrix designated by \p interface, to be used with the device handles.
  */
  */

+ 10 - 10
tests/datawizard/bcsr.c

@@ -23,16 +23,16 @@ void cpu_show_bcsr(void *descr[], void *arg)
 {
 {
 	(void)arg;
 	(void)arg;
 	struct starpu_bcsr_interface *iface = descr[0];
 	struct starpu_bcsr_interface *iface = descr[0];
-	uint32_t nnz = iface->nnz;
-	uint32_t nrow = iface->nrow;
-	int *nzval = (int *)iface->nzval;
-	uint32_t *colind = iface->colind;
-	uint32_t *rowptr = iface->rowptr;
-
-	uint32_t firstentry = iface->firstentry;
-	uint32_t r = iface->r;
-	uint32_t c = iface->c;
-	uint32_t elemsize = iface->elemsize;
+	uint32_t nnz = STARPU_BCSR_GET_NNZ(iface);
+	uint32_t nrow = STARPU_BCSR_GET_NROW(iface);
+	int *nzval = (int *)STARPU_BCSR_GET_NZVAL(iface);
+	uint32_t *colind = STARPU_BCSR_GET_COLIND(iface);
+	uint32_t *rowptr = STARPU_BCSR_GET_ROWPTR(iface);
+
+	uint32_t firstentry = STARPU_BCSR_GET_FIRSTENTRY(iface);
+	uint32_t r = STARPU_BCSR_GET_R(iface);
+	uint32_t c = STARPU_BCSR_GET_C(iface);
+	uint32_t elemsize = STARPU_BCSR_GET_ELEMSIZE(iface);
 
 
 	uint32_t i, j, y, x;
 	uint32_t i, j, y, x;
 	static starpu_pthread_mutex_t mutex = STARPU_PTHREAD_MUTEX_INITIALIZER;
 	static starpu_pthread_mutex_t mutex = STARPU_PTHREAD_MUTEX_INITIALIZER;