exanauts / CUDSS.jl

MIT License
18 stars 1 forks source link

Fail to call "cudss_set" and "cudss_get" #15

Closed yuwenchen95 closed 4 months ago

yuwenchen95 commented 7 months ago

Hi,

I tried to change (extract) the settings of a cudss solver other than the default one. It seems to be related to functions "cudss_set" and "cudss_get". However, Julia would crash once I try to change any parameters via "cudss_set". Is it currently an issue with the Julia wrapper?

amontoison commented 7 months ago

Hi @yuwenchen95!

Can you provide a MWE? I test cudss_set and cudss_get for all parameters here and all tests passed.

yuwenchen95 commented 7 months ago

Hi @yuwenchen95!

Can you provide a MWE? I test cudss_set and cudss_get for all parameters here and all tests passed.

My issues seems that I can't pass the test. Here is the error information I got when I run

pkg> add CUDSS
pkg> test CUDSS

:

data parameter = npivots: Error During Test at C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\test_cudss.jl:95
  Got exception outside of a @test
  CUDSSError: an invalid value was used as an argument (code 3, CUDSS_STATUS_INVALID_VALUE)
  Stacktrace:
    [1] throw_api_error(res::CUDSS.cudssStatus_t)
      @ CUDSS C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\error.jl:42
    [2] check
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\error.jl:52 [inlined]
    [3] cudssDataGet(handle::Ptr{CUDSS.cudssContext}, data::CudssData, param::String, value::Base.RefValue{Int32}, sizeInBytes::Int64, sizeWritten::Base.RefValue{Int32})
      @ CUDSS C:\Users\ddt00\.julia\packages\CUDA\htRwP\lib\utils\call.jl:26
    [4] cudss_get(data::CudssData, param::String)
      @ CUDSS C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\interfaces.jl:150
    [5] cudss_get(solver::CudssSolver{Float32}, param::String)
      @ CUDSS C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\interfaces.jl:142
    [6] macro expansion
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\test_cudss.jl:99 [inlined]
    [7] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1586 [inlined]
    [8] macro expansion
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\test_cudss.jl:95 [inlined]
    [9] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1586 [inlined]
   [10] macro expansion
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\test_cudss.jl:66 [inlined]
   [11] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1586 [inlined]
   [12] macro expansion
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\test_cudss.jl:65 [inlined]
   [13] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1586 [inlined]
   [14] cudss_solver()
      @ Main C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\test_cudss.jl:61
   [15] macro expansion
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\runtests.jl:23 [inlined]
   [16] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1498 [inlined]
   [17] macro expansion
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\runtests.jl:23 [inlined]
   [18] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1498 [inlined]
   [19] top-level scope
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\runtests.jl:13
   [20] include(fname::String)
      @ Base.MainInclude .\client.jl:478
   [21] top-level scope
      @ none:6
   [22] eval
      @ .\boot.jl:370 [inlined]
   [23] exec_options(opts::Base.JLOptions)
      @ Base .\client.jl:280
   [24] _start()
      @ Base .\client.jl:522

Now, I got another issue that it can't find the function unsafe_cudssCreate:

Unsymmetric -- Non-Hermitian: Error During Test at C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\test_cudss.jl:199
  Got exception outside of a @test
  UndefVarError: `unsafe_cudssCreate` not defined
  Stacktrace:
    [1] (::CUDSS.var"#51#52"{Base.RefValue{Ptr{CUDSS.cudssContext}}})()
      @ CUDSS C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\management.jl:6
    [2] #43
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\error.jl:48 [inlined]
    [3] retry_reclaim
      @ C:\Users\ddt00\.julia\dev\CUDA\src\pool.jl:370 [inlined]
    [4] check(f::CUDSS.var"#51#52"{Base.RefValue{Ptr{CUDSS.cudssContext}}}, errs::CUDSS.cudssStatus_t)
      @ CUDSS C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\error.jl:47
    [5] cudssCreate
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\management.jl:5 [inlined]
    [6] #54
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\management.jl:36 [inlined]
    [7] pop!(ctor::CUDSS.var"#54#61", cache::CUDA.APIUtils.HandleCache{CuContext, Ptr{CUDSS.cudssContext}}, key::CuContext)
      @ CUDA.APIUtils C:\Users\ddt00\.julia\dev\CUDA\lib\utils\cache.jl:38
    [8] (::CUDSS.var"#new_state#60")(cuda::NamedTuple{(:device, :context, :stream, :math_mode, :math_precision), Tuple{CuDevice, CuContext, CuStream, CUDA.MathMode, Symbol}})
      @ CUDSS C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\management.jl:35
    [9] #58
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\management.jl:52 [inlined]
   [10] get!(default::CUDSS.var"#58#65"{CUDSS.var"#new_state#60", NamedTuple{(:device, :context, :stream, :math_mode, :math_precision), Tuple{CuDevice, CuContext, CuStream, CUDA.MathMode, Symbol}}}, h::Dict{CuContext, NamedTuple{(:handle, :stream), Tuple{Ptr{CUDSS.cudssContext}, CuStream}}}, key::CuContext)
      @ Base .\dict.jl:468
   [11] handle()
      @ CUDSS C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\management.jl:51
   [12] CudssData()
      @ CUDSS C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\helpers.jl:105
   [13] CudssSolver(A::CuSparseMatrixCSR{ComplexF64, Int32}, structure::String, view::Char; index::Char)
      @ CUDSS C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\interfaces.jl:42
   [14] CudssSolver
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\interfaces.jl:39 [inlined]
   [15] lu(A::CuSparseMatrixCSR{ComplexF64, Int32})
      @ CUDSS C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\generic.jl:3
   [16] macro expansion
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\test_cudss.jl:208 [inlined]
   [17] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1498 [inlined]
   [18] macro expansion
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\test_cudss.jl:200 [inlined]
   [19] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1586 [inlined]
   [20] cudss_generic()
      @ Main C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\test_cudss.jl:197
   [21] macro expansion
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\runtests.jl:31 [inlined]
   [22] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1498 [inlined]
   [23] macro expansion
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\runtests.jl:31 [inlined]
   [24] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1498 [inlined]
   [25] top-level scope
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\runtests.jl:13
   [26] include(fname::String)
      @ Base.MainInclude .\client.jl:478
   [27] top-level scope
      @ none:6
   [28] eval
      @ .\boot.jl:370 [inlined]
   [29] exec_options(opts::Base.JLOptions)
      @ Base .\client.jl:280
   [30] _start()
      @ Base .\client.jl:522
