Skip to content
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

Zero gflops with evalpoly #23

Closed
schneiderfelipe opened this issue Jan 23, 2021 · 2 comments
Closed

Zero gflops with evalpoly #23

schneiderfelipe opened this issue Jan 23, 2021 · 2 comments

Comments

@schneiderfelipe
Copy link

Hi, I get the following with an example from the README.md:

julia> x = 0.5; coeffs = rand(10);

julia> cnt = @count_ops evalpoly($x, $coeffs)
Flop Counter: 0 flop

julia> @gflops evalpoly($x, $coeffs);
  0.00 GFlops,  0.00% peak  (0.00e+00 flop, 1.88e-08 s, 0 alloc: 0 bytes)

I thought the implementation of evalpoly might have changed (to maybe C), but that's not the case:

julia> @edit evalpoly(x, coeffs)

leads me to the following implementation:

evalpoly(x, p::AbstractVector) = _evalpoly(x, p)

function _evalpoly(x, p)
    N = length(p)
    ex = p[end]
    for i in N-1:-1:1
        ex = muladd(x, ex, p[i])
    end
    ex
end

Is this expected? Some version info follows:

julia> versioninfo()
Julia Version 1.4.1
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, broadwell)
Environment:
  JULIA_NUM_THREADS = 4
@chriselrod
Copy link

It requires the master branch of GFlops.

julia> using GFlops

julia> x = 0.5; coeffs = rand(10);

julia> evalpoly(x, coeffs)
1.0651611619095267

julia> @count_ops evalpoly($x, $coeffs)
Flop Counter: 18 flop
┌────────┬─────────┐
│        │ Float64 │
├────────┼─────────┤
│ muladd │       9 │
└────────┴─────────┘

(@v1.7) pkg> st GFlops
      Status `~/.julia/environments/v1.7/Project.toml`
  [2ea8233c] GFlops v0.1.3 `https://github.com/triscale-innov/GFlops.jl.git#master`

@ffevotte
Copy link
Member

Version 0.1.4 has now been released and should be available from the General Registry with this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants