So on a machine that can't support AMGX calling using AMGX gives an error. But it only gives that error the first time it's called! (See code below.)
Because using AMGXonly errors the first time, an approach like
const hasamgx =
try
using AMGX
true
catch
false
end
won't work.
It would be good if using AMGX would always work. Otherwise developers need to figure out ways to load AMGX conditionally based on the machine. Any suggestions on how to do that? Or what's the best way to conditionally load AMGX? Is there, for example, a way to check whether libamgxsh exists or can be installed on the machine?
cc @glwagner, @Elise-palethorpe
(base) navid:~/ (main) $ julia --project
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.8.2 (2022-09-29)
_/ |\__'_|_|_|\__'_| |
|__/ |
julia> using AMGX
ERROR: InitError: UndefVarError: libamgxsh not defined
Stacktrace:
[1] getproperty
@ ./Base.jl:31 [inlined]
[2] __init__()
@ AMGX ~/.julia/packages/AMGX/GFHHN/src/AMGX.jl:30
[3] _include_from_serialized(pkg::Base.PkgId, path::String, depmods::Vector{Any})
@ Base ./loading.jl:831
[4] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt64)
@ Base ./loading.jl:1039
[5] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1315
[6] _require_prelocked(uuidkey::Base.PkgId)
@ Base ./loading.jl:1200
[7] macro expansion
@ ./loading.jl:1180 [inlined]
[8] macro expansion
@ ./lock.jl:223 [inlined]
[9] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1144
during initialization of module AMGX
julia> using AMGX
julia> a=1
1
So on a machine that can't support AMGX calling
using AMGX
gives an error. But it only gives that error the first time it's called! (See code below.)Because
using AMGX
only errors the first time, an approach likewon't work.
It would be good if
using AMGX
would always work. Otherwise developers need to figure out ways to load AMGX conditionally based on the machine. Any suggestions on how to do that? Or what's the best way to conditionally load AMGX? Is there, for example, a way to check whetherlibamgxsh
exists or can be installed on the machine?cc @glwagner, @Elise-palethorpe