Title: DirectSolver yields incorrect result for random and close to random matrices · Issue #56 · NVIDIA/nvmath-python · GitHub
Open Graph Title: DirectSolver yields incorrect result for random and close to random matrices · Issue #56 · NVIDIA/nvmath-python
X Title: DirectSolver yields incorrect result for random and close to random matrices · Issue #56 · NVIDIA/nvmath-python
Description: I was considering swapping cupy sparse solvers for nvmath Python/cuDSS DirectSolver, but I am unable to obtain correct results even for small problem instances. Minimal example In example01_cupy.py replace n = 8 ... a += sp.diags([2.0] *...
Open Graph Description: I was considering swapping cupy sparse solvers for nvmath Python/cuDSS DirectSolver, but I am unable to obtain correct results even for small problem instances. Minimal example In example01_cupy.py...
X Description: I was considering swapping cupy sparse solvers for nvmath Python/cuDSS DirectSolver, but I am unable to obtain correct results even for small problem instances. Minimal example In example01_cupy.py...
Opengraph URL: https://github.com/NVIDIA/nvmath-python/issues/56
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"DirectSolver yields incorrect result for random and close to random matrices","articleBody":"\nI was considering swapping cupy sparse solvers for nvmath Python/cuDSS DirectSolver, but I am unable to obtain correct results even for small problem instances. \n\n### Minimal example\n\nIn `example01_cupy.py` replace\n\n```\nn = 8\n...\na += sp.diags([2.0] * n, format=\"csr\", dtype=\"float64\")\n```\nwith\n```\nn = 100\n...\n# a += sp.diags([2.0] * n, format=\"csr\", dtype=\"float64\")\n```\n\nThe same remains true, if I used small, but not tiny values for the diagonal like `0.01`.\n\n### Example observation 1\n\n```\n||A||: \t40.65133430135082\n||b||: \t14.142135623730951\n\ndet(A): 7.262125991606542e+28\n\n02-10 17:35:07 userlogger INFO = SPECIFICATION PHASE =\n02-10 17:35:07 userlogger INFO The LHS package is cupyx.\n02-10 17:35:07 userlogger INFO The RHS package is cupy.\n02-10 17:35:07 userlogger INFO The device_id=0, dtype = float64, index type = int32.\n02-10 17:35:07 userlogger INFO The number of equations = 100.\n02-10 17:35:07 userlogger INFO The operands' memory space is cuda, and the execution space is on device 0.\n02-10 17:35:07 userlogger INFO The specified stream for the DirectSolver ctor is \u003ccuda.core.experimental._stream.Stream object at 0x14b6709b87c0\u003e.\n02-10 17:35:07 userlogger INFO The library handle has been created: 94793135484384.\n02-10 17:35:07 userlogger INFO The sparse direct solver operation has been created.\n02-10 17:35:07 userlogger INFO Starting solver phase ANALYSIS...\n02-10 17:35:07 userlogger INFO This call is non-blocking and will return immediately after the operation is launched on the device.\n02-10 17:35:07 userlogger INFO Starting solver phase FACTORIZATION...\n02-10 17:35:07 userlogger INFO This call is non-blocking and will return immediately after the operation is launched on the device.\n02-10 17:35:07 userlogger INFO Starting solver phase SOLVE...\n02-10 17:35:07 userlogger INFO This call is non-blocking and will return immediately after the operation is launched on the device.\n02-10 17:35:07 userlogger INFO The DirectSolver object's resources have been released.\n\n CuDSS:\n||x||: \t\t29391823863.993862\n||Ax - b||: \t92575181911.9934\n\nCuPy:\n||x||: \t\t10.647411227999223\n||Ax - b||: \t4.289313285599112e-14\n\nNumPy:\n||x||: \t\t10.647411227999223\n||Ax - b||: \t4.29904389535207e-14\n```\n\n**Note that I computed the determinant to check whether A is invertible.** \n\n### Example observation 2\n\nVice versa I made the observation that DirectSolver sometimes returns not `nan` even though the determinant is 0. Note that here `b = cp.ones((n, 1), order=\"F\")` was only a vector\n\n```\n||A||: \t5.6922584694712395\n||b||: \t10.0\n\ndet(A): 0.0\n\n02-10 17:30:48 userlogger INFO = SPECIFICATION PHASE =\n02-10 17:30:48 userlogger INFO The LHS package is cupyx.\n02-10 17:30:48 userlogger INFO The RHS package is cupy.\n02-10 17:30:48 userlogger INFO The device_id=0, dtype = float64, index type = int32.\n02-10 17:30:48 userlogger INFO The number of equations = 100.\n02-10 17:30:48 userlogger INFO The operands' memory space is cuda, and the execution space is on device 0.\n02-10 17:30:48 userlogger INFO The specified stream for the DirectSolver ctor is \u003ccuda.core.experimental._stream.Stream object at 0x14c6b6504580\u003e.\n02-10 17:30:48 userlogger INFO The library handle has been created: 94064601263200.\n02-10 17:30:48 userlogger INFO The sparse direct solver operation has been created.\n02-10 17:30:48 userlogger INFO Starting solver phase ANALYSIS...\n02-10 17:30:48 userlogger INFO This call is non-blocking and will return immediately after the operation is launched on the device.\n02-10 17:30:48 userlogger INFO Starting solver phase FACTORIZATION...\n02-10 17:30:48 userlogger INFO This call is non-blocking and will return immediately after the operation is launched on the device.\n02-10 17:30:48 userlogger INFO Starting solver phase SOLVE...\n02-10 17:30:48 userlogger INFO This call is non-blocking and will return immediately after the operation is launched on the device.\n02-10 17:30:48 userlogger INFO The DirectSolver object's resources have been released.\n\n CuDSS:\n||x||: \t\t1.5379474527090538e+102\n||Ax - b||: \t1.5379474527090537e+89\n\nCuPy:\n||x||: \t\tnan\n||Ax - b||: \tnan\n\nNumPy:\n||x||: \t\tnan\n||Ax - b||: \tnan\n```\n\n","author":{"url":"https://github.com/TimoEckstein","@type":"Person","name":"TimoEckstein"},"datePublished":"2026-02-10T16:54:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/56/nvmath-python/issues/56"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2f68ce5b-450a-53d8-50d2-379763c90dc8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C62E:A2CB5:2EB0119:43AF27F:6A60EC6F |
| html-safe-nonce | 0ed08db9e2d1b61f4e03dedd1d4b15f472805d94ef152dbd2e767ab52b154ab8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNjJFOkEyQ0I1OjJFQjAxMTk6NDNBRjI3Rjo2QTYwRUM2RiIsInZpc2l0b3JfaWQiOiIyNjAwNDg4ODYxNDA0NTU2Mzk5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4ed9af3acb299d0e4e5a85bca2be35ffd1719ea776f331992042ad819cb8b136 |
| hovercard-subject-tag | issue:3922526229 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NVIDIA/nvmath-python/56/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3540cb438542ee5d2e045b6e3b607225dd156e306744cb2272e326eb45d74281/NVIDIA/nvmath-python/issues/56 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3540cb438542ee5d2e045b6e3b607225dd156e306744cb2272e326eb45d74281/NVIDIA/nvmath-python/issues/56 |
| og:image:alt | I was considering swapping cupy sparse solvers for nvmath Python/cuDSS DirectSolver, but I am unable to obtain correct results even for small problem instances. Minimal example In example01_cupy.py... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | TimoEckstein |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3ba36a464b9464992131f4003292a219fc87f92404b0dbe3fd1ef07f11102d0f |
| turbo-cache-control | no-preview |
| go-import | github.com/NVIDIA/nvmath-python git https://github.com/NVIDIA/nvmath-python.git |
| octolytics-dimension-user_id | 1728152 |
| octolytics-dimension-user_login | NVIDIA |
| octolytics-dimension-repository_id | 788208729 |
| octolytics-dimension-repository_nwo | NVIDIA/nvmath-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 788208729 |
| octolytics-dimension-repository_network_root_nwo | NVIDIA/nvmath-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2cc5e4f897a27632dd600edfec4c737bea2f8338 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width