-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
oneMKL: test failures with rotate and reflect #283
Comments
Looks like a bug in oneMKL? MWE: using oneAPI, LinearAlgebra
function main(; n = 1, T = ComplexF64)
x = ones(T, n)
y = ones(T, n)
c = one(real(T))
s = one(T)
d_x = oneArray(x)
d_y = oneArray(y)
rotate!(x, y, c, s)
#rotate!(d_x, d_y, c, s)
queue = global_queue(context(d_x), device(d_x))
incx = stride(x, 1)
incy = stride(y, 1)
@assert length(d_x) >= 1 + (n - 1)*abs(incx)
@assert length(d_y) >= 1 + (n - 1)*abs(incy)
if T == ComplexF64
oneMKL.onemklZrot(sycl_queue(queue), n, d_x, incx, d_y, incy, c, s)
elseif T == ComplexF32
oneMKL.onemklCrot(sycl_queue(queue), n, d_x, incx, d_y, incy, c, s)
end
@show x
@show Array(d_x)
@assert x == Array(d_x)
end The C++ wrappers seem fine... Even with ComplexF32, it occasionally fails: julia> main(; T=ComplexF32)
x = ComplexF32[2.0f0 + 0.0f0im]
Array(d_x) = ComplexF32[1.0f0 + 0.0f0im]
ERROR: AssertionError: x == Array(d_x)
Stacktrace:
[1] main(; n::Int64, T::Type)
@ Main ~/Julia/pkg/oneAPI/wip.jl:30
[2] top-level scope
@ REPL[10]:1
julia> main(; T=ComplexF32)
x = ComplexF32[2.0f0 + 0.0f0im]
Array(d_x) = ComplexF32[2.0f0 + 0.0f0im]
julia> main(; T=ComplexF32)
x = ComplexF32[2.0f0 + 0.0f0im]
Array(d_x) = ComplexF32[2.0f0 + 0.0f0im]
julia> main(; T=ComplexF32)
x = ComplexF32[2.0f0 + 0.0f0im]
Array(d_x) = ComplexF32[2.0f0 + 0.0f0im]
julia> main(; T=ComplexF32)
x = ComplexF32[2.0f0 + 0.0f0im]
Array(d_x) = ComplexF32[2.0f0 + 0.0f0im]
julia> main(; T=ComplexF32)
x = ComplexF32[2.0f0 + 0.0f0im]
Array(d_x) = ComplexF32[1.0f0 + 0.0f0im]
ERROR: AssertionError: x == Array(d_x)
Stacktrace:
[1] main(; n::Int64, T::Type)
@ Main ~/Julia/pkg/oneAPI/wip.jl:30
[2] top-level scope
@ REPL[10]:1 cc @amontoison, in case you're already relying on these. |
We use the |
Would that explain it switching from |
I fixed a typo with #284 but the error is not related. using oneAPI, LinearAlgebra, MKL
function main(; n = 1, T = ComplexF64)
x = ones(T, n)
y = ones(T, n)
c = rand(real(T))
s = T(sqrt(1 - c^2))
@test c*c + s*conj(s) ≈ 1
d_x = oneArray(x)
d_y = oneArray(y)
incx = stride(x, 1)
incy = stride(y, 1)
BLAS.rot!(n, x, incx, y, incy, c, s)
queue = global_queue(context(d_x), device(d_x))
incx = stride(d_x, 1)
incy = stride(d_y, 1)
@assert length(d_x) >= 1 + (n - 1)*abs(incx)
@assert length(d_y) >= 1 + (n - 1)*abs(incy)
(T == Float32) && oneMKL.onemklSrot(sycl_queue(queue), n, d_x, incx, d_y, incy, c, s)
(T == Float64) && oneMKL.onemklDrot(sycl_queue(queue), n, d_x, incx, d_y, incy, c, s)
(T == ComplexF32) && oneMKL.onemklCrot(sycl_queue(queue), n, d_x, incx, d_y, incy, c, s)
(T == ComplexF64) && oneMKL.onemklZrot(sycl_queue(queue), n, d_x, incx, d_y, incy, c, s)
@show x
@show Array(d_x)
@assert x == Array(d_x)
end What I don't understand is that we have a different result if we use MKL on CPU. I can't explain that we have random switch from ComplexF32[1.0f0 + 0.0f0im] to ComplexF32[2.0f0 + 0.0f0im] without random inputs in your example above. 🤔 |
@maleadt @amontoison We will take this to the oneMKL team. Thank you for the investigation and the very good test cases. |
IIRC this has been fixed by an update of the support library. |
Hi @maleadt , I am facing following errors when I tested latest master in my local setup.
Looks like couple of rotate/reflect primitives are failing for complexf64 type at level-1.
Test Environment:
OS: "Ubuntu 20.04.5 LTS"
CPU: i9-9900K
GPU: Intel(R) UHD Graphics 630 [0x3e98]
The text was updated successfully, but these errors were encountered: