Просмотр исходного кода

Set diduse before calling the callback, for the case where the callback releases the data which was lazily unregistered

Samuel Thibault лет назад: 8
Родитель
Сommit
ef31b0b57f
2 измененных файлов с 9 добавлено и 9 удалено
  1. 7 7
      src/datawizard/malloc.c
  2. 2 2
      src/datawizard/user_interactions.c

+ 7 - 7
src/datawizard/malloc.c

@@ -28,7 +28,7 @@
 #include <datawizard/malloc.h>
 #include <core/simgrid.h>
 
-#ifdef STARPU_SIMGRID
+#if 1 //def STARPU_SIMGRID
 #include <sys/mman.h>
 #include <fcntl.h>
 #endif
@@ -46,7 +46,7 @@ static int disable_pinning;
 static int malloc_on_node_default_flags[STARPU_MAXNODES];
 
 /* This file is used for implementing "folded" allocation */
-#ifdef STARPU_SIMGRID
+#if 1 //def STARPU_SIMGRID
 static int bogusfile = -1;
 static unsigned long _starpu_malloc_simulation_fold;
 #endif
@@ -221,7 +221,7 @@ int starpu_malloc_flags(void **A, size_t dim, int flags)
 #endif /* STARPU_SIMGRID */
 	}
 
-#ifdef STARPU_SIMGRID
+#if 1 //def STARPU_SIMGRID
 	if (flags & STARPU_MALLOC_SIMULATION_FOLDED)
 	{
 		/* Use "folded" allocation: the same file is mapped several
@@ -311,7 +311,7 @@ int starpu_malloc_flags(void **A, size_t dim, int flags)
 				ret = -ENOMEM;
 		}
 
-#if defined(STARPU_SIMGRID) || defined(STARPU_USE_CUDA)
+#if  1 //defined(STARPU_SIMGRID) || defined(STARPU_USE_CUDA)
 end:
 #endif
 	if (ret == 0)
@@ -370,7 +370,7 @@ static struct starpu_codelet free_pinned_cl =
 
 int starpu_free_flags(void *A, size_t dim, int flags)
 {
-#ifndef STARPU_SIMGRID
+#if 0 //ndef STARPU_SIMGRID
 	if (flags & STARPU_MALLOC_PINNED && disable_pinning <= 0 && STARPU_RUNNING_ON_VALGRIND == 0)
 	{
 		if (_starpu_can_submit_cuda_task())
@@ -437,7 +437,7 @@ int starpu_free_flags(void *A, size_t dim, int flags)
 	}
 #endif /* STARPU_SIMGRID */
 
-#ifdef STARPU_SIMGRID
+#if 1 //def STARPU_SIMGRID
 	if (flags & STARPU_MALLOC_SIMULATION_FOLDED)
 	{
 		munmap(A, dim);
@@ -805,7 +805,7 @@ _starpu_malloc_init(unsigned dst_node)
 	STARPU_PTHREAD_MUTEX_INIT(&chunk_mutex[dst_node], NULL);
 	disable_pinning = starpu_get_env_number("STARPU_DISABLE_PINNING");
 	malloc_on_node_default_flags[dst_node] = STARPU_MALLOC_PINNED | STARPU_MALLOC_COUNT;
-#ifdef STARPU_SIMGRID
+#if 1 //def STARPU_SIMGRID
 	/* Reasonably "costless" */
 	_starpu_malloc_simulation_fold = starpu_get_env_number_default("STARPU_MALLOC_SIMULATION_FOLD", 1) << 20;
 #endif

+ 2 - 2
src/datawizard/user_interactions.c

@@ -80,13 +80,13 @@ static void _starpu_data_acquire_fetch_data_callback(void *arg)
 	if (wrapper->post_sync_task)
 		_starpu_add_post_sync_tasks(wrapper->post_sync_task, handle);
 
-	wrapper->callback(wrapper->callback_arg);
-
 	struct _starpu_data_replicate *replicate =
 		wrapper->node >= 0 ? &handle->per_node[wrapper->node] : NULL;
 	if (replicate && replicate->mc)
 		replicate->mc->diduse = 1;
 
+	wrapper->callback(wrapper->callback_arg);
+
 	free(wrapper);
 }