Przeglądaj źródła

Fix a confusion when defining a filter that manipulates a piece of data with a
CSR interface: the nzval pointer must be computed using the root handle, not
the uninitialized structures describing the children.

Cédric Augonnet 15 lat temu
rodzic
commit
979164bb41

+ 6 - 4
src/datawizard/interfaces/csr_filters.c

@@ -62,16 +62,18 @@ void starpu_vertical_block_filter_func_csr(starpu_filter *f, starpu_data_handle
 			starpu_csr_interface_t *local = 
 				starpu_data_get_interface_on_node(chunk_handle, node);
 
+			starpu_csr_interface_t *root_local = 
+				starpu_data_get_interface_on_node(root_handle, node);
+
 			local->nnz = local_nnz;
 			local->nrow = child_nrow;
 			local->firstentry = local_firstentry;
 			local->elemsize = elemsize;
 
 			if (starpu_test_if_data_is_allocated_on_node(root_handle, node)) {
-				local->rowptr = &local->rowptr[first_index];
-				local->colind = &local->colind[local_firstentry];
-				char *nzval = (char *)(local->nzval);
-				local->nzval = (uintptr_t)&nzval[local_firstentry * elemsize];
+				local->rowptr = &root_local->rowptr[first_index];
+				local->colind = &root_local->colind[local_firstentry];
+				local->nzval = root_local->nzval + local_firstentry * elemsize;
 			}
 		}
 	}

+ 2 - 0
src/datawizard/interfaces/csr_interface.c

@@ -103,6 +103,8 @@ void starpu_register_csr_data(starpu_data_handle *handleptr, uint32_t home_node,
 		.elemsize = elemsize
 	};
 
+	fprintf(stderr, "ROWPTR: %p NZVAL %p\n", rowptr, nzval);
+
 	_starpu_register_data_handle(handleptr, home_node, &interface, &interface_csr_ops);
 }