Use_intel_libm = 1

compilation

#1

Is anyone successfully using Intel Math Library (USE_INTEL_LIBM = 1 in Make.user) in a self-compiled Julia 1.0.1?

Pre 1.0 I always used USE_INTEL_LIBM and USE_INTEL_MKL to replace all OpenBLAS by Intel pendants without any issues. However, for 1.0.1 things fail

  math: Error During Test at /projects/sborowsk/julia_build/julia/test/math.jl:841
  Test threw exception
  Expression: ≈(sinh(x), sinh(big(x)), rtol=eps(T))
  ccall: could not find function __ldexp_expf in library libimf

which seems to originate from base/special/hyperbolic.jl where in lines

 _ldexp_exp(x::Float64, i::T) where T = ccall(("__ldexp_exp", libm), Float64, (Float64, T), x, i)
 _ldexp_exp(x::Float32, i::T) where T = ccall(("__ldexp_expf",libm), Float32, (Float32, T), x, i)

libopenlibm specific functions are called which can’t be found in libimf.

If I replace those lines by

_ldexp_exp(x::Float64, i::T) where T = ccall(("ldexp", libm), Float64, (Float64, T), x, i)
_ldexp_exp(x::Float32, i::T) where T = ccall(("ldexpf",libm), Float32, (Float32, T), x, i)

Things work, but the test fails:

Error in testset math:
  Test Failed at /projects/sborowsk/julia_build/julia/test/math.jl:841
    Expression: ≈(sinh(x), sinh(big(x)), rtol=eps(T))
     Evaluated: 44.361416f0 ≈ 1.701399268705924328372129400192948964842537512956506377907196085335400360725516e+38 (rtol=1.1920929f-7)

Any related experiences anyone?

(I will write up a proper bug report if needed.)


#2

Maybe as a motivation for why intel’s math library:

julia> @btime sinh.($(rand(100_000))); # LIBM: libopenlibm
  3.259 ms (2 allocations: 781.33 KiB)
julia> @btime sinh.($(rand(100_000))); # LIBM: libimf
  1.556 ms (2 allocations: 781.33 KiB)