Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cfd9956

Browse filesBrowse files
authored
update xgboost inferface for GLCache (#122)
1 parent 217f868 commit cfd9956
Copy full SHA for cfd9956

File tree

Expand file treeCollapse file tree

2 files changed

+15
-7
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+15
-7
lines changed

‎libCacheSim/cache/eviction/GLCache/dataPrep.c

Copy file name to clipboardExpand all lines: libCacheSim/cache/eviction/GLCache/dataPrep.c
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,13 @@ static void prepare_training_data_per_package(cache_t *cache) {
293293
// safe_call(XGDMatrixSetUIntInfo(learner->train_dm, "group", group,
294294
// n_group));
295295

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));
300303
#endif
301304
}
302305

‎libCacheSim/cache/eviction/GLCache/inference.c

Copy file name to clipboardExpand all lines: libCacheSim/cache/eviction/GLCache/inference.c
+8-3Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static int prepare_inference_data(cache_t *cache) {
4141

4242
feature_t *x = learner->inference_x;
4343

44-
int n_segs = 0;
44+
unsigned int n_segs = 0;
4545
int inv_sample_ratio = MAX(params->n_in_use_segs / N_INFERENCE_DATA, 1);
4646
int credit = inv_sample_ratio;
4747
// printf("%d %d\n", params->n_in_use_segs, inv_sample_ratio);
@@ -66,8 +66,13 @@ static int prepare_inference_data(cache_t *cache) {
6666
}
6767
safe_call(XGDMatrixCreateFromMat(learner->inference_x, n_segs,
6868
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));
7176

7277
return n_segs;
7378
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.