@@ -51,7 +51,9 @@ export solve, solve!
51
51
export get_matrix
52
52
export schur_complement, pardisogetschur
53
53
export fix_iparm!
54
- export mkl_is_available, panua_is_available
54
+ export mkl_is_available, panua_is_available
55
+
56
+ VERSION >= v " 1.11.0-DEV.469" && eval (Meta. parse (" public panua_is_loaded, panua_is_licensed" ))
55
57
56
58
struct PardisoException <: Exception
57
59
info:: String
@@ -112,9 +114,36 @@ const pardiso_chkvec = Ref{Ptr}()
112
114
const pardiso_chkvec_z = Ref {Ptr} ()
113
115
const pardiso_get_schur_f = Ref {Ptr} ()
114
116
const PARDISO_LOADED = Ref (false )
117
+ const PARDISO_LICENSED = Ref (false )
118
+
119
+ function panua_is_licensed ()
120
+
121
+ if ! PARDISO_LOADED[]
122
+ return false
123
+ elseif PARDISO_LICENSED[]
124
+ return true
125
+ end
126
+ # Suppress unwanted output from pardisoinit, which prints license info to stdout
127
+ redirect_stdout (devnull ) do
128
+ try
129
+ ps = PardisoSolver (;loadchecks = false )
130
+ pardisoinit (ps) # errors if unlicensed
131
+ PARDISO_LICENSED[] = true
132
+ return true
133
+ catch e
134
+ if isa (e, PardisoException)
135
+ return false
136
+ else
137
+ rethrow (e)
138
+ end
139
+ end
140
+ end
141
+ end
115
142
116
- panua_is_available () = PARDISO_LOADED[]
143
+ panua_is_loaded () = PARDISO_LOADED[]
144
+ panua_is_available () = panua_is_loaded () && panua_is_licensed ()
117
145
146
+
118
147
function __init__ ()
119
148
global MKL_LOAD_FAILED
120
149
if LOCAL_MKL_FOUND
0 commit comments