Symmetric -- Hermitian: Error During Test at C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\test_cudss.jl:222
  Got exception outside of a @test
  UndefVarError: `unsafe_cudssCreate` not defined
  Stacktrace:
    [1] (::CUDSS.var"#51#52"{Base.RefValue{Ptr{CUDSS.cudssContext}}})()
      @ CUDSS C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\management.jl:6
    [2] #43
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\error.jl:48 [inlined]
    [3] retry_reclaim
      @ C:\Users\ddt00\.julia\dev\CUDA\src\pool.jl:370 [inlined]
    [4] check(f::CUDSS.var"#51#52"{Base.RefValue{Ptr{CUDSS.cudssContext}}}, errs::CUDSS.cudssStatus_t)
      @ CUDSS C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\error.jl:47
    [5] cudssCreate
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\management.jl:5 [inlined]
    [6] #54
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\management.jl:36 [inlined]
    [7] pop!(ctor::CUDSS.var"#54#61", cache::CUDA.APIUtils.HandleCache{CuContext, Ptr{CUDSS.cudssContext}}, key::CuContext)
      @ CUDA.APIUtils C:\Users\ddt00\.julia\dev\CUDA\lib\utils\cache.jl:38
    [8] (::CUDSS.var"#new_state#60")(cuda::NamedTuple{(:device, :context, :stream, :math_mode, :math_precision), Tuple{CuDevice, CuContext, CuStream, CUDA.MathMode, Symbol}})
      @ CUDSS C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\management.jl:35
    [9] #58
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\management.jl:52 [inlined]
   [10] get!(default::CUDSS.var"#58#65"{CUDSS.var"#new_state#60", NamedTuple{(:device, :context, :stream, :math_mode, :math_precision), Tuple{CuDevice, CuContext, CuStream, CUDA.MathMode, Symbol}}}, h::Dict{CuContext, NamedTuple{(:handle, :stream), Tuple{Ptr{CUDSS.cudssContext}, CuStream}}}, key::CuContext)
      @ Base .\dict.jl:468
   [11] handle()
      @ CUDSS C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\management.jl:51
   [12] CudssData()
      @ CUDSS C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\helpers.jl:105
   [13] CudssSolver(A::CuSparseMatrixCSR{ComplexF64, Int32}, structure::String, view::Char; index::Char)
      @ CUDSS C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\interfaces.jl:42
   [14] CudssSolver
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\interfaces.jl:39 [inlined]
   [15] ldlt(A::CuSparseMatrixCSR{ComplexF64, Int32}; view::Char)
      @ CUDSS C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\src\generic.jl:14
   [16] macro expansion
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\test_cudss.jl:234 [inlined]
   [17] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1498 [inlined]
   [18] macro expansion
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\test_cudss.jl:223 [inlined]
   [19] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1586 [inlined]
   [20] macro expansion
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\test_cudss.jl:221 [inlined]
   [21] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1586 [inlined]
   [22] cudss_generic()
      @ Main C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\test_cudss.jl:197
   [23] macro expansion
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\runtests.jl:31 [inlined]
   [24] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1498 [inlined]
   [25] macro expansion
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\runtests.jl:31 [inlined]
   [26] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1498 [inlined]
   [27] top-level scope
      @ C:\Users\ddt00\.julia\packages\CUDSS\gy7vh\test\runtests.jl:13
   [28] include(fname::String)
      @ Base.MainInclude .\client.jl:478
   [29] top-level scope
      @ none:6
   [30] eval
      @ .\boot.jl:370 [inlined]
   [31] exec_options(opts::Base.JLOptions)
      @ Base .\client.jl:280
   [32] _start()
      @ Base .\client.jl:522
