File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
Filter options
libCacheSim/cache/eviction/GLCache Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
Original file line number Diff line number Diff line change @@ -293,10 +293,13 @@ static void prepare_training_data_per_package(cache_t *cache) {
293
293
// safe_call(XGDMatrixSetUIntInfo(learner->train_dm, "group", group,
294
294
// n_group));
295
295
296
- safe_call (XGDMatrixSetUIntInfo (learner -> train_dm , "group" ,
297
- & learner -> n_train_samples , 1 ));
298
- safe_call (XGDMatrixSetUIntInfo (learner -> valid_dm , "group" ,
299
- & learner -> n_valid_samples , 1 ));
296
+ // convert to array interface format
297
+ char str_n_valid_sample [128 ];
298
+ snprintf (str_n_valid_sample , sizeof (str_n_valid_sample ),
299
+ "{\"data\": [%llu],\"shape\": [1],\"typestr\": \"<u4\",\"version\": 3}" ,
300
+ (unsigned long long )(uintptr_t )& learner -> n_valid_samples );
301
+ safe_call (XGDMatrixSetUIntInfo (learner -> train_dm , "group" , str_n_valid_sample ));
302
+ safe_call (XGDMatrixSetUIntInfo (learner -> valid_dm , "group" , str_n_valid_sample ));
300
303
#endif
301
304
}
302
305
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ static int prepare_inference_data(cache_t *cache) {
41
41
42
42
feature_t * x = learner -> inference_x ;
43
43
44
- int n_segs = 0 ;
44
+ unsigned int n_segs = 0 ;
45
45
int inv_sample_ratio = MAX (params -> n_in_use_segs / N_INFERENCE_DATA , 1 );
46
46
int credit = inv_sample_ratio ;
47
47
// printf("%d %d\n", params->n_in_use_segs, inv_sample_ratio);
@@ -66,8 +66,13 @@ static int prepare_inference_data(cache_t *cache) {
66
66
}
67
67
safe_call (XGDMatrixCreateFromMat (learner -> inference_x , n_segs ,
68
68
learner -> n_feature , -2 , & learner -> inf_dm ));
69
-
70
- safe_call (XGDMatrixSetUIntInfo (learner -> inf_dm , "group" , & n_segs , 1 ));
69
+
70
+ // convert to array interface format
71
+ char str_n_segs [128 ];
72
+ snprintf (str_n_segs , sizeof (str_n_segs ),
73
+ "{\"data\": [%llu],\"shape\": [1],\"typestr\": \"<u4\",\"version\": 3}" ,
74
+ (unsigned long long )(uintptr_t )& n_segs );
75
+ safe_call (XGDMatrixSetInfoFromInterface (learner -> inf_dm , "group" , str_n_segs ));
71
76
72
77
return n_segs ;
73
78
}
You can’t perform that action at this time.
0 commit comments