Linux下编译安装METIS/ParMetis

本文记录Linux下编译安装METIS的流程。

零、环境

操作系统Ubuntu 22.04.4 LTS
VS Code1.92.1
Git2.34.1
GCC11.4.0
CMake3.22.1
oneAPI2024.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_TYPEDebug

二、编译安装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_TYPEDebug

三、编译安装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_TYPEDebug

附录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.

网络

GKlibicon-default.png?t=O83Ahttps://github.com/KarypisLab/GKlib

METISicon-default.png?t=O83Ahttps://github.com/KarypisLab/METIS

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值