amontoison commented 7 months ago

The issue with unsafe_* functions is related to the last commits of CUDA.jl. If you install the version 5.1.2, it works.

@maleadt Should I just renamed functions unsafe_* into unchecked_* ? It breaks CUDSS.jl :(

yuwenchen95 commented 7 months ago

s that I can't pass the test. Here is the error information I got when I run

pkg> add CUDSS
pkg> test CUDSS

Hi @amontoison ,

Thank you for the help! It fix the latter issue of calling cudssSolver, but the first issue still remains and all (51) errors come from the test function cudss_solver() where cudss_get() fails to extract parameter values. Here is the test summary I got:

julia> cudss_solver()
data parameter = info: Error During Test at C:\Users\ddt00\.julia\dev\CUDSS\test\test_cudss.jl:95
  Got exception outside of a @test
  CUDSSError: an invalid value was used as an argument (code 3, CUDSS_STATUS_INVALID_VALUE)
  Stacktrace:
    [1] throw_api_error(res::CUDSS.cudssStatus_t)
      @ CUDSS C:\Users\ddt00\.julia\dev\CUDSS\src\error.jl:42
    [2] check
      @ C:\Users\ddt00\.julia\dev\CUDSS\src\error.jl:52 [inlined]
    [3] cudssDataGet(handle::Ptr{CUDSS.cudssContext}, data::CudssData, param::String, value::Base.RefValue{Int32}, sizeInBytes::Int64, sizeWritten::Base.RefValue{Int32})
      @ CUDSS C:\Users\ddt00\.julia\packages\CUDA\rXson\lib\utils\call.jl:26
    [4] cudss_get(data::CudssData, param::String)
      @ CUDSS C:\Users\ddt00\.julia\dev\CUDSS\src\interfaces.jl:150
    [5] cudss_get(solver::CudssSolver{Float32}, param::String)
      @ CUDSS C:\Users\ddt00\.julia\dev\CUDSS\src\interfaces.jl:142
    [6] macro expansion
      @ C:\Users\ddt00\.julia\dev\CUDSS\test\test_cudss.jl:99 [inlined]
    [7] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1586 [inlined]
    [8] macro expansion
      @ C:\Users\ddt00\.julia\dev\CUDSS\test\test_cudss.jl:95 [inlined]
    [9] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1586 [inlined]
   [10] macro expansion
      @ C:\Users\ddt00\.julia\dev\CUDSS\test\test_cudss.jl:66 [inlined]
   [11] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1586 [inlined]
   [12] macro expansion
      @ C:\Users\ddt00\.julia\dev\CUDSS\test\test_cudss.jl:65 [inlined]
   [13] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1586 [inlined]
   [14] cudss_solver()
      @ Main C:\Users\ddt00\.julia\dev\CUDSS\test\test_cudss.jl:61
   [15] top-level scope
      @ REPL[14]:1
   [16] top-level scope
      @ C:\Users\ddt00\.julia\packages\CUDA\rXson\src\initialization.jl:208
   [17] eval
      @ .\boot.jl:370 [inlined]
   [18] eval_user_input(ast::Any, backend::REPL.REPLBackend, mod::Module)
      @ REPL C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\REPL\src\REPL.jl:153
   [19] repl_backend_loop(backend::REPL.REPLBackend, get_module::Function)
      @ REPL C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\REPL\src\REPL.jl:249
   [20] start_repl_backend(backend::REPL.REPLBackend, consumer::Any; get_module::Function)
      @ REPL C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\REPL\src\REPL.jl:234
   [21] run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool, backend::Any)
      @ REPL C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\REPL\src\REPL.jl:379
   [22] run_repl(repl::REPL.AbstractREPL, consumer::Any)
      @ REPL C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\REPL\src\REPL.jl:365
   [23] (::Base.var"#1017#1019"{Bool, Bool, Bool})(REPL::Module)
      @ Base .\client.jl:421
   [24] #invokelatest#2
      @ .\essentials.jl:816 [inlined]
   [25] invokelatest
      @ .\essentials.jl:813 [inlined]
   [26] run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_file::Bool, color_set::Bool)
      @ Base .\client.jl:405
   [27] exec_options(opts::Base.JLOptions)
      @ Base .\client.jl:322
   [28] _start()
      @ Base .\client.jl:522
