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"
]
}
}
}
119 changes: 53 additions & 66 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,98 +5,85 @@ on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master

jobs:
build-cache:
runs-on: ubuntu-24.04
permissions:
packages: write
strategy:
matrix:
env_variant: [default]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true

- name: Set up Spack
uses: spack/[email protected]
with:
buildcache: true
color: true
path: _spack

- name: Checkout NumPEx Spack packages
uses: actions/checkout@v4
with:
repository: numpex/spack.numpex
path: numpex-spack
fetch-depth: 1

- name: Add NumPEx repo to Spack
run: |
spack repo add numpex-spack

- name: Install Metis via Spack
run: |
ls -l
spack -e spack/metis-${{ matrix.env_variant }} install --no-check-signature

- name: Push packages and update index
run: |
spack -e spack/metis-${{ matrix.env_variant }} mirror set --push --oci-username ${{ github.actor }} --oci-password "${{ secrets.GITHUB_TOKEN }}" feelpp-buildcache
spack -e spack/metis-${{ matrix.env_variant }} buildcache push --base-image ubuntu:24.04 --unsigned --update-index feelpp-buildcache
if: ${{ !cancelled() }}

build:
needs: build-cache
runs-on: ubuntu-24.04
permissions:
packages: write
strategy:
matrix:
env_variant: [default]
preset: [default, shared]
env_variant: [metis-default]
preset: [int32-real32-shared, int64-real64-shared]
continue-on-error: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true

- name: Set up Spack
uses: spack/setup-spack@v2.1.1
- name: Prepare Spack & Push Build-Cache
uses: numpex/spack-buildcache-action@v1.1.2
with:
buildcache: true
color: true
path: _spack

- name: Checkout NumPEx Spack packages
uses: actions/checkout@v4
with:
repository: numpex/spack.numpex
path: numpex-spack
fetch-depth: 1

- name: Add NumPEx repo to Spack
run: |
spack repo add numpex-spack

- name: Spack install dependencies
run: spack -e spack/metis-${{ matrix.env_variant }} install --no-check-signature
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/metis-${{ matrix.env_variant }}
spack env activate .spack/${{ matrix.env_variant }}
cmake --preset ${{ matrix.preset }}

- name: Build
run: cmake --build --preset ${{ matrix.preset }} --parallel

- name: Test
run: ctest --preset ${{ matrix.preset }} --output-on-failure
run: ctest --preset ${{ matrix.preset }} --output-on-failure

- name: Package with CPack
run: |
cmake --build --preset ${{ matrix.preset }} --target package
cmake --build --preset ${{ matrix.preset }} --target package_source

- name: Upload Metis artifacts
uses: actions/upload-artifact@v4
with:
name: metis-artifacts-${{ matrix.preset }}
path: |
build/${{ matrix.preset }}/*.tar.gz
build/${{ matrix.preset }}/*.zip
release:
# only run on tag pushes
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-24.04
steps:
- name: Download Metis artifacts
uses: actions/download-artifact@v4
with:
path: dist

- name: Create Release
uses: softprops/action-gh-release@v2
with:
# include both tgz and zip
files: |
dist/*.tar.gz
dist/*.zip
draft: false
# mark prereleases for pre-releases tags
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 }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ GKlib
.svn/

.spack-env
spack.lock
metis-*/
1 change: 1 addition & 0 deletions .spack/metis-default/spack.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ spack:
concretizer:
unify: when_possible
mirrors:
feelpp-buildcache: oci://ghcr.io/feelpp/spack-buildcache
numpex-buildcache: oci://ghcr.io/numpex/spack-buildcache
69 changes: 36 additions & 33 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
cmake_minimum_required(VERSION 3.21)
project(METIS VERSION 5.3.0 LANGUAGES C)

project(metis VERSION 5.3.1 LANGUAGES C)

set(METIS_PRERELEASE "-rc.8")
set(METIS_VERSION_STRING "${PROJECT_VERSION}${METIS_PRERELEASE}")
set(METIS_VERSION_MAJOR 5)
set(METIS_VERSION_MINOR 3)
set(METIS_VERSION_PATCH 1)
set(METIS_VERSION "${METIS_VERSION_MAJOR}.${METIS_VERSION_MINOR}.${METIS_VERSION_PATCH}${METIS_PRERELEASE}")
set(METIS_VERSION_NUMBER
((METIS_VERSION_MAJOR << 16) | (METIS_VERSION_MINOR << 9) | METIS_VERSION_PATCH)
)
# -----------------------------------------------------------------------------
# 1) Expose the same options that your old Makefile used:
# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -42,40 +51,11 @@ if(REAL64)
set(_METIS_REALWIDTH 64)
endif()

# -----------------------------------------------------------------------------
# Generate xinclude directory and headers
# -----------------------------------------------------------------------------
set(XINCLUDE_DIR "${CMAKE_BINARY_DIR}/xinclude")
file(MAKE_DIRECTORY ${XINCLUDE_DIR})

