File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 41
41
#include "utlist.h"
42
42
43
43
#define ENV_NVSHARE_ENABLE_SINGLE_OVERSUB "NVSHARE_ENABLE_SINGLE_OVERSUB"
44
+ #define ENV_NVSHARE_HIDE_MEMINFO_RESERVE_MIB "NVSHARE_HIDE_MEMINFO_RESERVE_MIB"
44
45
45
46
#define MEMINFO_RESERVE_MIB 1536 /* MiB */
46
47
#define KERN_SYNC_DURATION_BIG 10 /* seconds */
@@ -84,6 +85,7 @@ int pending_kernel_window = 1;
84
85
pthread_mutex_t kcount_mutex ;
85
86
86
87
int enable_single_oversub = 0 ;
88
+ int hide_meminfo_reserve_mib = 0 ;
87
89
int nvml_ok = 1 ;
88
90
89
91
/* Representation of a CUDA memory allocation */
@@ -330,6 +332,11 @@ static void initialize_libnvshare(void)
330
332
log_warn ("Enabling GPU memory oversubscription for this"
331
333
" application" );
332
334
}
335
+ value = getenv (ENV_NVSHARE_HIDE_MEMINFO_RESERVE_MIB );
336
+ if (value != NULL ) {
337
+ hide_meminfo_reserve_mib = 1 ;
338
+ log_warn ("Hiding %d MiB from CUDA memory info" , MEMINFO_RESERVE_MIB );
339
+ }
333
340
334
341
bootstrap_cuda ();
335
342
}
@@ -782,6 +789,10 @@ CUresult cuMemGetInfo(size_t *free, size_t *total)
782
789
reserve_mib = (MEMINFO_RESERVE_MIB ) MiB ;
783
790
* free = * total - (size_t ) reserve_mib ;
784
791
792
+ if (hide_meminfo_reserve_mib == 1 ) {
793
+ * total -= reserve_mib ;
794
+ }
795
+
785
796
log_debug ("nvshare's cuMemGetInfo returning free=%.2f MiB,"
786
797
" total=%.2f MiB" , toMiB (* free ), toMiB (* total ));
787
798
return result ;
You can’t perform that action at this time.
0 commit comments