......
data parameter = npivots: Error During Test at C:\Users\ddt00\.julia\dev\CUDSS\test\test_cudss.jl:95
  Got exception outside of a @test
  CUDSSError: an invalid value was used as an argument (code 3, CUDSS_STATUS_INVALID_VALUE)
  Stacktrace:
    [1] throw_api_error(res::CUDSS.cudssStatus_t)
      @ CUDSS C:\Users\ddt00\.julia\dev\CUDSS\src\error.jl:42
    [2] check
      @ C:\Users\ddt00\.julia\dev\CUDSS\src\error.jl:52 [inlined]
    [3] cudssDataGet(handle::Ptr{CUDSS.cudssContext}, data::CudssData, param::String, value::Base.RefValue{Int32}, sizeInBytes::Int64, sizeWritten::Base.RefValue{Int32})
      @ CUDSS C:\Users\ddt00\.julia\packages\CUDA\rXson\lib\utils\call.jl:26
    [4] cudss_get(data::CudssData, param::String)
      @ CUDSS C:\Users\ddt00\.julia\dev\CUDSS\src\interfaces.jl:150
    [5] cudss_get(solver::CudssSolver{Float32}, param::String)
      @ CUDSS C:\Users\ddt00\.julia\dev\CUDSS\src\interfaces.jl:142
    [6] macro expansion
      @ C:\Users\ddt00\.julia\dev\CUDSS\test\test_cudss.jl:99 [inlined]
    [7] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1586 [inlined]
    [8] macro expansion
      @ C:\Users\ddt00\.julia\dev\CUDSS\test\test_cudss.jl:95 [inlined]
    [9] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1586 [inlined]
   [10] macro expansion
      @ C:\Users\ddt00\.julia\dev\CUDSS\test\test_cudss.jl:66 [inlined]
   [11] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1586 [inlined]
   [12] macro expansion
      @ C:\Users\ddt00\.julia\dev\CUDSS\test\test_cudss.jl:65 [inlined]
   [13] macro expansion
      @ C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\Test\src\Test.jl:1586 [inlined]
   [14] cudss_solver()
      @ Main C:\Users\ddt00\.julia\dev\CUDSS\test\test_cudss.jl:61
   [15] top-level scope
      @ REPL[14]:1
   [16] top-level scope
      @ C:\Users\ddt00\.julia\packages\CUDA\rXson\src\initialization.jl:208
   [17] eval
      @ .\boot.jl:370 [inlined]
   [18] eval_user_input(ast::Any, backend::REPL.REPLBackend, mod::Module)
      @ REPL C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\REPL\src\REPL.jl:153
   [19] repl_backend_loop(backend::REPL.REPLBackend, get_module::Function)
      @ REPL C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\REPL\src\REPL.jl:249
   [20] start_repl_backend(backend::REPL.REPLBackend, consumer::Any; get_module::Function)
      @ REPL C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\REPL\src\REPL.jl:234
   [21] run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool, backend::Any)
      @ REPL C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\REPL\src\REPL.jl:379
   [22] run_repl(repl::REPL.AbstractREPL, consumer::Any)
      @ REPL C:\Users\ddt00\AppData\Local\Programs\julia-1.9.2\share\julia\stdlib\v1.9\REPL\src\REPL.jl:365
   [23] (::Base.var"#1017#1019"{Bool, Bool, Bool})(REPL::Module)
      @ Base .\client.jl:421
   [24] #invokelatest#2
      @ .\essentials.jl:816 [inlined]
   [25] invokelatest
      @ .\essentials.jl:813 [inlined]
   [26] run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_file::Bool, color_set::Bool)
      @ Base .\client.jl:405
   [27] exec_options(opts::Base.JLOptions)
      @ Base .\client.jl:322
   [28] _start()
      @ Base .\client.jl:522
