From 9bd1ad1f36ceb729240cac67f4889645859a1b18 Mon Sep 17 00:00:00 2001 From: cjamin Date: Thu, 2 Mar 2017 16:06:41 +0000 Subject: Use parallel_sort to sort distances git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/botteleneck-parallel-sort@2134 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: b3a43683ab1d452845138605488a845a4b694432 --- src/Bottleneck_distance/include/gudhi/Persistence_graph.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/Bottleneck_distance') diff --git a/src/Bottleneck_distance/include/gudhi/Persistence_graph.h b/src/Bottleneck_distance/include/gudhi/Persistence_graph.h index c7695112..44f4b827 100644 --- a/src/Bottleneck_distance/include/gudhi/Persistence_graph.h +++ b/src/Bottleneck_distance/include/gudhi/Persistence_graph.h @@ -25,6 +25,10 @@ #include +#ifdef GUDHI_USE_TBB +#include +#endif + #include #include #include // for numeric_limits @@ -144,7 +148,11 @@ inline std::vector Persistence_graph::sorted_distances() const { for (int v_point_index = 0; v_point_index < size(); ++v_point_index) distances.push_back(distance(u_point_index, v_point_index)); } +#ifdef GUDHI_USE_TBB + tbb::parallel_sort(distances.begin(), distances.end()); +#else std::sort(distances.begin(), distances.end()); +#endif return distances; } -- cgit v1.2.3 From 0023b64e6e3dba261902403931c93599d0d4360a Mon Sep 17 00:00:00 2001 From: cjamin Date: Fri, 3 Mar 2017 09:40:35 +0000 Subject: Link with TBB git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/botteleneck-parallel-sort@2141 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 80325216eace3cb1dbadbde3f4e5a3985b8feab0 --- src/Bottleneck_distance/benchmark/CMakeLists.txt | 3 +++ src/Bottleneck_distance/example/CMakeLists.txt | 2 ++ src/Bottleneck_distance/test/CMakeLists.txt | 3 +++ 3 files changed, 8 insertions(+) (limited to 'src/Bottleneck_distance') diff --git a/src/Bottleneck_distance/benchmark/CMakeLists.txt b/src/Bottleneck_distance/benchmark/CMakeLists.txt index 355e8d31..c99e0373 100644 --- a/src/Bottleneck_distance/benchmark/CMakeLists.txt +++ b/src/Bottleneck_distance/benchmark/CMakeLists.txt @@ -7,5 +7,8 @@ project(Bottleneck_distance_benchmark) if(CGAL_FOUND) if (NOT CGAL_VERSION VERSION_LESS 4.8.0) add_executable ( bottleneck_chrono bottleneck_chrono.cpp ) + if (TBB_FOUND) + target_link_libraries(bottleneck_chrono ${TBB_LIBRARIES}) + endif(TBB_FOUND) endif () endif() diff --git a/src/Bottleneck_distance/example/CMakeLists.txt b/src/Bottleneck_distance/example/CMakeLists.txt index b36d0f34..55f22c01 100644 --- a/src/Bottleneck_distance/example/CMakeLists.txt +++ b/src/Bottleneck_distance/example/CMakeLists.txt @@ -13,6 +13,8 @@ if(CGAL_FOUND) add_executable (alpha_rips_persistence_bottleneck_distance alpha_rips_persistence_bottleneck_distance.cpp) target_link_libraries(alpha_rips_persistence_bottleneck_distance ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}) if (TBB_FOUND) + target_link_libraries(bottleneck_read_file_example ${TBB_LIBRARIES}) + target_link_libraries(bottleneck_basic_example ${TBB_LIBRARIES}) target_link_libraries(alpha_rips_persistence_bottleneck_distance ${TBB_LIBRARIES}) endif(TBB_FOUND) add_test(alpha_rips_persistence_bottleneck_distance ${CMAKE_CURRENT_BINARY_DIR}/alpha_rips_persistence_bottleneck_distance diff --git a/src/Bottleneck_distance/test/CMakeLists.txt b/src/Bottleneck_distance/test/CMakeLists.txt index 6c8f112d..3e61f4cf 100644 --- a/src/Bottleneck_distance/test/CMakeLists.txt +++ b/src/Bottleneck_distance/test/CMakeLists.txt @@ -17,6 +17,9 @@ if(CGAL_FOUND) if (NOT CGAL_VERSION VERSION_LESS 4.8.0) add_executable ( bottleneckUT bottleneck_unit_test.cpp ) target_link_libraries(bottleneckUT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + if (TBB_FOUND) + target_link_libraries(bottleneckUT ${TBB_LIBRARIES}) + endif(TBB_FOUND) # Unitary tests add_test(NAME bottleneckUT COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bottleneckUT -- cgit v1.2.3