当前位置: 首页 > news >正文

安装pyamgx

首先编译AMGX

cmake -B build
cmake --build build --config Release

编译完之后进入AMGX/build 运行demo. 注意这里比README多加了个Release

examples/Release/amgx_capi -m ../examples/matrix.mtx -c ../src/configs/FGMRES_AGGREGATION.json

然后设置

setx AMGX_DIR "D:\dev\AMGX"

然后在pyamgx下

pip install .

将pyamgx/demo.py的前几部分改为下面的代码,并且运行python demo.py

import numpy as np
import scipy.sparse as sparse
import scipy.sparse.linalg as splinalgimport osos.add_dll_directory("D:/Dev/AMGX/build/Release")
os.add_dll_directory("C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.5/bin")import pyamgxpyamgx.initialize()# Initialize config and resources:
# cfg = pyamgx.Config().create_from_dict({
#    "config_version": 2,
#         "determinism_flag": 1,
#         "exception_handling" : 1,
#         "solver": {
#             "monitor_residual": 1,
#             "solver": "BICGSTAB",
#             "convergence": "RELATIVE_INI_CORE",
#             "preconditioner": {
#                 "solver": "NOSOLVER"
#         }
#     }
# })
cfg = pyamgx.Config().create_from_file("D:/dev/AMGX/src/configs/AGGREGATION_JACOBI.json")

注意几点:

  1. add_dll_directory是让windows找到DLL的。因为windows DLL不会去PATH里面搜索,所以要这样设置。
  2. create_from_dict在windows也是无法使用的。会出现如下报错
  3. 如果pip install .这一步出现了问题,那么可以将AMGX/build/Release下面的几个dll拷贝到AMGX/build/试一试
Error parsing config file: Error: Cannot read config file: C:\Users\cl-w\AppData\Local\Temp\tmpudy9b9x1
Traceback (most recent call last):File "D:\dev\pyamgx\demo.py", line 16, in <module>cfg = pyamgx.Config().create_from_dict({File "pyamgx\\Config.pyx", line 63, in pyamgx.Config.create_from_dictwith tempfile.NamedTemporaryFile(mode='r+') as fp:File "pyamgx\\Config.pyx", line 66, in pyamgx.Config.create_from_dictself.create_from_file(fp.name.encode())File "pyamgx\\Config.pyx", line 49, in pyamgx.Config.create_from_filecheck_error(AMGX_config_create_from_file(&self.cfg, param_file))File "pyamgx\\Errors.pyx", line 62, in pyamgx.check_errorraise AMGXError(get_error_string(err_code))
pyamgx.AMGXError: I/O error.

http://www.mrgr.cn/news/35554.html

相关文章:

  • 3DGS 学习笔记
  • C语言课程设计题目(24个选题)
  • WPF入门教学十六 图形基础
  • update-alternatives工具来管理和切换不同的Java
  • 基于深度学习的人机情感交互
  • JAVA基本简介(期末)
  • HDFS_API文件和文件夹
  • PR视频剪辑工具全指南:开启专业剪辑之旅
  • 力扣每日一题 字符串中最多数目的子序列 贪心 字符串 前缀和
  • 二叉树的基本概念(上)
  • 【C++笔试强训】
  • 交换机和路由器的区别
  • 煤矿井下钻场目标检测数据集 5类 voc格式
  • VisualStudio如何卸载Resharper插件?
  • 记一次Mac 匪夷所思终端常用网络命令恢复记录
  • 【python】利用python处理数据(stata等价命令)
  • 运算符重载
  • spring-boot、spring-cloud、spring-cloud-alibaba的常用依赖的依赖声明及pom文件
  • HtmlCss 基础总结(基础好了才是最能打的)五
  • 【每天学个新注解】Day 5 Lombok注解简解(四)—@Cleanup