Test Summary:                              | Error  Total  Time
precision = Float32                        |    51     51  4.5s
  structure = G                            |     9      9  0.6s
    view = L                               |     3      3  0.2s
      config parameter = reordering_alg    |         None  0.0s
      config parameter = factorization_alg |         None  0.0s
      config parameter = solve_alg         |         None  0.0s
      config parameter = matching_type     |         None  0.0s
      config parameter = solve_mode        |         None  0.0s
      config parameter = ir_n_steps        |         None  0.0s
      config parameter = ir_tol            |         None  0.0s
      config parameter = pivot_type        |         None  0.0s
      config parameter = pivot_threshold   |         None  0.0s
      config parameter = pivot_epsilon     |         None  0.0s
      config parameter = max_lu_nnz        |         None  0.0s
      data parameter = info                |     1      1  0.1s
      data parameter = lu_nnz              |     1      1  0.0s
      data parameter = npivots             |     1      1  0.1s
      data parameter = inertia             |         None  0.0s
      data parameter = perm_reorder        |         None  0.0s
      data parameter = perm_row            |         None  0.0s
      data parameter = perm_col            |         None  0.0s
      data parameter = diag                |         None  0.0s
      data parameter = user_perm           |         None  0.0s
    view = U                               |     3      3  0.2s
      config parameter = reordering_alg    |         None  0.0s
      config parameter = factorization_alg |         None  0.0s
      config parameter = solve_alg         |         None  0.0s
      config parameter = matching_type     |         None  0.0s
      config parameter = solve_mode        |         None  0.0s
      config parameter = ir_n_steps        |         None  0.0s
      config parameter = ir_tol            |         None  0.0s
      config parameter = pivot_type        |         None  0.0s
      config parameter = pivot_threshold   |         None  0.0s
      config parameter = pivot_epsilon     |         None  0.0s
      config parameter = max_lu_nnz        |         None  0.0s
      data parameter = info                |     1      1  0.0s
      data parameter = lu_nnz              |     1      1  0.0s
      data parameter = npivots             |     1      1  0.0s
      data parameter = inertia             |         None  0.0s
      data parameter = perm_reorder        |         None  0.0s
      data parameter = perm_row            |         None  0.0s
      data parameter = perm_col            |         None  0.0s
      data parameter = diag                |         None  0.0s
      data parameter = user_perm           |         None  0.0s
    view = F                               |     3      3  0.2s
      config parameter = reordering_alg    |         None  0.0s
      config parameter = factorization_alg |         None  0.0s
      config parameter = solve_alg         |         None  0.0s
      config parameter = matching_type     |         None  0.0s
      config parameter = solve_mode        |         None  0.0s
      config parameter = ir_n_steps        |         None  0.0s
      config parameter = ir_tol            |         None  0.0s
      config parameter = pivot_type        |         None  0.0s
      config parameter = pivot_threshold   |         None  0.0s
      config parameter = pivot_epsilon     |         None  0.0s
      config parameter = max_lu_nnz        |         None  0.0s
      data parameter = info                |     1      1  0.0s
      data parameter = lu_nnz              |     1      1  0.1s
      data parameter = npivots             |     1      1  0.0s
      data parameter = inertia             |         None  0.0s
      data parameter = perm_reorder        |         None  0.0s
      data parameter = perm_row            |         None  0.0s
      data parameter = perm_col            |         None  0.0s
      data parameter = diag                |         None  0.0s
      data parameter = user_perm           |         None  0.0s
  structure = S                            |    12     12  0.7s
    view = L                               |     4      4  0.2s
      config parameter = reordering_alg    |         None  0.0s
      config parameter = factorization_alg |         None  0.0s
      config parameter = solve_alg         |         None  0.0s
      config parameter = matching_type     |         None  0.0s
      config parameter = solve_mode        |         None  0.0s
      config parameter = ir_n_steps        |         None  0.0s
      config parameter = ir_tol            |         None  0.0s
      config parameter = pivot_type        |         None  0.0s
      config parameter = pivot_threshold   |         None  0.0s
      config parameter = pivot_epsilon     |         None  0.0s
      config parameter = max_lu_nnz        |         None  0.0s
      data parameter = info                |     1      1  0.0s
      data parameter = lu_nnz              |     1      1  0.1s
      data parameter = npivots             |     1      1  0.0s
      data parameter = inertia             |     1      1  0.0s
      data parameter = perm_reorder        |         None  0.0s
      data parameter = perm_row            |         None  0.0s
      data parameter = perm_col            |         None  0.0s
      data parameter = diag                |         None  0.0s
      data parameter = user_perm           |         None  0.0s
    view = U                               |     4      4  0.2s
      config parameter = reordering_alg    |         None  0.0s
      config parameter = factorization_alg |         None  0.0s
      config parameter = solve_alg         |         None  0.0s
      config parameter = matching_type     |         None  0.0s
      config parameter = solve_mode        |         None  0.0s
      config parameter = ir_n_steps        |         None  0.0s
      config parameter = ir_tol            |         None  0.0s
      config parameter = pivot_type        |         None  0.0s
      config parameter = pivot_threshold   |         None  0.0s
      config parameter = pivot_epsilon     |         None  0.0s
      config parameter = max_lu_nnz        |         None  0.0s
      data parameter = info                |     1      1  0.0s
      data parameter = lu_nnz              |     1      1  0.0s
      data parameter = npivots             |     1      1  0.0s
      data parameter = inertia             |     1      1  0.1s
      data parameter = perm_reorder        |         None  0.0s
      data parameter = perm_row            |         None  0.0s
      data parameter = perm_col            |         None  0.0s
      data parameter = diag                |         None  0.0s
      data parameter = user_perm           |         None  0.0s
    view = F                               |     4      4  0.2s
      config parameter = reordering_alg    |         None  0.0s
      config parameter = factorization_alg |         None  0.0s
      config parameter = solve_alg         |         None  0.0s
      config parameter = matching_type     |         None  0.0s
      config parameter = solve_mode        |         None  0.0s
      config parameter = ir_n_steps        |         None  0.0s
      config parameter = ir_tol            |         None  0.0s
      config parameter = pivot_type        |         None  0.0s
      config parameter = pivot_threshold   |         None  0.0s
      config parameter = pivot_epsilon     |         None  0.0s
      config parameter = max_lu_nnz        |         None  0.0s
      data parameter = info                |     1      1  0.0s
      data parameter = lu_nnz              |     1      1  0.1s
      data parameter = npivots             |     1      1  0.1s
      data parameter = inertia             |     1      1  0.1s
      data parameter = perm_reorder        |         None  0.0s
      data parameter = perm_row            |         None  0.0s
      data parameter = perm_col            |         None  0.0s
      data parameter = diag                |         None  0.0s
      data parameter = user_perm           |         None  0.0s
  structure = H                            |    12     12  0.7s
    view = L                               |     4      4  0.2s
      config parameter = reordering_alg    |         None  0.0s
      config parameter = factorization_alg |         None  0.0s
      config parameter = solve_alg         |         None  0.0s
      config parameter = matching_type     |         None  0.0s
      config parameter = solve_mode        |         None  0.0s
      config parameter = ir_n_steps        |         None  0.0s
      config parameter = ir_tol            |         None  0.0s
      config parameter = pivot_type        |         None  0.0s
      config parameter = pivot_threshold   |         None  0.0s
      config parameter = pivot_epsilon     |         None  0.0s
      config parameter = max_lu_nnz        |         None  0.0s
      data parameter = info                |     1      1  0.0s
      data parameter = lu_nnz              |     1      1  0.0s
      data parameter = npivots             |     1      1  0.0s
      data parameter = inertia             |     1      1  0.0s
      data parameter = perm_reorder        |         None  0.0s
      data parameter = perm_row            |         None  0.0s
      data parameter = perm_col            |         None  0.0s
      data parameter = diag                |         None  0.0s
      data parameter = user_perm           |         None  0.0s
    view = U                               |     4      4  0.2s
      config parameter = reordering_alg    |         None  0.0s
      config parameter = factorization_alg |         None  0.0s
      config parameter = solve_alg         |         None  0.0s
      config parameter = matching_type     |         None  0.0s
      config parameter = solve_mode        |         None  0.0s
      config parameter = ir_n_steps        |         None  0.0s
      config parameter = ir_tol            |         None  0.0s
      config parameter = pivot_type        |         None  0.0s
      config parameter = pivot_threshold   |         None  0.0s
      config parameter = pivot_epsilon     |         None  0.0s
      config parameter = max_lu_nnz        |         None  0.0s
      data parameter = info                |     1      1  0.0s
      data parameter = lu_nnz              |     1      1  0.0s
      data parameter = npivots             |     1      1  0.0s
      data parameter = inertia             |     1      1  0.0s
      data parameter = perm_reorder        |         None  0.0s
      data parameter = perm_row            |         None  0.0s
      data parameter = perm_col            |         None  0.0s
      data parameter = diag                |         None  0.0s
      data parameter = user_perm           |         None  0.0s
    view = F                               |     4      4  0.2s
      config parameter = reordering_alg    |         None  0.0s
      config parameter = factorization_alg |         None  0.0s
      config parameter = solve_alg         |         None  0.0s
      config parameter = matching_type     |         None  0.0s
      config parameter = solve_mode        |         None  0.0s
      config parameter = ir_n_steps        |         None  0.0s
      config parameter = ir_tol            |         None  0.0s
      config parameter = pivot_type        |         None  0.0s
      config parameter = pivot_threshold   |         None  0.0s
      config parameter = pivot_epsilon     |         None  0.0s
      config parameter = max_lu_nnz        |         None  0.0s
      data parameter = info                |     1      1  0.0s
      data parameter = lu_nnz              |     1      1  0.0s
      data parameter = npivots             |     1      1  0.1s
      data parameter = inertia             |     1      1  0.1s
      data parameter = perm_reorder        |         None  0.0s
      data parameter = perm_row            |         None  0.0s
      data parameter = perm_col            |         None  0.0s
      data parameter = diag                |         None  0.0s
      data parameter = user_perm           |         None  0.0s
  structure = SPD                          |     9      9  0.6s
    view = L                               |     3      3  0.2s
      config parameter = reordering_alg    |         None  0.0s
      config parameter = factorization_alg |         None  0.0s
      config parameter = solve_alg         |         None  0.0s
      config parameter = matching_type     |         None  0.0s
      config parameter = solve_mode        |         None  0.0s
      config parameter = ir_n_steps        |         None  0.0s
      config parameter = ir_tol            |         None  0.0s
      config parameter = pivot_type        |         None  0.0s
      config parameter = pivot_threshold   |         None  0.0s
      config parameter = pivot_epsilon     |         None  0.0s
      config parameter = max_lu_nnz        |         None  0.0s
      data parameter = info                |     1      1  0.0s
      data parameter = lu_nnz              |     1      1  0.1s
      data parameter = npivots             |     1      1  0.1s
      data parameter = inertia             |         None  0.0s
      data parameter = perm_reorder        |         None  0.0s
      data parameter = perm_row            |         None  0.0s
      data parameter = perm_col            |         None  0.0s
      data parameter = diag                |         None  0.0s
      data parameter = user_perm           |         None  0.0s
    view = U                               |     3      3  0.2s
      config parameter = reordering_alg    |         None  0.0s
      config parameter = factorization_alg |         None  0.0s
      config parameter = solve_alg         |         None  0.0s
      config parameter = matching_type     |         None  0.0s
      config parameter = solve_mode        |         None  0.0s
      config parameter = ir_n_steps        |         None  0.0s
      config parameter = ir_tol            |         None  0.0s
      config parameter = pivot_type        |         None  0.0s
      config parameter = pivot_threshold   |         None  0.0s
      config parameter = pivot_epsilon     |         None  0.0s
      config parameter = max_lu_nnz        |         None  0.0s
      data parameter = info                |     1      1  0.1s
      data parameter = lu_nnz              |     1      1  0.0s
      data parameter = npivots             |     1      1  0.0s
      data parameter = inertia             |         None  0.0s
      data parameter = perm_reorder        |         None  0.0s
      data parameter = perm_row            |         None  0.0s
      data parameter = perm_col            |         None  0.0s
      data parameter = diag                |         None  0.0s
      data parameter = user_perm           |         None  0.0s
    view = F                               |     3      3  0.2s
      config parameter = reordering_alg    |         None  0.0s
      config parameter = factorization_alg |         None  0.0s
      config parameter = solve_alg         |         None  0.0s
      config parameter = matching_type     |         None  0.0s
      config parameter = solve_mode        |         None  0.0s
      config parameter = ir_n_steps        |         None  0.0s
      config parameter = ir_tol            |         None  0.0s
      config parameter = pivot_type        |         None  0.0s
      config parameter = pivot_threshold   |         None  0.0s
      config parameter = pivot_epsilon     |         None  0.0s
      config parameter = max_lu_nnz        |         None  0.0s
      data parameter = info                |     1      1  0.0s
      data parameter = lu_nnz              |     1      1  0.0s
      data parameter = npivots             |     1      1  0.0s
      data parameter = inertia             |         None  0.0s
      data parameter = perm_reorder        |         None  0.0s
      data parameter = perm_row            |         None  0.0s
      data parameter = perm_col            |         None  0.0s
      data parameter = diag                |         None  0.0s
      data parameter = user_perm           |         None  0.0s
  structure = HPD                          |     9      9  0.6s
    view = L                               |     3      3  0.2s
      config parameter = reordering_alg    |         None  0.0s
      config parameter = factorization_alg |         None  0.0s
      config parameter = solve_alg         |         None  0.0s
      config parameter = matching_type     |         None  0.0s
      config parameter = solve_mode        |         None  0.0s
      config parameter = ir_n_steps        |         None  0.0s
      config parameter = ir_tol            |         None  0.0s
      config parameter = pivot_type        |         None  0.0s
      config parameter = pivot_threshold   |         None  0.0s
      config parameter = pivot_epsilon     |         None  0.0s
      config parameter = max_lu_nnz        |         None  0.0s
      data parameter = info                |     1      1  0.1s
      data parameter = lu_nnz              |     1      1  0.1s
      data parameter = npivots             |     1      1  0.1s
      data parameter = inertia             |         None  0.0s
      data parameter = perm_reorder        |         None  0.0s
      data parameter = perm_row            |         None  0.0s
      data parameter = perm_col            |         None  0.0s
      data parameter = diag                |         None  0.0s
      data parameter = user_perm           |         None  0.0s
    view = U                               |     3      3  0.2s
      config parameter = reordering_alg    |         None  0.0s
      config parameter = factorization_alg |         None  0.0s
      config parameter = solve_alg         |         None  0.0s
      config parameter = matching_type     |         None  0.0s
      config parameter = solve_mode        |         None  0.0s
      config parameter = ir_n_steps        |         None  0.0s
      config parameter = ir_tol            |         None  0.0s
      config parameter = pivot_type        |         None  0.0s
      config parameter = pivot_threshold   |         None  0.0s
      config parameter = pivot_epsilon     |         None  0.0s
      config parameter = max_lu_nnz        |         None  0.0s
      data parameter = info                |     1      1  0.0s
      data parameter = lu_nnz              |     1      1  0.1s
      data parameter = npivots             |     1      1  0.0s
      data parameter = inertia             |         None  0.0s
      data parameter = perm_reorder        |         None  0.0s
      data parameter = perm_row            |         None  0.0s
      data parameter = perm_col            |         None  0.0s
      data parameter = diag                |         None  0.0s
      data parameter = user_perm           |         None  0.0s
    view = F                               |     3      3  0.2s
      config parameter = reordering_alg    |         None  0.0s
      config parameter = factorization_alg |         None  0.0s
      config parameter = solve_alg         |         None  0.0s
      config parameter = matching_type     |         None  0.0s
      config parameter = solve_mode        |         None  0.0s
      config parameter = ir_n_steps        |         None  0.0s
      config parameter = ir_tol            |         None  0.0s
      config parameter = pivot_type        |         None  0.0s
      config parameter = pivot_threshold   |         None  0.0s
      config parameter = pivot_epsilon     |         None  0.0s
      config parameter = max_lu_nnz        |         None  0.0s
      data parameter = info                |     1      1  0.1s
      data parameter = lu_nnz              |     1      1  0.1s
      data parameter = npivots             |     1      1  0.1s
      data parameter = inertia             |         None  0.0s
      data parameter = perm_reorder        |         None  0.0s
      data parameter = perm_row            |         None  0.0s
      data parameter = perm_col            |         None  0.0s
      data parameter = diag                |         None  0.0s
      data parameter = user_perm           |         None  0.0s
