[GPU-Plugin] Integration of a faster version of grow_gpu plugin into mainstream (#2360)
* Integrating a faster version of grow_gpu plugin 1. Removed the older files to reduce duplication 2. Moved all of the grow_gpu files under 'exact' folder 3. All of them are inside 'exact' namespace to avoid any conflicts 4. Fixed a bug in benchmark.py while running only 'grow_gpu' plugin 5. Added cub and googletest submodules to ease integration and unit-testing 6. Updates to CMakeLists.txt to directly build cuda objects into libxgboost * Added support for building gpu plugins through make flow 1. updated makefile and config.mk to add right targets 2. added unit-tests for gpu exact plugin code * 1. Added support for building gpu plugin using 'make' flow as well 2. Updated instructions for building and testing gpu plugin * Fix travis-ci errors for PR#2360 1. lint errors on unit-tests 2. removed googletest, instead depended upon dmlc-core provide gtest cache * Some more fixes to travis-ci lint failures PR#2360 * Added Rory's copyrights to the files containing code from both. * updated copyright statement as per Rory's request * moved the static datasets into a script to generate them at runtime * 1. memory usage print when silent=0 2. tests/ and test/ folder organization 3. removal of the dependency of googletest for just building xgboost 4. coding style updates for .cuh as well * Fixes for compilation warnings * add cuda object files as well when JVM_BINDINGS=ON
This commit is contained in:
64
plugin/updater_gpu/test/cpp/node.cu
Normal file
64
plugin/updater_gpu/test/cpp/node.cu
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "gtest/gtest.h"
|
||||
#include "../../src/exact/node.cuh"
|
||||
|
||||
|
||||
namespace xgboost {
|
||||
namespace tree {
|
||||
namespace exact {
|
||||
|
||||
TEST(Split, Test) {
|
||||
Split s;
|
||||
EXPECT_FALSE(s.isSplittable(0.5f));
|
||||
s.score = 1.f;
|
||||
EXPECT_FALSE(s.isSplittable(0.5f));
|
||||
s.index = 2;
|
||||
EXPECT_TRUE(s.isSplittable(0.5f));
|
||||
EXPECT_FALSE(s.isSplittable(1.5f));
|
||||
}
|
||||
|
||||
TEST(Node, Test) {
|
||||
Node<int16_t> n;
|
||||
EXPECT_TRUE(n.isUnused());
|
||||
EXPECT_FALSE(n.isLeaf());
|
||||
EXPECT_TRUE(n.isDefaultLeft());
|
||||
n.dir = RightDir;
|
||||
EXPECT_TRUE(n.isUnused());
|
||||
EXPECT_FALSE(n.isLeaf());
|
||||
EXPECT_FALSE(n.isDefaultLeft());
|
||||
n.id = 123;
|
||||
EXPECT_FALSE(n.isUnused());
|
||||
EXPECT_TRUE(n.isLeaf());
|
||||
EXPECT_FALSE(n.isDefaultLeft());
|
||||
n.score = 0.5f;
|
||||
EXPECT_FALSE(n.isUnused());
|
||||
EXPECT_FALSE(n.isLeaf());
|
||||
EXPECT_FALSE(n.isDefaultLeft());
|
||||
}
|
||||
|
||||
TEST(Segment, Test) {
|
||||
Segment s;
|
||||
EXPECT_FALSE(s.isValid());
|
||||
s.start = 2;
|
||||
EXPECT_FALSE(s.isValid());
|
||||
s.end = 4;
|
||||
EXPECT_TRUE(s.isValid());
|
||||
}
|
||||
|
||||
} // namespace exact
|
||||
} // namespace tree
|
||||
} // namespace xgboost
|
||||
Reference in New Issue
Block a user