Skip to content

Commit 84f6943

Browse files
larshgharitha-j
andauthored
Moved gpu octree tests to test/gpu. (#3965)
* Moved gpu octree tests to test/gpu. * add .points and std:: after removal of previous PRs. * exclude gpu octree tests from ctest * add cmake option for excluding gpu tests Co-authored-by: haritha-j <[email protected]>
1 parent b040ed0 commit 84f6943

File tree

16 files changed

+105
-32
lines changed

16 files changed

+105
-32
lines changed

.ci/azure-pipelines/build/ubuntu.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ steps:
88
-DCMAKE_BUILD_TYPE="MinSizeRel" \
99
-DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" \
1010
-DPCL_ONLY_CORE_POINT_TYPES=ON \
11+
-DPCL_DISABLE_GPU_TESTS=ON \
1112
-DBUILD_simulation=ON \
1213
-DBUILD_surface_on_nurbs=ON \
1314
-DBUILD_global_tests=ON \

cmake/pcl_options.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,15 @@ option(WITH_DOCS "Build doxygen documentation" OFF)
6969
set(PCL_INDEX_SIZE -1 CACHE STRING "Set index size. Available options are: 8 16 32 64. A negative value indicates default size (32 for PCL >= 1.12, 8*sizeof(int) i.e., the number of bits in int, otherwise)")
7070
set_property(CACHE PCL_INDEX_SIZE PROPERTY STRINGS -1 8 16 32 64)
7171

72-
#set whether indices are signed or unsigned
72+
# Set whether indices are signed or unsigned
7373
set(PCL_INDEX_SIGNED true CACHE BOOL "Set whether indices need to be signed or unsigned. Signed by default.")
7474
if (PCL_INDEX_SIGNED)
7575
set(PCL_INDEX_SIGNED_STR "true")
7676
else()
7777
set (PCL_INDEX_SIGNED_STR "false")
7878
endif()
79+
80+
# Set whether gpu tests should be run
81+
# (Used to prevent gpu tests from executing in CI where GPU hardware is unavailable)
82+
option(PCL_DISABLE_GPU_TESTS "Disable running GPU tests. If disabled, tests will still be built." OFF)
83+

gpu/containers/src/device_memory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include <pcl/gpu/containers/device_memory.h>
3838
#include <pcl/gpu/utils/safe_call.hpp>
3939

40-
#include "cuda_runtime_api.h"
40+
#include <cuda_runtime_api.h>
4141
#include <cassert>
4242

4343
#define HAVE_CUDA

gpu/octree/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,3 @@ PCL_MAKE_PKGCONFIG(${LIB_NAME} COMPONENT ${SUBSYS_NAME} DESC ${SUBSYS_DESC} PCL_
3636

3737
# Install include files
3838
PCL_ADD_INCLUDES("${SUBSYS_NAME}" "${SUBSYS_PATH}" ${incs})
39-
40-
add_subdirectory(test)

gpu/octree/test/CMakeLists.txt

Lines changed: 0 additions & 11 deletions
This file was deleted.

gpu/utils/include/pcl/gpu/utils/safe_call.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#ifndef __PCL_CUDA_SAFE_CALL_HPP__
3838
#define __PCL_CUDA_SAFE_CALL_HPP__
3939

40-
#include "cuda_runtime_api.h"
40+
#include <cuda_runtime_api.h>
4141
#include <pcl/gpu/containers/initialization.h>
4242

4343
#if defined(__GNUC__)

test/CMakeLists.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,18 @@ add_library(pcl_gtest STATIC ${GTEST_SRC_DIR}/src/gtest-all.cc)
1818

1919
enable_testing()
2020

21+
# VS needs -C config to run correct
2122
if(MSVC)
22-
# VS needs -C config to run correct
23-
add_custom_target(tests "${CMAKE_CTEST_COMMAND}" -C $<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release> -V -T Test VERBATIM)
24-
else()
25-
add_custom_target(tests "${CMAKE_CTEST_COMMAND}" -V -T Test VERBATIM)
23+
set(PCL_CTEST_ARGUMENTS ${PCL_CTEST_ARGUMENTS} -C $<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>)
2624
endif()
2725

26+
# Enables you to disable GPU tests. Used on CI as it has no access to GPU hardware
27+
if(PCL_DISABLE_GPU_TESTS)
28+
set(PCL_CTEST_ARGUMENTS ${PCL_CTEST_ARGUMENTS} -E gpu)
29+
endif()
30+
31+
add_custom_target(tests "${CMAKE_CTEST_COMMAND}" ${PCL_CTEST_ARGUMENTS} -V -T Test VERBATIM)
32+
2833
set_target_properties(tests PROPERTIES FOLDER "Tests")
2934

3035
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include")
@@ -34,6 +39,7 @@ add_subdirectory(common)
3439
add_subdirectory(features)
3540
add_subdirectory(filters)
3641
add_subdirectory(geometry)
42+
add_subdirectory(gpu)
3743
add_subdirectory(io)
3844
add_subdirectory(kdtree)
3945
add_subdirectory(keypoints)

test/gpu/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
if(NOT HAVE_CUDA)
2+
return()
3+
endif()
4+
5+
add_subdirectory(octree)

test/gpu/octree/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
set(SUBSYS_NAME tests_gpu_octree)
2+
set(SUBSYS_DESC "Point cloud library gpu octree tests")
3+
set(SUBSYS_DEPS common octree gpu_containers gpu_octree gpu_utils)
4+
5+
set(DEFAULT ON)
6+
set(build TRUE)
7+
set(REASON "")
8+
PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}")
9+
PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS})
10+
11+
if(NOT build)
12+
return()
13+
endif()
14+
15+
PCL_ADD_TEST(gpu_octree_performance test_gpu_octree_perfomance FILES perfomance.cpp LINK_WITH pcl_gtest pcl_common pcl_octree pcl_gpu_octree)
16+
PCL_ADD_TEST(gpu_octree_approx_nearest test_gpu_approx_nearest FILES test_approx_nearest.cpp LINK_WITH pcl_gtest pcl_common pcl_octree pcl_gpu_octree pcl_gpu_utils)
17+
PCL_ADD_TEST(gpu_octree_bfrs test_gpu_bfrs FILES test_bfrs_gpu.cpp LINK_WITH pcl_gtest pcl_common pcl_octree pcl_gpu_octree)
18+
PCL_ADD_TEST(gpu_octree_host_radius test_gpu_host_radius_search FILES test_host_radius_search.cpp LINK_WITH pcl_gtest pcl_common pcl_octree pcl_gpu_octree)
19+
PCL_ADD_TEST(gpu_octree_knn_search test_gpu_knn_search FILES test_knn_search.cpp LINK_WITH pcl_gtest pcl_common pcl_octree pcl_gpu_octree)
20+
PCL_ADD_TEST(gpu_octree_radius_search test_gpu_radius_search FILES test_radius_search.cpp LINK_WITH pcl_gtest pcl_common pcl_octree pcl_gpu_octree)

gpu/octree/test/data_source.hpp renamed to test/gpu/octree/data_source.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ struct DataGenerator
131131
float query_radius = radius > 0 ? radius : radiuses[i];
132132
const PointType& query = queries[i];
133133

134-
for(std::size_t ind = 0; ind < size(); ++ind)
134+
for(std::size_t ind = 0; ind < points.size(); ++ind)
135135
{
136136
const PointType& point = points[ind];
137137

0 commit comments

Comments
 (0)