瀏覽代碼

New starpu_memory_get_total function to get the size of a memory node.

Samuel Thibault 11 年之前
父節點
當前提交
fbd1b911e7

+ 1 - 0
ChangeLog

@@ -67,6 +67,7 @@ Small features:
     pinning.
   * New STARPU_DISABLE_KERNELS environment variable to disable actual kernel
     execution.
+  * New starpu_memory_get_total function to get the size of a memory node.
 
 Changes:
   * Fix of the livelock issue discovered while executing applications

+ 2 - 0
doc/doxygen/chapters/05check_list_performance.doxy

@@ -83,6 +83,8 @@ Talk about
 \ref STARPU_LIMIT_OPENCL_devid_MEM, \ref STARPU_LIMIT_OPENCL_MEM
 and \ref STARPU_LIMIT_CPU_MEM
 
+starpu_memory_get_total()
+
 starpu_memory_get_available()
 
 \section PerformanceModelCalibration Performance Model Calibration

+ 6 - 0
doc/doxygen/chapters/api/standard_memory_library.doxy

@@ -65,6 +65,12 @@ This function frees memory by specifying its size. The given
 flags should be consistent with the ones given to starpu_malloc_flags()
 when allocating the memory.
 
+\fn ssize_t starpu_memory_get_total(unsigned node)
+\ingroup API_Standard_Memory_Library
+If a memory limit is defined on the given node (see Section \ref
+HowToLimitMemoryPerNode), return the amount of total memory
+on the node. Otherwise return -1.
+
 \fn ssize_t starpu_memory_get_available(unsigned node)
 \ingroup API_Standard_Memory_Library
 If a memory limit is defined on the given node (see Section \ref

+ 2 - 1
include/starpu_stdlib.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2013  Université de Bordeaux 1
+ * Copyright (C) 2010-2014  Université de Bordeaux 1
  * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -36,6 +36,7 @@ int starpu_free(void *A);
 int starpu_malloc_flags(void **A, size_t dim, int flags);
 int starpu_free_flags(void *A, size_t dim, int flags);
 
+starpu_ssize_t starpu_memory_get_total(unsigned node);
 starpu_ssize_t starpu_memory_get_available(unsigned node);
 
 #ifdef __cplusplus

+ 8 - 0
src/datawizard/memory_manager.c

@@ -79,6 +79,14 @@ void _starpu_memory_manager_deallocate_size(size_t size, unsigned node)
 	STARPU_PTHREAD_MUTEX_UNLOCK(&lock_nodes[node]);
 }
 
+starpu_ssize_t starpu_memory_get_total(unsigned node)
+{
+	if (global_size[node] == 0)
+		return -1;
+	else
+		return global_size[node];
+}
+
 starpu_ssize_t starpu_memory_get_available(unsigned node)
 {
 	if (global_size[node] == 0)