move communication for eam/omp warning outside the threaded region. undo for INTEL
This commit is contained in:
@ -234,7 +234,6 @@ void PairEAMIntel::eval(const int offload, const int vflag,
|
||||
const int istride = fc.rhor_istride();
|
||||
const int jstride = fc.rhor_jstride();
|
||||
const int fstride = fc.frho_stride();
|
||||
int beyond_rhomax = 0;
|
||||
{
|
||||
#if defined(__MIC__) && defined(_LMP_INTEL_OFFLOAD)
|
||||
*timer_compute = MIC_Wtime();
|
||||
@ -453,10 +452,7 @@ void PairEAMIntel::eval(const int offload, const int vflag,
|
||||
if (EFLAG) {
|
||||
flt_t phi = ((frho_spline_e[ioff].a*p + frho_spline_e[ioff].b)*p +
|
||||
frho_spline_e[ioff].c)*p + frho_spline_e[ioff].d;
|
||||
if (rho[i] > frhomax) {
|
||||
phi += fp_f[i] * (rho[i]-frhomax);
|
||||
beyond_rhomax = 1;
|
||||
}
|
||||
if (rho[i] > frhomax) phi += fp_f[i] * (rho[i]-frhomax);
|
||||
if (!ONETYPE) {
|
||||
const int ptr_off=itype*ntypes + itype;
|
||||
oscale = scale_f[ptr_off];
|
||||
@ -568,12 +564,10 @@ void PairEAMIntel::eval(const int offload, const int vflag,
|
||||
} else
|
||||
rhoip = rhojp;
|
||||
const flt_t z2p = (z2r_spline_t[joff].a*p +
|
||||
z2r_spline_t[joff].b)*p +
|
||||
z2r_spline_t[joff].c;
|
||||
z2r_spline_t[joff].b)*p + z2r_spline_t[joff].c;
|
||||
const flt_t z2 = ((z2r_spline_t[joff].d*p +
|
||||
z2r_spline_t[joff].e)*p +
|
||||
z2r_spline_t[joff].f)*p +
|
||||
z2r_spline_t[joff].g;
|
||||
z2r_spline_t[joff].f)*p + z2r_spline_t[joff].g;
|
||||
|
||||
const flt_t recip = (flt_t)1.0/r;
|
||||
const flt_t phi = z2*recip;
|
||||
@ -656,16 +650,6 @@ void PairEAMIntel::eval(const int offload, const int vflag,
|
||||
else
|
||||
fix->stop_watch(TIME_HOST_PAIR);
|
||||
|
||||
if (EFLAG && (!exceeded_rhomax)) {
|
||||
MPI_Allreduce(&beyond_rhomax, &exceeded_rhomax, 1, MPI_INT, MPI_SUM, world);
|
||||
if (exceeded_rhomax) {
|
||||
if (comm->me == 0)
|
||||
error->warning(FLERR,
|
||||
"A per-atom density exceeded rhomax of EAM potential table - "
|
||||
"a linear extrapolation to the energy was made");
|
||||
}
|
||||
}
|
||||
|
||||
if (EFLAG || vflag)
|
||||
fix->add_result_array(f_start, ev_global, offload, eatom, 0, vflag);
|
||||
else
|
||||
|
||||
@ -46,6 +46,7 @@ void PairEAMOMP::compute(int eflag, int vflag)
|
||||
const int nall = atom->nlocal + atom->nghost;
|
||||
const int nthreads = comm->nthreads;
|
||||
const int inum = list->inum;
|
||||
int beyond_rhomax = 0;
|
||||
|
||||
// grow energy and fp arrays if necessary
|
||||
// need to be atom->nmax in length
|
||||
@ -61,7 +62,7 @@ void PairEAMOMP::compute(int eflag, int vflag)
|
||||
}
|
||||
|
||||
#if defined(_OPENMP)
|
||||
#pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(eflag,vflag)
|
||||
#pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(eflag,vflag) reduction(+:beyond_rhomax)
|
||||
#endif
|
||||
{
|
||||
int ifrom, ito, tid;
|
||||
@ -78,24 +79,34 @@ void PairEAMOMP::compute(int eflag, int vflag)
|
||||
|
||||
if (evflag) {
|
||||
if (eflag) {
|
||||
if (force->newton_pair) eval<1,1,1>(ifrom, ito, thr);
|
||||
else eval<1,1,0>(ifrom, ito, thr);
|
||||
if (force->newton_pair) eval<1,1,1>(ifrom, ito, &beyond_rhomax, thr);
|
||||
else eval<1,1,0>(ifrom, ito, &beyond_rhomax, thr);
|
||||
} else {
|
||||
if (force->newton_pair) eval<1,0,1>(ifrom, ito, thr);
|
||||
else eval<1,0,0>(ifrom, ito, thr);
|
||||
if (force->newton_pair) eval<1,0,1>(ifrom, ito, &beyond_rhomax, thr);
|
||||
else eval<1,0,0>(ifrom, ito, &beyond_rhomax, thr);
|
||||
}
|
||||
} else {
|
||||
if (force->newton_pair) eval<0,0,1>(ifrom, ito, thr);
|
||||
else eval<0,0,0>(ifrom, ito, thr);
|
||||
if (force->newton_pair) eval<0,0,1>(ifrom, ito, &beyond_rhomax, thr);
|
||||
else eval<0,0,0>(ifrom, ito, &beyond_rhomax, thr);
|
||||
}
|
||||
|
||||
thr->timer(Timer::PAIR);
|
||||
reduce_thr(this, eflag, vflag, thr);
|
||||
} // end of omp parallel region
|
||||
|
||||
if (eflag && (!exceeded_rhomax)) {
|
||||
MPI_Allreduce(&beyond_rhomax, &exceeded_rhomax, 1, MPI_INT, MPI_SUM, world);
|
||||
if (exceeded_rhomax) {
|
||||
if (comm->me == 0)
|
||||
error->warning(FLERR,
|
||||
"A per-atom density exceeded rhomax of EAM potential table - "
|
||||
"a linear extrapolation to the energy was made");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <int EVFLAG, int EFLAG, int NEWTON_PAIR>
|
||||
void PairEAMOMP::eval(int iifrom, int iito, ThrData * const thr)
|
||||
void PairEAMOMP::eval(int iifrom, int iito, int *beyond_rhomax, ThrData * const thr)
|
||||
{
|
||||
int i,j,ii,jj,m,jnum,itype,jtype;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair;
|
||||
@ -103,7 +114,6 @@ void PairEAMOMP::eval(int iifrom, int iito, ThrData * const thr)
|
||||
double *coeff;
|
||||
int *ilist,*jlist,*numneigh,**firstneigh;
|
||||
|
||||
int beyond_rhomax = 0;
|
||||
evdwl = 0.0;
|
||||
|
||||
const auto * _noalias const x = (dbl3_t *) atom->x[0];
|
||||
@ -207,7 +217,7 @@ void PairEAMOMP::eval(int iifrom, int iito, ThrData * const thr)
|
||||
phi = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
|
||||
if (rho[i] > rhomax) {
|
||||
phi += fp[i] * (rho[i]-rhomax);
|
||||
beyond_rhomax = 1;
|
||||
*beyond_rhomax = 1;
|
||||
}
|
||||
e_tally_thr(this, i, i, nlocal, NEWTON_PAIR, scale[type[i]][type[i]]*phi, 0.0, thr);
|
||||
}
|
||||
@ -303,16 +313,6 @@ void PairEAMOMP::eval(int iifrom, int iito, ThrData * const thr)
|
||||
f[i].y += fytmp;
|
||||
f[i].z += fztmp;
|
||||
}
|
||||
|
||||
if (EFLAG && (!exceeded_rhomax)) {
|
||||
MPI_Allreduce(&beyond_rhomax, &exceeded_rhomax, 1, MPI_INT, MPI_SUM, world);
|
||||
if (exceeded_rhomax) {
|
||||
if (comm->me == 0)
|
||||
error->warning(FLERR,
|
||||
"A per-atom density exceeded rhomax of EAM potential table - "
|
||||
"a linear extrapolation to the energy was made");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -39,7 +39,7 @@ class PairEAMOMP : public PairEAM, public ThrOMP {
|
||||
|
||||
private:
|
||||
template <int EVFLAG, int EFLAG, int NEWTON_PAIR>
|
||||
void eval(int iifrom, int iito, ThrData *const thr);
|
||||
void eval(int iifrom, int iito, int *beyond_rhomax, ThrData *const thr);
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
Reference in New Issue
Block a user