Explorar el Código

Fix pingpong benchmark termination: it supposed to take the handle reference before calling _starpu_fetch_data_on_node

Samuel Thibault hace 13 años
padre
commit
e095444a11
Se han modificado 2 ficheros con 16 adiciones y 1 borrados
  1. 3 0
      src/datawizard/coherency.h
  2. 13 1
      src/debug/latency.c

+ 3 - 0
src/datawizard/coherency.h

@@ -217,9 +217,12 @@ struct starpu_data_state_t {
 
 void _starpu_display_msi_stats(void);
 
+/* This does not take a reference on the handle, the caller has to do it,
+ * e.g. through _starpu_attempt_to_submit_data_request_from_apps() */
 int _starpu_fetch_data_on_node(struct starpu_data_state_t *state, struct starpu_data_replicate_s *replicate,
 				starpu_access_mode mode, unsigned is_prefetch,
 				void (*callback_func)(void *), void *callback_arg);
+/* This releases a reference on the handle */
 void _starpu_release_data_on_node(struct starpu_data_state_t *state, uint32_t default_wt_mask,
 				struct starpu_data_replicate_s *replicate);
 

+ 13 - 1
src/debug/latency.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010  Université de Bordeaux 1
+ * Copyright (C) 2010-2011  Université de Bordeaux 1
  * Copyright (C) 2010  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -29,12 +29,24 @@ void _starpu_benchmark_ping_pong(starpu_data_handle handle,
 	{
 		int ret;
 
+		_starpu_spin_lock(&handle->header_lock);
+		handle->refcnt++;
+		handle->busy_count++;
+		_starpu_spin_unlock(&handle->header_lock);
+
 		struct starpu_data_replicate_s *replicate_0 = &handle->per_node[node0];
 		ret = _starpu_fetch_data_on_node(handle, replicate_0, STARPU_RW, 0, NULL, NULL);
 		STARPU_ASSERT(!ret);
+		_starpu_release_data_on_node(handle, 0, replicate_0);
+
+		_starpu_spin_lock(&handle->header_lock);
+		handle->refcnt++;
+		handle->busy_count++;
+		_starpu_spin_unlock(&handle->header_lock);
 
 		struct starpu_data_replicate_s *replicate_1 = &handle->per_node[node1];
 		ret = _starpu_fetch_data_on_node(handle, replicate_1, STARPU_RW, 0, NULL, NULL);
 		STARPU_ASSERT(!ret);
+		_starpu_release_data_on_node(handle, 0, replicate_1);
 	}
 }