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

calcN! optimization #2

Open
navidcy opened this issue Aug 23, 2020 · 4 comments
Open

calcN! optimization #2

navidcy opened this issue Aug 23, 2020 · 4 comments

Comments

@navidcy
Copy link
Member

navidcy commented Aug 23, 2020

@glwagner any ideas to better optimize calcN!?

function calcN!(N, sol, t, clock, vars, params, grid)
@. vars.uh = sol[:, 1]
@. vars.vh = sol[:, 2]
ldiv!(vars.u, grid.rfftplan, vars.uh)
ldiv!(vars.v, grid.rfftplan, vars.vh)
@. vars.vu² = vars.v * vars.u^2
mul!(vars.vu²h, grid.rfftplan, vars.vu²)
@views @. N[:, 1] = + vars.vu²h - (params.B + 1) * sol[:, 1] # + v*u² - (B+1) u
N[1, 1] += params.E * grid.nx # note that fft(constant) = constant * nx
@views @. N[:, 2] = - vars.vu²h + params.B * sol[:, 1] # - v*u² + B*u
return nothing
end

@glwagner
Copy link
Member

line 105 could use @inbounds. Not sure what else...

@navidcy
Copy link
Member Author

navidcy commented Aug 23, 2020

what about @Inbouds on line 107?

@glwagner
Copy link
Member

@inbounds is implied by broadcasting, I think.

@rveltz
Copy link
Contributor

rveltz commented Nov 26, 2020

@. vars.uh = @view sol[:, 1] ?

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