real dd_choose_grid(FILE *fplog, t_commrec *cr,gmx_domdec_t *dd,t_inputrec *ir, gmx_mtop_t *mtop,matrix box,gmx_ddbox_t *ddbox, bool bDynLoadBal,real dlb_scale, real cellsize_limit,real cutoff_dd, bool bInterCGBondeds,bool bInterCGMultiBody) { int npme,nkx,nky; real limit; if (MASTER(cr)) { if (EEL_PME(ir->coulombtype)) { if (cr->npmenodes >= 0) { if (cr->nnodes <= 2 && cr->npmenodes > 0) { gmx_fatal(FARGS, "Can not have separate PME nodes with 2 or less nodes"); } } else { if (cr->nnodes < 12 && pme_inconvenient_nnodes(ir->nkx,ir->nky,cr->nnodes) == 0) { cr->npmenodes = 0; } else { cr->npmenodes = guess_npme(fplog,mtop,ir,box,cr->nnodes); } } if (fplog) { fprintf(fplog,"Using %d separate PME nodes\n",cr->npmenodes); } } else { if (cr->npmenodes < 0) { cr->npmenodes = 0; } } limit = optimize_ncells(fplog,cr->nnodes,cr->npmenodes, bDynLoadBal,dlb_scale, mtop,box,ddbox,ir,dd, cellsize_limit,cutoff_dd, bInterCGBondeds,bInterCGMultiBody, dd->nc); } else { limit = 0; } /* Communicate the information set by the master to all nodes */ gmx_bcast(sizeof(dd->nc),dd->nc,cr); if (EEL_PME(ir->coulombtype)) { gmx_bcast(sizeof(ir->nkx),&ir->nkx,cr); gmx_bcast(sizeof(ir->nky),&ir->nky,cr); gmx_bcast(sizeof(cr->npmenodes),&cr->npmenodes,cr); } else { cr->npmenodes = 0; } return limit; }
real dd_choose_grid(FILE *fplog, t_commrec *cr, gmx_domdec_t *dd, t_inputrec *ir, gmx_mtop_t *mtop, matrix box, gmx_ddbox_t *ddbox, gmx_bool bDynLoadBal, real dlb_scale, real cellsize_limit, real cutoff_dd, gmx_bool bInterCGBondeds) { gmx_int64_t nnodes_div, ldiv; real limit; if (MASTER(cr)) { nnodes_div = cr->nnodes; if (EEL_PME(ir->coulombtype)) { if (cr->npmenodes > 0) { if (cr->npmenodes >= cr->nnodes) { gmx_fatal(FARGS, "Cannot have %d separate PME ranks with just %d total ranks", cr->npmenodes, cr->nnodes); } /* If the user purposely selected the number of PME nodes, * only check for large primes in the PP node count. */ nnodes_div -= cr->npmenodes; } } else { cr->npmenodes = 0; } if (nnodes_div > 12) { ldiv = largest_divisor(nnodes_div); /* Check if the largest divisor is more than nnodes^2/3 */ if (ldiv*ldiv*ldiv > nnodes_div*nnodes_div) { gmx_fatal(FARGS, "The number of ranks you selected (%d) contains a large prime factor %d. In most cases this will lead to bad performance. Choose a number with smaller prime factors or set the decomposition (option -dd) manually.", nnodes_div, ldiv); } } if (EEL_PME(ir->coulombtype)) { if (cr->npmenodes < 0) { /* Use PME nodes when the number of nodes is more than 16 */ if (cr->nnodes <= 18) { cr->npmenodes = 0; if (fplog) { fprintf(fplog, "Using %d separate PME ranks, as there are too few total\n ranks for efficient splitting\n", cr->npmenodes); } } else { cr->npmenodes = guess_npme(fplog, mtop, ir, box, cr->nnodes); if (fplog) { fprintf(fplog, "Using %d separate PME ranks, as guessed by mdrun\n", cr->npmenodes); } } } else { if (fplog) { fprintf(fplog, "Using %d separate PME ranks, per user request\n", cr->npmenodes); } } } limit = optimize_ncells(fplog, cr->nnodes, cr->npmenodes, bDynLoadBal, dlb_scale, mtop, box, ddbox, ir, dd, cellsize_limit, cutoff_dd, bInterCGBondeds, dd->nc); } else { limit = 0; } /* Communicate the information set by the master to all nodes */ gmx_bcast(sizeof(dd->nc), dd->nc, cr); if (EEL_PME(ir->coulombtype)) { gmx_bcast(sizeof(ir->nkx), &ir->nkx, cr); gmx_bcast(sizeof(ir->nky), &ir->nky, cr); gmx_bcast(sizeof(cr->npmenodes), &cr->npmenodes, cr); } else { cr->npmenodes = 0; } return limit; }
real dd_choose_grid(FILE *fplog, t_commrec *cr,gmx_domdec_t *dd,t_inputrec *ir, gmx_mtop_t *mtop,matrix box,gmx_ddbox_t *ddbox, gmx_bool bDynLoadBal,real dlb_scale, real cellsize_limit,real cutoff_dd, gmx_bool bInterCGBondeds,gmx_bool bInterCGMultiBody) { int npme,nkx,nky; int ldiv; real limit; if (MASTER(cr)) { if (cr->nnodes > 12) { ldiv = largest_divisor(cr->nnodes); /* Check if the largest divisor is more than nnodes^2/3 */ if (ldiv*ldiv*ldiv > cr->nnodes*cr->nnodes) { gmx_fatal(FARGS,"The number of nodes you selected (%d) contains a large prime factor %d. In most cases this will lead to bad performance. Choose a number with smaller prime factors or set the decomposition (option -dd) manually.", cr->nnodes,ldiv); } } if (EEL_PME(ir->coulombtype)) { if (cr->npmenodes >= 0) { if (cr->nnodes <= 2 && cr->npmenodes > 0) { gmx_fatal(FARGS, "Can not have separate PME nodes with 2 or less nodes"); } } else { if (cr->nnodes <= 10) { cr->npmenodes = 0; } else { cr->npmenodes = guess_npme(fplog,mtop,ir,box,cr->nnodes); } } if (fplog) { fprintf(fplog,"Using %d separate PME nodes\n",cr->npmenodes); } } else { if (cr->npmenodes < 0) { cr->npmenodes = 0; } } limit = optimize_ncells(fplog,cr->nnodes,cr->npmenodes, bDynLoadBal,dlb_scale, mtop,box,ddbox,ir,dd, cellsize_limit,cutoff_dd, bInterCGBondeds,bInterCGMultiBody, dd->nc); } else { limit = 0; } /* Communicate the information set by the master to all nodes */ gmx_bcast(sizeof(dd->nc),dd->nc,cr); if (EEL_PME(ir->coulombtype)) { gmx_bcast(sizeof(ir->nkx),&ir->nkx,cr); gmx_bcast(sizeof(ir->nky),&ir->nky,cr); gmx_bcast(sizeof(cr->npmenodes),&cr->npmenodes,cr); } else { cr->npmenodes = 0; } return limit; }