Bläddra i källkod

Fix count of number of valid copies. Take into account the case where a memory node has all the bits, but fragmented.

Samuel Thibault 14 år sedan
förälder
incheckning
93ea7f7cbd
1 ändrade filer med 8 tillägg och 1 borttagningar
  1. 8 1
      src/datawizard/filters.c

+ 8 - 1
src/datawizard/filters.c

@@ -296,6 +296,7 @@ void starpu_data_unpartition(starpu_data_handle root_handle, uint32_t gathering_
 			struct starpu_data_replicate_s *local = &root_handle->children[child].per_node[node];
 
 			if (local->state == STARPU_INVALID) {
+				/* One of the bits is missing */
 				isvalid = 0; 
 			}
 
@@ -304,13 +305,19 @@ void starpu_data_unpartition(starpu_data_handle root_handle, uint32_t gathering_
 				_starpu_request_mem_chunk_removal(&root_handle->children[child], node);
 		}
 
+		if (!root_handle->per_node[node].allocated)
+			/* Even if we have all the bits, if we don't have the
+			 * whole data, it's not valid */
+			isvalid = 0;
+
 		if (!isvalid && root_handle->per_node[node].allocated && root_handle->per_node[node].automatically_allocated)
 			/* free the data copy in a lazy fashion */
 			_starpu_request_mem_chunk_removal(root_handle, node);
 
 		/* if there was no invalid copy, the node still has a valid copy */
 		still_valid[node] = isvalid;
-		nvalids++;
+		if (isvalid)
+			nvalids++;
 	}
 
 	/* either shared or owned */