JuliaMath / Yeppp.jl

Yeppp! bindings
Other
55 stars 14 forks source link

Remove scaler mulitply #8

Closed hiccup7 closed 9 years ago

hiccup7 commented 9 years ago

OpenBLAS v0.2.15 will improve the performance of many functions, and I am waiting for this release before comparing some functions with Yeppp. Today, I found that the Yeppp scaler multiply is slower than the base that uses OpenBLAS v0.2.14:

blas_set_num_threads(CPU_CORES)
using Yeppp

const n = 100000
const reps = 200000
const a = 2.0
const x = ones(Float64, n)
const res = similar(x)
@time for k=1:reps; Yeppp.multiply!(res, x, a); end
@time for k=1:reps; Yeppp.multiply!(res, x, a); end
#11.0 seconds, single-threaded

@time for k=1:reps; scale!(x, a); end
#6.9 seconds, single-threaded

To avoid confusion from a Yeppp function that is slower than the base, I propose to remove the Yeppp.multiply!() method using a scaler argument. Good to do this before Yeppp gets widely used in Julia.

Maratyszcza commented 9 years ago

Right, multiplication by scalar doesn't have optimized kernels in Yeppp 1.0.0

BTW, optimized kernels are documented in Yeppp! C API reference

ViralBShah commented 9 years ago

Good point.

ViralBShah commented 9 years ago

@Maratyszcza Which are the Yeppp functions that we really should be providing here, in addition to what we have, where Yeppp will give serious gains? What else should we remove, except for scalar operations?

panlanfeng commented 9 years ago

The scalar operations and negate! function are not optimized. I agree with removing them until a new version of Yeppp! is released.

ViralBShah commented 9 years ago

Please go for it if you can.