Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,14 @@ if(DETRAY_SETUP_BENCHMARK)
endif()

# Set up covfie.
option(DETRAY_SETUP_COVFIE "Set up the covfie target(s) explicitly" TRUE)
if(DETRAY_BUILD_TESTING OR DETRAY_BUILD_BENCHMARKS OR DETRAY_BUILD_CLI_TOOLS)
set(DETRAY_BUILD_COVFIE ON)
endif()
option(
DETRAY_SETUP_COVFIE
"Set up the covfie target(s) explicitly"
${DETRAY_BUILD_COVFIE}
)
option(
DETRAY_USE_SYSTEM_COVFIE
"Pick up an existing installation of covfie from the build environment"
Expand Down
2 changes: 1 addition & 1 deletion detectors/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ file(
detray_add_library( detray_detectors detectors ${_detray_detectors_headers})
target_link_libraries(
detray_detectors
INTERFACE covfie::core vecmem::core detray::core detray::io
INTERFACE vecmem::core detray::core detray::io
)

unset(_detray_detector_headers)
2 changes: 0 additions & 2 deletions io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ file(
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"include/detray/io/backend/*.hpp"
"include/detray/io/backend/detail/*.hpp"
"include/detray/io/covfie/*.hpp"
"include/detray/io/frontend/*.hpp"
"include/detray/io/frontend/detail/*.hpp"
"include/detray/io/frontend/impl/*.hpp"
Expand All @@ -38,7 +37,6 @@ target_link_libraries(
INTERFACE
nlohmann_json::nlohmann_json
vecmem::core
covfie::core
detray::core
detray::io_utils
)
Expand Down
2 changes: 1 addition & 1 deletion io/include/detray/io/backend/detail/grid_reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ class grid_reader {
}
entry.set_volume(volume_idx);
entry.set_index(static_cast<dindex>(c));
vgr_builder->get().template populate<attach<>>(mbin, entry);
grid.template populate<attach<>>(mbin, entry);
}
}
} else {
Expand Down
52 changes: 0 additions & 52 deletions io/include/detray/io/covfie/read_bfield.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion plugins/svgtools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ detray_add_library( detray_svgtools svgtools
)
target_link_libraries(
detray_svgtools
INTERFACE detray::core actsvg::core actsvg::meta
INTERFACE detray::core detray::io actsvg::core actsvg::meta
)

# Clean up.
Expand Down
98 changes: 58 additions & 40 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#
# Mozilla Public License Version 2.0

message(STATUS "Building 'detray::test_utils' component")

# Set the common C++ flags.
include(detray-compiler-options-cpp)

Expand All @@ -14,37 +12,84 @@ include_directories(
$<TARGET_PROPERTY:covfie::core,INTERFACE_INCLUDE_DIRECTORIES>
)

# Set up a test library, which can be used by downstream projects without
# building the detray unit and integration
# Detray unit and integration test framework (depends on google test)
if(DETRAY_BUILD_TESTING)
message(STATUS "Building 'detray::test_framework' component")

file(
GLOB _detray_test_headers
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"include/detray/test/framework/*.hpp"
)

add_library(detray_test_framework INTERFACE "${_detray_test_headers}")
add_library(detray::test_framework ALIAS detray_test_framework)

target_include_directories(
detray_test_framework
INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include"
)

target_link_libraries(
detray_test_framework
INTERFACE GTest::gtest vecmem::core detray::core detray::detectors
)

unset(_detray_test_headers)
endif()

# Common test dependencies such as test detectors, B-fields and track generators
# (depends on covfie)
if(DETRAY_BUILD_TEST_UTILS)
message(STATUS "Building 'detray::test_common' component")

file(
GLOB _detray_test_common_headers
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"include/detray/test/common/*.hpp"
"include/detray/test/common/factories/*.hpp"
"include/detray/test/common/event_generator/*.hpp"
)

detray_add_library(detray_test_common test_common "${_detray_test_common_headers}")

target_link_libraries(
detray_test_common
INTERFACE vecmem::core covfie::core detray::core detray::detectors
)

unset(_detray_test_common_headers)
endif()

# Lightweight test utils library without external dependencies
if(DETRAY_BUILD_TEST_UTILS OR DETRAY_BUILD_VALIDATION_TOOLS)
message(STATUS "Building 'detray::test_utils' component")

file(
GLOB _detray_test_utils_headers
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"include/detray/test/utils/*.hpp"
"include/detray/test/utils/detectors/*.hpp"
"include/detray/test/utils/detectors/factories/*.hpp"
"include/detray/test/utils/simulation/event_generator/*.hpp"
"include/detray/test/utils/simulation/*.hpp"
)

detray_add_library(detray_test_utils test_utils ${_detray_test_utils_headers})
target_link_libraries(
detray_test_utils
INTERFACE vecmem::core detray::core detray::detectors
)

target_link_libraries(detray_test_utils INTERFACE vecmem::core detray::core)

unset(_detray_test_utils_headers)
endif()

# Build extended validation tools
# Build extended validation tools (actsvg and csv depencies)
if(DETRAY_BUILD_VALIDATION_TOOLS)
message(STATUS "Building 'detray::validation_utils' component")

file(
GLOB _detray_validation_headers
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"include/detray/test/validation/*.hpp"
)

detray_add_library(detray_validation_utils validation_utils ${_detray_validation_headers})

target_link_libraries(
detray_validation_utils
INTERFACE
Expand All @@ -58,33 +103,6 @@ if(DETRAY_BUILD_VALIDATION_TOOLS)
unset(_detray_validation_headers)
endif()

# Build the common (host and device) test library (mostly for integration tests)
if(DETRAY_BUILD_TESTING)
message(STATUS "Building 'detray::test_common' component")

file(
GLOB _detray_test_headers
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"include/detray/test/common/*.hpp"
"include/detray/test/common/detail/*.hpp"
)

add_library(detray_test_common INTERFACE "${_detray_test_headers}")
add_library(detray::test_common ALIAS detray_test_common)

target_include_directories(
detray_test_common
INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include"
)

target_link_libraries(
detray_test_common
INTERFACE GTest::gtest vecmem::core detray::core detray::test_utils
)

unset(_detray_test_headers)
endif()

# Include all of the code-holding sub-directories.

# Build the benchmarks
Expand Down
2 changes: 1 addition & 1 deletion tests/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ target_include_directories(

target_link_libraries(
detray_benchmarks
INTERFACE benchmark::benchmark vecmem::core detray::core detray::test_utils
INTERFACE benchmark::benchmark vecmem::core detray::core detray::test_common
)

unset(_detray_benchmarks_headers)
Expand Down
6 changes: 3 additions & 3 deletions tests/benchmarks/cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ macro(detray_add_cpu_benchmark algebra)
"intersect_surfaces.cpp"
"masks.cpp"
LINK_LIBRARIES benchmark::benchmark benchmark::benchmark_main vecmem::core detray::benchmarks
detray::core_${algebra} detray::test_utils
detray::core_${algebra} detray::test_common
)

target_compile_options(
Expand All @@ -51,7 +51,7 @@ macro(detray_add_cpu_benchmark algebra)
detray_add_executable( benchmark_cpu_propagation_${algebra}
"propagation.cpp"
LINK_LIBRARIES detray::benchmark_cpu benchmark::benchmark_main
vecmem::core detray::core_${algebra} detray::test_utils
vecmem::core detray::core_${algebra} detray::test_common
)

target_compile_options(
Expand Down Expand Up @@ -91,7 +91,7 @@ if(DETRAY_VC_SOA_PLUGIN)
detray_add_executable(benchmark_cpu_vc_soa_vs_${algebra}
"intersectors.cpp"
LINK_LIBRARIES benchmark::benchmark benchmark::benchmark_main vecmem::core detray::core_vc_soa detray::core_vc_aos detray::core_${algebra}
detray::test_utils
detray::test_common
)

target_compile_options(
Expand Down
18 changes: 10 additions & 8 deletions tests/benchmarks/cpu/find_volume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* Mozilla Public License Version 2.0
*/

// Detray test include(s).
#include "detray/test/utils/detectors/build_toy_detector.hpp"
#include "detray/test/utils/types.hpp"
// Detray benchmark include(s)
#include "detray/benchmarks/types.hpp"

// Detray test include(s)
#include "detray/test/common/build_toy_detector.hpp"

// VecMem include(s).
#include <vecmem/memory/host_memory_resource.hpp>
Expand All @@ -21,8 +23,8 @@
// Use the detray:: namespace implicitly.
using namespace detray;

using test_algebra = test::algebra;
using scalar = test::scalar;
using bench_algebra = benchmarks::algebra;
using scalar = benchmarks::scalar;

// Benchmarks the cost of searching a volume by position
void BM_FIND_VOLUMES(benchmark::State &state) {
Expand All @@ -35,7 +37,7 @@ void BM_FIND_VOLUMES(benchmark::State &state) {
vecmem::host_memory_resource host_mr;
toy_det_config<scalar> toy_cfg{};
toy_cfg.n_edc_layers(7u);
auto [d, names] = build_toy_detector<test_algebra>(host_mr, toy_cfg);
auto [d, names] = build_toy_detector<bench_algebra>(host_mr, toy_cfg);

static const unsigned int itest = 10000u;

Expand All @@ -57,8 +59,8 @@ void BM_FIND_VOLUMES(benchmark::State &state) {
for (auto _ : state) {
for (unsigned int i1 = 0u; i1 < itest; ++i1) {
for (unsigned int i0 = 0u; i0 < itest; ++i0) {
test::vector3 rz{static_cast<scalar>(i0) * step0, 0.f,
static_cast<scalar>(i1) * step1};
benchmarks::vector3 rz{static_cast<scalar>(i0) * step0, 0.f,
static_cast<scalar>(i1) * step1};
const auto &v = d.volume(rz);

benchmark::DoNotOptimize(successful);
Expand Down
16 changes: 8 additions & 8 deletions tests/benchmarks/cpu/grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include "detray/geometry/shapes/rectangle2D.hpp"
#include "detray/utils/grid/detail/concepts.hpp"

// Detray test include(s).
#include "detray/test/utils/types.hpp"
// Detray benchmark include(s)
#include "detray/benchmarks/types.hpp"

// VecMem include(s).
#include <vecmem/memory/host_memory_resource.hpp>
Expand All @@ -32,14 +32,14 @@
// Use the detray:: namespace implicitly.
using namespace detray;

using test_algebra = test::algebra;
using scalar = test::scalar;
using bench_algebra = benchmarks::algebra;
using scalar = benchmarks::scalar;

namespace {

#ifdef DETRAY_BENCHMARK_PRINTOUTS
/// Test point for printouts
const auto tp = test::point2{12.f, 30.f};
const auto tp = benchmarks::point2{12.f, 30.f};
#endif

/// Prepare test points
Expand All @@ -50,7 +50,7 @@ auto make_random_points() {
std::uniform_real_distribution<scalar> dist1(0.f, 24.f);
std::uniform_real_distribution<scalar> dist2(0.f, 59.f);

std::vector<test::point2> points{};
std::vector<benchmarks::point2> points{};
for (unsigned int itest = 0u; itest < 1000000u; ++itest) {
points.push_back({dist1(gen), dist2(gen)});
}
Expand All @@ -63,7 +63,7 @@ template <typename bin_t>
auto make_regular_grid(vecmem::memory_resource &mr) {

// Data-owning grids with bin capacity 1
auto gr_factory = grid_factory<bin_t, simple_serializer, test_algebra>{mr};
auto gr_factory = grid_factory<bin_t, simple_serializer, bench_algebra>{mr};

// Spans of the axes
std::vector<scalar> spans = {0.f, 25.f, 0.f, 60.f};
Expand Down Expand Up @@ -94,7 +94,7 @@ auto make_irregular_grid(vecmem::memory_resource &mr) {
}

// Data-owning grids with bin capacity 1
auto gr_factory = grid_factory<bin_t, simple_serializer, test_algebra>{mr};
auto gr_factory = grid_factory<bin_t, simple_serializer, bench_algebra>{mr};

// Rectangular grid with closed bin bounds and irregular binning on all axes
return gr_factory.template new_grid<rectangle2D>(
Expand Down
Loading
Loading