Window下python安装metis

目录

1、需要准备的软件(文件夹)

2、安装步骤

1、修改注册表

2、修改CMakeList.txt

3、修改metis.h(option)

4、确定Cmake与VS是否匹配

5、在刚刚的命令行窗口里面继续运行

6、修改gk_arch.h

7、生成metis.dll文件

8、设定METIS_DLL环境变量

9、安装metis python warpper


此文章仅用于分享如何安装,参考了两位大佬的知乎,知乎:pofatoezildongZheX,本文也主要是模仿pofatoezil的知乎写法以及顺序,只是在自己稍微总结了一下,并且在最后一步使用了不同的方法(原方法每次import metis前都要定义一次METIS_DLL)。

1、需要准备的软件(文件夹)

Metis的官网下载Metis,并且下载压缩包,conda-metis,VS2019,下载完成后将Metis和conda-metis的文件分别解压,得到文件夹

2、安装步骤

1、修改注册表

在window搜索里输入regedit,打开注册表,找到\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\路径

(1)修改该路径下.\4.0\中的数值数据为C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin

(2)修改该路径下.\ToolVersion\4.0\中的数值数据为C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin

2、修改CMakeList.txt

在一开始的时候,我还没看到pofatoezil的回答,我生成的是.lib文件,后面发现python 需要的是.dll文件。

编辑刚刚解压的文件conda-metis-master

conda-metis-master/CMakeLists.txt,在第19行加入 

set(METIS_LIBRARY_TYPE SHARED)

3、修改metis.h(option)

打开conda-metis-master\include\metis.h,将 #define IDXTYPEWIDTH 32 该为

#define IDXTYPEWIDTH 64

4、确定Cmake与VS是否匹配

在conda-metis-master文件夹里进入命令行(cmd)输入下列指令

cmake--help

如果能正确运行,应该就能看到一大堆东西,其中就有"Visual Studio 16 2019"等等

5、在刚刚的命令行窗口里面继续运行

.\vsgen -G "Visual Studio 16 2019" -A x64

在运行此代码后,在conda-metis-master\build\windows\下应该会出现很多的文件,如METIS.sln

6、修改gk_arch.h

找到文件conda-metis-master\GKlib\gk_arch.h,编辑

找到 #define rint(x) ((idx_t)((x)+0.5)),在前面加两条//,效果如下

//#define rint(x) ((idx_t)((x)+0.5))

7、生成metis.dll文件

使用VS打开conda-metis-master\build\windows\METIS.sln文件,选择Release和x64,然后点击生成(B),再点击生成解决方案(B)

这一步运行有可能会报错,不过报错也没关系,可以看看文件夹\conda-metis-master\build\windows\libmetis\Release是否有metis.dll文件,如果有就可以了。

8、设定METIS_DLL环境变量

在命令行窗口运行下列代码,your path这里记得换回你conda-metis-master的路径前缀。

setx METIS_DLL <'your path'>\conda-metis-master\build\windows\libmetis\Release\metis.dll

此代码不同于两位大神的做法,运行上述代码后,就不用每次导metis包的时候都要定义一次METIS_DLL

9、安装metis python warpper

在命令行窗口输入下列代码

pip install metis

如果上述步骤都能运行,那应该可以在python里正常引用metis包了。

[1] Metis 5.1.0 安裝心得 in Win10 - 知乎

[2]Cluster-GCN代码运行环境配置攻略 - 知乎

[3]GitHub - menpo/conda-metis: Builds metis 5.1.0 using conda

[4]cmd 设置环境cmd环境变量命令set 设置永久环境变量命令setx_小蓝的博客-CSDN博客

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
metis-5.1.0安装包和manual手册 2 What is new in version 5.0 4 2.1 Changes in the command-line programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.1.1 Migration issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.2 Changes in the API routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.2.1 Migration issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3 Overview of METIS 6 3.1 Partitioning a graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.2 Alternate partitioning objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.3 Support for multi-phase and multi-physics computations . . . . . . . . . . . . . . . . . . . . . . . . 8 3.4 Partitioning a mesh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.5 Partitioning for heterogeneous parallel computing architectures . . . . . . . . . . . . . . . . . . . . . 8 3.6 Computing a fill-reducing ordering of a sparse matrix . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.7 Converting a mesh into a graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 4 METIS’ stand-alone programs 9 4.1 Input file formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 4.1.1 Graph file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 4.1.2 Mesh file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 4.1.3 Target partition weights file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.2 Output file formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 4.2.1 Partition file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值