# metis.h.in should define @ _METIS_IDXWIDTH @ and @ _METIS_REALWIDTH @ at top
configure_file(
"${CMAKE_SOURCE_DIR}/include/metis.h.in"
"${XINCLUDE_DIR}/metis.h"
@ONLY
)

# copy the CMakeLists.txt stub into xinclude
configure_file(
"${CMAKE_SOURCE_DIR}/include/CMakeLists.txt"
"${XINCLUDE_DIR}/CMakeLists.txt"
COPYONLY
)

# make sure generated headers are found first
include_directories(BEFORE ${XINCLUDE_DIR})

# -----------------------------------------------------------------------------
# GKlib include/link paths (if provided)
# -----------------------------------------------------------------------------
if(GKLIB_PATH)
include_directories(${GKLIB_PATH}/include)
link_directories(${GKLIB_PATH}/lib)
endif()

include(GNUInstallDirs)
# -----------------------------------------------------------------------------
# Add subdirectories for core library and programs
# -----------------------------------------------------------------------------
add_subdirectory(include)
add_subdirectory(libmetis)
add_subdirectory(programs)

Expand Down Expand Up @@ -110,3 +90,26 @@ install(
DESTINATION ${ConfigPackageLocation}
)

# -----------------------------------------------------------------------------
# CPack packaging
# -----------------------------------------------------------------------------
include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_NAME "Metis")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "METIS Graph Partitioning Library")
set(CPACK_PACKAGE_VERSION_MAJOR "${METIS_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${METIS_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${METIS_VERSION_PATCH}")
set(CPACK_PACKAGE_VERSION "${METIS_VERSION}")
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${METIS_PRERELEASE}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}${METIS_PRERELEASE}")
SET(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${METIS_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)
49 changes: 49 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"cacheVariables": {
"BUILD_SHARED_LIBS": "ON",
"CMAKE_RUNTIME_OUTPUT_DIRECTORY": "${sourceDir}/build/${presetName}/bin"
//"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/${presetName}-install/"
}
},
{
Expand All @@ -51,6 +52,38 @@
"CMAKE_RUNTIME_OUTPUT_DIRECTORY": "${sourceDir}/build/${presetName}/bin",
"GKLIB_PATH": "./GKlib"
}
},
{
"name": "int64",
"hidden": true,
"displayName": "64-bit integers",
"description": "64-bit integers build of METIS",
"inherits": "default",
"cacheVariables": {
"IDX64": "ON"
}
},
{
"name": "real64",
"hidden": true,
"displayName": "64-bit real numbers",
"description": "64-bit real numbers build of METIS",
"inherits": "default",
"cacheVariables": {
"REAL64": "ON"
}
},
{
"name": "int32-real32-shared",
"displayName": "32-bit index and real numbers (shared)",
"description": "32-bit index and real numbers build of METIS",
"inherits": ["shared"]
},
{
"name": "int64-real64-shared",
"displayName": "64-bit index and real numbers (shared)",
"description": "64-bit index and real numbers build of METIS",
"inherits": ["int64","real64", "shared"]
}
],
"buildPresets": [
Expand All @@ -65,6 +98,14 @@
{
"name": "local-gklib",
"configurePreset": "local-gklib"
},
{
"name": "int32-real32-shared",
"configurePreset": "int32-real32-shared"
},
{
"name": "int64-real64-shared",
"configurePreset": "int64-real64-shared"
}
],
"testPresets": [
Expand All @@ -79,6 +120,14 @@
{
"name": "local-gklib",
"configurePreset": "local-gklib"
},
{
"name": "int32-real32-shared",
"configurePreset": "int32-real32-shared"
},
{
"name": "int64-real64-shared",
"configurePreset": "int64-real64-shared"
}
]
}
2 changes: 2 additions & 0 deletions cmake/MetisConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@PACKAGE_INIT@

include(CMakeFindDependencyMacro)
find_dependency(GKlib REQUIRED)
include("${CMAKE_CURRENT_LIST_DIR}/MetisConfigVersion.cmake")

# this import makes the imported target available
Expand Down
3 changes: 2 additions & 1 deletion include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
configure_file(metis.h.in metis.h @ONLY)
if(METIS_INSTALL)
install(FILES metis.h DESTINATION include)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/metis.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/metis)
endif()
9 changes: 2 additions & 7 deletions libmetis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,12 @@ target_include_directories(metis
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/libmetis>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<BUILD_INTERFACE:${GKLIB_PATH}/include>
$<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:include/metis>

)

target_compile_definitions(metis
PRIVATE
IDXTYPEWIDTH=32
REALTYPEWIDTH=32
)

target_link_libraries(metis
PUBLIC m GKlib::GKlib

Expand Down