Skip to content

Commit

Permalink
Grabbag of fixes for 0.7 (JuliaMath#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan committed Mar 15, 2018
1 parent 6e26a1e commit 508ad53
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 115 deletions.
6 changes: 3 additions & 3 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
julia 0.7.0-DEV.602
AbstractFFTs 0.2.0
julia 0.7.0-DEV.3449
AbstractFFTs 0.3.0
Reexport
Compat 0.27.0
Compat 0.60.0
BinDeps 0.6.0
3 changes: 3 additions & 0 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Libdl

# If BLAS was compiled with MKL and the user wants MKL-based FFTs, we'll oblige.
# In that case, we have to do this little dance to get around having to use BinDeps
# for a library that's already linked to Julia.
Expand All @@ -18,6 +20,7 @@ if provider == "MKL" && Base.BLAS.vendor() === :mkl
open(depsfile, "w") do f
println(f, """
# This is an auto-generated file, do not edit
using Libdl
if Libdl.dlopen_e("$mklpath") == C_NULL
error("Unable to load MKL from '$mklpath'.\\n",
"Please rerun Pkg.build(\\"FFTW\\") and restart Julia.")
Expand Down
7 changes: 4 additions & 3 deletions deps/build_fftw.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using Libdl
using BinDeps
using BinDeps: builddir, depsdir, libdir

# Binaries is not a recognized provider on Linux >:/
modified_defaults = false
if !in(BinDeps.Binaries, BinDeps.defaults)
unshift!(BinDeps.defaults, BinDeps.Binaries)
pushfirst!(BinDeps.defaults, BinDeps.Binaries)
modified_defaults = true
end

Expand All @@ -23,7 +24,7 @@ end
# Why can't everyone just agree on what to call this library...
function makealiases(lib)
major = string(FFTW_VER.major)
nover = replace(lib, major, "")
nover = replace(lib, major => "")
return String[
nover,
join([lib, Libdl.dlext, major], "."),
Expand Down Expand Up @@ -116,5 +117,5 @@ else
end

if modified_defaults
shift!(BinDeps.defaults)
popfirst!(BinDeps.defaults)
end
11 changes: 4 additions & 7 deletions src/FFTW.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ __precompile__()
module FFTW

using Compat
using LinearAlgebra
using Reexport
@reexport using AbstractFFTs

Expand All @@ -14,11 +15,7 @@ import AbstractFFTs: Plan, ScaledPlan,
rfft_output_size, brfft_output_size,
plan_inv, normalization

if VERSION < v"0.7.0-DEV.986"
import Base.FFTW: dct, idct, dct!, idct!, plan_dct, plan_idct, plan_dct!, plan_idct!
else
export dct, idct, dct!, idct!, plan_dct, plan_idct, plan_dct!, plan_idct!
end
export dct, idct, dct!, idct!, plan_dct, plan_idct, plan_dct!, plan_idct!

const depsfile = joinpath(dirname(@__DIR__), "deps", "deps.jl")
if isfile(depsfile)
Expand All @@ -29,12 +26,12 @@ else
end

# MKL provides its own FFTW
fftw_vendor() = Base.BLAS.vendor() === :mkl ? :mkl : :fftw
fftw_vendor() = BLAS.vendor() === :mkl ? :mkl : :fftw

if fftw_vendor() === :mkl
const libfftw_name = "libmkl_rt"
const libfftwf_name = "libmkl_rt"
elseif Compat.Sys.iswindows()
elseif Sys.iswindows()
const libfftw_name = "libfftw3"
const libfftwf_name = "libfftw3f"
else
Expand Down
12 changes: 5 additions & 7 deletions src/dct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ const sqrthalf = sqrt(0.5)
const sqrt2 = sqrt(2.0)
const onerange = 1:1

function A_mul_B!(y::StridedArray{T}, p::DCTPlan{T,REDFT10},
x::StridedArray{T}) where T
function mul!(y::StridedArray{T}, p::DCTPlan{T,REDFT10}, x::StridedArray{T}) where T
assert_applicable(p.plan, x, y)
unsafe_execute!(p.plan, x, y)
scale!(y, p.nrm)
Expand All @@ -150,8 +149,7 @@ function A_mul_B!(y::StridedArray{T}, p::DCTPlan{T,REDFT10},
end

# note: idct changes input data
function A_mul_B!(y::StridedArray{T}, p::DCTPlan{T,REDFT01},
x::StridedArray{T}) where T
function mul!(y::StridedArray{T}, p::DCTPlan{T,REDFT01}, x::StridedArray{T}) where T
assert_applicable(p.plan, x, y)
scale!(x, p.nrm)
r = p.r
Expand All @@ -166,9 +164,9 @@ function A_mul_B!(y::StridedArray{T}, p::DCTPlan{T,REDFT01},
end

*(p::DCTPlan{T,REDFT10,false}, x::StridedArray{T}) where {T} =
A_mul_B!(Array{T}(p.plan.osz), p, x)
mul!(Array{T}(undef, p.plan.osz), p, x)

*(p::DCTPlan{T,REDFT01,false}, x::StridedArray{T}) where {T} =
A_mul_B!(Array{T}(p.plan.osz), p, copy(x)) # need copy to preserve input
mul!(Array{T}(undef, p.plan.osz), p, copy(x)) # need copy to preserve input

*(p::DCTPlan{T,K,true}, x::StridedArray{T}) where {T,K} = A_mul_B!(x, p, x)
*(p::DCTPlan{T,K,true}, x::StridedArray{T}) where {T,K} = mul!(x, p, x)
Loading

0 comments on commit 508ad53

Please sign in to comment.