Declared victory on compute grid and grid/local
This commit is contained in:
@ -272,7 +272,8 @@ void ComputeSNAGridLocal::compute_local()
|
|||||||
// linear contributions
|
// linear contributions
|
||||||
|
|
||||||
for (int icoeff = 0; icoeff < ncoeff; icoeff++)
|
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
|
// quadratic contributions
|
||||||
|
|
||||||
@ -280,9 +281,11 @@ void ComputeSNAGridLocal::compute_local()
|
|||||||
int ncount = ncoeff;
|
int ncount = ncoeff;
|
||||||
for (int icoeff = 0; icoeff < ncoeff; icoeff++) {
|
for (int icoeff = 0; icoeff < ncoeff; icoeff++) {
|
||||||
double bveci = snaptr->blist[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++)
|
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);
|
memory->destroy(local_flags);
|
||||||
if (gridlocal_allocated) {
|
if (gridlocal_allocated) {
|
||||||
gridlocal_allocated = 0;
|
gridlocal_allocated = 0;
|
||||||
// MEMORY LEAK!!
|
memory->destroy4d_offset(gridlocal,nzlo,nylo,nxlo);
|
||||||
// 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->create(grid,size_array_rows,size_array_cols,"grid:grid");
|
memory->create(grid,size_array_rows,size_array_cols,"grid:grid");
|
||||||
|
|||||||
@ -104,16 +104,12 @@ void ComputeGridLocal::allocate()
|
|||||||
|
|
||||||
if (gridlocal_allocated) {
|
if (gridlocal_allocated) {
|
||||||
gridlocal_allocated = 0;
|
gridlocal_allocated = 0;
|
||||||
// MEMORY LEAK!!
|
memory->destroy4d_offset(gridlocal,nzlo,nylo,nxlo);
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nxlo <= nxhi && nylo <= nyhi && nzlo <= nzhi) {
|
if (nxlo <= nxhi && nylo <= nyhi && nzlo <= nzhi) {
|
||||||
gridlocal_allocated = 1;
|
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");
|
nxlo,nxhi,"grid:gridlocal");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -248,6 +244,6 @@ void ComputeGridLocal::copy_gridlocal_to_local_array()
|
|||||||
|
|
||||||
double ComputeGridLocal::memory_usage()
|
double ComputeGridLocal::memory_usage()
|
||||||
{
|
{
|
||||||
int nbytes = size_array_cols*ngridlocal*sizeof(double); // gridlocal
|
int nbytes = size_local_cols*ngridlocal*sizeof(double); // gridlocal
|
||||||
return nbytes;
|
return nbytes;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user