Browse Source

src/datawizard/interfaces: improve error messages for filter functions

Nathalie Furmento 6 years ago
parent
commit
74d47c6081

+ 19 - 27
src/datawizard/interfaces/block_filters.c

@@ -1,8 +1,8 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2012                                     Inria
- * Copyright (C) 2010,2011,2013,2015,2017                 CNRS
- * Copyright (C) 2011-2014,2016, 2019                           Université de Bordeaux
+ * Copyright (C) 2010,2011,2013,2015,2017,2019            CNRS
+ * Copyright (C) 2011-2014,2016, 2019                     Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -21,7 +21,7 @@
 #include <datawizard/filters.h>
 
 void starpu_block_filter_block(void *father_interface, void *child_interface, STARPU_ATTRIBUTE_UNUSED struct starpu_data_filter *f,
-                                    unsigned id, unsigned nparts)
+			       unsigned id, unsigned nparts)
 {
         struct starpu_block_interface *block_father = (struct starpu_block_interface *) father_interface;
         struct starpu_block_interface *block_child = (struct starpu_block_interface *) child_interface;
@@ -31,12 +31,11 @@ void starpu_block_filter_block(void *father_interface, void *child_interface, ST
         uint32_t nz = block_father->nz;
 	size_t elemsize = block_father->elemsize;
 
-	STARPU_ASSERT_MSG(nparts <= nx, "%u parts for %u elements", nparts, nx);
+	STARPU_ASSERT_MSG(nparts <= nx, "cannot split %u elements in %u parts", nx, nparts, nx);
 
 	uint32_t chunk_size;
 	size_t offset;
-	starpu_filter_nparts_compute_chunk_size_and_offset(nx, nparts, elemsize, id, 1,
-				       &chunk_size, &offset);
+	starpu_filter_nparts_compute_chunk_size_and_offset(nx, nparts, elemsize, id, 1, &chunk_size, &offset);
 
 	STARPU_ASSERT_MSG(block_father->id == STARPU_BLOCK_INTERFACE_ID, "%s can only be applied on a block data", __func__);
 	block_child->id = block_father->id;
@@ -57,7 +56,7 @@ void starpu_block_filter_block(void *father_interface, void *child_interface, ST
 }
 
 void starpu_block_filter_block_shadow(void *father_interface, void *child_interface, STARPU_ATTRIBUTE_UNUSED struct starpu_data_filter *f,
-                                    unsigned id, unsigned nparts)
+				      unsigned id, unsigned nparts)
 {
         struct starpu_block_interface *block_father = (struct starpu_block_interface *) father_interface;
         struct starpu_block_interface *block_child = (struct starpu_block_interface *) child_interface;
@@ -70,13 +69,11 @@ void starpu_block_filter_block_shadow(void *father_interface, void *child_interf
         uint32_t nz = block_father->nz;
 	size_t elemsize = block_father->elemsize;
 
-	STARPU_ASSERT_MSG(nparts <= nx, "%u parts for %u elements", nparts, nx);
+	STARPU_ASSERT_MSG(nparts <= nx, "cannot split %u elements in %u parts", nx, nparts);
 
 	uint32_t child_nx;
 	size_t offset;
-	starpu_filter_nparts_compute_chunk_size_and_offset(nx, nparts, elemsize, id, 1,
-						     &child_nx, &offset);
-	
+	starpu_filter_nparts_compute_chunk_size_and_offset(nx, nparts, elemsize, id, 1, &child_nx, &offset);
 
 	STARPU_ASSERT_MSG(block_father->id == STARPU_BLOCK_INTERFACE_ID, "%s can only be applied on a block data", __func__);
 	block_child->id = block_father->id;
@@ -97,7 +94,7 @@ void starpu_block_filter_block_shadow(void *father_interface, void *child_interf
 }
 
 void starpu_block_filter_vertical_block(void *father_interface, void *child_interface, STARPU_ATTRIBUTE_UNUSED struct starpu_data_filter *f,
-                                    unsigned id, unsigned nparts)
+					unsigned id, unsigned nparts)
 {
         struct starpu_block_interface *block_father = (struct starpu_block_interface *) father_interface;
         struct starpu_block_interface *block_child = (struct starpu_block_interface *) child_interface;
@@ -107,12 +104,11 @@ void starpu_block_filter_vertical_block(void *father_interface, void *child_inte
         uint32_t nz = block_father->nz;
 	size_t elemsize = block_father->elemsize;
 
-	STARPU_ASSERT_MSG(nparts <= ny, "%u parts for %u elements", nparts, ny);
+	STARPU_ASSERT_MSG(nparts <= ny, "cannot split %u elements in %u parts", ny, nparts);
 
 	uint32_t child_ny;
 	size_t offset;
-	starpu_filter_nparts_compute_chunk_size_and_offset(ny, nparts, elemsize, id, block_father->ldy,
-				       &child_ny, &offset);
+	starpu_filter_nparts_compute_chunk_size_and_offset(ny, nparts, elemsize, id, block_father->ldy, &child_ny, &offset);
 
 	STARPU_ASSERT_MSG(block_father->id == STARPU_BLOCK_INTERFACE_ID, "%s can only be applied on a block data", __func__);
 	block_child->id = block_father->id;
@@ -133,7 +129,7 @@ void starpu_block_filter_vertical_block(void *father_interface, void *child_inte
 }
 
 void starpu_block_filter_vertical_block_shadow(void *father_interface, void *child_interface, STARPU_ATTRIBUTE_UNUSED struct starpu_data_filter *f,
-                                    unsigned id, unsigned nparts)
+					       unsigned id, unsigned nparts)
 {
         struct starpu_block_interface *block_father = (struct starpu_block_interface *) father_interface;
         struct starpu_block_interface *block_child = (struct starpu_block_interface *) child_interface;
@@ -146,14 +142,12 @@ void starpu_block_filter_vertical_block_shadow(void *father_interface, void *chi
         uint32_t nz = block_father->nz;
 	size_t elemsize = block_father->elemsize;
 
-	STARPU_ASSERT_MSG(nparts <= ny, "%u parts for %u elements", nparts, ny);
+	STARPU_ASSERT_MSG(nparts <= ny, "cannot split %u elements in %u parts", ny, nparts);
 
 	uint32_t child_ny;
 	size_t offset;
 
-	starpu_filter_nparts_compute_chunk_size_and_offset(ny, nparts, elemsize, id,
-						     block_father->ldy,
-						     &child_ny, &offset);
+	starpu_filter_nparts_compute_chunk_size_and_offset(ny, nparts, elemsize, id, block_father->ldy, &child_ny, &offset);
 
 	STARPU_ASSERT_MSG(block_father->id == STARPU_BLOCK_INTERFACE_ID, "%s can only be applied on a block data", __func__);
 	block_child->id = block_father->id;
@@ -174,7 +168,7 @@ void starpu_block_filter_vertical_block_shadow(void *father_interface, void *chi
 }
 
 void starpu_block_filter_depth_block(void *father_interface, void *child_interface, STARPU_ATTRIBUTE_UNUSED struct starpu_data_filter *f,
-                                    unsigned id, unsigned nparts)
+				     unsigned id, unsigned nparts)
 {
         struct starpu_block_interface *block_father = (struct starpu_block_interface *) father_interface;
         struct starpu_block_interface *block_child = (struct starpu_block_interface *) child_interface;
@@ -184,7 +178,7 @@ void starpu_block_filter_depth_block(void *father_interface, void *child_interfa
         uint32_t nz = block_father->nz;
 	size_t elemsize = block_father->elemsize;
 
-	STARPU_ASSERT_MSG(nparts <= nz, "%u parts for %u elements", nparts, nz);
+	STARPU_ASSERT_MSG(nparts <= nz, "cannot split %u elements in %u parts", nz, nparts);
 
 	uint32_t child_nz;
 	size_t offset;
@@ -211,7 +205,7 @@ void starpu_block_filter_depth_block(void *father_interface, void *child_interfa
 }
 
 void starpu_block_filter_depth_block_shadow(void *father_interface, void *child_interface, STARPU_ATTRIBUTE_UNUSED struct starpu_data_filter *f,
-                                    unsigned id, unsigned nparts)
+					    unsigned id, unsigned nparts)
 {
         struct starpu_block_interface *block_father = (struct starpu_block_interface *) father_interface;
         struct starpu_block_interface *block_child = (struct starpu_block_interface *) child_interface;
@@ -224,14 +218,12 @@ void starpu_block_filter_depth_block_shadow(void *father_interface, void *child_
         uint32_t nz = block_father->nz - 2 * shadow_size;
 	size_t elemsize = block_father->elemsize;
 
-	STARPU_ASSERT_MSG(nparts <= nz, "%u parts for %u elements", nparts, nz);
+	STARPU_ASSERT_MSG(nparts <= nz, "cannot split %u elements into %u parts", nz, nparts);
 
 	uint32_t child_nz;
 	size_t offset;
 
-	starpu_filter_nparts_compute_chunk_size_and_offset(nz, nparts, elemsize, id,
-						     block_father->ldz,
-						     &child_nz, &offset);
+	starpu_filter_nparts_compute_chunk_size_and_offset(nz, nparts, elemsize, id, block_father->ldz, &child_nz, &offset);
 
 	STARPU_ASSERT_MSG(block_father->id == STARPU_BLOCK_INTERFACE_ID, "%s can only be applied on a block data", __func__);
 	block_child->id = block_father->id;

+ 10 - 16
src/datawizard/interfaces/matrix_filters.c

@@ -3,7 +3,7 @@
  * Copyright (C) 2008-2014,2016,2019                      Université de Bordeaux
  * Copyright (C) 2012                                     Inria
  * Copyright (C) 2010                                     Mehdi Juhoor
- * Copyright (C) 2010,2011,2013,2015,2017                 CNRS
+ * Copyright (C) 2010,2011,2013,2015,2017,2019            CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -33,13 +33,12 @@ void starpu_matrix_filter_block(void *father_interface, void *child_interface, S
 	uint32_t ny = matrix_father->ny;
 	size_t elemsize = matrix_father->elemsize;
 
-	STARPU_ASSERT_MSG(nchunks <= nx, "%u parts for %u elements", nchunks, nx);
+	STARPU_ASSERT_MSG(nchunks <= nx, "cannot split %u elements in %u parts", nx, nchunks);
 
 	uint32_t child_nx;
 	size_t offset;
 
-	starpu_filter_nparts_compute_chunk_size_and_offset(nx, nchunks, elemsize, id, 1,
-						     &child_nx, &offset);
+	starpu_filter_nparts_compute_chunk_size_and_offset(nx, nchunks, elemsize, id, 1, &child_nx, &offset);
 
 	STARPU_ASSERT_MSG(matrix_father->id == STARPU_MATRIX_INTERFACE_ID, "%s can only be applied on a matrix data", __func__);
 
@@ -77,13 +76,12 @@ void starpu_matrix_filter_block_shadow(void *father_interface, void *child_inter
 	uint32_t ny = matrix_father->ny;
 	size_t elemsize = matrix_father->elemsize;
 
-	STARPU_ASSERT_MSG(nchunks <= nx, "%u parts for %u elements", nchunks, nx);
+	STARPU_ASSERT_MSG(nchunks <= nx, "cannot split %u elements in %u parts", nx, nchunks);
 
 	uint32_t child_nx;
 	size_t offset;
 
-	starpu_filter_nparts_compute_chunk_size_and_offset(nx, nchunks, elemsize, id, 1,
-						     &child_nx, &offset);
+	starpu_filter_nparts_compute_chunk_size_and_offset(nx, nchunks, elemsize, id, 1, &child_nx, &offset);
 
 	child_nx += 2 * shadow_size;
 
@@ -117,14 +115,12 @@ void starpu_matrix_filter_vertical_block(void *father_interface, void *child_int
 	uint32_t ny = matrix_father->ny;
 	size_t elemsize = matrix_father->elemsize;
 
-	STARPU_ASSERT_MSG(nchunks <= ny, "%u parts for %u elements", nchunks, ny);
+	STARPU_ASSERT_MSG(nchunks <= ny, "cannot split %u elements in %u parts", ny, nchunks);
 
 	uint32_t child_ny;
 	size_t offset;
 
-	starpu_filter_nparts_compute_chunk_size_and_offset(ny, nchunks, elemsize, id,
-						     matrix_father->ld,
-						     &child_ny, &offset);
+	starpu_filter_nparts_compute_chunk_size_and_offset(ny, nchunks, elemsize, id, matrix_father->ld, &child_ny, &offset);
 
 	STARPU_ASSERT_MSG(matrix_father->id == STARPU_MATRIX_INTERFACE_ID, "%s can only be applied on a matrix data", __func__);
 	matrix_child->id = matrix_father->id;
@@ -157,14 +153,12 @@ void starpu_matrix_filter_vertical_block_shadow(void *father_interface, void *ch
 	uint32_t ny = matrix_father->ny - 2 * shadow_size;
 	size_t elemsize = matrix_father->elemsize;
 
-	STARPU_ASSERT_MSG(nchunks <= ny, "%u parts for %u elements", nchunks, ny);
+	STARPU_ASSERT_MSG(nchunks <= ny, "cannot split %u elements in %u parts", ny, nchunks);
 
 	uint32_t child_ny;
 	size_t offset;
 
-	starpu_filter_nparts_compute_chunk_size_and_offset(ny, nchunks, elemsize, id,
-						     matrix_father->ld,
-						     &child_ny, &offset);
+	starpu_filter_nparts_compute_chunk_size_and_offset(ny, nchunks, elemsize, id, matrix_father->ld, &child_ny, &offset);
 	child_ny += 2 * shadow_size;
 
 	STARPU_ASSERT_MSG(matrix_father->id == STARPU_MATRIX_INTERFACE_ID, "%s can only be applied on a matrix data", __func__);
@@ -172,7 +166,7 @@ void starpu_matrix_filter_vertical_block_shadow(void *father_interface, void *ch
 	matrix_child->nx = nx;
 	matrix_child->ny = child_ny;
 	matrix_child->elemsize = elemsize;
-	STARPU_ASSERT_MSG(matrix_father->allocsize == matrix_father->nx * matrix_father->ny * matrix_father->elemsize, "partitioning matrix with non-trivial allocsize not supported yet, patch welcome");
+	STARPU_ASSERT_MSG(matrix_father->allocsize == matrix_father->nx * matrix_father->ny * matrix_father->elemsize, "partitioning matrix with non-trivial allocsize not supported yet, patch welcomed");
 	matrix_child->allocsize = matrix_child->nx * matrix_child->ny * elemsize;
 
 	/* is the information on this node valid ? */

+ 7 - 9
src/datawizard/interfaces/vector_filters.c

@@ -3,7 +3,7 @@
  * Copyright (C) 2008-2014,2016,2017,2019                 Université de Bordeaux
  * Copyright (C) 2012                                     Inria
  * Copyright (C) 2010                                     Mehdi Juhoor
- * Copyright (C) 2010,2011,2013,2015-2017                 CNRS
+ * Copyright (C) 2010,2011,2013,2015-2017,2019            CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -29,12 +29,11 @@ void starpu_vector_filter_block(void *father_interface, void *child_interface, S
 	uint32_t nx = vector_father->nx;
 	size_t elemsize = vector_father->elemsize;
 
-	STARPU_ASSERT_MSG(nchunks <= nx, "%u parts for %u elements", nchunks, nx);
+	STARPU_ASSERT_MSG(nchunks <= nx, "cannot split %u elements in %u parts", nx, nchunks);
 
 	uint32_t child_nx;
 	size_t offset;
-	starpu_filter_nparts_compute_chunk_size_and_offset(nx, nchunks, elemsize, id, 1,
-						     &child_nx, &offset);
+	starpu_filter_nparts_compute_chunk_size_and_offset(nx, nchunks, elemsize, id, 1, &child_nx, &offset);
 
 	STARPU_ASSERT_MSG(vector_father->id == STARPU_VECTOR_INTERFACE_ID, "%s can only be applied on a vector data", __func__);
 	vector_child->id = vector_father->id;
@@ -64,12 +63,11 @@ void starpu_vector_filter_block_shadow(void *father_interface, void *child_inter
 	uint32_t nx = vector_father->nx - 2 * shadow_size;
 	size_t elemsize = vector_father->elemsize;
 
-	STARPU_ASSERT_MSG(nchunks <= nx, "%u parts for %u elements", nchunks, nx);
+	STARPU_ASSERT_MSG(nchunks <= nx, "cannot split %u elements in %u parts", nx, nchunks);
 
 	uint32_t child_nx;
 	size_t offset;
-	starpu_filter_nparts_compute_chunk_size_and_offset(nx, nchunks, elemsize, id, 1,
-						     &child_nx, &offset);
+	starpu_filter_nparts_compute_chunk_size_and_offset(nx, nchunks, elemsize, id, 1, &child_nx, &offset);
 	child_nx += 2*shadow_size;
 
 	STARPU_ASSERT_MSG(vector_father->id == STARPU_VECTOR_INTERFACE_ID, "%s can only be applied on a vector data", __func__);
@@ -155,7 +153,7 @@ void starpu_vector_filter_list_long(void *father_interface, void *child_interfac
 	vector_child->id = vector_father->id;
 	vector_child->nx = chunk_size;
 	vector_child->elemsize = elemsize;
-	STARPU_ASSERT_MSG(vector_father->allocsize == vector_father->nx * vector_father->elemsize, "partitioning vector with non-trival allocsize not supported yet, patch welcome");
+	STARPU_ASSERT_MSG(vector_father->allocsize == vector_father->nx * vector_father->elemsize, "partitioning vector with non-trival allocsize not supported yet, patch welcomed");
 	vector_child->allocsize = vector_child->nx * elemsize;
 
 	if (vector_father->dev_handle)
@@ -188,7 +186,7 @@ void starpu_vector_filter_list(void *father_interface, void *child_interface, st
 	vector_child->id = vector_father->id;
 	vector_child->nx = chunk_size;
 	vector_child->elemsize = elemsize;
-	STARPU_ASSERT_MSG(vector_father->allocsize == vector_father->nx * vector_father->elemsize, "partitioning vector with non-trival allocsize not supported yet, patch welcome");
+	STARPU_ASSERT_MSG(vector_father->allocsize == vector_father->nx * vector_father->elemsize, "partitioning vector with non-trival allocsize not supported yet, patch welcomed");
 	vector_child->allocsize = vector_child->nx * elemsize;
 
 	if (vector_father->dev_handle)