Browse Source

Fix automatic RAM allocation on CUDA without memcpy_peer: we can not allocated pinned memory, since that requires waiting for a task, and starpu_malloc_on_node is called with a spinlock locked.

Samuel Thibault 12 years ago
parent
commit
49b7fe4fd2
1 changed files with 14 additions and 2 deletions
  1. 14 2
      src/datawizard/malloc.c

+ 14 - 2
src/datawizard/malloc.c

@@ -370,7 +370,13 @@ starpu_malloc_on_node(unsigned dst_node, size_t size)
 	{
 	{
 		case STARPU_CPU_RAM:
 		case STARPU_CPU_RAM:
 		{
 		{
-			starpu_malloc((void**) &addr, size);
+			starpu_malloc_flags((void**) &addr, size,
+#if defined(STARPU_USE_CUDA) && !defined(HAVE_CUDA_MEMCPY_PEER) && !defined(STARPU_SIMGRID)
+					0
+#else
+					STARPU_MALLOC_PINNED
+#endif
+					);
 			break;
 			break;
 		}
 		}
 #if defined(STARPU_USE_CUDA) || defined(STARPU_SIMGRID)
 #if defined(STARPU_USE_CUDA) || defined(STARPU_SIMGRID)
@@ -462,7 +468,13 @@ starpu_free_on_node(unsigned dst_node, uintptr_t addr, size_t size)
 	switch(kind)
 	switch(kind)
 	{
 	{
 		case STARPU_CPU_RAM:
 		case STARPU_CPU_RAM:
-			starpu_free((void*)addr);
+			starpu_free_flags((void*)addr, size,
+#if defined(STARPU_USE_CUDA) && !defined(HAVE_CUDA_MEMCPY_PEER) && !defined(STARPU_SIMGRID)
+					0
+#else
+					STARPU_MALLOC_PINNED
+#endif
+					);
 			break;
 			break;
 #if defined(STARPU_USE_CUDA) || defined(STARPU_SIMGRID)
 #if defined(STARPU_USE_CUDA) || defined(STARPU_SIMGRID)
 		case STARPU_CUDA_RAM:
 		case STARPU_CUDA_RAM: