-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DeviceSpan in HostDeviceVector, use it in regression obj.
- Loading branch information
1 parent
c8ad315
commit dbd61c2
Showing
5 changed files
with
51 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/*! | ||
* Copyright 2018 XGBoost contributors | ||
*/ | ||
|
||
#include <gtest/gtest.h> | ||
#include "../../../src/common/host_device_vector.h" | ||
#include "../../../src/common/device_helpers.cuh" | ||
|
||
namespace xgboost { | ||
namespace common { | ||
|
||
TEST(HostDeviceVector, Span) { | ||
HostDeviceVector<float> vec {1.0f, 2.0f, 3.0f, 4.0f}; | ||
vec.Reshard(GPUSet{0, 1}); | ||
auto span = vec.DeviceSpan(0); | ||
ASSERT_EQ(vec.Size(), span.size()); | ||
ASSERT_EQ(vec.DevicePointer(0), span.data()); | ||
} | ||
|
||
} // namespace common | ||
} // namespace xgboost | ||
|