diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6b7d2ea --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +name: ci + +on: + push: + paths: + - "**.c" + - "**.cmake" + - "**/CMakeLists.txt" + - ".github/workflows/ci.yml" + workflow_dispatch: + +# avoid wasted runs +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + + +jobs: + + unix: + + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + intsize: [32, 64] + + runs-on: ${{ matrix.os }} + timeout-minutes: 5 + + steps: + - name: Install MPI (Linux) + if: ${{ runner.os == 'Linux' }} + run: sudo apt install libopenmpi-dev + + - name: Install MPI (MacOS) + if: ${{ runner.os == 'macOS' }} + run: brew install open-mpi + + - &checkout + uses: actions/checkout@v4 + + - run: cmake -B build -DIDXTYPEWIDTH=${{ matrix.intsize }} + - run: cmake --build build --parallel + + - run: ctest --test-dir build -V diff --git a/.gitmodules b/.gitmodules index e69de29..c337695 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "METIS"] + path = METIS + url = https://github.com/scivision/METIS diff --git a/CMakeLists.txt b/CMakeLists.txt index 146bc5f..0f0631e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,43 +1,59 @@ -cmake_minimum_required(VERSION 2.8) -project(ParMETIS C) +cmake_minimum_required(VERSION 3.16...4.1) +if(NOT CMAKE_BUILD_TYPE AND NOT DEFINED ENV{CMAKE_BUILD_TYPE}) + set(CMAKE_BUILD_TYPE Release CACHE STRING "Debug or Release") +endif() -# Search for MPI. -# GK commented this out as it seems to be creating problems -# include(FindMPI) -# if(NOT MPI_FOUND) -# message(FATAL_ERROR "mpi is not found") -# endif() -# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MPI_COMPILE_FLAGS}") +project(parmetis LANGUAGES C VERSION 1.0.0) +# --- need METIS first +include(GNUInstallDirs) +include(cmake/GitSubmodule.cmake) -# Prepare libraries. -if(SHARED) - set(ParMETIS_LIBRARY_TYPE SHARED) -else() - set(ParMETIS_LIBRARY_TYPE STATIC) +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND parmetis_IS_TOP_LEVEL) + set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/local" CACHE PATH "install prefix" FORCE) endif() +message(STATUS "${PROJECT_NAME} ${PROJECT_VERSION} CMake ${CMAKE_VERSION} install prefix ${CMAKE_INSTALL_PREFIX}") + +git_submodule(${CMAKE_CURRENT_SOURCE_DIR}/METIS) +add_subdirectory(METIS) + +set(CMAKE_C_STANDARD 99) + +add_compile_definitions( +"REALTYPEWIDTH=$,${REALTYPEWIDTH},32>" +"IDXTYPEWIDTH=$,${IDXTYPEWIDTH},32>" +) + +find_package(MPI REQUIRED) + include(./conf/gkbuild.cmake) -# List of paths that the compiler will search for header files. -# i.e., the -I equivalent -include_directories(include) -include_directories(${MPI_INCLUDE_PATH}) -include_directories(${GKLIB_PATH}/include) -include_directories(${METIS_PATH}/include) -include_directories(${CMAKE_INSTALL_PREFIX}/include) - -# List of paths that the compiler will search for library files. -# i.e., the -L equivalent -link_directories(${GKLIB_PATH}/lib) -link_directories(${METIS_PATH}/lib) -link_directories(${CMAKE_INSTALL_PREFIX}/lib) - -# List of directories that cmake will look for CMakeLists.txt -add_subdirectory(include) +install(FILES include/parmetis.h TYPE INCLUDE) + +add_library(parmetis) +target_include_directories(parmetis PUBLIC +"$" +$ +) +target_link_libraries(parmetis PRIVATE MPI::MPI_C metis::metis) + +if(SHARED) + target_link_libraries(parmetis PRIVATE metis GKlib) +endif() + +add_library(parmetis::parmetis INTERFACE IMPORTED GLOBAL) +target_link_libraries(parmetis::parmetis INTERFACE parmetis) + +install(TARGETS parmetis EXPORT ${PROJECT_NAME}-targets) + add_subdirectory(libparmetis) add_subdirectory(programs) # This is for testing during development and is not being distributed #add_subdirectory(test) + +include(cmake/install.cmake) + +file(GENERATE OUTPUT .gitignore CONTENT "*") diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..f0bf935 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,72 @@ +{ + "version": 6, + +"configurePresets": [ +{ + "name": "default", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "CMAKE_COMPILE_WARNING_AS_ERROR": true + } +} +], +"buildPresets": [ + { + "name": "default", + "configurePreset": "default" + }, + { + "name": "release", + "configurePreset": "default", + "configuration": "Release" + } +], +"testPresets": [ +{ + "name": "default", + "configurePreset": "default", + "output": { + "outputOnFailure": true, + "verbosity": "verbose" + }, + "execution": { + "noTestsAction": "error", + "scheduleRandom": true, + "stopOnFailure": false, + "timeout": 60 + } +}, +{ + "name": "release", "inherits": "default", + "configuration": "Release" +} +], +"workflowPresets": [ + { + "name": "default", + "steps": [ + { + "type": "configure", + "name": "default" + }, + { + "type": "build", + "name": "default" + } + ] + }, + { + "name": "release", + "steps": [ + { + "type": "configure", + "name": "default" + }, + { + "type": "build", + "name": "release" + } + ] + } +] +} diff --git a/METIS b/METIS new file mode 160000 index 0000000..d4a3aac --- /dev/null +++ b/METIS @@ -0,0 +1 @@ +Subproject commit d4a3aac2a3a0efc18e1de24ae97302ed510f43c7 diff --git a/README.md b/README.md index ca03a05..5d293ac 100644 --- a/README.md +++ b/README.md @@ -1,82 +1,26 @@ -# ParMETIS +# ParMETIS -ParMETIS is an MPI-based library for partitioning graphs, partitioning finite element meshes, -and producing fill reducing orderings for sparse matrices. The algorithms implemented in -ParMETIS are based on the multilevel recursive-bisection, multilevel k-way, and multi-constraint +[![ci](https://github.com/scivision/ParMETIS/actions/workflows/ci.yml/badge.svg)](https://github.com/scivision/ParMETIS/actions/workflows/ci.yml) + +ParMETIS is an MPI-based library for partitioning graphs, partitioning finite element meshes, +and producing fill reducing orderings for sparse matrices. The algorithms implemented in +ParMETIS are based on the multilevel recursive-bisection, multilevel k-way, and multi-constraint partitioning schemes developed in our lab. -## Downloading ParMETIS +## Downloading ParMETIS You can download ParMETIS by simply cloning it using the command: ``` git clone https://github.com/KarypisLab/ParMETIS.git ``` -## Building the ParMETIS library To build ParMETIS you can follow the instructions below: -### Dependencies - -General dependencies for building ParMETIS are: gcc, cmake, build-essential, and an MPI library. -In Ubuntu systems these can be obtained from the apt package manager (e.g., apt-get install cmake, mpich, etc) - -``` -sudo apt-get install build-essential -sudo apt-get install cmake -``` - -In addition, you need to download and install -[GKlib](https://github.com/KarypisLab/GKlib) and -[METIS](https://github.com/KarypisLab/METIS) by following the instructions there. - - -### Building and installing ParMETIS - -ParMETIS is primarily configured by passing options to make config. For example: - -``` -make config cc=mpicc prefix=~/local -make install +```sh +cmake --workflow --preset default ``` -will configure ParMETIS to be built using mpicc and then install the binaries, header files, and libraries at - -``` -~/local/bin -~/local/include -~/local/lib -``` - -directories, respectively. - -### Common configuration options are: - - cc=[compiler] - The C compiler to use [default is determined by CMake] - shared=1 - Build a shared library instead of a static one [off by default] - prefix=[PATH] - Set the installation prefix [~/local by default] - gklib_path=[PATH] - Set the prefix path where GKlib has been installed. You can skip - this if GKlib's installation prefix is the same as that of ParMETIS. - metis_path=[PATH] - Set the prefix path where METIS has been installed. You can skip - this if METIS' installation prefix is the same as that of ParMETIS. - -### Advanced debugging related options: - - gdb=1 - Build with support for GDB [off by default] - debug=1 - Enable debugging support [off by default] - assert=1 - Enable asserts [off by default] - assert2=1 - Enable very expensive asserts [off by default] - -### Other make commands - - make uninstall - Removes all files installed by 'make install'. - - make clean - Removes all object files but retains the configuration options. - - make distclean - Performs clean and completely removes the build directory. ### Definitions of supported data types @@ -85,8 +29,6 @@ ParMETIS uses the same data types for integers and floating point numbers (32/64 integers and single/double precision floating point numbers) as used when configuring and building METIS. - ## Copyright & License Notice -Copyright 1998-2020, Regents of the University of Minnesota - +Copyright 1998-2020, Regents of the University of Minnesota diff --git a/cmake/GitSubmodule.cmake b/cmake/GitSubmodule.cmake new file mode 100644 index 0000000..e7fe55d --- /dev/null +++ b/cmake/GitSubmodule.cmake @@ -0,0 +1,69 @@ +# get/update Git submodule directory to CMake, assuming the +# Git submodule directory is a CMake project. +# If the submodule directory is not in the same directory, descend level by level with multiple +# git_submodule() calls. +# +# For example, in the MUMPS project, we have submodule directories +# mumps/parmetis/METIS/GKlib +# +# from the mumps/ directory to enable METIS but not ParMETIS if the user desires, we do +# git_submodule(${PROJECT_SOURCE_DIR}/parmetis) +# if(MUMPS_parmetis) +# add_subdirectory(${PROJECT_SOURCE_DIR}/parmetis) +# # ParMETIS project itself handles METIS submodule, then METIS handles GKlib submodule +# else() +# git_submodule(${PROJECT_SOURCE_DIR}/parmetis/METIS) +# add_subdirectory(${PROJECT_SOURCE_DIR}/parmetis/METIS) +# METIS project itself handles GKlib submodule +# endif() + + +function(git_submodule submod_dir) + + +if(EXISTS ${submod_dir}/CMakeLists.txt) + return() +endif() + +find_package(Git REQUIRED) + +set(CMAKE_EXECUTE_PROCESS_COMMAND_ECHO STDOUT) + +cmake_path(GET submod_dir PARENT_PATH mod_dir) +# we need to descend level by level + +if(IS_DIRECTORY ${mod_dir}/.git) + +message(STATUS "${mod_dir} is a Git repository, updating submodule ${submod_dir}") + +execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive -- ${submod_dir} + WORKING_DIRECTORY ${mod_dir} + COMMAND_ERROR_IS_FATAL ANY +) + +else() + +cmake_path(GET submod_dir STEM submod_name) +message(STATUS "${PROJECT_SOURCE_DIR} is not a Git repository.") +message(STATUS "Getting ${mod_dir}/.gitmodules info to Git clone ${submod_name} into ${submod_dir}") + +execute_process( + COMMAND ${GIT_EXECUTABLE} config + --file ${mod_dir}/.gitmodules + --get submodule.${submod_name}.url + WORKING_DIRECTORY ${mod_dir} + OUTPUT_VARIABLE submod_url + OUTPUT_STRIP_TRAILING_WHITESPACE + COMMAND_ERROR_IS_FATAL ANY +) +# Some platforms like Windows, Git might refuse to clone into a totally empty existing directory +# this is a known technique, to "git clone" from that empty submod_dir directory to make it work. +execute_process( + COMMAND ${GIT_EXECUTABLE} clone ${submod_url} ${submod_dir} + WORKING_DIRECTORY ${submod_dir} + COMMAND_ERROR_IS_FATAL ANY +) + +endif() + +endfunction() diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in new file mode 100644 index 0000000..a812dbb --- /dev/null +++ b/cmake/config.cmake.in @@ -0,0 +1,7 @@ +@PACKAGE_INIT@ + +include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake) + +find_dependency(metis CONFIG) + +check_required_components(@PROJECT_NAME@) diff --git a/cmake/install.cmake b/cmake/install.cmake new file mode 100644 index 0000000..b4f3197 --- /dev/null +++ b/cmake/install.cmake @@ -0,0 +1,50 @@ +# --- BOILERPLATE: install / packaging + +include(CMakePackageConfigHelpers) + +configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/config.cmake.in +${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake +INSTALL_DESTINATION cmake +) + +write_basic_package_version_file( +${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake +COMPATIBILITY SameMajorVersion +) + +install(EXPORT ${PROJECT_NAME}-targets +NAMESPACE ${PROJECT_NAME}:: +DESTINATION cmake +) + +install(FILES +${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake +${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake +DESTINATION cmake +) + +# # allow use of package from build directory without installing +export(EXPORT ${PROJECT_NAME}-targets +FILE ${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}-targets.cmake +NAMESPACE ${PROJECT_NAME}:: +) + +# --- CPack + +set(CPACK_GENERATOR "TBZ2") +set(CPACK_SOURCE_GENERATOR "TBZ2") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") +set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md") +set(CPACK_PACKAGE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/package) + +# not .gitignore as its regex syntax is more advanced than CMake +set(CPACK_SOURCE_IGNORE_FILES .git/ .github/ .vscode/ _CPack_Packages/ +${CMAKE_BINARY_DIR}/ ${PROJECT_BINARY_DIR}/ +archive/ concepts/ +) + +install(FILES ${CPACK_RESOURCE_FILE_README} ${CPACK_RESOURCE_FILE_LICENSE} +DESTINATION share/docs/${PROJECT_NAME} +) + +include(CPack) diff --git a/conf/gkbuild.cmake b/conf/gkbuild.cmake index ec91224..d3a9386 100644 --- a/conf/gkbuild.cmake +++ b/conf/gkbuild.cmake @@ -3,141 +3,94 @@ include(CheckFunctionExists) include(CheckIncludeFile) # Setup options. -option(GDB "enable use of GDB" OFF) -option(ASSERT "turn asserts on" OFF) -option(ASSERT2 "additional assertions" OFF) -option(DEBUG "add debugging support" OFF) -option(GPROF "add gprof support" OFF) option(OPENMP "enable OpenMP support" OFF) option(PCRE "enable PCRE support" OFF) option(GKREGEX "enable GKREGEX support" OFF) option(GKRAND "enable GKRAND support" OFF) + # Add compiler flags. if(MSVC) - set(GK_COPTS "/Ox") - set(GK_COPTIONS "-DWIN32 -DMSC -D_CRT_SECURE_NO_DEPRECATE -DUSE_GKREGEX") -elseif(MINGW) - set(GK_COPTS "-DUSE_GKREGEX") + set(GKlib_COPTIONS WIN32 MSC _CRT_SECURE_NO_DEPRECATE USE_GKREGEX) +elseif(WIN32) + set(GKlib_COPTIONS USE_GKREGEX) else() - set(GK_COPTIONS "-DLINUX -D_FILE_OFFSET_BITS=64") + set(GKlib_COPTIONS LINUX FILE_OFFSET_BITS=64) endif(MSVC) + if(CYGWIN) - set(GK_COPTIONS "${GK_COPTIONS} -DCYGWIN") -endif(CYGWIN) -if(CMAKE_COMPILER_IS_GNUCC) -# GCC opts. - set(GK_COPTIONS "${GK_COPTIONS} -std=c99 -fno-strict-aliasing") -# -march=native is not a valid flag on PPC: -if(CMAKE_SYSTEM_PROCESSOR MATCHES "power|ppc|powerpc|ppc64|powerpc64" OR (APPLE AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc|ppc64")) - set(GK_COPTIONS "${GK_COPTIONS} -mtune=native") -else() - set(GK_COPTIONS "${GK_COPTIONS} -march=native") -endif() - if(NOT MINGW) - set(GK_COPTIONS "${GK_COPTIONS} -fPIC") - endif(NOT MINGW) -# GCC warnings. - set(GK_COPTIONS "${GK_COPTIONS} -Werror -Wall -pedantic -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unknown-pragmas -Wno-unused-label") -elseif(${CMAKE_C_COMPILER_ID} MATCHES "Sun") -# Sun insists on -xc99. - set(GK_COPTIONS "${GK_COPTIONS} -xc99") -endif(CMAKE_COMPILER_IS_GNUCC) - -if(${CMAKE_C_COMPILER_ID} STREQUAL "Intel") - set(GK_COPTIONS "${GK_COPTIONS} -xHost") - # set(GK_COPTIONS "${GK_COPTIONS} -fast") + list(APPEND GKlib_COPTIONS CYGWIN) endif() -# Add support for the Accelerate framework in OS X if(APPLE) - set(GK_COPTIONS "${GK_COPTIONS} -framework Accelerate") -endif(APPLE) - -# Find OpenMP if it is requested. -if(OPENMP) - include(FindOpenMP) - if(OPENMP_FOUND) - set(GK_COPTIONS "${GK_COPTIONS} -D__OPENMP__ ${OpenMP_C_FLAGS}") - else() - message(WARNING "OpenMP was requested but support was not found") - endif(OPENMP_FOUND) -endif(OPENMP) - - -# Add various definitions. -if(GDB) - set(GK_COPTS "${GK_COPTS} -g") - set(GK_COPTIONS "${GK_COPTIONS} -Werror") -else() - set(GK_COPTS "-O3") -endif(GDB) - - -if(DEBUG) - set(GK_COPTS "-Og") - set(GK_COPTIONS "${GK_COPTIONS} -DDEBUG") -endif(DEBUG) + list(APPEND GKlib_COPTIONS MACOS) +endif() -if(GPROF) - set(GK_COPTS "-pg") -endif(GPROF) +if(CMAKE_C_COMPILER_ID STREQUAL "GNU") + list(APPEND GKlib_COPTS -fno-strict-aliasing -Wall -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unknown-pragmas -Wno-unused-label) +endif() -if(NOT ASSERT) - set(GK_COPTIONS "${GK_COPTIONS} -DNDEBUG") -endif(NOT ASSERT) +if(UNIX) +include(CheckPIESupported) +check_pie_supported() +set(CMAKE_POSITION_INDEPENDENT_CODE true) +endif() -if(NOT ASSERT2) - set(GK_COPTIONS "${GK_COPTIONS} -DNDEBUG2") -endif(NOT ASSERT2) +# Find OpenMP if it is requested. +if(OPENMP) + find_package(OpenMP REQUIRED) + list(APPEND GKlib_COPTIONS __OPENMP__) +endif() +# Set the CPU type +if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") + list(APPEND GKlib_COPTIONS NO_X86=1) +endif() # Add various options if(PCRE) - set(GK_COPTIONS "${GK_COPTIONS} -D__WITHPCRE__") -endif(PCRE) + list(APPEND GKlib_COPTIONS __WITHPCRE__) +endif() if(GKREGEX) - set(GK_COPTIONS "${GK_COPTIONS} -DUSE_GKREGEX") -endif(GKREGEX) +list(APPEND GKlib_COPTIONS USE_GKREGEX) +endif() if(GKRAND) - set(GK_COPTIONS "${GK_COPTIONS} -DUSE_GKRAND") -endif(GKRAND) +list(APPEND GKlib_COPTIONS USE_GKRAND) +endif() # Check for features. check_include_file(execinfo.h HAVE_EXECINFO_H) if(HAVE_EXECINFO_H) - set(GK_COPTIONS "${GK_COPTIONS} -DHAVE_EXECINFO_H") + list(APPEND GKlib_COPTIONS HAVE_EXECINFO_H) endif(HAVE_EXECINFO_H) check_function_exists(getline HAVE_GETLINE) if(HAVE_GETLINE) - set(GK_COPTIONS "${GK_COPTIONS} -DHAVE_GETLINE") + list(APPEND GKlib_COPTIONS HAVE_GETLINE) endif(HAVE_GETLINE) # Custom check for TLS. if(MSVC) - set(GK_COPTIONS "${GK_COPTIONS} -D__thread=__declspec(thread)") - - # This if checks if that value is cached or not. - if("${HAVE_THREADLOCALSTORAGE}" MATCHES "^${HAVE_THREADLOCALSTORAGE}$") + if(NOT DEFINED HAVE_THREADLOCALSTORAGE) + message(CHECK_START "checking for thread-local storage") try_compile(HAVE_THREADLOCALSTORAGE ${CMAKE_BINARY_DIR} - ${CMAKE_SOURCE_DIR}/conf/check_thread_storage.c) + ${CMAKE_CURRENT_LIST_DIR}/check_thread_storage.c) if(HAVE_THREADLOCALSTORAGE) - message(STATUS "checking for thread-local storage - found") + message(CHECK_PASS "found") else() - message(STATUS "checking for thread-local storage - not found") + message(CHECK_FAIL "not found") endif() endif() if(NOT HAVE_THREADLOCALSTORAGE) - set(GK_COPTIONS "${GK_COPTIONS} -D__thread=") + list(APPEND GKlib_COPTIONS __thread=) endif() endif() # Finally set the official C flags. -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GK_COPTIONS} ${GK_COPTS}") - +add_compile_options("$<$:${GKlib_COPTS}>") +add_compile_definitions("$<$:${GKlib_COPTIONS}>") diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt deleted file mode 100644 index 6a27074..0000000 --- a/include/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -install(FILES parmetis.h DESTINATION include) \ No newline at end of file diff --git a/libparmetis/CMakeLists.txt b/libparmetis/CMakeLists.txt index b9d6d84..c9832ef 100644 --- a/libparmetis/CMakeLists.txt +++ b/libparmetis/CMakeLists.txt @@ -1,17 +1,10 @@ -# Include directories for library code. -include_directories(.) - -# Find sources. -file(GLOB parmetis_sources *.c) - -# Create libparmetis -add_library(parmetis ${ParMETIS_LIBRARY_TYPE} ${parmetis_sources}) - -if(SHARED) - target_link_libraries(parmetis metis GKlib) -endif() - -install(TARGETS parmetis - LIBRARY DESTINATION lib - RUNTIME DESTINATION lib - ARCHIVE DESTINATION lib) +target_sources(parmetis PRIVATE +diffutil.c initmsection.c move.c rename.h wave.c +akwayfm.c frename.c initpart.c msetup.c renumber.c weird.c +ametis.c gklib.c kmetis.c node_refine.c rmetis.c wspace.c +balancemylink.c gklib_defs.h kwayrefine.c ometis.c selectq.c xyzpart.c +comm.c gklib_rename.h macros.h parmetislib.h serial.c +csrmatch.c gkmetis.c match.c proto.h stat.c +ctrl.c gkmpi.c mdiffusion.c pspases.c struct.h +debug.c graph.c mesh.c redomylink.c timer.c +defs.h initbalance.c mmetis.c remap.c util.c) diff --git a/programs/CMakeLists.txt b/programs/CMakeLists.txt index 2f9341c..bba4c28 100644 --- a/programs/CMakeLists.txt +++ b/programs/CMakeLists.txt @@ -1,5 +1,3 @@ -include_directories(.) - # Create programs. add_executable(pm_ptest ptest.c io.c adaptgraph.c) add_executable(pm_mtest mtest.c io.c) @@ -7,10 +5,11 @@ add_executable(pm_parmetis parmetis.c io.c adaptgraph.c) add_executable(pm_pometis pometis.c io.c) add_executable(pm_dglpart dglpart.c) -# Link with the required libraries -foreach(prog pm_ptest pm_mtest pm_parmetis pm_pometis pm_dglpart) - target_link_libraries(${prog} parmetis metis GKlib m) +# Link with the required libraries +foreach(prog IN ITEMS pm_ptest pm_mtest pm_parmetis pm_pometis pm_dglpart) + target_include_directories(${prog} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${metis_fc_SOURCE_DIR}/include) + target_link_libraries(${prog} PRIVATE parmetis metis GKlib MPI::MPI_C + $<$:m>) endforeach(prog) -install(TARGETS pm_ptest pm_mtest pm_parmetis pm_pometis pm_dglpart - RUNTIME DESTINATION bin) +install(TARGETS pm_ptest pm_mtest pm_parmetis pm_pometis pm_dglpart)