Skip to content

Commit

Permalink
Move get thread local into API guards.
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Feb 11, 2020
1 parent cbd5a3c commit bea3258
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/c_api/c_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <string>
#include <memory>


#include "xgboost/data.h"
#include "xgboost/host_device_vector.h"
#include "xgboost/learner.h"
Expand Down Expand Up @@ -554,10 +553,10 @@ XGB_DLL int XGBoosterPredict(BoosterHandle handle,
int32_t training,
xgboost::bst_ulong *len,
const bst_float **out_result) {
HostDeviceVector<bst_float>& preds =
XGBAPIThreadLocalStore::Get()->ret_vec_float;
API_BEGIN();
CHECK_HANDLE();
HostDeviceVector<bst_float>& preds =
XGBAPIThreadLocalStore::Get()->ret_vec_float;
auto *bst = static_cast<Learner*>(handle);
bst->Predict(
*static_cast<std::shared_ptr<DMatrix>*>(dmat),
Expand Down

0 comments on commit bea3258

Please sign in to comment.