Skip to content

Commit

Permalink
Use metis directly instead of scotch_metis wrapper
Browse files Browse the repository at this point in the history
This fixes build of examples/mpi/partition on Arch Linux
  • Loading branch information
ddemidov committed Dec 14, 2014
1 parent a3eaea6 commit d7c5f16
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ endif()
#----------------------------------------------------------------------------
find_package(Pastix QUIET)
find_package(Scotch QUIET)
find_package(Metis QUIET)
find_package(BLAS QUIET)

if (PASTIX_INCLUDES AND SCOTCH_INCLUDES AND BLAS_FOUND)
Expand Down
18 changes: 18 additions & 0 deletions cmake/FindMetis.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Find Metis library

if (NOT (METIS_INCLUDES AND METIS_LIBRARIES))
find_path(METIS_INCLUDES
NAMES metis.h
PATHS $ENV{METISDIR}
PATH_SUFFIXES metis
)


find_library(METIS_LIBRARY metis PATHS $ENV{METISDIR})
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
METIS DEFAULT_MSG METIS_INCLUDES METIS_LIBRARY)

mark_as_advanced(METIS_INCLUDES METIS_LIBRARY)
3 changes: 1 addition & 2 deletions cmake/FindScotch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ if (NOT (SCOTCH_INCLUDES AND SCOTCH_LIBRARIES))
find_library(PTSCOTCH_LIBRARY ptscotch PATHS $ENV{SCOTCHDIR})
find_library(SCOTCHERR_LIBRARY scotcherr PATHS $ENV{SCOTCHDIR})
find_library(PTSCOTCHERR_LIBRARY ptscotcherr PATHS $ENV{SCOTCHDIR})
find_library(SCOTCH_METIS_LIBRARY scotchmetis PATHS $ENV{SCOTCHDIR})

set(SCOTCH_LIBRARIES
"${SCOTCH_LIBRARY};${PTSCOTCH_LIBRARY};${SCOTCHERR_LIBRARY};${PTSCOTCHERR_LIBRARY};${SCOTCH_METIS_LIBRARY}"
"${SCOTCH_LIBRARY};${PTSCOTCH_LIBRARY};${SCOTCHERR_LIBRARY};${PTSCOTCHERR_LIBRARY}"
)
endif()

Expand Down
4 changes: 2 additions & 2 deletions examples/mpi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ if (MPI_CXX_FOUND)
add_mpi_example(check_pastix check_pastix.cpp)
endif()

if (EIGEN_INCLUDE AND SCOTCH_INCLUDES)
if (EIGEN_INCLUDE AND METIS_INCLUDES)
add_executable(partition partition.cpp)
target_link_Libraries(partition
${Boost_LIBRARIES}
${SCOTCH_LIBRARIES}
${METIS_LIBRARY}
)
endif()

Expand Down
8 changes: 4 additions & 4 deletions examples/mpi/partition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <unsupported/Eigen/SparseExtra>

extern "C" {
#include <scotch.h>
#include <metis.h>
}

Expand Down Expand Up @@ -156,9 +155,6 @@ std::vector<int> pointwise_partition(
if (npart == 1) {
boost::fill(part, 0);
} else {
int wgtflag = 0;
int numflag = 0;
int options = 0;
int edgecut;

#if defined(METIS_VER_MAJOR) && (METIS_VER_MAJOR >= 5)
Expand All @@ -179,6 +175,10 @@ std::vector<int> pointwise_partition(
part.data()
);
#else
int wgtflag = 0;
int numflag = 0;
int options = 0;

METIS_PartGraphKway(
&nrows,
const_cast<int*>(ptr.data()),
Expand Down

0 comments on commit d7c5f16

Please sign in to comment.