本文记录Linux下编译安装METIS的流程。
零、环境
操作系统 | Ubuntu 22.04.4 LTS |
VS Code | 1.92.1 |
Git | 2.34.1 |
GCC | 11.4.0 |
CMake | 3.22.1 |
oneAPI | 2024.2.1 |
一、安装依赖
1.1 下载GKlib
sudo apt-get install build-essential
sudo apt-get install cmake
2.2 编译安装GKlib
下载GKlib代码,
git clone https://github.com/KarypisLab/GKlib
按照下表完成CMake相关配置,构建项目,完成编译与安装。
CMAKE_INSTALL_PREFIX | ~/dev/3rdparty/install/intel-dbg |
CMAKE_BUILD_TYPE | Debug |
二、编译安装METIS
2.1 下载源码
git clone https://github.com/KarypisLab/METIS.git
2.2 配置
运行以下命令在生成build/xinclude目录
make config shared=1 cc=icx prefix=~/dev/3rdparty/install/intel-dbg
2.3 编译安装
按照下表完成CMake相关配置,构建项目,完成编译与安装。
CMAKE_INSTALL_PREFIX | ~/dev/3rdparty/install/intel-dbg |
CMAKE_BUILD_TYPE | Debug |
三、编译安装ParMETIS
3.1 下载源码
git clone https://github.com/KarypisLab/ParMETIS
修改ParMETIS/libparmetis/CMakeLists.txt,
# Include directories for library code.
include_directories(.)
# Find sources.
file(GLOB parmetis_sources *.c)
# Create libparmetis
add_library(parmetis ${ParMETIS_LIBRARY_TYPE} ${parmetis_sources})
find_package(MPI REQUIRED)
if(SHARED)
target_link_libraries(parmetis metis GKlib)
target_link_libraries(parmetis ${MPI_C_LIBRARIES$})
target_include_directories(parmetis ${MPI_C_INCLUDE_DIRS})
endif()
install(TARGETS parmetis
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib
ARCHIVE DESTINATION lib)
3.3 配置
运行一下命令配置ParMETIS,
make config shared=1 cc=mpiicx prefix=~/dev/3rdparty/install/intel-dbg
3.3 编译安装
按照下表完成CMake相关配置,构建项目,完成编译与安装。
CMAKE_INSTALL_PREFIX | ~/dev/3rdparty/install/intel-dbg |
CMAKE_BUILD_TYPE | Debug |
附录I: cmake-tools-kits.json
[
{
"name": "GCC 11.4.0 x86_64-linux-gnu",
"compilers": {
"C": "/usr/bin/gcc",
"CXX": "/usr/bin/g++"
},
"isTrusted": true
},
{
"name": "Intel(R) oneAPI DPC++/C++ Compiler 2024.2.1",
"compilers": {
"C": "/opt/intel/oneapi/compiler/2024.2/bin/icx",
"CXX": "/opt/intel/oneapi/compiler/2024.2/bin/icpx"
},
"isTrusted": true
}
]
附录II: launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "linux_intel",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/programs/mpmetis",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}
参考文献
- Karypis R .A software package for partitioning unstructured graphs, partitioning meshes, and computing fill-reducing orderings of sparse matrices, Version 5.1.0. 2013.