Skip to content

Commit

Permalink
feat: make Sparsehash option for distributed code, but enable it by d…
Browse files Browse the repository at this point in the history
…efault via the 'distributed' CMake preset
  • Loading branch information
DanielSeemaier committed Jul 19, 2024
1 parent 1869436 commit 16924c8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ option(KAMINPAR_BUILD_WITH_CCACHE "Use ccache to build." ON)
option(KAMINPAR_BUILD_WITH_DEBUG_SYMBOLS "Always build with debug symbols, even in Release mode." ON)
option(KAMINPAR_BUILD_WITH_MTKAHYPAR "If Mt-KaHyPar can be found, build the Mt-KaHyPar initial partitioner." OFF)
option(KAMINPAR_BUILD_WITH_GROWT "Build the shared-memory partitioner with Growt." ON)
option(KAMINPAR_BUILD_WITH_SPARSEHASH "Build with Google Sparsehash." OFF)
option(KAMINPAR_BUILD_WITH_PG "Build with the -pg option for profiling." OFF)

# Control data type sizes
Expand Down Expand Up @@ -322,9 +323,8 @@ message(" dist::BlockWeight = std::int64_t")
################################################################################

# Google Sparsehash
find_package(Sparsehash)
if (Sparsehash_FOUND)
message(STATUS "Found Google Sparsehash")
if (KAMINPAR_BUILD_WITH_SPARSEHASH)
find_package(Sparsehash REQUIRED)
list(APPEND KAMINPAR_DEFINITIONS "-DKAMINPAR_SPARSEHASH_FOUND")
endif ()

Expand Down
1 change: 1 addition & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"displayName": "Default Config for dKaMinPar",
"cacheVariables": {
"KAMINPAR_BUILD_DISTRIBUTED": "ON",
"KAMINPAR_BUILD_WITH_SPARSEHASH": "ON",
"KAMINPAR_64BIT_IDS": "OFF",
"KAMINPAR_64BIT_EDGE_IDS": "OFF",
"KAMINPAR_64BIT_NODE_IDS": "OFF",
Expand Down
5 changes: 2 additions & 3 deletions kaminpar-common/datastructures/rating_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ template <typename Key, typename Value> class Sparsehash {
private:
google::dense_hash_map<Key, Value> map;
};
#else
// @todo decide whether we want this silent fallback or trigger an error
#else // KAMINPAR_SPARSEHASH_FOUND
template <typename Key, typename Value> using Sparsehash = SparseMap<Key, Value>;
#endif
#endif // KAMINPAR_SPARSEHASH_FOUND
} // namespace rm_backyard

template <
Expand Down
6 changes: 5 additions & 1 deletion kaminpar-dist/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ file(GLOB_RECURSE KAMINPAR_DIST_SOURCE_FILES CONFIGURE_DEPENDS

add_library(kaminpar_dist ${KAMINPAR_DIST_SOURCE_FILES})
target_include_directories(kaminpar_dist PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../")
target_link_libraries(kaminpar_dist PUBLIC kaminpar_shm kaminpar_mpi growt Sparsehash::Sparsehash)
target_link_libraries(kaminpar_dist PUBLIC kaminpar_shm kaminpar_mpi growt)

if (Sparsehash_FOUND)
target_link_libraries(kaminpar_dist PUBLIC Sparsehash::Sparsehash)
endif ()

# If we can find Mt-KaHyPar, make it available as an option for initial partitioning
if (KAMINPAR_BUILD_WITH_MTKAHYPAR)
Expand Down
2 changes: 0 additions & 2 deletions kaminpar-dist/coarsening/clustering/lp/global_lp_clusterer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
******************************************************************************/
#include "kaminpar-dist/coarsening/clustering/lp/global_lp_clusterer.h"

#include <google/dense_hash_map>

#include "kaminpar-mpi/sparse_alltoall.h"

#include "kaminpar-dist/datastructures/distributed_graph.h"
Expand Down

0 comments on commit 16924c8

Please sign in to comment.