The nbnxn grid search sorting range parameter used the whole box
height instead of the local DD cell height with domain decomposition
along z. This could not cause errors, but the search used O(N^2) time
with more than 4 domains along z, instead of O(N).
Change-Id: I324df6b15635a5ecff7c8bfeb124fdb933e5f845
typedef struct {
rvec c0; /* The lower corner of the (local) grid */
rvec c1; /* The upper corner of the (local) grid */
typedef struct {
rvec c0; /* The lower corner of the (local) grid */
rvec c1; /* The upper corner of the (local) grid */
+ rvec size; /* c1 - c0 */
real atom_density; /* The atom number density for the local grid */
gmx_bool bSimple; /* Is this grid simple or super/sub */
real atom_density; /* The atom number density for the local grid */
gmx_bool bSimple; /* Is this grid simple or super/sub */
copy_rvec(corner0, grid->c0);
copy_rvec(corner1, grid->c1);
copy_rvec(corner0, grid->c0);
copy_rvec(corner1, grid->c1);
+ copy_rvec(size, grid->size);
/* Prints the average bb size, used for debug output */
static void print_bbsizes_simple(FILE *fp,
/* Prints the average bb size, used for debug output */
static void print_bbsizes_simple(FILE *fp,
- const nbnxn_search_t nbs,
const nbnxn_grid_t *grid)
{
int c, d;
const nbnxn_grid_t *grid)
{
int c, d;
}
dsvmul(1.0/grid->nc, ba, ba);
}
dsvmul(1.0/grid->nc, ba, ba);
- fprintf(fp, "ns bb: %4.2f %4.2f %4.2f %4.2f %4.2f %4.2f rel %4.2f %4.2f %4.2f\n",
- nbs->box[XX][XX]/grid->ncx,
- nbs->box[YY][YY]/grid->ncy,
- nbs->box[ZZ][ZZ]*grid->ncx*grid->ncy/grid->nc,
+ fprintf(fp, "ns bb: grid %4.2f %4.2f %4.2f abs %4.2f %4.2f %4.2f rel %4.2f %4.2f %4.2f\n",
+ grid->sx,
+ grid->sy,
+ grid->na_c/(grid->atom_density*grid->sx*grid->sy),
- ba[XX]*grid->ncx/nbs->box[XX][XX],
- ba[YY]*grid->ncy/nbs->box[YY][YY],
- ba[ZZ]*grid->nc/(grid->ncx*grid->ncy*nbs->box[ZZ][ZZ]));
+ ba[XX]/grid->sx,
+ ba[YY]/grid->sy,
+ ba[ZZ]/(grid->na_c/(grid->atom_density*grid->sx*grid->sy)));
}
/* Prints the average bb size, used for debug output */
static void print_bbsizes_supersub(FILE *fp,
}
/* Prints the average bb size, used for debug output */
static void print_bbsizes_supersub(FILE *fp,
- const nbnxn_search_t nbs,
const nbnxn_grid_t *grid)
{
int ns, c, s;
const nbnxn_grid_t *grid)
{
int ns, c, s;
}
dsvmul(1.0/ns, ba, ba);
}
dsvmul(1.0/ns, ba, ba);
- fprintf(fp, "ns bb: %4.2f %4.2f %4.2f %4.2f %4.2f %4.2f rel %4.2f %4.2f %4.2f\n",
- nbs->box[XX][XX]/(grid->ncx*GPU_NSUBCELL_X),
- nbs->box[YY][YY]/(grid->ncy*GPU_NSUBCELL_Y),
- nbs->box[ZZ][ZZ]*grid->ncx*grid->ncy/(grid->nc*GPU_NSUBCELL_Z),
+ fprintf(fp, "ns bb: grid %4.2f %4.2f %4.2f abs %4.2f %4.2f %4.2f rel %4.2f %4.2f %4.2f\n",
+ grid->sx/GPU_NSUBCELL_X,
+ grid->sy/GPU_NSUBCELL_Y,
+ grid->na_sc/(grid->atom_density*grid->sx*grid->sy*GPU_NSUBCELL_Z),
- ba[XX]*grid->ncx*GPU_NSUBCELL_X/nbs->box[XX][XX],
- ba[YY]*grid->ncy*GPU_NSUBCELL_Y/nbs->box[YY][YY],
- ba[ZZ]*grid->nc*GPU_NSUBCELL_Z/(grid->ncx*grid->ncy*nbs->box[ZZ][ZZ]));
+ ba[XX]*GPU_NSUBCELL_X/grid->sx,
+ ba[YY]*GPU_NSUBCELL_Y/grid->sy,
+ ba[ZZ]/(grid->na_sc/(grid->atom_density*grid->sx*grid->sy*GPU_NSUBCELL_Z)));
}
/* Potentially sorts atoms on LJ coefficients !=0 and ==0.
}
/* Potentially sorts atoms on LJ coefficients !=0 and ==0.
sort_atoms(ZZ, FALSE, dd_zone,
nbs->a+ash, na, x,
grid->c0[ZZ],
sort_atoms(ZZ, FALSE, dd_zone,
nbs->a+ash, na, x,
grid->c0[ZZ],
- 1.0/nbs->box[ZZ][ZZ], ncz*grid->na_sc,
+ 1.0/grid->size[ZZ], ncz*grid->na_sc,
sort_work);
/* Fill the ncz cells in this column */
sort_work);
/* Fill the ncz cells in this column */
sort_atoms(ZZ, FALSE, dd_zone,
nbs->a+ash, na, x,
grid->c0[ZZ],
sort_atoms(ZZ, FALSE, dd_zone,
nbs->a+ash, na, x,
grid->c0[ZZ],
- 1.0/nbs->box[ZZ][ZZ], ncz*grid->na_sc,
+ 1.0/grid->size[ZZ], ncz*grid->na_sc,
sort_work);
/* This loop goes over the supercells and subcells along z at once */
sort_work);
/* This loop goes over the supercells and subcells along z at once */
- print_bbsizes_simple(debug, nbs, grid);
+ print_bbsizes_simple(debug, grid);
}
else
{
fprintf(debug, "ns non-zero sub-cells: %d average atoms %.2f\n",
grid->nsubc_tot, (a1-a0)/(double)grid->nsubc_tot);
}
else
{
fprintf(debug, "ns non-zero sub-cells: %d average atoms %.2f\n",
grid->nsubc_tot, (a1-a0)/(double)grid->nsubc_tot);
- print_bbsizes_supersub(debug, nbs, grid);
+ print_bbsizes_supersub(debug, grid);
fprintf(fp, "nbl na_sc %d rl %g ncp %d per cell %.1f atoms %.1f ratio %.2f\n",
nbl->na_sc, rl, nbl->ncj, nbl->ncj/(double)grid->nc,
nbl->ncj/(double)grid->nc*grid->na_sc,
fprintf(fp, "nbl na_sc %d rl %g ncp %d per cell %.1f atoms %.1f ratio %.2f\n",
nbl->na_sc, rl, nbl->ncj, nbl->ncj/(double)grid->nc,
nbl->ncj/(double)grid->nc*grid->na_sc,
- nbl->ncj/(double)grid->nc*grid->na_sc/(0.5*4.0/3.0*M_PI*rl*rl*rl*grid->nc*grid->na_sc/det(nbs->box)));
+ nbl->ncj/(double)grid->nc*grid->na_sc/(0.5*4.0/3.0*M_PI*rl*rl*rl*grid->nc*grid->na_sc/(grid->size[XX]*grid->size[YY]*grid->size[ZZ])));
fprintf(fp, "nbl average j cell list length %.1f\n",
0.25*nbl->ncj/(double)nbl->nci);
fprintf(fp, "nbl average j cell list length %.1f\n",
0.25*nbl->ncj/(double)nbl->nci);
fprintf(fp, "nbl na_c %d rl %g ncp %d per cell %.1f atoms %.1f ratio %.2f\n",
nbl->na_ci, rl, nbl->nci_tot, nbl->nci_tot/(double)grid->nsubc_tot,
nbl->nci_tot/(double)grid->nsubc_tot*grid->na_c,
fprintf(fp, "nbl na_c %d rl %g ncp %d per cell %.1f atoms %.1f ratio %.2f\n",
nbl->na_ci, rl, nbl->nci_tot, nbl->nci_tot/(double)grid->nsubc_tot,
nbl->nci_tot/(double)grid->nsubc_tot*grid->na_c,
- nbl->nci_tot/(double)grid->nsubc_tot*grid->na_c/(0.5*4.0/3.0*M_PI*rl*rl*rl*grid->nsubc_tot*grid->na_c/det(nbs->box)));
+ nbl->nci_tot/(double)grid->nsubc_tot*grid->na_c/(0.5*4.0/3.0*M_PI*rl*rl*rl*grid->nsubc_tot*grid->na_c/(grid->size[XX]*grid->size[YY]*grid->size[ZZ])));
fprintf(fp, "nbl average j super cell list length %.1f\n",
0.25*nbl->ncj4/(double)nbl->nsci);
fprintf(fp, "nbl average j super cell list length %.1f\n",
0.25*nbl->ncj4/(double)nbl->nsci);