* Move get transpose into cc. * Clean up headers in host device vector, remove thrust dependency. * Move span and host device vector into public. * Install c++ headers. * Short notes for c and c++. Co-Authored-By: Philip Hyunsu Cho <chohyu01@cs.washington.edu>
28 lines
888 B
Plaintext
28 lines
888 B
Plaintext
// Copyright by Contributors
|
|
#include <xgboost/linear_updater.h>
|
|
#include <xgboost/gbm.h>
|
|
|
|
#include "../helpers.h"
|
|
#include "../../../src/gbm/gblinear_model.h"
|
|
|
|
namespace xgboost {
|
|
|
|
TEST(Linear, GPUCoordinate) {
|
|
auto mat = xgboost::CreateDMatrix(10, 10, 0);
|
|
auto lparam = CreateEmptyGenericParam(GPUIDX);
|
|
auto updater = std::unique_ptr<xgboost::LinearUpdater>(
|
|
xgboost::LinearUpdater::Create("gpu_coord_descent", &lparam));
|
|
updater->Configure({{"eta", "1."}});
|
|
xgboost::HostDeviceVector<xgboost::GradientPair> gpair(
|
|
(*mat)->Info().num_row_, xgboost::GradientPair(-5, 1.0));
|
|
xgboost::gbm::GBLinearModel model;
|
|
model.param.num_feature = (*mat)->Info().num_col_;
|
|
model.param.num_output_group = 1;
|
|
model.LazyInitModel();
|
|
updater->Update(&gpair, (*mat).get(), &model, gpair.Size());
|
|
|
|
ASSERT_EQ(model.bias()[0], 5.0f);
|
|
|
|
delete mat;
|
|
}
|
|
} // namespace xgboost |