mirror of https://github.com/CGAL/cgal
Add a bench of DT3 with TBB and Google benchmark
This commit is contained in:
parent
4208951252
commit
12181210e8
|
|
@ -99,6 +99,8 @@ create_cmake_script_with_options()
|
|||
# Created by the script cgal_create_CMakeLists
|
||||
# This is the CMake script for compiling a set of CGAL applications.
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
|
||||
EOF
|
||||
#---------------------------------------------------------------------------
|
||||
if [ "$SINGLE_SOURCE" = "n" ]; then
|
||||
|
|
@ -111,8 +113,6 @@ EOF
|
|||
cat << 'EOF'
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.11)
|
||||
|
||||
# CGAL and its components
|
||||
EOF
|
||||
if [ -n "$ENABLE_CTEST" ]; then
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
# Created by the script cgal_create_CMakeLists
|
||||
# This is the CMake script for compiling a set of CGAL applications.
|
||||
|
||||
cmake_minimum_required(VERSION 3.1...3.15)
|
||||
|
||||
project( Triangulation_3 )
|
||||
|
||||
|
||||
# CGAL and its components
|
||||
find_package( CGAL QUIET COMPONENTS )
|
||||
|
||||
if ( NOT CGAL_FOUND )
|
||||
|
||||
message(STATUS "This project requires the CGAL library, and will not be compiled.")
|
||||
return()
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
# Boost and its components
|
||||
find_package( Boost REQUIRED )
|
||||
|
||||
if ( NOT Boost_FOUND )
|
||||
|
||||
message(STATUS "This project requires the Boost library, and will not be compiled.")
|
||||
|
||||
return()
|
||||
|
||||
endif()
|
||||
|
||||
# include for local directory
|
||||
|
||||
# include for local package
|
||||
|
||||
|
||||
# Creating entries for all C++ files with "main" routine
|
||||
# ##########################################################
|
||||
|
||||
|
||||
create_single_source_cgal_program( "incident_edges.cpp" )
|
||||
|
||||
create_single_source_cgal_program( "simple_2.cpp" )
|
||||
|
||||
create_single_source_cgal_program( "simple.cpp" )
|
||||
|
||||
create_single_source_cgal_program( "Triangulation_benchmark_3.cpp" )
|
||||
|
||||
find_package(benchmark)
|
||||
|
||||
if(TARGET benchmark::benchmark)
|
||||
find_package(TBB REQUIRED)
|
||||
include( CGAL_target_use_TBB )
|
||||
|
||||
create_single_source_cgal_program( "DT3_benchmark_with_TBB.cpp" )
|
||||
CGAL_target_use_TBB(DT3_benchmark_with_TBB)
|
||||
target_link_libraries(DT3_benchmark_with_TBB PRIVATE benchmark::benchmark)
|
||||
endif()
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
#include <CGAL/Real_timer.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Delaunay_triangulation_3.h>
|
||||
#include <CGAL/bounding_box.h>
|
||||
#include <CGAL/Random.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <benchmark/benchmark.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef K::Point_3 Point_3;
|
||||
|
||||
typedef CGAL::Triangulation_data_structure_3<
|
||||
CGAL::Triangulation_vertex_base_3<K>,
|
||||
CGAL::Triangulation_cell_base_3<K>,
|
||||
CGAL::Parallel_tag> Tds;
|
||||
typedef CGAL::Delaunay_triangulation_3<K, Tds> PDT;
|
||||
|
||||
// global variables used by bench_dt3
|
||||
int argc;
|
||||
char** argv;
|
||||
|
||||
|
||||
|
||||
void bench_dt3(benchmark::State& state) {
|
||||
CGAL::get_default_random() = CGAL::Random(0);
|
||||
|
||||
std::vector<Point_3> points;
|
||||
Point_3 p;
|
||||
|
||||
std::ifstream in(argv[1]);
|
||||
while(in >> p)
|
||||
points.push_back(p);
|
||||
|
||||
for(auto _ : state) {
|
||||
CGAL::Bbox_3 bb = CGAL::bounding_box(points.begin(), points.end()).bbox();
|
||||
PDT::Lock_data_structure locking_ds(bb, 50);
|
||||
|
||||
PDT pdt(points.begin(), points.end(), &locking_ds);
|
||||
}
|
||||
return;
|
||||
}
|
||||
BENCHMARK(bench_dt3)->Unit(benchmark::kMillisecond);;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
benchmark::Initialize(&argc, argv);
|
||||
::argc = argc;
|
||||
::argv = argv;
|
||||
benchmark::RunSpecifiedBenchmarks();
|
||||
}
|
||||
Loading…
Reference in New Issue