Declared victory on compute grid and grid/local
This commit is contained in:
@ -272,17 +272,20 @@ void ComputeSNAGridLocal::compute_local()
|
||||
// linear contributions
|
||||
|
||||
for (int icoeff = 0; icoeff < ncoeff; icoeff++)
|
||||
gridlocal[size_local_cols_base+icoeff][iz][iy][ix] = snaptr->blist[icoeff];
|
||||
|
||||
gridlocal[size_local_cols_base+icoeff][iz][iy][ix] =
|
||||
snaptr->blist[icoeff];
|
||||
|
||||
// quadratic contributions
|
||||
|
||||
if (quadraticflag) {
|
||||
int ncount = ncoeff;
|
||||
for (int icoeff = 0; icoeff < ncoeff; icoeff++) {
|
||||
double bveci = snaptr->blist[icoeff];
|
||||
gridlocal[size_local_cols_base+ncount++][iz][iy][ix] = 0.5*bveci*bveci;
|
||||
gridlocal[size_local_cols_base+ncount++][iz][iy][ix] =
|
||||
0.5*bveci*bveci;
|
||||
for (int jcoeff = icoeff+1; jcoeff < ncoeff; jcoeff++)
|
||||
gridlocal[size_local_cols_base+ncount++][iz][iy][ix] = bveci*snaptr->blist[jcoeff];
|
||||
gridlocal[size_local_cols_base+ncount++][iz][iy][ix] =
|
||||
bveci*snaptr->blist[jcoeff];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,11 +207,7 @@ void ComputeGrid::allocate()
|
||||
memory->destroy(local_flags);
|
||||
if (gridlocal_allocated) {
|
||||
gridlocal_allocated = 0;
|
||||
// MEMORY LEAK!!
|
||||
// can't seem to free this memory without seg-fault
|
||||
// printf("Before allocate destroy4d, proc %d %p\n",comm->me,gridlocal);
|
||||
// memory->destroy4d_offset(gridlocal,nzlo,nylo,nxlo);
|
||||
// printf("After allocate destroy4d, proc %d %p\n",comm->me,gridlocal);
|
||||
memory->destroy4d_offset(gridlocal,nzlo,nylo,nxlo);
|
||||
}
|
||||
|
||||
memory->create(grid,size_array_rows,size_array_cols,"grid:grid");
|
||||
|
||||
@ -104,16 +104,12 @@ void ComputeGridLocal::allocate()
|
||||
|
||||
if (gridlocal_allocated) {
|
||||
gridlocal_allocated = 0;
|
||||
// MEMORY LEAK!!
|
||||
// can't seem to free this memory without seg-fault
|
||||
// printf("Before allocate destroy4d, proc %d %p\n",comm->me,gridlocal);
|
||||
// memory->destroy4d_offset(gridlocal,nzlo,nylo,nxlo);
|
||||
// printf("After allocate destroy4d, proc %d %p\n",comm->me,gridlocal);
|
||||
memory->destroy4d_offset(gridlocal,nzlo,nylo,nxlo);
|
||||
}
|
||||
|
||||
if (nxlo <= nxhi && nylo <= nyhi && nzlo <= nzhi) {
|
||||
gridlocal_allocated = 1;
|
||||
memory->create4d_offset(gridlocal,size_array_cols,nzlo,nzhi,nylo,nyhi,
|
||||
memory->create4d_offset(gridlocal,size_local_cols,nzlo,nzhi,nylo,nyhi,
|
||||
nxlo,nxhi,"grid:gridlocal");
|
||||
}
|
||||
}
|
||||
@ -248,6 +244,6 @@ void ComputeGridLocal::copy_gridlocal_to_local_array()
|
||||
|
||||
double ComputeGridLocal::memory_usage()
|
||||
{
|
||||
int nbytes = size_array_cols*ngridlocal*sizeof(double); // gridlocal
|
||||
int nbytes = size_local_cols*ngridlocal*sizeof(double); // gridlocal
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user