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

Memory Pools #82

Merged
merged 22 commits into from
Nov 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
bca7ddc
[OCCA] Update OCCA with latest fixes
noelchalmers Nov 17, 2022
eccb689
[Core] Add occa memory pools to platform
noelchalmers Nov 17, 2022
d1c378b
[LinAlg] Use memory pools in linAlg. Also merge some okl kernels
noelchalmers Nov 17, 2022
9468c29
[InitialGuess] Use memory pools in initialGuess generators. Also twea…
noelchalmers Nov 17, 2022
468d917
[InitialGuess] Update some initial guess kernels
noelchalmers Nov 17, 2022
efedee1
[LinearSolver] Use memory pools in linearSolvers and update some kernels
noelchalmers Nov 17, 2022
5b67c67
[ParAlmond] Use memory pools in parAlmond and update some kernels
noelchalmers Nov 17, 2022
da181d0
[TimeStepper] Use memory pools in timesteppers and update some kernels
noelchalmers Nov 17, 2022
234d46e
[Elliptic] Use memory pools in elliptic solver
noelchalmers Nov 17, 2022
0894686
[Advection] Use memory pools in advection solver
noelchalmers Nov 17, 2022
00541b7
[Acoustics] Use memory pools in acoustics solver
noelchalmers Nov 17, 2022
1e5656f
[Gradient] Use memory pools in gradient solver
noelchalmers Nov 17, 2022
1fc2eb4
[cns] Use memory pools in cns solver
noelchalmers Nov 17, 2022
99a3c79
[bns] Use memory pools in bns solver
noelchalmers Nov 17, 2022
a7eb5e2
[fpe] Use memory pools in fpe solver
noelchalmers Nov 17, 2022
6545f03
[ins] Use memory pools in ins solver
noelchalmers Nov 17, 2022
ea3c3c1
[Test] Small tweak in elliptic test
noelchalmers Nov 17, 2022
84b190b
[Elliptic] Initialize x to zero in elliptic solver runs
noelchalmers Nov 17, 2022
ce58ea5
[Memory] Don't let pinnedMemory be implicitly convertable to deviceMe…
noelchalmers Nov 18, 2022
cea4e35
[Mesh] Fix a warning about uninitialized variables
noelchalmers Nov 18, 2022
c3aa8e8
Make some unintentionally synchronous memcopies asynchronous
noelchalmers Nov 18, 2022
7a74aff
The 'do nothing' initialGuess strategy isn't safe since the input vec…
noelchalmers Nov 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[fpe] Use memory pools in fpe solver
  • Loading branch information
noelchalmers committed Nov 18, 2022
commit a7eb5e22e7fd5d68c7239dbf23fed409316142f3
5 changes: 0 additions & 5 deletions solvers/fokkerPlanck/fpe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@ class fpe_t: public solver_t {
memory<dfloat> q;
deviceMemory<dfloat> o_q;

deviceMemory<dfloat> o_Mq;

memory<dfloat> grad;
deviceMemory<dfloat> o_grad;

//subcycling
int Nsubcycles;
timeStepper_t subStepper;
Expand Down
3 changes: 2 additions & 1 deletion solvers/fokkerPlanck/src/fpeReport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ void fpe_t::Report(dfloat time, int tstep){
static int frame=0;

//compute q.M*q
dlong Nentries = mesh.Nelements*mesh.Np;
deviceMemory<dfloat> o_Mq = platform.reserve<dfloat>(Nentries);
mesh.MassMatrixApply(o_q, o_Mq);

dlong Nentries = mesh.Nelements*mesh.Np;
dfloat norm2 = sqrt(platform.linAlg().innerProd(Nentries, o_q, o_Mq, mesh.comm));

if(mesh.rank==0)
Expand Down
3 changes: 2 additions & 1 deletion solvers/fokkerPlanck/src/fpeRun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ void fpe_t::Run(){
// output norm of final solution
{
//compute q.M*q
dlong Nentries = mesh.Nelements*mesh.Np;
deviceMemory<dfloat> o_Mq = platform.reserve<dfloat>(Nentries);
mesh.MassMatrixApply(o_q, o_Mq);

dlong Nentries = mesh.Nelements*mesh.Np;
dfloat norm2 = sqrt(platform.linAlg().innerProd(Nentries, o_q, o_Mq, mesh.comm));

if(mesh.rank==0)
Expand Down
9 changes: 2 additions & 7 deletions solvers/fokkerPlanck/src/fpeSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,11 @@ void fpe_t::Setup(platform_t& _platform, mesh_t& _mesh,
traceHalo = mesh.HaloTraceSetup(1); //one field

// compute samples of q at interpolation nodes
q.malloc(Nlocal+Nhalo, 0.0);
o_q = platform.malloc<dfloat>(q);
q.malloc(Nlocal+Nhalo);
o_q = platform.malloc<dfloat>(Nlocal+Nhalo);

//storage for M*q during reporting
o_Mq = platform.malloc<dfloat>(q);
mesh.MassMatrixKernelSetup(1); // mass matrix operator

grad.malloc((Nlocal+Nhalo)*4, 0.0);
o_grad = platform.malloc<dfloat>(grad);

// OCCA build stuff
properties_t kernelInfo = mesh.props; //copy base occa properties

Expand Down
6 changes: 4 additions & 2 deletions solvers/fokkerPlanck/src/fpeStep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ SOFTWARE.

dfloat fpe_t::MaxWaveSpeed(deviceMemory<dfloat>& o_Q, const dfloat T){

//Note: if this is on the critical path in the future, we should pre-allocate this
deviceMemory<dfloat> o_maxSpeed = platform.malloc<dfloat>(mesh.Nelements);
deviceMemory<dfloat> o_maxSpeed = platform.reserve<dfloat>(mesh.Nelements);

maxWaveSpeedKernel(mesh.Nelements,
mesh.o_vgeo,
Expand Down Expand Up @@ -192,6 +191,9 @@ void fpe_t::Advection(deviceMemory<dfloat>& o_Q, deviceMemory<dfloat>& o_RHS, co

void fpe_t::Diffusion(deviceMemory<dfloat>& o_Q, deviceMemory<dfloat>& o_RHS, const dfloat T) {

dlong Ntotal = (mesh.Nelements+mesh.totalHaloPairs)*mesh.Np;
deviceMemory<dfloat> o_grad = platform.reserve<dfloat>(4*Ntotal);

//compute gradq and pack with q
gradientKernel(mesh.Nelements,
mesh.o_vgeo,
Expand Down