Open dlfivefifty opened 9 years ago
Bessel functions would have been nice, but I guess they're mainly elementary transcendentals. Seems like an @accelerate macro, which would somehow use @replaceBase if the package is detected and leave functions unchanged otherwise, would be offer functionality similar to @compat.
We can just add the line:
if OS_NAME == :Darwin && Pkg.isinstalled(“AppleAccelerate”) using AppleAccelerate @replaceBase(sqrt) end
to replace all usages.
On 24 Sep 2015, at 7:49 am, Richard Mikael Slevinsky notifications@github.com wrote:
Bessel functions would have been nice, but I guess they're mainly elementary transcendentals. Seems like an @accelerate https://github.com/accelerate macro, which would somehow use @replaceBase if the package is detected and leave functions unchanged otherwise, would be offer functionality similar to @compat https://github.com/compat.
— Reply to this email directly or view it on GitHub https://github.com/ApproxFun/SingularIntegralEquations.jl/issues/43#issuecomment-142740353.
I wonder if we can rewrite besselj? 😉
Exp makes a 4x difference:
julia> r=rand(1000000);@time AppleAccelerate.exp(r); 0.003829 seconds (8 allocations: 7.630 MB)
julia> r=rand(1000000);@time exp(r); 0.016968 seconds (6 allocations: 7.630 MB, 13.50% gc time)
Also, should we be using Float32’s? That adds another 2x speedup (for both built-in and AppleAccelerate).
On 24 Sep 2015, at 7:49 am, Richard Mikael Slevinsky notifications@github.com wrote:
Bessel functions would have been nice, but I guess they're mainly elementary transcendentals. Seems like an @accelerate https://github.com/accelerate macro, which would somehow use @replaceBase if the package is detected and leave functions unchanged otherwise, would be offer functionality similar to @compat https://github.com/compat.
— Reply to this email directly or view it on GitHub https://github.com/ApproxFun/SingularIntegralEquations.jl/issues/43#issuecomment-142740353.
Plotting is essentially a loop over a loop, so the in-place methods are important too.
julia> out = Array(Float64,1000);
julia> r = rand(1_000,1_000);@time [exp(r[i,:]) for i=1:1000];
0.022481 seconds (5.47 k allocations: 15.487 MB, 14.27% gc time)
julia> r = rand(1_000,1_000);@time [AppleAccelerate.exp(r[i,:]) for i=1:1000];
0.011269 seconds (7.96 k allocations: 15.540 MB, 21.60% gc time)
julia> r = rand(1_000,1_000);@time [AppleAccelerate.exp!(out,r[i,:]) for i=1:1000];
0.007681 seconds (4.96 k allocations: 7.789 MB)
(Of course the above code is much slower than using the full r
matrices, but for Green's function evaluation routines it would likely appear as above.)
What's the speed if you call AppleAccellerate.exp!(vec(r))?
I think modifying vec(r) also modifies r...
Sent from my iPad
On 25 Sep 2015, at 12:59 AM, Richard Mikael Slevinsky notifications@github.com wrote:
(Of course the above code is much slower than using the full r matrices, but for Green's function evaluation routines it would likely appear as above.)
— Reply to this email directly or view it on GitHub.
I think my argument only makes sense in the context of these functions.
Should there also be in-place transforms?
Yes there should. if you search for transform! you’ll see that TensorSpace has one already, but not really anything else. This is only used for ProductFun I think.
On 25 Sep 2015, at 8:33 am, Richard Mikael Slevinsky notifications@github.com wrote:
I think my argument only makes sense in the context of these functions https://github.com/ApproxFun/SingularIntegralEquations.jl/blob/master/src/GreensFun/evaluation.jl.
Should there also be in-place transforms?
— Reply to this email directly or view it on GitHub https://github.com/ApproxFun/SingularIntegralEquations.jl/issues/43#issuecomment-143067249.
Yes, those allow 2D transforms to be done with 1D transforms (and planned only once :8ball: !), along one dimension at a time.
Probably we will move fast evaluation to ArrayFire?
Yes . We’ll have to get ApproxFun working in 0.5 first though, which last I checked is held up by a Julia type inference bug
On 25 May 2016, at 9:27 AM, Richard Mikael Slevinsky notifications@github.com wrote:
Probably we will move fast evaluation to ArrayFire?
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/ApproxFun/SingularIntegralEquations.jl/issues/43#issuecomment-221432089
This suggests about a 2x speed increase:
julia> r=rand(10000000);@time sqrt(r); 0.049254 seconds (6 allocations: 76.294 MB, 11.57% gc time)
julia> r=rand(10000000);@time AppleAccelerate.sqrt(r); 0.026610 seconds (8 allocations: 76.294 MB, 21.70% gc time)