Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "Ubuntu 24.04 with C++",

"image": "mcr.microsoft.com/devcontainers/cpp:ubuntu-24.04",
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cmake-tools",
"josetr.cmake-language-support-vscode",
"asciidoctor.asciidoctor-vscode",
"ms-python.python",
"ms-toolsai.jupyter",
"ms-vsliveshare.vsliveshare",
"asciidoctor.asciidoctor-vscode",
"shardulm94.trailing-spaces",
"redhat.vscode-yaml"
]
}
}
}
90 changes: 90 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: CI

on:
workflow_dispatch:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-24.04
permissions:
packages: write
strategy:
matrix:
env_variant: [int32-real32-shared, int64-real64-shared]

steps:

- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Prepare Spack & Push Build-Cache
uses: numpex/spack-buildcache-action@v1.1.2
with:
env-variant: ${{ matrix.env_variant }}
repo-packages: numpex/spack.numpex
repo-packages-path: numpex-spack
mirror: numpex-buildcache
mirror-token: ${{ secrets.GITHUB_TOKEN }}
env-path: .spack
# base-image: ubuntu:24.04

- name: Configure CMake
shell: spack-bash {0}
run: |
spack env activate .spack/${{ matrix.env_variant }}
cmake --preset ${{ matrix.env_variant }}

# 4) build
- name: Build
run: cmake --build --preset ${{ matrix.env_variant }} --parallel

# 5) test
- name: Test
run: ctest --preset ${{ matrix.env_variant }} --output-on-failure

# 6) package via CPack
- name: Package with CPack
run: |
cmake --build --preset ${{ matrix.env_variant }} --target package
cmake --build --preset ${{ matrix.env_variant }} --target package_source

