40
40
#include "client.h"
41
41
#include "utlist.h"
42
42
43
- #define ENV_NVSHARE_ENABLE_SINGLE_OVERSUB "NVSHARE_ENABLE_SINGLE_OVERSUB"
44
- #define ENV_NVSHARE_HIDE_MEMINFO_RESERVE_MIB "NVSHARE_HIDE_MEMINFO_RESERVE_MIB "
43
+ #define ENV_NVSHARE_ENABLE_SINGLE_OVERSUB "NVSHARE_ENABLE_SINGLE_OVERSUB"
44
+ #define ENV_NVSHARE_USE_ORIGINAL_MEMINFO "NVSHARE_USE_ORIGINAL_MEMINFO "
45
45
46
46
#define MEMINFO_RESERVE_MIB 1536 /* MiB */
47
47
#define KERN_SYNC_DURATION_BIG 10 /* seconds */
@@ -85,7 +85,7 @@ int pending_kernel_window = 1;
85
85
pthread_mutex_t kcount_mutex ;
86
86
87
87
int enable_single_oversub = 0 ;
88
- int hide_meminfo_reserve_mib = 0 ;
88
+ int use_original_meminfo = 0 ;
89
89
int nvml_ok = 1 ;
90
90
91
91
/* Representation of a CUDA memory allocation */
@@ -109,7 +109,6 @@ static void bootstrap_cuda(void)
109
109
void * cuda_handle ;
110
110
void * nvml_handle ;
111
111
112
-
113
112
true_or_exit (pthread_mutex_init (& kcount_mutex , NULL ) == 0 );
114
113
115
114
nvml_handle = dlopen ("libnvidia-ml.so.1" , RTLD_LAZY );
@@ -332,10 +331,10 @@ static void initialize_libnvshare(void)
332
331
log_warn ("Enabling GPU memory oversubscription for this"
333
332
" application" );
334
333
}
335
- value = getenv (ENV_NVSHARE_HIDE_MEMINFO_RESERVE_MIB );
334
+ value = getenv (ENV_NVSHARE_USE_ORIGINAL_MEMINFO );
336
335
if (value != NULL ) {
337
- hide_meminfo_reserve_mib = 1 ;
338
- log_warn ("Hiding %d MiB from CUDA memory info " , MEMINFO_RESERVE_MIB );
336
+ use_original_meminfo = 1 ;
337
+ log_warn ("Using original mem info without removing %d MiB " , MEMINFO_RESERVE_MIB );
339
338
}
340
339
341
340
bootstrap_cuda ();
@@ -786,11 +785,9 @@ CUresult cuMemGetInfo(size_t *free, size_t *total)
786
785
* To avoid internal thrashing, we empirically choose a sane value for
787
786
* MEMINFO_RESERVE_MIB.
788
787
*/
789
- reserve_mib = (MEMINFO_RESERVE_MIB ) MiB ;
790
- * free = * total - (size_t ) reserve_mib ;
791
-
792
- if (hide_meminfo_reserve_mib == 1 ) {
793
- * total -= reserve_mib ;
788
+ if (use_original_meminfo == 0 ) {
789
+ reserve_mib = (MEMINFO_RESERVE_MIB ) MiB ;
790
+ * free = * total - (size_t ) reserve_mib ;
794
791
}
795
792
796
793
log_debug ("nvshare's cuMemGetInfo returning free=%.2f MiB,"
0 commit comments