pyamgx: Python interface to NVIDIA's AMGX library
For installation instructions, overview and examples, see the documentation.
GPU accelerated multigrid library for Python
Home Page: https://pyamgx.readthedocs.io
License: BSD 3-Clause "New" or "Revised" License
For installation instructions, overview and examples, see the documentation.
I tried to run the "Demo" in the documentation, but here's the error I'm getting:
AMGX version 2.2.0.132-opensource
Built on Dec 17 2021, 10:01:48
Compiled with CUDA Runtime 11.4, using CUDA driver 11.4
Error initializing amgx core: Reader 'MatrixMarket' is already registered
---------------------------------------------------------------------------
AMGXError Traceback (most recent call last)
<ipython-input-6-b8458b63a257> in <module>
5 import pyamgx
6
----> 7 pyamgx.initialize()
8
9 # Initialize config and resources:
~/Code/pyamgx/pyamgx/pyamgx.pyx in pyamgx.initialize()
18 Initialize AMGX.
19 """
---> 20 check_error(AMGX_initialize())
21 check_error(AMGX_initialize_plugins())
22
~/Code/pyamgx/pyamgx/Errors.pyx in pyamgx.check_error()
60 """
61 if err_code is not RC.OK:
---> 62 raise AMGXError(get_error_string(err_code))
AMGXError: Error initializing amgx core.
Would really appreciate it if you could shed some light.
When running the demo code:
import os
import numpy as np
import scipy.sparse as sparse
import scipy.sparse.linalg as splinalg
import pyamgx
pyamgx.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"
}
}
})
rsc = pyamgx.Resources().create_simple(cfg)
# Create matrices and vectors:
A = pyamgx.Matrix().create(rsc)
b = pyamgx.Vector().create(rsc)
x = pyamgx.Vector().create(rsc)
# Create solver:
solver = pyamgx.Solver().create(rsc, cfg)
# Upload system:
M = sparse.csr_matrix(np.random.rand(5, 5))
rhs = np.random.rand(5)
sol = np.zeros(5, dtype=np.float64)
A.upload_CSR(M)
b.upload(rhs)
x.upload(sol)
# Setup and solve system:
solver.setup(A)
solver.solve(b, x)
# Download solution
x.download(sol)
print("pyamgx solution: ", sol)
print("scipy solution: ", splinalg.spsolve(M, rhs))
# Clean up:
A.destroy()
x.destroy()
b.destroy()
solver.destroy()
rsc.destroy()
cfg.destroy()
pyamgx.finalize()
it works with original size of 5:
AMGX version 2.0.0.130-opensource
Built on Aug 17 2018, 13:54:04
Compiled with CUDA Runtime 8.0, using CUDA driver 9.0
pyamgx solution: [-0.04913677 0.45919818 0.32257954 -5.92235908 5.07968096]
scipy solution: [-0.04913677 0.45919818 0.32257954 -5.92235908 5.07968096]
However, when increasing the size
import os
import numpy as np
import scipy.sparse as sparse
import scipy.sparse.linalg as splinalg
import pyamgx
pyamgx.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"
}
}
})
rsc = pyamgx.Resources().create_simple(cfg)
# Create matrices and vectors:
A = pyamgx.Matrix().create(rsc)
b = pyamgx.Vector().create(rsc)
x = pyamgx.Vector().create(rsc)
# Create solver:
solver = pyamgx.Solver().create(rsc, cfg)
# Upload system:
M = sparse.csr_matrix(np.random.rand(50, 50))
rhs = np.random.rand(50)
sol = np.zeros(50, dtype=np.float64)
A.upload_CSR(M)
b.upload(rhs)
x.upload(sol)
# Setup and solve system:
solver.setup(A)
solver.solve(b, x)
# Download solution
x.download(sol)
print("pyamgx solution: ", sol)
print("scipy solution: ", splinalg.spsolve(M, rhs))
# Clean up:
A.destroy()
x.destroy()
b.destroy()
solver.destroy()
rsc.destroy()
cfg.destroy()
pyamgx.finalize()
results don't match (and sometimes it shows nan values for AMGX results):
AMGX version 2.0.0.130-opensource
Built on Aug 17 2018, 13:54:04
Compiled with CUDA Runtime 8.0, using CUDA driver 9.0
pyamgx solution: [nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan
nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan
nan nan nan nan nan nan nan nan nan nan nan nan nan nan]
scipy solution: [ 1.34510525e+00 -1.84795490e+00 8.21675778e-01 1.34116418e+00
-6.96444229e-01 1.43148095e+00 7.08443873e-01 -1.99171184e+00
-1.04956682e+00 -1.39552602e+00 1.06465736e+00 1.67046274e+00
2.78546394e-01 -4.69101519e-02 -5.79393645e-01 3.34543665e-02
5.66351654e-01 -2.89784225e-01 4.65161455e-02 -7.26722900e-01
-1.32436708e+00 -7.62393583e-01 -1.27278275e+00 9.19390392e-01
1.15142300e+00 -6.32118527e-01 1.49184592e-01 1.31297032e-01
-1.20398898e+00 -1.81848002e+00 8.59732035e-01 1.24897810e+00
1.84654850e-01 -3.91532778e-01 1.17519625e-03 8.40269678e-01
1.69749016e+00 8.36441707e-01 -1.41898643e+00 3.10896151e-01
-7.92247414e-02 -2.50256260e+00 -2.73683331e-01 -6.78059601e-04
2.32159380e+00 -4.42947010e-01 1.76246294e+00 -4.46720554e-01
-4.65628157e-01 5.52782146e-01]
Is this a bug or am I doing something wrong?
Thanks
Hi,
I am trying to link pyamgx to an AMGX installation through Spack. It looks like the directory structure for AMGX in the install root dir is different compared to an install from source. Due to this, I am having trouble figuring out, what path to export for the AMGX_BUILD_DIR variable.
Here is additional info on contents of the install directory:
Contents on install dir:
$ ls -a
. .. include lib .spack
$ cd include/
$ ls
amgx_c.h amgx_config.h
$ cd ../lib/
$ ls
configs examples libamgx.a libamgxsh.so sublibs
Let me know if any more info is required.
I understand that currently pyamgx only supports "simple" Resource objects for single GPU application. However, in a multi-GPU environment, does pyamgx currently have the ability to choose which GPU to use? It does not seem so, and the following is from the current doc page:
"Resources objects are used to specify the resources (GPUs, MPI ranks) used by Vector, Matrix and Solver objects. Currently, pyamgx only supports “simple” Resources objects for single threaded, single GPU applications. created using the create_simple() method:"
It appears that the AMGX library only supports single-GPU applications. But the ability to choose which GPU to run on can still be beneficial, because otherwise the application will always runson the default (#0) GPU, which is often the busiest one.
Dear Shwina
I would need to solve numerous linear systems, so pyamgx will be helpful. I have installed it using anaconda, and I have tried to run the Demo at https://pyamgx.readthedocs.io/en/latest/demo.html. Unfortunately, I get this error
[autoreload of pyamgx failed: Traceback (most recent call last):
File "C:\Users\User\Anaconda3\lib\site-packages\IPython\extensions\autoreload.py", line 245, in check
superreload(m, reload, self.old_objects)
File "C:\Users\User\Anaconda3\lib\site-packages\IPython\extensions\autoreload.py", line 394, in superreload
module = reload(module)
File "C:\Users\User\Anaconda3\lib\imp.py", line 314, in reload
return importlib.reload(module)
File "C:\Users\User\Anaconda3\lib\importlib\__init__.py", line 169, in reload
_bootstrap._exec(spec, module)
File "<frozen importlib._bootstrap>", line 604, in _exec
File "<frozen importlib._bootstrap_external>", line 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "D:\Francisco\LAVORI\CUDA_PY\pyamgx.py", line 7, in <module>
pyamgx.initialize()
AttributeError: module 'pyamgx' has no attribute 'initialize'
]
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Temp/ipykernel_13368/2086866730.py", line 1, in <module>
runfile('D:/Francisco/LAVORI/CUDA_PY/pyamgx.py', wdir='D:/Francisco/LAVORI/CUDA_PY')
File "C:\Users\User\Anaconda3\lib\site-packages\debugpy\_vendored\pydevd\_pydev_bundle\pydev_umd.py", line 167, in runfile
execfile(filename, namespace)
File "C:\Users\User\Anaconda3\lib\site-packages\debugpy\_vendored\pydevd\_pydev_imps\_pydev_execfile.py", line 25, in execfile
exec(compile(contents + "\n", file, 'exec'), glob, loc)
File "D:/Francisco/LAVORI/CUDA_PY/pyamgx.py", line 7, in <module>
pyamgx.initialize()
AttributeError: module 'pyamgx' has no attribute 'initialize'
Hi,
I will be very happy to see an upload_raw method for matrices, just like the method with the same name for vectors. This method will allow us to upload the matrix with data already on the GPU, which can potentially reduce the time spent for data transferring. Thanks!
--qingshan
@wd15 Contribution is welcome
solver.destroy()
documentation references Matrix
instead of Solver
:
https://github.com/shwina/pyamgx/blob/master/pyamgx/Solver.pyx#L154
I tried to build pyamgx but I got an error - see below. AMGX was properly installed and AMGX_DIR environment variable was set to the root directory of AMGX (in my case /home/pyim/AMGX_master).
Any ideas?
python setup.py build_ext
running build_ext
building 'pyamgx' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/public/apps/python/2.7.12/gcc.6.2.0/lib/python2.7/site-packages/numpy/core/include -I/public/apps/python/2.7.12/gcc.6.2.0/include/python2.7 -c pyamgx/pyamgx.c -o build/temp.linux-x86_64-2.7/pyamgx/pyamgx.o
pyamgx/pyamgx.c:9:20: warning: "/" within comment [-Wcomment]
"pyamgx/.pyx, pyamgx/*.pxi"
pyamgx/pyamgx.c:9:34: warning: "/*" within comment [-Wcomment]
pyamgx/pyamgx.c:506:20: fatal error: amgx_c.h: No such file or directory
#include "amgx_c.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
Currently, all pyamgx objects must be explicitly cleaned up by calling a .destroy()
method, but it should be possible to automatically clean up objects when they go out of scope (or at exit), using weakref.finalize
- Python >= 3.4 only.
warning: I don't know what to do with 'runtime_library_dirs': ['C:\\Users\\Administrator\\Anaconda3\\lib\\site-packages\\numpy\\core\\include', 'C:\\ProgramData\\NVIDIA Corporation\\AMGX-master\\build']
error: don't know how to set runtime library search path for MSVC
Can you please make a proper release of this software, it makes it easier for HPC sites to install when there is a proper release.
[atrikut@node0524 tests]$ pytest test_vector.py test_matrix.py
================================================================= test session starts ==================================================================
platform linux -- Python 3.6.3, pytest-3.2.1, py-1.4.34, pluggy-0.4.0
rootdir: /home/atrikut/projects/pyamgx, inifile:
collected 4 items
test_vector.py ..
test_matrix.py ..
=============================================================== 4 passed in 1.28 seconds ===============================================================
AMGX version 2.0.0.130-opensource
Built on Feb 6 2018, 20:25:44
Compiled with CUDA Runtime 8.0, using CUDA driver 9.0
Cannot read file as JSON object, trying as AMGX config
AMGX version 2.0.0.130-opensource
Built on Feb 6 2018, 20:25:44
Compiled with CUDA Runtime 8.0, using CUDA driver 9.0
Cannot read file as JSON object, trying as AMGX config
AMGX version 2.0.0.130-opensource
Built on Feb 6 2018, 20:25:44
Compiled with CUDA Runtime 8.0, using CUDA driver 9.0
Cannot read file as JSON object, trying as AMGX config
AMGX version 2.0.0.130-opensource
Built on Feb 6 2018, 20:25:44
Compiled with CUDA Runtime 8.0, using CUDA driver 9.0
Cannot read file as JSON object, trying as AMGX config
[atrikut@node0524 tests]$ pytest test_matrix.py test_vector.py
================================================================= test session starts ==================================================================
platform linux -- Python 3.6.3, pytest-3.2.1, py-1.4.34, pluggy-0.4.0
rootdir: /home/atrikut/projects/pyamgx, inifile:
collected 4 items
test_matrix.py ..
test_vector.py .F
======================================================================= FAILURES =======================================================================
________________________________________________________________ TestVector.test_upload ________________________________________________________________
self = <test_vector.TestVector object at 0x2b5892847e48>
def test_upload(self):
self.v.create(self.rsrc)
self.v.upload(
3,
np.array([1, 2, 3.], dtype=np.float64))
> assert (self.v._err == RC.OK)
E assert 9 == 0
E + where 9 = <pyamgx.Vector object at 0x2b5891e26e10>._err
E + where <pyamgx.Vector object at 0x2b5891e26e10> = <test_vector.TestVector object at 0x2b5892847e48>.v
E + and 0 = RC.OK
test_vector.py:28: AssertionError
---------------------------------------------------------------- Captured stdout setup -----------------------------------------------------------------
x8b
/software/anaconda3/5.0.1/bin/python : ()+0x19f00e
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x198b8b
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x19828e
/software/anaconda3/5.0.1/bin/python : ()+0x198dc1
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x197f24
/software/anaconda3/5.0.1/bin/python : ()+0x198dc1
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
AMGX version 2.0.0.130-opensource
Built on Feb 6 2018, 20:25:44
Compiled with CUDA Runtime 8.0, using CUDA driver 9.0
Cannot read file as JSON object, trying as AMGX config
Caught amgx exception: Cannot allocate pinned memory
at: /home/atrikut/projects/AMGX/base/src/global_thread_handle.cu:374
Stack trace:
/home/atrikut/local/AMGX/build/libamgxsh.so : amgx::memory::PinnedMemoryPool::PinnedMemoryPool()+0xdc
/home/atrikut/local/AMGX/build/libamgxsh.so : amgx::allocate_resources(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long)+0x3b
/home/atrikut/local/AMGX/build/libamgxsh.so : amgx::Resources::Resources(amgx::AMG_Configuration*, void*, int, int const*)+0x63a
/home/atrikut/local/AMGX/build/libamgxsh.so : AMGX_resources_create_simple()+0x56
/home/atrikut/projects/pyamgx/pyamgx.cpython-36m-x86_64-linux-gnu.so : ()+0x5c45
/software/anaconda3/5.0.1/bin/python : _PyCFunction_FastCallDict()+0x115
/software/anaconda3/5.0.1/bin/python : ()+0x19eebc
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x198b8b
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x198b8b
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : PyEval_EvalCodeEx()+0x975
/software/anaconda3/5.0.1/bin/python : ()+0x19a6f4
/software/anaconda3/5.0.1/bin/python : PyObject_Call()+0x3e
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x1a08
/software/anaconda3/5.0.1/bin/python : ()+0x19828e
/software/anaconda3/5.0.1/bin/python : ()+0x198dc1
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : _PyFunction_FastCallDict()+0x11b
/software/anaconda3/5.0.1/bin/python : _PyObject_FastCallDict()+0x26f
/software/anaconda3/5.0.1/bin/python : _PyObject_Call_Prepend()+0x63
/software/anaconda3/5.0.1/bin/python : PyObject_Call()+0x3e
/software/anaconda3/5.0.1/bin/python : ()+0x16bd0b
/software/anaconda3/5.0.1/bin/python : ()+0x19f1f7
/software/anaconda3/5.0.1/bin/python : _PyObject_FastCallDict()+0x8b
/software/anaconda3/5.0.1/bin/python : ()+0x19f00e
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x198b8b
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x19828e
/software/anaconda3/5.0.1/bin/python : ()+0x198dc1
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x197f24
/software/anaconda3/5.0.1/bin/python : ()+0x198dc1
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x198b8b
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x197f2
----------------------------------------------------------------- Captured stdout call -----------------------------------------------------------------
4
/software/anaconda3/5.0.1/bin/python : _PyFunction_FastCallDict()+0x3d7
/software/anaconda3/5.0.1/bin/python : _PyObject_FastCallDict()+0x26f
/software/anaconda3/5.0.1/bin/python : _PyObject_Call_Prepend()+0x63
/software/anaconda3/5.0.1/bin/python : PyObject_Call()+0x3e
/software/anaconda3/5.0.1/bin/python : ()+0x16c6a7
/software/anaconda3/5.0.1/bin/python : PyObject_Call()+0x3e
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x1a08
/software/anaconda3/5.0.1/bin/python : ()+0x19828e
/software/anaconda3/5.0.1/bin/python : ()+0x198dc1
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x197f24
/software/anaconda3/5.0.1/bin/python : _PyFunction_FastCallDict()+0x3d7
/software/anaconda3/5.0.1/bin/python : _PyObject_FastCallDict()+0x26f
/software/anaconda3/5.0.1/bin/python : _PyObject_Call_Prepend()+0x63
/software/anaconda3/5.0.1/bin/python : PyObject_Call()+0x3e
/software/anaconda3/5.0.1/bin/python : ()+0x16bd0b
Caught amgx exception: Invalid/null C wrapper.
at: /home/atrikut/projects/AMGX/base/include/amgx_c_wrappers.inl:517
Stack trace:
/home/atrikut/local/AMGX/build/libamgxsh.so : amgx::CWrapHandle<AMGX_resources_handle_struct*, amgx::Resources>::CWrapHandle(AMGX_resources_handle_struct*)+0x31e
/home/atrikut/local/AMGX/build/libamgxsh.so : AMGX_vector_create_impl()+0x27
/home/atrikut/projects/pyamgx/pyamgx.cpython-36m-x86_64-linux-gnu.so : ()+0xd51c
/software/anaconda3/5.0.1/bin/python : _PyCFunction_FastCallDict()+0x154
/software/anaconda3/5.0.1/bin/python : ()+0x19eebc
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : _PyFunction_FastCallDict()+0x11b
/software/anaconda3/5.0.1/bin/python : _PyObject_FastCallDict()+0x26f
/software/anaconda3/5.0.1/bin/python : _PyObject_Call_Prepend()+0x63
/software/anaconda3/5.0.1/bin/python : PyObject_Call()+0x3e
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x1a08
/software/anaconda3/5.0.1/bin/python : PyEval_EvalCodeEx()+0x329
/software/anaconda3/5.0.1/bin/python : ()+0x19a6f4
/software/anaconda3/5.0.1/bin/python : PyObject_Call()+0x3e
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x1a08
/software/anaconda3/5.0.1/bin/python : ()+0x19828e
/software/anaconda3/5.0.1/bin/python : ()+0x198dc1
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : _PyFunction_FastCallDict()+0x11b
/software/anaconda3/5.0.1/bin/python : _PyObject_FastCallDict()+0x26f
/software/anaconda3/5.0.1/bin/python : _PyObject_Call_Prepend()+0x63
/software/anaconda3/5.0.1/bin/python : PyObject_Call()+0x3e
/software/anaconda3/5.0.1/bin/python : ()+0x16bd0b
/software/anaconda3/5.0.1/bin/python : ()+0x19f1f7
/software/anaconda3/5.0.1/bin/python : _PyObject_FastCallDict()+0x8b
/software/anaconda3/5.0.1/bin/python : ()+0x19f00e
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x198b8b
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x19828e
/software/anaconda3/5.0.1/bin/python : ()+0x198dc1
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x197f24
/software/anaconda3/5.0.1/bin/python : ()+0x198dc1
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x198b8b
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x197f24
/software/anaconda3/5.0.1/bin/python : _PyFunction_FastCallDict()+0x3d7
/software/anaconda3/5.0.1/bin/python : _PyObject_FastCallDict()+0x26f
/software/anaconda3/5.0.1/bin/python : _PyObject_Call_Prepend()+0x63
/software/anaconda3/5.0.1/bin/python : PyObject_Call()+0x3e
/software/anaconda3/5.0.1/bin/python : ()+0x16c6a7
/software/anaconda3/5.0.1/bin/python : _PyObject_FastCallDict()+0x8b
/software/anaconda3/5.0.1/bin/python : _PyObject_FastCallKeywords()+0xaa
/software/anaconda3/5.0.1/bin/python : ()+0x19f00e
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x10c7
/software/anaconda3/5.0.1/bin/python : ()+0x198b8b
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : PyEval_EvalCodeEx()+0x329
/software/anaconda3/5.0.1/bin/python : ()+0x19a6f4
/software/anaconda3/5.0.1/bin/python : PyObject_Call()+0x3e
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x1a08
/software/anaconda3/5.0.1/bin/python : ()+0x19828e
/software/anaconda3/5.0.1/bin/python : ()+0x198dc1
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
Caught amgx exception: Mode not found.
at: /home/atrikut/projects/AMGX/base/include/amgx_c_wrappers.inl:646
Stack trace:
/home/atrikut/local/AMGX/build/libamgxsh.so : AMGX_Mode amgx::(anonymous namespace)::get_mode_from<AMGX_vector_handle_struct*>(AMGX_vector_handle_struct* const&)+0xd8
/home/atrikut/local/AMGX/build/libamgxsh.so : amgx::getResourcesFromVectorHandle(AMGX_vector_handle_struct*, amgx::Resources**)+0x21
/home/atrikut/local/AMGX/build/libamgxsh.so : AMGX_vector_upload_impl()+0x25
/home/atrikut/projects/pyamgx/pyamgx.cpython-36m-x86_64-linux-gnu.so : ()+0x96a2
/software/anaconda3/5.0.1/bin/python : _PyCFunction_FastCallDict()+0x154
/software/anaconda3/5.0.1/bin/python : ()+0x19eebc
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : _PyFunction_FastCallDict()+0x11b
/software/anaconda3/5.0.1/bin/python : _PyObject_FastCallDict()+0x26f
/software/anaconda3/5.0.1/bin/python : _PyObject_Call_Prepend()+0x63
/software/anaconda3/5.0.1/bin/python : PyObject_Call()+0x3e
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x1a08
/software/anaconda3/5.0.1/bin/python : PyEval_EvalCodeEx()+0x329
/software/anaconda3/5.0.1/bin/python : ()+0x19a6f4
/software/anaconda3/5.0.1/bin/python : PyObject_Call()+0x3e
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x1a08
/software/anaconda3/5.0.1/bin/python : ()+0x19828e
/software/anaconda3/5.0.1/bin/python : ()+0x198dc1
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : _PyFunction_FastCallDict()+0x11b
/software/anaconda3/5.0.1/bin/python : _PyObject_FastCallDict()+0x26f
/software/anaconda3/5.0.1/bin/python : _PyObject_Call_Prepend()+0x63
/software/anaconda3/5.0.1/bin/python : PyObject_Call()+0x3e
/software/anaconda3/5.0.1/bin/python : ()+0x16bd0b
/software/anaconda3/5.0.1/bin/python : ()+0x19f1f7
/software/anaconda3/5.0.1/bin/python : _PyObject_FastCallDict()+0x8b
/software/anaconda3/5.0.1/bin/python : ()+0x19f00e
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x198b8b
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x19828e
/software/anaconda3/5.0.1/bin/python : ()+0x198dc1
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x197f24
/software/anaconda3/5.0.1/bin/python : ()+0x198dc1
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x198b8b
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/a
--------------------------------------------------------------- Captured stdout teardown ---------------------------------------------------------------
naconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x197f24
/software/anaconda3/5.0.1/bin/python : _PyFunction_FastCallDict()+0x3d7
/software/anaconda3/5.0.1/bin/python : _PyObject_FastCallDict()+0x26f
/software/anaconda3/5.0.1/bin/python : _PyObject_Call_Prepend()+0x63
/software/anaconda3/5.0.1/bin/python : PyObject_Call()+0x3e
/software/anaconda3/5.0.1/bin/python : ()+0x16c6a7
/software/anaconda3/5.0.1/bin/python : _PyObject_FastCallDict()+0x8b
/software/anaconda3/5.0.1/bin/python : _PyObject_FastCallKeywords()+0xaa
/software/anaconda3/5.0.1/bin/python : ()+0x19f00e
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x10c7
/software/anaconda3/5.0.1/bin/python : ()+0x198b8b
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : PyEval_EvalCodeEx()+0x329
/software/anaconda3/5.0.1/bin/python : ()+0x19a6f4
/software/anaconda3/5.0.1/bin/python : PyObject_Call()+0x3e
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x1a08
/software/anaconda3/5.0.1/bin/python : ()+0x19828e
/software/anaconda3/5.0.1/bin/python : ()+0x198dc1
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
Caught amgx exception: Mode not found.
at: /home/atrikut/projects/AMGX/base/include/amgx_c_wrappers.inl:646
Stack trace:
/home/atrikut/local/AMGX/build/libamgxsh.so : AMGX_Mode amgx::(anonymous namespace)::get_mode_from<AMGX_vector_handle_struct*>(AMGX_vector_handle_struct* const&)+0xd8
/home/atrikut/local/AMGX/build/libamgxsh.so : amgx::getResourcesFromVectorHandle(AMGX_vector_handle_struct*, amgx::Resources**)+0x21
/home/atrikut/local/AMGX/build/libamgxsh.so : AMGX_vector_destroy_impl()+0x1e
/home/atrikut/projects/pyamgx/pyamgx.cpython-36m-x86_64-linux-gnu.so : ()+0x545d
/software/anaconda3/5.0.1/bin/python : _PyCFunction_FastCallDict()+0x19a
/software/anaconda3/5.0.1/bin/python : ()+0x19eebc
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x198b8b
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x198b8b
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x198b8b
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x1980b6
/software/anaconda3/5.0.1/bin/python : ()+0x198dc1
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x198b8b
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x198b8b
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x198b8b
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x198b8b
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x198b8b
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : PyEval_EvalCodeEx()+0x329
/software/anaconda3/5.0.1/bin/python : ()+0x19a6f4
/software/anaconda3/5.0.1/bin/python : PyObject_Call()+0x3e
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x1a08
/software/anaconda3/5.0.1/bin/python : ()+0x19828e
/software/anaconda3/5.0.1/bin/python : ()+0x198dc1
/software/a
========================================================== 1 failed, 3 passed in 1.28 seconds ==========================================================
naconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : _PyFunction_FastCallDict()+0x11b
/software/anaconda3/5.0.1/bin/python : _PyObject_FastCallDict()+0x26f
/software/anaconda3/5.0.1/bin/python : _PyObject_Call_Prepend()+0x63
/software/anaconda3/5.0.1/bin/python : PyObject_Call()+0x3e
/software/anaconda3/5.0.1/bin/python : ()+0x16bd0b
/software/anaconda3/5.0.1/bin/python : ()+0x19f1f7
/software/anaconda3/5.0.1/bin/python : _PyObject_FastCallDict()+0x8b
/software/anaconda3/5.0.1/bin/python : ()+0x19f00e
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x198b8b
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x19828e
/software/anaconda3/5.0.1/bin/python : ()+0x198dc1
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
/software/anaconda3/5.0.1/bin/python : ()+0x197f24
/software/anaconda3/5.0.1/bin/python : ()+0x198dc1
/software/anaconda3/5.0.1/bin/python : ()+0x19ef95
/software/anaconda3/5.0.1/bin/python : _PyEval_EvalFrameDefault()+0x30a
$ python test_amgx.py
Traceback (most recent call last):
File "/data/guyer/fipy/test_amgx.py", line 5, in <module>
import pyamgx
ImportError: /toolbox/guyer/AMGX/build/libamgxsh.so: undefined symbol: omp_get_num_threads
It works with AMGX v2.3.0
test_amgx.py
is pyamgx demo code.
pyamgx/Matrix.pyx in pyamgx.Matrix.upload_CSR (pyamgx/pyamgx.c:3191)()
pyamgx/Matrix.pyx in pyamgx.Matrix.upload (pyamgx/pyamgx.c:2830)()
TypeError: upload() takes at most 4 positional arguments (5 given)
@shwina
I have installed pyamgx on Windows system succefully, and tested a large symmetric sparse linear system, it works well. It is said in the document that pyamgx only supports “simple” resources objects for single threaded, single GPU applications. Is it possible to implement a multithreaded version such as to make it more competitive. In addition, the function cfg.create_from_dict( ) seems not to be working properly (cfg.creat( ) and cfg.creat_from_file( ) are both Ok). Thanks for your contributions.
Best wishes
Currently pyamgx.Vector has the method download( ) for numpy arrays, and download_raw( ) for raw pointers (possibly on GPU?) Raw pointers are rather difficult to use. I hope that a generic interface can be implemented for the Vector.download( ) method, which can download data either to a numpy array variable, or a cupy array variable, just like the Vector.upload( ) method and the Matrix.upload( ) method. Many thanks!
I tried to install amgx / pyamgx using this Nix recipe. I've encountered three problems while testing using demo.py.
import numpy
as the first import in demo.py. Otherwise, I get the following error.Traceback (most recent call last):
File "<string>", line 1, in <module>
File "__init__.pxd", line 163, in init pyamgx
File "/nix/store/mq134cl5nfiy422cjzvjms90az1zxnwh-python2.7-numpy-1.14.0/lib/python2.7/site-packages/numpy/__init__.py", line 142, in <module>
from . import add_newdocs
...
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
The configuration in demo.py on line 6 needs to be changed to cfg = pyamgx.Config().create_from_file(os.environ['AMGX_DIR']+'/lib/configs/core/FGMRES_AGGREGATION.json')
since I'm accessing the json file in lib/ where pyamgx is installed.
When running demo.py
I now get the following error.
AMGX version 2.0.0.130-opensource
Built on May 14 2018, 23:06:38
Failed while initializing CUDA runtime in cudaRuntimeGetVersionVariable 'solver' not registered
Converting config string to current config version
Error parsing parameter string: Incorrect config entry (number of equal signs is not 1) : "config_version": 2
Error parsing parameter string obtained from file:
Traceback (most recent call last):
File "demo.py", line 8, in <module>
cfg = pyamgx.Config().create_from_file(os.environ['AMGX_DIR']+'/lib/configs/core/FGMRES_AGGREGATION.json')
File "pyamgx/Config.pyx", line 49, in pyamgx.Config.create_from_file
File "pyamgx/Errors.pyx", line 62, in pyamgx.check_error
pyamgx.AMGXError: Incorrect amgx configuration provided.
I'm using version 6cb23fed266 of amgx and version df32133 of pyamgx. Are those versions compatible?
Hi,
It appears that pyamgx.Matrix.replace_coefficients is not working properly. The AMGX documentation says that for this function to work, matrix_upload_all must have been called previously. This function is not yet available in PYAMGX, and this may be the reason?
Hello,
I've been trying to install pyamgx unsuccessfully. The instructions at the website are clear and explicit and I think I've followed them correctly.
export AMGX_DIR=/home/user/Documents/AMGX-master
When I get to the step that requests: "pip install ." I get the following error message:
user@cb2l-002:~/Documents/pyamgx$ pip install . --user
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/init.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
warnings.warn(warning, RequestsDependencyWarning)
Processing /home/user/Documents/pyamgx
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-req-build-RQkQsR/setup.py", line 38
*AMGX_include_dirs
^
SyntaxError: invalid syntax----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-RQkQsR/
I tried running setup.py from the IPython console to which I receive the very same output:
File "/home/user/Documents/pyamgx/setup.py", line 38
*AMGX_include_dirs
^
SyntaxError: invalid syntax
To my understanding the answer is simple. This is not accepted as it doesn't follow the Python syntaxis. This is unmodified code I just downloaded from here... maybe my Cython isn't properly running? maybe something got mixed up at the previous update of the code?
I'd appreciate any input.
Thank you!
Initialize
Finalize
Initialize Plugins
Finalize Plugins
Get API Version
Get Error String
Get Build Info Strings
Pin Memory
Unpin Memory
Install Signal Handler
Reset Signal Handler
Register Print Callback
Read System
Write System
Config Create
Config Create From File
Config Destroy
Resources Create Simple
Resources Destroy
Solver Create
Solver Destroy
Solver Setup
Solver Solve With 0 Initial Guess
Solver Solve
Solver Get Iterations Number
Solver Get Iterations Residual
Solver Get Status
Matrix Create
Matrix Destroy
Matrix Upload All
Matrix Replace Coefficients
Matrix Get Size
Vector Create
Vector Destroy
Vector Upload
Vector Download
Vector Set Zero
Vector Get Size
Functions not listed in the API reference:
Hello!
Currently I'm working with sparse square matrix formed by PDE system. Matrix is singular as there are some zero rows, including last ones. It's not a lineal algebra issue, because RHS is also zero at these points. Still, I can't use Matrix.upload
method. It checks CSR indptr
size and decides, that matrix is non-square (but it is square). indptr
gives incorrect matrix size, because last rows of matrix have no non-zero values. I made a change in that code and AMGX works correctly with such a matrix.
I suggest 2 things:
Also in MPI case AMGX Matrix.upload
function accepts non-square matrix. It is stated in AMGX documentation. So I think this check is not needed at all. I can make pull request for this feature if you decide, what option is preferable.
Now that the upload( ) method works for both numpy arrays and cupy arrays, I suggest that the documentation be updated for this feature.
The upload_raw( ) method now seems obsolete. I suggest that this method be removed.
Hi there,
I was wondering if there were any examples MPI based examples on pyamgx?
Kind regards,
Tony
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.