浏览代码

- merge trunk

Olivier Aumage 11 年之前
父节点
当前提交
84fe3d8fb6
共有 3 个文件被更改,包括 14 次插入1 次删除
  1. 9 0
      src/core/workers.c
  2. 1 0
      src/core/workers.h
  3. 4 1
      src/datawizard/interfaces/data_interface.c

+ 9 - 0
src/core/workers.c

@@ -1951,3 +1951,12 @@ unsigned starpu_worker_get_sched_ctx_list(int workerid, unsigned **sched_ctxs)
 	}
 	}
 	return nsched_ctxs;
 	return nsched_ctxs;
 }
 }
+
+unsigned _starpu_worker_have_only_CPUs()
+{
+	int i;
+	for(i = 0; i < STARPU_NMAXWORKERS; i++)
+		if(config.workers[i].arch != STARPU_CPU_WORKER)
+			return 0;
+	return 1;
+}

+ 1 - 0
src/core/workers.h

@@ -435,4 +435,5 @@ unsigned _starpu_worker_mutex_is_sched_mutex(int workerid, starpu_pthread_mutex_
 
 
 int _starpu_worker_get_nsched_ctxs(int workerid);
 int _starpu_worker_get_nsched_ctxs(int workerid);
 
 
+unsigned _starpu_worker_have_only_CPUs(void);
 #endif // __WORKERS_H__
 #endif // __WORKERS_H__

+ 4 - 1
src/datawizard/interfaces/data_interface.c

@@ -615,8 +615,11 @@ static void _starpu_data_unregister(starpu_data_handle_t handle, unsigned cohere
 	STARPU_ASSERT_MSG(handle->nchildren == 0, "data %p needs to be unpartitioned before unregistration", handle);
 	STARPU_ASSERT_MSG(handle->nchildren == 0, "data %p needs to be unpartitioned before unregistration", handle);
 	STARPU_ASSERT(!(nowait && handle->busy_count != 0));
 	STARPU_ASSERT(!(nowait && handle->busy_count != 0));
 
 
+	/* no need to forbid the unregister in a task or callback when we have only CPUs,
+	   the data is on the RAM anyway */
+	unsigned only_cpus = _starpu_worker_have_only_CPUs();
 	int sequential_consistency = handle->sequential_consistency;
 	int sequential_consistency = handle->sequential_consistency;
-	if (sequential_consistency && !nowait)
+	if (sequential_consistency && !nowait && !only_cpus)
 	{
 	{
 		STARPU_ASSERT_MSG(_starpu_worker_may_perform_blocking_calls(), "starpu_data_unregister must not be called from a task or callback, perhaps you can use starpu_data_unregister_submit instead");
 		STARPU_ASSERT_MSG(_starpu_worker_may_perform_blocking_calls(), "starpu_data_unregister must not be called from a task or callback, perhaps you can use starpu_data_unregister_submit instead");