Browse Source

bcsr: Add missing interface macros

Samuel Thibault 3 years ago
parent
commit
bbad97d7c7
2 changed files with 34 additions and 10 deletions
  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)
 /**
+   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
    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)
 /**
+   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
    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;
 	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;
 	static starpu_pthread_mutex_t mutex = STARPU_PTHREAD_MUTEX_INITIALIZER;