# 7) upload artifacts
- name: Upload ParMETIS artifacts
uses: actions/upload-artifact@v4
with:
name: metis-artifacts-${{ matrix.env_variant }}
path: |
build/${{ matrix.env_variant }}/*.tar.gz
build/${{ matrix.env_variant }}/*.zip

release:
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-24.04
steps:
- name: Download ParMETIS artifacts
uses: actions/download-artifact@v4
with:
path: dist

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.tar.gz
dist/*.zip
draft: false
prerelease: ${{ contains(github.ref, '-rc') || contains(github.ref, '-alpha') || contains(github.ref, '-beta') }}
name: Release ${{ github.ref_name }}
generate_release_notes: true
tag_name: ${{ github.ref }}
token: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ graphs/*.epart.*
graphs/*.npart.*
.svn/

.spack-env
1 change: 1 addition & 0 deletions .spack/int32-real32-shared/spack.lock

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions .spack/int32-real32-shared/spack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This is a Spack Environment file.
#
# It describes a set of packages to be installed, along with
# configuration settings.
spack:
config:
install_tree:
padded_length: 128
packages:
all:
compiler: ['gcc@14:', 'clang@14:']
require: [target=x86_64_v3]
mpi:
require: [openmpi@:4.1.6 fabrics=auto]
definitions:
- compilers: ['gcc@14:']
- mpis: [openmpi@:4.1.6 fabrics=auto]
- packages: [gklib+shared, metis+shared~int64]
specs:
- $compilers
- matrix:
- [$mpis]
- [$%compilers]
- matrix:
- [$packages]
- [$%compilers]
view: true
concretizer:
unify: true
mirrors:
numpex-buildcache: oci://ghcr.io/numpex/spack-buildcache
31 changes: 31 additions & 0 deletions .spack/int64-real64-shared/spack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This is a Spack Environment file.
#
# It describes a set of packages to be installed, along with
# configuration settings.
spack:
config:
install_tree:
padded_length: 128
packages:
all:
compiler: [gcc@14:, clang@14:]
require: ['target=x86_64_v3']
mpi:
require: ['openmpi@:4 fabrics=auto']
definitions:
- compilers: [gcc@12:]
- mpis: ['openmpi@:4.1.6 fabrics=auto']
- packages: [gklib+shared,metis+shared+int64]
specs:
- $compilers
- matrix:
- [$mpis]
- [$%compilers]
- matrix:
- [$packages]
- [$%compilers]
view: true
concretizer:
unify: when_possible
mirrors:
numpex-buildcache: oci://ghcr.io/numpex/spack-buildcache
159 changes: 123 additions & 36 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,43 +1,130 @@
cmake_minimum_required(VERSION 2.8)
project(ParMETIS C)
cmake_minimum_required(VERSION 3.15)
project(ParMETIS
VERSION 4.0.4
DESCRIPTION "Parallel Graph Partitioning Library"
LANGUAGES C
)


# 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}")
set(ParMETIS_PRERELEASE "-rc.4")
set(ParMETIS_VERSION_STRING "${PROJECT_VERSION}${ParMETIS_PRERELEASE}")
set(ParMETIS_VERSION_MAJOR 5)
set(ParMETIS_VERSION_MINOR 3)
set(ParMETIS_VERSION_PATCH 1)
set(ParMETIS_VERSION "${ParMETIS_VERSION_MAJOR}.${ParMETIS_VERSION_MINOR}.${ParMETIS_VERSION_PATCH}${ParMETIS_PRERELEASE}")
set(ParMETIS_VERSION_NUMBER
((ParMETIS_VERSION_MAJOR << 16) | (ParMETIS_VERSION_MINOR << 9) | ParMETIS_VERSION_PATCH)
)

# -----------------------------------------------------------------------------
# 1) Options
# -----------------------------------------------------------------------------

# Prepare libraries.
if(SHARED)
set(ParMETIS_LIBRARY_TYPE SHARED)
option(IDX64 "enable 64‑bit indices (IDXTYPEWIDTH=64)" OFF)
option(REAL64 "enable 64‑bit reals (REALTYPEWIDTH=64)" OFF)
option(SHARED "build shared library" OFF)
option(GDB "enable gdb symbols" OFF)
option(ASSERT "enable ASSERT" OFF)
option(ASSERT2 "enable ASSERT2" OFF)
option(DEBUG "enable DEBUG" OFF)
option(GPROF "enable gprof profiling" OFF)
option(VALGRIND "enable valgrind instrumentation" OFF)
option(OPENMP "enable OpenMP support" OFF)

option(BUILD_SHARED_LIBS
"Build ParMETIS as a shared library (default OFF → static)"
${SHARED}
)
# -----------------------------------------------------------------------------
# 2) Map options to compile-time widths
# -----------------------------------------------------------------------------
if(IDX64)
set(IDXTYPEWIDTH 64)
else()
set(ParMETIS_LIBRARY_TYPE STATIC)
set(IDXTYPEWIDTH 32)
endif()

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)
add_subdirectory(libparmetis)
add_subdirectory(programs)

# This is for testing during development and is not being distributed
#add_subdirectory(test)
if(REAL64)
set(REALTYPEWIDTH 64)
else()
set(REALTYPEWIDTH 32)
endif()



# -----------------------------------------------------------------------------
# 2) Dependencies
# -----------------------------------------------------------------------------
find_package(MPI REQUIRED) # MPI::MPI_C
find_package(GKlib REQUIRED) # GKlib::GKlib
find_package(Metis REQUIRED) # METIS::metis
if(OPENMP)
find_package(OpenMP REQUIRED)
endif()

option(PARMETIS_ENABLE_TESTS "Enable PARMETIS testing (default OFF)" ON)
if (PARMETIS_ENABLE_TESTS)
enable_testing()
endif()
# -----------------------------------------------------------------------------
# 3) Subdirectories
# -----------------------------------------------------------------------------
add_subdirectory(include) # installs parmetis.h
add_subdirectory(libparmetis) # builds ParMETIS lib
add_subdirectory(programs) # builds pm_* executables

# -----------------------------------------------------------------------------
# 4) Installation & Export
# -----------------------------------------------------------------------------
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

install(
EXPORT ParMETISTargets
NAMESPACE ParMETIS::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ParMETIS
)

# 4b) Generate and install Config files for find_package(ParMETIS)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/ParMETISConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)

configure_package_config_file(
"${CMAKE_CURRENT_LIST_DIR}/cmake/ParMETISConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/ParMETISConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ParMETIS
)

install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/ParMETISConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/ParMETISConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ParMETIS
)

# -----------------------------------------------------------------------------
# 5) CPack (optional)
# -----------------------------------------------------------------------------
include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_NAME "ParMETIS")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "ParMETIS Graph Partitioning Library")
set(CPACK_PACKAGE_VERSION_MAJOR "${ParMETIS_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${ParMETIS_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${ParMETIS_VERSION_PATCH}")
set(CPACK_PACKAGE_VERSION "${ParMETIS_VERSION}")
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${ParMETIS_PRERELEASE}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}${ParMETIS_PRERELEASE}")
SET(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${ParMETIS_PRERELEASE}-${CMAKE_SYSTEM_NAME}")

# Optionally point to your LICENSE and README
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
set(CPACK_GENERATOR "TGZ;ZIP")
set(CPACK_SOURCE_IGNORE_FILES
"/build/;/.spack-env/;spack*;metis-*;.git/;~$;${CPACK_SOURCE_IGNORE_FILES}"
)

include(CPack)
Loading