Skip to content

Commit ece1962

Browse files
authored
versioninfo: simplify, improve type stability (#1274)
Change the `env_var_names` local from `Vector{Any}` to `Vector{Vector{String}}`. This should prevent some sysimage invalidation that happens on 64-bit Windows when running: ```julia struct I <: Integer end function Base.:(<<)(::I, ::Int) end ```
1 parent 3e525a8 commit ece1962

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

src/LinearAlgebra.jl

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -788,31 +788,22 @@ function versioninfo(io::IO=stdout)
788788
println(io, indent, "LinearAlgebra.BLAS.get_num_threads() = ", BLAS.get_num_threads())
789789
println(io, "Relevant environment variables:")
790790
env_var_names = [
791-
"JULIA_NUM_THREADS",
792-
"MKL_DYNAMIC",
793-
"MKL_NUM_THREADS",
791+
["JULIA_NUM_THREADS"],
792+
["MKL_DYNAMIC"],
793+
["MKL_NUM_THREADS"],
794794
# OpenBLAS has a hierarchy of environment variables for setting the
795795
# number of threads, see
796796
# https://github.com/xianyi/OpenBLAS/blob/c43ec53bdd00d9423fc609d7b7ecb35e7bf41b85/README.md#setting-the-number-of-threads-using-environment-variables
797-
("OPENBLAS_NUM_THREADS", "GOTO_NUM_THREADS", "OMP_NUM_THREADS"),
797+
["OPENBLAS_NUM_THREADS", "GOTO_NUM_THREADS", "OMP_NUM_THREADS"],
798798
]
799799
printed_at_least_one_env_var = false
800800
print_var(io, indent, name) = println(io, indent, name, " = ", ENV[name])
801801
for name in env_var_names
802-
if name isa Tuple
803-
# If `name` is a Tuple, then find the first environment which is
804-
# defined, and disregard the following ones.
805-
for nm in name
806-
if haskey(ENV, nm)
807-
print_var(io, indent, nm)
808-
printed_at_least_one_env_var = true
809-
break
810-
end
811-
end
812-
else
813-
if haskey(ENV, name)
814-
print_var(io, indent, name)
802+
for nm in name
803+
if haskey(ENV, nm)
804+
print_var(io, indent, nm)
815805
printed_at_least_one_env_var = true
806+
break
816807
end
817808
end
818809
end

0 commit comments

Comments
 (0)