소스 검색

The starpu_test_if_data_is_allocated_on_node makes it possible to check whether
a piece of data is allocated or not on a specific memory node.

Cédric Augonnet 15 년 전
부모
커밋
99cc9c0ec0

+ 2 - 0
include/starpu-data.h

@@ -66,6 +66,8 @@ unsigned starpu_get_worker_memory_node(unsigned workerid);
  * commit their changes in main memory (node 0). */
 void starpu_data_set_wb_mask(starpu_data_handle state, uint32_t wb_mask);
 
+unsigned starpu_test_if_data_is_allocated_on_node(starpu_data_handle handle, uint32_t memory_node);
+
 #ifdef __cplusplus
 }
 #endif

+ 5 - 0
src/datawizard/coherency.c

@@ -432,3 +432,8 @@ inline void set_data_requested_flag_if_needed(starpu_data_handle handle, uint32_
 
 //	pthread_spin_unlock(&handle->header_lock);
 }
+
+unsigned starpu_test_if_data_is_allocated_on_node(starpu_data_handle handle, uint32_t memory_node)
+{
+	return handle->per_node[memory_node].allocated;
+} 

+ 2 - 3
src/datawizard/interfaces/bcsr_filters.c

@@ -44,8 +44,7 @@ void starpu_canonical_block_filter_bcsr(starpu_filter *f __attribute__((unused))
 
 	/* actually create all the chunks */
 
-	/* XXX */
-	STARPU_ASSERT(root_handle->per_node[0].allocated);
+	STARPU_ASSERT(starpu_test_if_data_is_allocated_on_node(root_handle, 0));
 
 	/* each chunk becomes a small dense matrix */
 	unsigned chunk;
@@ -65,7 +64,7 @@ void starpu_canonical_block_filter_bcsr(starpu_filter *f __attribute__((unused))
 			local->ld = c;
 			local->elemsize = elemsize;
 
-			if (root_handle->per_node[node].allocated) {
+			if (starpu_test_if_data_is_allocated_on_node(root_handle, node)) {
 				struct starpu_bcsr_interface_s *node_interface =
 					starpu_data_get_interface_on_node(root_handle, node);
 				uint8_t *nzval = (uint8_t *)(node_interface->nzval);

+ 1 - 1
src/datawizard/interfaces/bcsr_interface.c

@@ -185,7 +185,7 @@ uintptr_t starpu_get_bcsr_local_nzval(starpu_data_handle handle)
 	unsigned node;
 	node = get_local_memory_node();
 
-	STARPU_ASSERT(handle->per_node[node].allocated);
+	STARPU_ASSERT(starpu_test_if_data_is_allocated_on_node(handle, node));
 
 	starpu_bcsr_interface_t *interface =
 		starpu_data_get_interface_on_node(handle, node);

+ 2 - 2
src/datawizard/interfaces/blas_filters.c

@@ -63,7 +63,7 @@ void starpu_block_filter_func(starpu_filter *f, starpu_data_handle root_handle)
 			local->ny = ny;
 			local->elemsize = elemsize;
 
-			if (root_handle->per_node[node].allocated) {
+			if (starpu_test_if_data_is_allocated_on_node(root_handle, node)) {
 				starpu_blas_interface_t *local_root =
 					starpu_data_get_interface_on_node(root_handle, node);
 
@@ -114,7 +114,7 @@ void starpu_vertical_block_filter_func(starpu_filter *f, starpu_data_handle root
 			local->ny = child_ny;
 			local->elemsize = elemsize;
 
-			if (root_handle->per_node[node].allocated) {
+			if (starpu_test_if_data_is_allocated_on_node(root_handle, node)) {
 				starpu_blas_interface_t *local_root =
 					starpu_data_get_interface_on_node(root_handle, node);
 

+ 2 - 2
src/datawizard/interfaces/blas_interface.c

@@ -195,7 +195,7 @@ uint32_t starpu_get_blas_local_ld(starpu_data_handle handle)
 	unsigned node;
 	node = get_local_memory_node();
 
-	STARPU_ASSERT(handle->per_node[node].allocated);
+	STARPU_ASSERT(starpu_test_if_data_is_allocated_on_node(handle, node));
 
 	starpu_blas_interface_t *interface =
 		starpu_data_get_interface_on_node(handle, node);
@@ -208,7 +208,7 @@ uintptr_t starpu_get_blas_local_ptr(starpu_data_handle handle)
 	unsigned node;
 	node = get_local_memory_node();
 
-	STARPU_ASSERT(handle->per_node[node].allocated);
+	STARPU_ASSERT(starpu_test_if_data_is_allocated_on_node(handle, node));
 
 	starpu_blas_interface_t *interface =
 		starpu_data_get_interface_on_node(handle, node);

+ 3 - 3
src/datawizard/interfaces/block_interface.c

@@ -197,7 +197,7 @@ uint32_t starpu_get_block_local_ldy(starpu_data_handle handle)
 	unsigned node;
 	node = get_local_memory_node();
 
-	STARPU_ASSERT(handle->per_node[node].allocated);
+	STARPU_ASSERT(starpu_test_if_data_is_allocated_on_node(handle, node));
 	
 	starpu_block_interface_t *interface =
 		starpu_data_get_interface_on_node(handle, node);
@@ -210,7 +210,7 @@ uint32_t starpu_get_block_local_ldz(starpu_data_handle handle)
 	unsigned node;
 	node = get_local_memory_node();
 
-	STARPU_ASSERT(handle->per_node[node].allocated);
+	STARPU_ASSERT(starpu_test_if_data_is_allocated_on_node(handle, node));
 
 	starpu_block_interface_t *interface =
 		starpu_data_get_interface_on_node(handle, node);
@@ -223,7 +223,7 @@ uintptr_t starpu_get_block_local_ptr(starpu_data_handle handle)
 	unsigned node;
 	node = get_local_memory_node();
 
-	STARPU_ASSERT(handle->per_node[node].allocated);
+	STARPU_ASSERT(starpu_test_if_data_is_allocated_on_node(handle, node));
 
 	starpu_block_interface_t *interface =
 		starpu_data_get_interface_on_node(handle, node);

+ 2 - 3
src/datawizard/interfaces/csr_filters.c

@@ -39,8 +39,7 @@ void starpu_vertical_block_filter_func_csr(starpu_filter *f, starpu_data_handle
 	/* actually create all the chunks */
 	uint32_t chunk_size = (nrow + nchunks - 1)/nchunks;
 
-	/* XXX */
-	STARPU_ASSERT(root_handle->per_node[0].allocated);
+	STARPU_ASSERT(starpu_test_if_data_is_allocated_on_node(root_handle, 0));
 	uint32_t *rowptr = root_interface->rowptr;
 
 	unsigned chunk;
@@ -68,7 +67,7 @@ void starpu_vertical_block_filter_func_csr(starpu_filter *f, starpu_data_handle
 			local->firstentry = local_firstentry;
 			local->elemsize = elemsize;
 
-			if (root_handle->per_node[node].allocated) {
+			if (starpu_test_if_data_is_allocated_on_node(root_handle, node)) {
 				local->rowptr = &local->rowptr[first_index];
 				local->colind = &local->colind[local_firstentry];
 				float *nzval = (float *)(local->nzval);

+ 3 - 3
src/datawizard/interfaces/csr_interface.c

@@ -159,7 +159,7 @@ uintptr_t starpu_get_csr_local_nzval(starpu_data_handle handle)
 	unsigned node;
 	node = get_local_memory_node();
 
-	STARPU_ASSERT(handle->per_node[node].allocated);
+	STARPU_ASSERT(starpu_test_if_data_is_allocated_on_node(handle, node));
 
 	starpu_csr_interface_t *interface =
 		starpu_data_get_interface_on_node(handle, node);
@@ -172,7 +172,7 @@ uint32_t *starpu_get_csr_local_colind(starpu_data_handle handle)
 	unsigned node;
 	node = get_local_memory_node();
 
-	STARPU_ASSERT(handle->per_node[node].allocated);
+	STARPU_ASSERT(starpu_test_if_data_is_allocated_on_node(handle, node));
 
 	starpu_csr_interface_t *interface =
 		starpu_data_get_interface_on_node(handle, node);
@@ -185,7 +185,7 @@ uint32_t *starpu_get_csr_local_rowptr(starpu_data_handle handle)
 	unsigned node;
 	node = get_local_memory_node();
 
-	STARPU_ASSERT(handle->per_node[node].allocated);
+	STARPU_ASSERT(starpu_test_if_data_is_allocated_on_node(handle, node));
 
 	starpu_csr_interface_t *interface =
 		starpu_data_get_interface_on_node(handle, node);

+ 4 - 4
src/datawizard/interfaces/vector_filters.c

@@ -57,7 +57,7 @@ void starpu_block_filter_func_vector(starpu_filter *f, starpu_data_handle root_h
 			local->nx = child_nx;
 			local->elemsize = elemsize;
 
-			if (root_handle->per_node[node].allocated) {
+			if (starpu_test_if_data_is_allocated_on_node(root_handle, node)) {
 				starpu_vector_interface_t *local_root =
 					starpu_data_get_interface_on_node(root_handle, node);
 
@@ -95,7 +95,7 @@ void starpu_divide_in_2_filter_func_vector(starpu_filter *f, starpu_data_handle
 		local->nx = length_first;
 		local->elemsize = elemsize;
 
-		if (root_handle->per_node[node].allocated) {
+		if (starpu_test_if_data_is_allocated_on_node(root_handle, node)) {
 			starpu_vector_interface_t *local_root =
 				starpu_data_get_interface_on_node(root_handle, node);
 
@@ -114,7 +114,7 @@ void starpu_divide_in_2_filter_func_vector(starpu_filter *f, starpu_data_handle
 		local->nx = nx - length_first;
 		local->elemsize = elemsize;
 
-		if (root_handle->per_node[node].allocated) {
+		if (starpu_test_if_data_is_allocated_on_node(root_handle, node)) {
 			starpu_vector_interface_t *local_root =
 				starpu_data_get_interface_on_node(root_handle, node);
 
@@ -157,7 +157,7 @@ void starpu_list_filter_func_vector(starpu_filter *f, starpu_data_handle root_ha
 			local->nx = chunk_size;
 			local->elemsize = elemsize;
 
-			if (root_handle->per_node[node].allocated) {
+			if (starpu_test_if_data_is_allocated_on_node(root_handle, node)) {
 				starpu_vector_interface_t *local_root =
 					starpu_data_get_interface_on_node(root_handle, node);
 

+ 1 - 1
src/datawizard/interfaces/vector_interface.c

@@ -171,7 +171,7 @@ uintptr_t starpu_get_vector_local_ptr(starpu_data_handle handle)
 	unsigned node;
 	node = get_local_memory_node();
 
-	STARPU_ASSERT(handle->per_node[node].allocated);
+	STARPU_ASSERT(starpu_test_if_data_is_allocated_on_node(handle, node));
 
 	starpu_vector_interface_t *interface =
 		starpu_data_get_interface_on_node(handle, node);