ERROR: Some tests did not pass: 0 passed, 0 failed, 51 errored, 0 broken.
amontoison commented 7 months ago

@yuwenchen95 Can you provide the version of your packages and of your cuda toolkit?

yuwenchen95 commented 7 months ago

@amontoison

My package versions are:

CEnum v0.4.2
CUDA v5.1.2
CUDSS_jll v0.1.0+0
julia v1.9.2

and LinearAlgebra, SparseArrays, Test are consistent with the julia version right?

CUDA:

julia> CUDA.versioninfo()
CUDA runtime 12.3, artifact installation
CUDA driver 12.3
NVIDIA driver 546.12.0

CUDA libraries:
- CUBLAS: 12.3.4
- CURAND: 10.3.4
- CUFFT: 11.0.12
- CUSOLVER: 11.5.4
- CUSPARSE: 12.2.0
- CUPTI: 21.0.0
- NVML: 12.0.0+546.12

Julia packages:
- CUDA: 5.1.2
- CUDA_Driver_jll: 0.7.0+1
- CUDA_Runtime_jll: 0.10.1+0

Toolchain:
- Julia: 1.9.2
- LLVM: 14.0.6

Environment:
- JULIA_CUDA_NSYS: C:\Program Files\NVIDIA Corporation\Nsight Systems 2023.2.1\target-windows-x64\nsys.exe

