Commit 4f94e7ef authored by David Goz's avatar David Goz 😴
Browse files

hpc_school

parent 0ac85ae2
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -225,9 +225,7 @@ void JacobiAlgorithm(MyData **const restrict Phi,
{
  *error = 0.0;

#pragma omp parallel default(none) shared(error, delta, Phi, Phi0)      \
                                   firstprivate(ibeg, iend, jbeg, jend) \
                                   num_threads(Nthreads)
#pragma omp parallel default(none) /**** MISSING CLAUSES ****/
  {
#if defined(DEBUG)
    const int id  = omp_get_thread_num();
@@ -236,7 +234,9 @@ void JacobiAlgorithm(MyData **const restrict Phi,
    #pragma omp barrier
#endif /* DEBUG */

    #pragma omp for schedule(static)

    /***** MISSING LOOP(s) PARALLELIZATION *****/
    
    for (int j=jbeg ; j<=jend ; j++)
      {
	for (int i=ibeg ; i<=iend ; i++)
+4 −18
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ int main(int argc, char **argv)
     2. Generate grid, allocate memory
     -------------------------------------------------------- */

  /* memory allocation */
  /* memory allocation for I.C. */
  MyData *xg = (MyData *) malloc((NX_GLOB + 2*NGHOST) * sizeof(MyData));
  MyData *yg = (MyData *) malloc((NY_GLOB + 2*NGHOST) * sizeof(MyData));
  assert((xg != NULL) && (yg != NULL));
@@ -136,24 +136,10 @@ int main(int argc, char **argv)
  printf("\n\t NX_GLOB x NY_GLOB = %d x %d\n", NX_GLOB, NY_GLOB);
  printf("\n\t Time = %lf [s]\n\n", seconds() - time_start);

  // free memory
  if (phi0)
    {
      free(phi0[0]);
      free(phi0);
    }

  if (phi)
    {
      free(phi[0]);
      free(phi);
    }

  if (yg)
    free(yg);

  if (xg)
    free(xg);
  /******************** MISSING CODE ********************************/
  /* free memory dynamically allocated                              */
  /******************** MISSING CODE ********************************/
  
  return 0;
}
Loading