Skip to content

Commit

Permalink
fix tbb new API, and add total refinement time
Browse files Browse the repository at this point in the history
  • Loading branch information
janetournois committed Dec 1, 2023
1 parent 33b9d44 commit 0aa0242
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
30 changes: 24 additions & 6 deletions Mesh_3/benchmark/Mesh_3/concurrency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const char * const BENCHMARK_SCRIPT_FILENAME = "concurrency_script.txt";
// BENCHMARK GENERAL PARAMETERS
// ==========================================================================

//#define BENCHMARK_WITH_1_TO_MAX_THREADS
#define BENCHMARK_WITH_1_TO_MAX_THREADS
//#define CGAL_MESH_3_POLYHEDRON_WITH_FEATURES
//#define CGAL_MESH_3_IMPLICIT_WITH_FEATURES
//#define CGAL_MESH_3_BENCHMARK_EXPORT_TO_MAYA
Expand Down Expand Up @@ -84,7 +84,7 @@ const int TET_SHAPE = 3;
// Verbose
// ==========================================================================

# define CGAL_CONCURRENT_MESH_3_VERBOSE
//# define CGAL_CONCURRENT_MESH_3_VERBOSE
//# define CGAL_CONCURRENT_MESH_3_VERY_VERBOSE

// ==========================================================================
Expand Down Expand Up @@ -195,6 +195,7 @@ class XML_perf_data
subelements.push_back("Cells_scan_time");
subelements.push_back("Cells_refin_time");
subelements.push_back("Lloyd_optim_time");
subelements.push_back("Refinement_time_total");
subelements.push_back("Odt_optim_time");
subelements.push_back("Perturber_optim_time");
subelements.push_back("Exuder_optim_time");
Expand Down Expand Up @@ -452,7 +453,8 @@ bool make_mesh_polyhedron(const std::string &input_filename,
double facet_sizing,
double cell_sizing)
{
std::cout << "make_mesh_polyhedron" << std::endl;
std::cout << "make_mesh_polyhedron("
<< input_filename << ")" << std::endl;

// Domain
typedef Kernel K;
Expand Down Expand Up @@ -531,6 +533,9 @@ bool make_mesh_polyhedron(const std::string &input_filename,
double sliverbound = 2;
#endif

CGAL::Real_timer t;
t.start();

C3t3 c3t3 = CGAL::make_mesh_3<C3t3>( domain
, criteria
# ifdef CGAL_MESH_3_BENCHMARK_LLOYD
Expand All @@ -552,7 +557,9 @@ bool make_mesh_polyhedron(const std::string &input_filename,
, no_exude()
#endif
);
t.stop();

CGAL_MESH_3_SET_PERFORMANCE_DATA("Refinement_time_total", t.time());
CGAL_MESH_3_SET_PERFORMANCE_DATA("V", c3t3.triangulation().number_of_vertices());
CGAL_MESH_3_SET_PERFORMANCE_DATA("F", c3t3.number_of_facets_in_complex());
CGAL_MESH_3_SET_PERFORMANCE_DATA("T", c3t3.number_of_cells_in_complex());
Expand Down Expand Up @@ -637,6 +644,9 @@ bool make_mesh_3D_images(const std::string &input_filename,
double sliverbound = 2;
#endif

CGAL::Real_timer t;
t.start();

C3t3 c3t3 = CGAL::make_mesh_3<C3t3>( domain
, criteria
# ifdef CGAL_MESH_3_BENCHMARK_LLOYD
Expand All @@ -659,6 +669,8 @@ bool make_mesh_3D_images(const std::string &input_filename,
#endif
);

t.stop();
CGAL_MESH_3_SET_PERFORMANCE_DATA("Refinement_time_total", t.time());
CGAL_MESH_3_SET_PERFORMANCE_DATA("V", c3t3.triangulation().number_of_vertices());
CGAL_MESH_3_SET_PERFORMANCE_DATA("F", c3t3.number_of_facets_in_complex());
CGAL_MESH_3_SET_PERFORMANCE_DATA("T", c3t3.number_of_cells_in_complex());
Expand Down Expand Up @@ -778,6 +790,9 @@ bool make_mesh_implicit(double facet_approx,
double sliverbound = 2;
#endif

CGAL::Real_timer t;
t.start();

C3t3 c3t3 = CGAL::make_mesh_3<C3t3>( domain
, criteria
# ifdef CGAL_MESH_3_BENCHMARK_LLOYD
Expand All @@ -800,6 +815,8 @@ bool make_mesh_implicit(double facet_approx,
#endif
);

t.stop();
CGAL_MESH_3_SET_PERFORMANCE_DATA("Refinement_time_total", t.time());
CGAL_MESH_3_SET_PERFORMANCE_DATA("V", c3t3.triangulation().number_of_vertices());
CGAL_MESH_3_SET_PERFORMANCE_DATA("F", c3t3.number_of_facets_in_complex());
CGAL_MESH_3_SET_PERFORMANCE_DATA("T", c3t3.number_of_cells_in_complex());
Expand Down Expand Up @@ -881,8 +898,9 @@ int main()
int i = 1;
#ifdef CGAL_CONCURRENT_MESH_3
# ifdef BENCHMARK_WITH_1_TO_MAX_THREADS
int max_nb_threads = tbb::this_task_arena::max_concurrency();
for(num_threads = 1 ;
num_threads <= tbb::task_scheduler_init::default_num_threads() ;
num_threads <= max_nb_threads ;
++num_threads)
# endif
/*for (Concurrent_mesher_config::get().num_work_items_per_batch = 5 ;
Expand Down Expand Up @@ -965,7 +983,7 @@ int main()

if (input == "Klein_function")
make_mesh_implicit(facet_approx, facet_sizing, cell_sizing, Klein_function(), input);
/*else if (input == "Tanglecube_function")
else if (input == "Tanglecube_function")
make_mesh_implicit(facet_approx, facet_sizing, cell_sizing, Tanglecube_function(), input);
else if (input == "Sphere_function")
make_mesh_implicit(facet_approx, facet_sizing, cell_sizing, Sphere_function(1.), input);
Expand All @@ -978,7 +996,7 @@ int main()
{
Cylinder_function f(3., 0.1);
make_mesh_implicit(facet_approx, facet_sizing, cell_sizing, f, input);
}*/
}
else
{
size_t dot_position = input.find_last_of('.');
Expand Down
12 changes: 6 additions & 6 deletions Mesh_3/benchmark/Mesh_3/concurrency_script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
#########################################################
##### Benchmark for refinement+optim
#########################################################
#meshes/elephant.off 0.05 0.04 0.04 10000
#meshes/elephant.off 0.01 0.004 0.004 10000
#meshes/elephant.off 0.0068 0.002 0.0025 10000 # typical timing (11 thr): 4.4 2.3 9.9
#meshes/elephant.off 0.05 0.04 0.04 100
meshes/elephant.off 0.01 0.004 0.004 1000
#meshes/elephant.off 0.0068 0.002 0.0025 10 # typical timing (11 thr): 4.4 2.3 9.9
#meshes/elephant.off 0.0068 0.002 0.0025 10000
#meshes/fandisk.off 0.0068 0.003 0.006 1 # typical timing (11 thr): 2.4 1.0 2.9
#D:/INRIA/Data/_Models/BigOFF/lucy-100kt.off 0.0068 0.0015 0.003 1
Expand Down Expand Up @@ -190,9 +190,9 @@
#Klein_function 0.0068 0.033 0.10 1

#Tanglecube_function 0.0068 0.01 0.03 1
#Tanglecube_function 0.0068 0.012 0.035 1
#Tanglecube_function 0.0068 0.013 0.04 1
#Tanglecube_function 0.0068 0.017 0.05 1
Tanglecube_function 0.0068 0.012 0.035 1
Tanglecube_function 0.0068 0.013 0.04 1
Tanglecube_function 0.0068 0.017 0.05 1
#Tanglecube_function 0.0068 0.02 0.06 1
#Tanglecube_function 0.0068 0.023 0.07 1
#Tanglecube_function 0.0068 0.027 0.08 1
Expand Down

0 comments on commit 0aa0242

Please sign in to comment.