Demo entry 6350237

advance-velocity-acc

   

Submitted by anonymous on Mar 09, 2017 at 00:07
Language: C. Code size: 870 Bytes.

void advanceVelocity(SimFlat* s, int nBoxes, real_t dt)
{
   int maxTotalAtoms = MAXATOMS * s->boxes->nTotalBoxes;
	int* s_boxes_nAtoms = s->boxes->nAtoms;
   real3* restrict s_atoms_p = s->atoms->p;
   real3* restrict s_atoms_f = s->atoms->f;

//   #pragma omp parallel for
	#pragma acc parallel loop independent gang \
													present(s_boxes_nAtoms[0:nBoxes], \
														s_atoms_p[0:maxTotalAtoms][0:3], \
														s_atoms_f[0:maxTotalAtoms][0:3] \
													) async
   for (int iBox=0; iBox<nBoxes; iBox++)
   {
		#pragma acc loop independent
      for (int ii=0; ii < s_boxes_nAtoms[iBox]; ii++)
      {
      	int iOff=MAXATOMS*iBox + ii;

			#pragma acc loop independent
//			#pragma unroll
      	for(int j=0;j<3;j++) {
				s_atoms_p[iOff][j] += dt*s_atoms_f[iOff][j];
      	}
      }
   }

	#pragma acc wait

}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).