浏览代码

Allow to use ~0 as broadcast wt_mask

Samuel Thibault 14 年之前
父节点
当前提交
ac44749ef2
共有 3 个文件被更改,包括 3 次插入10 次删除
  1. 1 0
      src/datawizard/coherency.c
  2. 1 1
      src/datawizard/write_back.c
  3. 1 9
      tests/opt/datawizard/wt_broadcast.c

+ 1 - 0
src/datawizard/coherency.c

@@ -469,6 +469,7 @@ void _starpu_release_data_on_node(starpu_data_handle handle, uint32_t default_wt
 {
 	uint32_t wt_mask;
 	wt_mask = default_wt_mask | handle->wt_mask;
+	wt_mask &= (1<<_starpu_get_memory_nodes_count())-1;
 
 	/* Note that it is possible that there is no valid copy of the data (if
 	 * starpu_data_invalidate was called for instance). In that case, we do

+ 1 - 1
src/datawizard/write_back.c

@@ -37,7 +37,7 @@ void _starpu_write_through_data(starpu_data_handle handle, uint32_t requesting_n
 
 	/* first commit all changes onto the nodes specified by the mask */
 	uint32_t node;
-	for (node = 0; node < STARPU_MAXNODES; node++)
+	for (node = 0; node < _starpu_get_memory_nodes_count(); node++)
 	{
 		if (write_through_mask & (1<<node)) {
 			/* we need to commit the buffer on that node */

+ 1 - 9
tests/opt/datawizard/wt_broadcast.c

@@ -92,16 +92,8 @@ int main(int argc, char **argv)
 
 	/* Create a mask with all the memory nodes, so that we can ask StarPU
 	 * to broadcast the handle whenever it is modified. */
-	uint32_t wt_mask = 0;
 
-	int id;
-	for (id = 0; id < nworkers; id++)
-	{
-		unsigned node = starpu_worker_get_memory_node(id);
-		wt_mask |= (1<<node);
-	}
-
-	starpu_data_set_wt_mask(handle, wt_mask);
+	starpu_data_set_wt_mask(handle, ~0);
 
 	unsigned ntasks = 1024;
 	unsigned nloops = 16;