1 device:
  0: NVIDIA GeForce GTX 1070 with Max-Q Design (sm_61, 7.886 GiB / 8.000 GiB available)
amontoison commented 7 months ago

Thanks, @yuwenchen95!

Based on your logs, I've traced the source of the error to the cudss_get() function when it's applied to a data parameter. This function should be used with one of the following parameters:

I strongly suspect that the issue lies with the lu_nnz parameter type. I've already reached out to NVIDIA about it. According to their documentation, it's listed as an int, but on Linux, it must be a 64-bit integer. It's possible that they implemented it as a Clong, which is a 32-bit integer on Windows... This could explain the discrepancies.

Could you please replace Int64 with Clong here and run the tests again?

yuwenchen95 commented 7 months ago
  • npivots

Hi, @amontoison

I tried it as you said and the result is a bit strange: When I start a Julia REPL, the cudss_get() works for the first time extracting info, inertia, lu_nnz, but it returns the error as before:

julia> include("cudssTest.jl")
[ Info: Precompiling CUDSS [45b445bb-4962-46a0-9369-b4df9d0f772e]
9.872531835682577e-15

julia> v = cudss_get(solver,"info")
0

julia> v = cudss_get(solver,"info")
ERROR: CUDSSError: an invalid value was used as an argument (code 3, CUDSS_STATUS_INVALID_VALUE)
Stacktrace:
 [1] throw_api_error(res::CUDSS.cudssStatus_t)
   @ CUDSS C:\Users\ddt00\.julia\dev\CUDSS\src\error.jl:42
 [2] check
   @ C:\Users\ddt00\.julia\dev\CUDSS\src\error.jl:52 [inlined]
 [3] cudssDataGet(handle::Ptr{CUDSS.cudssContext}, data::CudssData, param::String, value::Base.RefValue{Int32}, sizeInBytes::Int64, sizeWritten::Base.RefValue{Int32})
   @ CUDSS C:\Users\ddt00\.julia\packages\CUDA\rXson\lib\utils\call.jl:26
 [4] cudss_get(data::CudssData, param::String)
   @ CUDSS C:\Users\ddt00\.julia\dev\CUDSS\src\interfaces.jl:150
 [5] cudss_get(solver::CudssSolver{Float64}, param::String)
   @ CUDSS C:\Users\ddt00\.julia\dev\CUDSS\src\interfaces.jl:142
 [6] top-level scope
   @ REPL[2]:1
 [7] top-level scope
   @ C:\Users\ddt00\.julia\packages\CUDA\rXson\src\initialization.jl:208

I don't know why it only works for the first extraction but fails for others, even if I rerun the example code on the website. Is there any command missing after the call of cudssDataGet()?

In addition, extracting npivots never works in my windows system. I tried to change its type in Int64 but it still fails.

maleadt commented 7 months ago

Should I just renamed functions unsafe_* into unchecked_* ?

Yes. FWIW, the unchecked functions aren't really considered public API. It may be best to use try/catch, or is the performance critical here?

amontoison commented 4 months ago

@yuwenchen95 I updated CUDSS.jl for using cuDSS 0.2.1. Can you check if it fixes your issue?

amontoison commented 4 months ago

Should I just renamed functions unsafe_* into unchecked_* ?

Yes. FWIW, the unchecked functions aren't really considered public API. It may be best to use try/catch, or is the performance critical here?

Sorry Tim, I forgot to answer. I updated the code to not use the unchecked routines: https://github.com/exanauts/CUDSS.jl/commit/0b37757b96e4fedfe05674d67876f83079272c12

amontoison commented 4 months ago

@yuwenchen95 I finally found the culprit! (see #39) A wrong type was used in the Julia wrappers generated by Clang.jl.

yuwenchen95 commented 4 months ago

@yuwenchen95 I finally found the culprit! (see #39) A wrong type was used in the Julia wrappers generated by Clang.jl.

I checked it and the issue is fixed. Thanks a lot! @amontoison