Giter Club home page Giter Club logo

Comments (4)

xintin avatar xintin commented on August 13, 2024

We can not have this name. DRB076-flush-orig-no.c already exists. Please change DRB170- name.

@chunhualiao
Can we add -npb- before -no/-yes to all NPB kernels to idenitfy in general?

from dataracebench.

chunhualiao avatar chunhualiao commented on August 13, 2024

from dataracebench.

xintin avatar xintin commented on August 13, 2024

Okay.

from dataracebench.

xintin avatar xintin commented on August 13, 2024

Below is a properly indented version of this program. Whatever nowait and flush are doing, we have already included that nature.

#include <stdio.h>
#include <stdbool.h>
#define ISIZ 12
#define OMEGA_DEFAULT   1.2

static bool flag[ISIZ/2*2+1];
int len = sizeof(flag)/sizeof(flag[0]);


int main(int argh, char* argv[])
{
  int i,j,k,m,ist,iend,jst,jend,nx,ny,nz,iglob,xi,jglob,eta,zeta;
  double omega;
  double v[ISIZ][ISIZ/2*2+1][ISIZ/2*2+1][5];
  omega = OMEGA_DEFAULT;
  nx = ISIZ;
  ny = ISIZ;
  nz = ISIZ;
  ist = 1;
  iend = nx-2;
  jst =1;
  jend = ny -2;

  printf("%d\n",len);
  for (i=0;i<len;i++)printf("%d ",flag[i]);
  printf("\n");

/* inintal value */
  for (i = 0; i < nx; i++) {
    iglob = i;
    xi = ( (double)(iglob) ) / ( nx - 1 );
    for (j = 0; j < ny; j++) {
      jglob = j;
      eta = ( (double)(jglob) ) / ( ny - 1 );
      for (k = 0; k < nz; k++) {
        zeta = ( (double)(k) ) / ( nz - 1 );
        for (m = 0; m < 5; m++) {
            v[i][j][k][m] = xi + eta +  zeta;
        }
      }
    }
  }
    #pragma omp parallel private(k)
    {
      for(k = 1; k <= nz - 2; k++){

        #pragma omp for nowait schedule(static)
        for (i = ist; i <= iend; i++) {
          for (j = jst; j <= jend; j++) {
            for (m = 0; m < 5; m++) {
              v[i][j][k][m] = v[i][j][k][m] - omega * (  v[i][j][k-1][0] + v[i][j][k-1][1] + v[i][j][k-1][2] + v[i][j][k-1][3] + v[i][j][k-1][4]  );
            }
          }
        }

        #pragma omp for nowait schedule(static)
        for (i = ist; i <= iend; i++) {
          if (i != ist) {
            while (flag[i-1] == 0) {
            #pragma omp flush(flag)
            }
          }

          if (i != iend) {
            while (flag[i] == 1) {
            #pragma omp flush(flag)
            }
          }

         for (j = jst; j<= jend; j++) {
           for (m = 0; m < 5; m++) {
             v[i][j][k][m] = v[i][j][k][m] - omega * ( v[i][j-1][k][0] + v[i][j-1][k][1] + v[i-1][j][k][1] + v[i][j-1][k][2] + v[i-1][j][k][3] + v[i-1][j][k][4] );
           }
           v[i][j][k][1] = v[i][j][k][1] - v[i][j][k][0];
         }

         if (i != ist) flag[i-1] = 0;
         if (i != iend) flag[i] = 1;
         #pragma omp flush(flag)
       }
     }
  }

  for (i=0;i<len;i++)printf("%d ",flag[i]);
  printf("\n");
  return 0;
}

from dataracebench.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.