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

Start relying on randomkit and slowly deprecate use of leesper/go_rng #205

Open
chewxy opened this issue May 13, 2018 · 0 comments
Open

Comments

@chewxy
Copy link
Member

chewxy commented May 13, 2018

This is a profile from a recent NN run (resnet + extras)

Showing top 10 nodes out of 55
      flat  flat%   sum%        cum   cum%
    83.61s 21.93% 21.93%     83.65s 21.95%  runtime.cgocall
    54.80s 14.38% 36.31%     55.81s 14.64%  gorgonia.org/gorgonia.(*maxPoolOp).f64s
    26.68s  7.00% 43.31%    173.86s 45.61%  github.com/leesper/go_rng.UniformGenerator.Float64Range
    22.25s  5.84% 49.15%     22.25s  5.84%  sync.(*Mutex).Lock
    21.34s  5.60% 54.75%     21.34s  5.60%  sync.(*Mutex).Unlock
    20.72s  5.44% 60.18%     20.72s  5.44%  gonum.org/v1/gonum/internal/asm/f64.AxpyUnitaryTo
    17.27s  4.53% 64.71%    193.17s 50.68%  gorgonia.org/gorgonia.Uniform64
    16.04s  4.21% 68.92%    147.18s 38.61%  github.com/leesper/go_rng.UniformGenerator.Float64
    14.33s  3.76% 72.68%     14.91s  3.91%  runtime.newdefer
    13.30s  3.49% 76.17%     37.43s  9.82%  math/rand.(*Rand).Float64
(pprof) web

The reason why leespe/go_rng is slow is due to mutex locking (and reliance on the math/rand package. A better idea is to use a PCG random number generator (h/t: @dgryski) , which is what gorgonia.org/randomkit aims to be.

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

No branches or pull requests

1 participant