Export c++ headers in CMake installation. (#4897)

* 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>
This commit is contained in:
Jiaming Yuan
2019-10-06 23:53:09 -04:00
committed by GitHub
parent 4ab1df5fe6
commit 095de3bf5f
55 changed files with 240 additions and 209 deletions

View File

@@ -7,7 +7,7 @@
#include <thrust/iterator/counting_iterator.h>
#include "../../../src/common/device_helpers.cuh"
#include "../../../src/common/host_device_vector.h"
#include <xgboost/host_device_vector.h>
namespace xgboost {
namespace common {
@@ -58,7 +58,7 @@ void InitHostDeviceVector(size_t n, int device, HostDeviceVector<int> *v) {
void PlusOne(HostDeviceVector<int> *v) {
int device = v->DeviceIdx();
SetDevice(device);
thrust::transform(v->tbegin(), v->tend(), v->tbegin(),
thrust::transform(dh::tcbegin(*v), dh::tcend(*v), dh::tbegin(*v),
[=]__device__(unsigned int a){ return a + 1; });
}
@@ -69,7 +69,7 @@ void CheckDevice(HostDeviceVector<int>* v,
ASSERT_EQ(v->Size(), size);
SetDevice(v->DeviceIdx());
ASSERT_TRUE(thrust::equal(v->tcbegin(), v->tcend(),
ASSERT_TRUE(thrust::equal(dh::tcbegin(*v), dh::tcend(*v),
thrust::make_counting_iterator(first)));
ASSERT_TRUE(v->DeviceCanRead());
// ensure that the device has at most the access specified by access
@@ -77,7 +77,7 @@ void CheckDevice(HostDeviceVector<int>* v,
ASSERT_EQ(v->HostCanRead(), access == GPUAccess::kRead);
ASSERT_FALSE(v->HostCanWrite());
ASSERT_TRUE(thrust::equal(v->tbegin(), v->tend(),
ASSERT_TRUE(thrust::equal(dh::tbegin(*v), dh::tend(*v),
thrust::make_counting_iterator(first)));
ASSERT_TRUE(v->DeviceCanRead());
ASSERT_TRUE(v->DeviceCanWrite());

View File

@@ -4,7 +4,7 @@
#include <gtest/gtest.h>
#include <vector>
#include "../../../src/common/span.h"
#include <xgboost/span.h>
#include "test_span.h"
namespace xgboost {

View File

@@ -8,7 +8,7 @@
#include <thrust/execution_policy.h>
#include "../../../src/common/device_helpers.cuh"
#include "../../../src/common/span.h"
#include <xgboost/span.h>
#include "test_span.h"
namespace xgboost {

View File

@@ -4,8 +4,8 @@
#ifndef XGBOOST_TEST_SPAN_H_
#define XGBOOST_TEST_SPAN_H_
#include "../../include/xgboost/base.h"
#include "../../../src/common/span.h"
#include <xgboost/base.h>
#include <xgboost/span.h>
template <typename Iter>
XGBOOST_DEVICE void InitializeRange(Iter _begin, Iter _end) {

View File

@@ -1,10 +1,11 @@
#include <xgboost/base.h>
#include <gtest/gtest.h>
#include <xgboost/base.h>
#include <xgboost/span.h>
#include <xgboost/host_device_vector.h>
#include <vector>
#include "../../../src/common/host_device_vector.h"
#include "../../../src/common/transform.h"
#include "../../../src/common/span.h"
#include "../helpers.h"
#if defined(__CUDACC__)