Skip to content

Commit

Permalink
Some more tweaks for JuliaLang#5050
Browse files Browse the repository at this point in the history
  • Loading branch information
Viral B. Shah committed Dec 9, 2013
1 parent 7ccb109 commit cfcd075
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
6 changes: 6 additions & 0 deletions DISTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ called `USE_BLAS64` is available as part of the Julia build. When doing
`make USE_BLAS64=0`, Julia will call BLAS and LAPACK assuming a 32-bit
API, where all integers are 32-bit wide, even on a 64-bit architecture.

Other libraries that Julia uses, such as ARPACK and SuiteSparse also
use BLAS and LAPACK internally. The APIs need to be consistent across
all libraries that depend on BLAS and LAPACK. The Julia build process
will build all these libraries correctly, but when overriding defaults
and using system provided libraries, this consistency must be ensured.


Compilation scripts
===================
Expand Down
13 changes: 0 additions & 13 deletions base/linalg/lapack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3304,17 +3304,4 @@ for (fn, elty) in ((:dtrttf_, :Float64),
end
end

#
# Build-time check if BlasInt is of the correct expected bitsize
#
_, _info = potrf!('U', [[1.0, 0.0] [0.0, -1.0]])
if _info!=2 #mangled info code
if _info == 2^33
error("""Wrong size of BlasInt for LAPACK: LAPACK was compiled with 32-bit integer support but Julia expects 64-bit integers. Please check the BLAS and LAPACK libraries your system is using or recompile OpenBLAS with the correct USE_BLAS64 settings.""")
elseif _info == 0
error("""Wrong size of BlasInt for LAPACK: LAPACK was compiled with 64-bit integer support but Julia expects 32-bit integers. Please check the BLAS and LAPACK libraries your system is using or recompile OpenBLAS with the correct USE_BLAS64 settings.""")
else
error("""Unparseable LAPACK info code: Julia did not understand the error codes used by your LAPACK library. Please check the BLAS and LAPACK libraries your system is using or recompile OpenBLAS.""")
end
end
end # module
15 changes: 15 additions & 0 deletions base/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,21 @@ function check_blas()
quit()
end
end

#
# Check if BlasInt is the expected bitsize, by triggering an error
#
(_, info) = LinAlg.LAPACK.potrf!('U', [1.0 0.0; 0.0 -1.0])
if info != 2 # mangled info code
if info == 2^33
error("""BLAS and LAPACK are compiled with 32-bit integer support, but Julia expects 64-bit integers. Please build Julia with USE_BLAS64=0.""")
elseif info == 0
error("""BLAS and LAPACK are compiled with 64-bit integer support but Julia expects 32-bit integers. Please build Julia with USE_BLAS64=1.""")
else
error("""The LAPACK library produced an undefined error code. Please verify the installation of BLAS and LAPACK.""")
end
end

end

# system information
Expand Down

0 comments on commit cfcd075

Please sign in to comment.