Unverified Commit d1bf4d57 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

reduce warnings related to OpenMP with clang

parent ed208fa4
Loading
Loading
Loading
Loading
+8 −11
Changes for src/USER-OMP/fix_nh_asphere_omp.cpp: 8 added lines, 11 removed lines.
Original line number Diff line number Diff line
@@ -77,15 +77,14 @@ void FixNHAsphereOMP::nve_v()
  const double * _noalias const rmass = atom->rmass;
  const int * _noalias const mask = atom->mask;
  const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal;
  int i;

  // standard nve_v velocity update. for efficiency the loop is
  // merged with FixNHOMP instead of calling it for the COM update.

#if defined(_OPENMP)
#pragma omp parallel for default(none) private(i) schedule(static)
#pragma omp parallel for default(none) schedule(static)
#endif
  for (i = 0; i < nlocal; i++) {
  for (int i = 0; i < nlocal; i++) {
    if (mask[i] & groupbit) {
      const double dtfm = dtf / rmass[i];
      v[i].x += dtfm*f[i].x;
@@ -112,7 +111,6 @@ void FixNHAsphereOMP::nve_x()
  AtomVecEllipsoid::Bonus * _noalias const bonus = avec->bonus;
  const int * _noalias const ellipsoid = atom->ellipsoid;
  const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal;
  int i;

  // set timestep here since dt may have changed or come via rRESPA

@@ -124,9 +122,9 @@ void FixNHAsphereOMP::nve_x()
  // principal moments of inertia

#if defined(_OPENMP)
#pragma omp parallel for default(none) private(i) schedule(static)
#pragma omp parallel for default(none) schedule(static)
#endif
  for (i = 0; i < nlocal; i++)
  for (int i = 0; i < nlocal; i++)
    if (mask[i] & groupbit) {
      double omega[3], inertia[3];

@@ -162,13 +160,12 @@ void FixNHAsphereOMP::nh_v_temp()
  dbl3_t * _noalias const angmom = (dbl3_t *) atom->angmom[0];
  const int * _noalias const mask = atom->mask;
  const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal;
  int i;

  if (which == NOBIAS) {
#if defined(_OPENMP)
#pragma omp parallel for default(none) private(i) schedule(static)
#pragma omp parallel for default(none) schedule(static)
#endif
    for (i = 0; i < nlocal; i++) {
    for (int i = 0; i < nlocal; i++) {
      if (mask[i] & groupbit) {
        v[i].x *= factor_eta;
        v[i].y *= factor_eta;
@@ -180,9 +177,9 @@ void FixNHAsphereOMP::nh_v_temp()
    }
  } else if (which == BIAS) {
#if defined(_OPENMP)
#pragma omp parallel for default(none) private(i) schedule(static)
#pragma omp parallel for default(none) schedule(static)
#endif
    for (i = 0; i < nlocal; i++) {
    for (int i = 0; i < nlocal; i++) {
      double buf[3];
      if (mask[i] & groupbit) {
        temperature->remove_bias_thr(i,&v[i].x,buf);
+18 −24
Changes for src/USER-OMP/fix_nh_omp.cpp: 18 added lines, 24 removed lines.
Original line number Diff line number Diff line
@@ -56,11 +56,10 @@ void FixNHOMP::remap()

  if (allremap) domain->x2lamda(nlocal);
  else {
    int i;
#if defined (_OPENMP)
#pragma omp parallel for private(i) default(none) schedule(static)
#pragma omp parallel for default(none) schedule(static)
#endif
    for (i = 0; i < nlocal; i++)
    for (int i = 0; i < nlocal; i++)
      if (mask[i] & dilate_group_bit)
        domain->x2lamda(x[i],x[i]);
  }
@@ -207,11 +206,10 @@ void FixNHOMP::remap()

  if (allremap) domain->lamda2x(nlocal);
  else {
    int i;
#if defined (_OPENMP)
#pragma omp parallel for private(i) default(none) schedule(static)
#pragma omp parallel for default(none) schedule(static)
#endif
    for (i = 0; i < nlocal; i++)
    for (int i = 0; i < nlocal; i++)
      if (mask[i] & dilate_group_bit)
        domain->lamda2x(x[i],x[i]);
  }
@@ -234,13 +232,12 @@ void FixNHOMP::nh_v_press()
  dbl3_t * _noalias const v = (dbl3_t *) atom->v[0];
  const int * _noalias const mask = atom->mask;
  const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal;
  int i;

  if (which == NOBIAS) {
#if defined(_OPENMP)
#pragma omp parallel for default(none) private(i) schedule(static)
#pragma omp parallel for default(none) schedule(static)
#endif
    for (i = 0; i < nlocal; i++) {
    for (int i = 0; i < nlocal; i++) {
      if (mask[i] & groupbit) {
        v[i].x *= factor0;
        v[i].y *= factor1;
@@ -256,9 +253,9 @@ void FixNHOMP::nh_v_press()
    }
  } else if (which == BIAS) {
#if defined(_OPENMP)
#pragma omp parallel for default(none) private(i) schedule(static)
#pragma omp parallel for default(none) schedule(static)
#endif
    for (i = 0; i < nlocal; i++) {
    for (int i = 0; i < nlocal; i++) {
      double buf[3];
      if (mask[i] & groupbit) {
        temperature->remove_bias_thr(i,&v[i].x,buf);
@@ -288,14 +285,13 @@ void FixNHOMP::nve_v()
  const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0];
  const int * _noalias const mask = atom->mask;
  const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal;
  int i;

  if (atom->rmass) {
    const double * _noalias const rmass = atom->rmass;
#if defined(_OPENMP)
#pragma omp parallel for default(none) private(i) schedule(static)
#pragma omp parallel for default(none) schedule(static)
#endif
    for (i = 0; i < nlocal; i++) {
    for (int i = 0; i < nlocal; i++) {
      if (mask[i] & groupbit) {
        const double dtfm = dtf / rmass[i];
        v[i].x += dtfm*f[i].x;
@@ -307,9 +303,9 @@ void FixNHOMP::nve_v()
    const double *_noalias const mass = atom->mass;
    const int * _noalias const type = atom->type;
#if defined(_OPENMP)
#pragma omp parallel for default(none) private(i) schedule(static)
#pragma omp parallel for default(none) schedule(static)
#endif
    for (i = 0; i < nlocal; i++) {
    for (int i = 0; i < nlocal; i++) {
      if (mask[i] & groupbit) {
        const double dtfm = dtf / mass[type[i]];
        v[i].x += dtfm*f[i].x;
@@ -330,14 +326,13 @@ void FixNHOMP::nve_x()
  const dbl3_t * _noalias const v = (dbl3_t *) atom->v[0];
  const int * _noalias const mask = atom->mask;
  const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal;
  int i;

  // x update by full step only for atoms in group

#if defined(_OPENMP)
#pragma omp parallel for default(none) private(i) schedule(static)
#pragma omp parallel for default(none) schedule(static)
#endif
  for (i = 0; i < nlocal; i++) {
  for (int i = 0; i < nlocal; i++) {
    if (mask[i] & groupbit) {
      x[i].x += dtv * v[i].x;
      x[i].y += dtv * v[i].y;
@@ -354,13 +349,12 @@ void FixNHOMP::nh_v_temp()
  dbl3_t * _noalias const v = (dbl3_t *) atom->v[0];
  const int * _noalias const mask = atom->mask;
  const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal;
  int i;

  if (which == NOBIAS) {
#if defined(_OPENMP)
#pragma omp parallel for default(none) private(i) schedule(static)
#pragma omp parallel for default(none) schedule(static)
#endif
    for (i = 0; i < nlocal; i++) {
    for (int i = 0; i < nlocal; i++) {
      if (mask[i] & groupbit) {
        v[i].x *= factor_eta;
        v[i].y *= factor_eta;
@@ -369,9 +363,9 @@ void FixNHOMP::nh_v_temp()
    }
  } else if (which == BIAS) {
#if defined(_OPENMP)
#pragma omp parallel for default(none) private(i) schedule(static)
#pragma omp parallel for default(none) schedule(static)
#endif
    for (i = 0; i < nlocal; i++) {
    for (int i = 0; i < nlocal; i++) {
      double buf[3];
      if (mask[i] & groupbit) {
        temperature->remove_bias_thr(i,&v[i].x,buf);
+6 −8
Changes for src/USER-OMP/fix_nh_sphere_omp.cpp: 6 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -76,7 +76,6 @@ void FixNHSphereOMP::nve_v()
  const double dtfrotate = dtf / INERTIA;

  const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal;
  int i;

  // standard nve_v velocity update. for efficiency the loop is
  // merged with FixNHOMP instead of calling it for the COM update.
@@ -86,9 +85,9 @@ void FixNHSphereOMP::nve_v()
  // 4 cases depending on radius vs shape and rmass vs mass

#if defined(_OPENMP)
#pragma omp parallel for default(none) private(i) schedule(static)
#pragma omp parallel for default(none) schedule(static)
#endif
  for (i = 0; i < nlocal; i++) {
  for (int i = 0; i < nlocal; i++) {
    if (mask[i] & groupbit) {
      const double dtfm = dtf / rmass[i];
      v[i].x += dtfm*f[i].x;
@@ -113,13 +112,12 @@ void FixNHSphereOMP::nh_v_temp()
  dbl3_t * _noalias const omega = (dbl3_t *) atom->omega[0];
  const int * _noalias const mask = atom->mask;
  const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal;
  int i;

  if (which == NOBIAS) {
#if defined(_OPENMP)
#pragma omp parallel for default(none) private(i) schedule(static)
#pragma omp parallel for default(none) schedule(static)
#endif
    for (i = 0; i < nlocal; i++) {
    for (int i = 0; i < nlocal; i++) {
      if (mask[i] & groupbit) {
        v[i].x *= factor_eta;
        v[i].y *= factor_eta;
@@ -131,9 +129,9 @@ void FixNHSphereOMP::nh_v_temp()
    }
  } else if (which == BIAS) {
#if defined(_OPENMP)
#pragma omp parallel for default(none) private(i) schedule(static)
#pragma omp parallel for default(none) schedule(static)
#endif
    for (i = 0; i < nlocal; i++) {
    for (int i = 0; i < nlocal; i++) {
      double buf[3];
      if (mask[i] & groupbit) {
        temperature->remove_bias_thr(i,&v[i].x,buf);
+45 −45
Changes for src/USER-OMP/fix_qeq_reax_omp.cpp: 45 added lines, 45 removed lines.
Original line number Diff line number Diff line
@@ -188,7 +188,7 @@ void FixQEqReaxOMP::compute_H()
#pragma omp parallel default(shared)
#endif
  {
    int i, j, ii, jj, mfill, jnum, flag;
    int  mfill, jnum, flag;
    int *jlist;
    double dx, dy, dz, r_sqr;

@@ -197,15 +197,15 @@ void FixQEqReaxOMP::compute_H()
#if defined(_OPENMP)
#pragma omp for schedule(guided)
#endif
    for (ii = 0; ii < inum; ii++) {
      i = ilist[ii];
    for (int ii = 0; ii < inum; ii++) {
      int i = ilist[ii];
      if (mask[i] & groupbit) {
        jlist = firstneigh[i];
        jnum = numneigh[i];
        mfill = H.firstnbr[i];

        for (jj = 0; jj < jnum; jj++) {
          j = jlist[jj];
        for (int jj = 0; jj < jnum; jj++) {
          int j = jlist[jj];

          dx = x[j][0] - x[i][0];
          dy = x[j][1] - x[i][1];
@@ -450,13 +450,13 @@ void FixQEqReaxOMP::init_matvec()

int FixQEqReaxOMP::CG( double *b, double *x)
{
  int  i, ii, imax;
  int  i, imax;
  double alpha, beta, b_norm;
  double sig_old, sig_new;

  double my_buf[2], buf[2];

  int nn, jj;
  int nn;
  int *ilist;
  if (reaxc) {
    nn = reaxc->list->inum;
@@ -476,16 +476,16 @@ int FixQEqReaxOMP::CG( double *b, double *x)
  tmp1 = tmp2 = 0.0;

#if defined(_OPENMP)
#pragma omp parallel for schedule(dynamic,50) private(i) reduction(+:tmp1,tmp2)
#pragma omp parallel for schedule(dynamic,50) reduction(+:tmp1,tmp2)
#endif
  for (jj = 0; jj < nn; ++jj) {
    i = ilist[jj];
    if (atom->mask[i] & groupbit) {
      r[i] = b[i] - q[i];
      d[i] = r[i] * Hdia_inv[i]; //pre-condition
  for (int jj = 0; jj < nn; ++jj) {
    int ii = ilist[jj];
    if (atom->mask[ii] & groupbit) {
      r[ii] = b[ii] - q[ii];
      d[ii] = r[ii] * Hdia_inv[ii]; //pre-condition

      tmp1 += b[i] * b[i];
      tmp2 += r[i] * d[i];
      tmp1 += b[ii] * b[ii];
      tmp2 += r[ii] * d[ii];
    }
  }

@@ -509,10 +509,10 @@ int FixQEqReaxOMP::CG( double *b, double *x)
    {

#if defined(_OPENMP)
#pragma omp for schedule(dynamic,50) private(ii) reduction(+:tmp1)
#pragma omp for schedule(dynamic,50) reduction(+:tmp1)
#endif
      for (jj = 0; jj < nn; jj++) {
        ii = ilist[jj];
      for (int jj = 0; jj < nn; jj++) {
        int ii = ilist[jj];
        if (atom->mask[ii] & groupbit) tmp1 += d[ii] * q[ii];
      }

@@ -529,10 +529,10 @@ int FixQEqReaxOMP::CG( double *b, double *x)

#if defined(_OPENMP)
#pragma omp barrier
#pragma omp for schedule(dynamic,50) private(ii) reduction(+:tmp1)
#pragma omp for schedule(dynamic,50) reduction(+:tmp1)
#endif
      for (jj = 0; jj < nn; jj++) {
        ii = ilist[jj];
      for (int jj = 0; jj < nn; jj++) {
        int ii = ilist[jj];
        if (atom->mask[ii] & groupbit) {
          x[ii] += alpha * d[ii];
          r[ii] -= alpha * q[ii];
@@ -552,10 +552,10 @@ int FixQEqReaxOMP::CG( double *b, double *x)
    beta = sig_new / sig_old;

#if defined(_OPENMP)
#pragma omp for schedule(dynamic,50) private(ii)
#pragma omp for schedule(dynamic,50)
#endif
    for (jj = 0; jj < nn; jj++) {
      ii = ilist[jj];
    for (int jj = 0; jj < nn; jj++) {
      int ii = ilist[jj];
      if (atom->mask[ii] & groupbit) d[ii] = p[ii] + beta * d[ii];
    }
  }
@@ -771,7 +771,7 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2)

  double my_buf[4], buf[4];

  int nn, ii, jj;
  int nn;
  int *ilist;
  if (reaxc) {
    nn = reaxc->list->inum;
@@ -791,20 +791,20 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2)
  tmp1 = tmp2 = tmp3 = tmp4 = 0.0;

#if defined(_OPENMP)
#pragma omp parallel for schedule(dynamic,50) private(i) reduction(+:tmp1,tmp2,tmp3,tmp4)
#pragma omp parallel for schedule(dynamic,50) reduction(+:tmp1,tmp2,tmp3,tmp4)
#endif
  for (jj = 0; jj < nn; ++jj) {
    i = ilist[jj];
    if (atom->mask[i] & groupbit) {
      int indxI = 2 * i;
      r[indxI  ] = b1[i] - q[indxI  ];
      r[indxI+1] = b2[i] - q[indxI+1];
  for (int jj = 0; jj < nn; ++jj) {
    int ii = ilist[jj];
    if (atom->mask[ii] & groupbit) {
      int indxI = 2 * ii;
      r[indxI  ] = b1[ii] - q[indxI  ];
      r[indxI+1] = b2[ii] - q[indxI+1];

      d[indxI  ] = r[indxI  ] * Hdia_inv[i]; //pre-condition
      d[indxI+1] = r[indxI+1] * Hdia_inv[i];
      d[indxI  ] = r[indxI  ] * Hdia_inv[ii]; //pre-condition
      d[indxI+1] = r[indxI+1] * Hdia_inv[ii];

      tmp1 += b1[i] * b1[i];
      tmp2 += b2[i] * b2[i];
      tmp1 += b1[ii] * b1[ii];
      tmp2 += b2[ii] * b2[ii];

      tmp3 += r[indxI  ] * d[indxI  ];
      tmp4 += r[indxI+1] * d[indxI+1];
@@ -836,10 +836,10 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2)
    {

#if defined(_OPENMP)
#pragma omp for schedule(dynamic,50) private(ii) reduction(+:tmp1,tmp2)
#pragma omp for schedule(dynamic,50) reduction(+:tmp1,tmp2)
#endif
      for (jj = 0; jj < nn; jj++) {
        ii = ilist[jj];
      for (int jj = 0; jj < nn; jj++) {
        int ii = ilist[jj];
        if (atom->mask[ii] & groupbit) {
          int indxI = 2 * ii;
          tmp1 += d[indxI  ] * q[indxI  ];
@@ -865,10 +865,10 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2)

#if defined(_OPENMP)
#pragma omp barrier
#pragma omp for schedule(dynamic,50) private(ii) reduction(+:tmp1,tmp2)
#pragma omp for schedule(dynamic,50) reduction(+:tmp1,tmp2)
#endif
      for (jj = 0; jj < nn; jj++) {
        ii = ilist[jj];
      for (int jj = 0; jj < nn; jj++) {
        int ii = ilist[jj];
        if (atom->mask[ii] & groupbit) {
          int indxI = 2 * ii;
          x1[ii] += alpha_s * d[indxI  ];
@@ -905,10 +905,10 @@ int FixQEqReaxOMP::dual_CG( double *b1, double *b2, double *x1, double *x2)
    beta_t = sig_new_t / sig_old_t;

#if defined(_OPENMP)
#pragma omp for schedule(dynamic,50) private(ii)
#pragma omp for schedule(dynamic,50)
#endif
    for (jj = 0; jj < nn; jj++) {
      ii = ilist[jj];
    for (int jj = 0; jj < nn; jj++) {
      int ii = ilist[jj];
      if (atom->mask[ii] & groupbit) {
        int indxI = 2 * ii;

+8 −12
Changes for src/USER-OMP/fix_rigid_nh_omp.cpp: 8 added lines, 12 removed lines.
Original line number Diff line number Diff line
@@ -87,12 +87,11 @@ void FixRigidNHOMP::initial_integrate(int vflag)

  // update xcm, vcm, quat, conjqm and angmom
  double akt=0.0, akr=0.0;
  int ibody;

#if defined(_OPENMP)
#pragma omp parallel for default(none) private(ibody) shared(scale_r,scale_t,scale_v) schedule(static) reduction(+:akt,akr)
#pragma omp parallel for default(none) shared(scale_r,scale_t,scale_v) schedule(static) reduction(+:akt,akr)
#endif
  for (ibody = 0; ibody < nbody; ibody++) {
  for (int ibody = 0; ibody < nbody; ibody++) {
    double mbody[3],tbody[3],fquat[4];
    const double dtf2 = dtf * 2.0;

@@ -390,7 +389,6 @@ void FixRigidNHOMP::compute_forces_and_torques()

void FixRigidNHOMP::final_integrate()
{
  int ibody;
  double scale_t[3],scale_r;

  // compute scale variables
@@ -422,9 +420,9 @@ void FixRigidNHOMP::final_integrate()
  const double dtf2 = dtf * 2.0;

#if defined(_OPENMP)
#pragma omp parallel for default(none) private(ibody) shared(scale_t,scale_r) schedule(static) reduction(+:akt,akr)
#pragma omp parallel for default(none) shared(scale_t,scale_r) schedule(static) reduction(+:akt,akr)
#endif
  for (ibody = 0; ibody < nbody; ibody++) {
  for (int ibody = 0; ibody < nbody; ibody++) {
    double mbody[3],tbody[3],fquat[4];

    // update vcm by 1/2 step
@@ -542,11 +540,10 @@ void FixRigidNHOMP::remap()

  if (allremap) domain->x2lamda(nlocal);
  else {
    int i;
#if defined (_OPENMP)
#pragma omp parallel for private(i) default(none) schedule(static)
#pragma omp parallel for default(none) schedule(static)
#endif
    for (i = 0; i < nlocal; i++)
    for (int i = 0; i < nlocal; i++)
      if (mask[i] & dilate_group_bit)
        domain->x2lamda(x[i],x[i]);
  }
@@ -575,11 +572,10 @@ void FixRigidNHOMP::remap()

  if (allremap) domain->lamda2x(nlocal);
  else {
    int i;
#if defined (_OPENMP)
#pragma omp parallel for private(i) default(none) schedule(static)
#pragma omp parallel for default(none) schedule(static)
#endif
    for (i = 0; i < nlocal; i++)
    for (int i = 0; i < nlocal; i++)
      if (mask[i] & dilate_group_bit)
        domain->lamda2x(x[i],x[i]);
  }
Loading