Objective function evaluation on GPU with minimal PCIe transfers (#2935)
* Added GPU objective function and no-copy interface. - xgboost::HostDeviceVector<T> syncs automatically between host and device - no-copy interfaces have been added - default implementations just sync the data to host and call the implementations with std::vector - GPU objective function, predictor, histogram updater process data directly on GPU
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#include <xgboost/objective.h>
|
||||
#include <dmlc/registry.h>
|
||||
|
||||
#include "../common/host_device_vector.h"
|
||||
|
||||
namespace dmlc {
|
||||
DMLC_REGISTRY_ENABLE(::xgboost::ObjFunctionReg);
|
||||
} // namespace dmlc
|
||||
@@ -22,12 +24,27 @@ ObjFunction* ObjFunction::Create(const std::string& name) {
|
||||
}
|
||||
return (e->body)();
|
||||
}
|
||||
|
||||
void ObjFunction::GetGradient(HostDeviceVector<bst_float>* preds,
|
||||
const MetaInfo& info,
|
||||
int iteration,
|
||||
HostDeviceVector<bst_gpair>* out_gpair) {
|
||||
GetGradient(preds->data_h(), info, iteration, &out_gpair->data_h());
|
||||
}
|
||||
|
||||
void ObjFunction::PredTransform(HostDeviceVector<bst_float> *io_preds) {
|
||||
PredTransform(&io_preds->data_h());
|
||||
}
|
||||
|
||||
} // namespace xgboost
|
||||
|
||||
namespace xgboost {
|
||||
namespace obj {
|
||||
// List of files that will be force linked in static links.
|
||||
DMLC_REGISTRY_LINK_TAG(regression_obj);
|
||||
#ifdef XGBOOST_USE_CUDA
|
||||
DMLC_REGISTRY_LINK_TAG(regression_obj_gpu);
|
||||
#endif
|
||||
DMLC_REGISTRY_LINK_TAG(multiclass_obj);
|
||||
DMLC_REGISTRY_LINK_TAG(rank_obj);
|
||||
} // namespace obj
|
||||
|
||||
Reference in New Issue
Block a user