Giter Club home page Giter Club logo

Comments (3)

xintin avatar xintin commented on August 13, 2024

I have renamed the file name from DRB173-threadprivate-orig-no.c to DRB173-threadprivate3-orig-no.c. We already have DRB085-threadprivate-orig-no.c with the same name and DRB091-threadprivate2-orig-no.c. You might like to do this once you are done with Big table result and create a new PR.

from dataracebench.

xintin avatar xintin commented on August 13, 2024

As per my understanding of the code, I have simplified as below. There are a few questions, @chunhualiao please comment if my understanding is correct. x is a Threadprivate. That said, if we are using private(i,j,k), it will always result in j and k value as 0. The x[0] = -1.0 only for tid=0. For the rest of the tids it will be 0.0. The final j, k-values are quite indeterministic here. And more of it, it is not a correct execution.

//sample simplification to test - not correct

#include <omp.h>
#include <stdio.h>

static double x[20];
#pragma omp threadprivate(x)

int main(){
  int i;
  double j,k;

  #pragma omp parallel for default(shared) private(i,j,k)
  for (i = 0; i < 20; i++){
    x[i] = -1.0;
    j = x[0];
    k = i+0.05;
  }
  printf ("%f %f\n", j, k);

  return 0;
}

To have a data race free code, we can have something like below:

#include <omp.h>
#include <stdio.h>

static double x[20];
#pragma omp threadprivate(x)

int main(){
  int i;
  double j,k;

  #pragma omp parallel for default(shared)
  for (i = 0; i < 20; i++){
    x[i] = -1.0;
    if(omp_get_thread_num()==0){
      j = x[0];
    }
    if(omp_get_thread_num()==0){
      k = i+0.05;
    }
  }

  printf ("%f %f\n", j, k);

  return 0;
}

Please share your thoughts. or else can use copyprivate, but that we already have; one such kernel.

from dataracebench.

chunhualiao avatar chunhualiao commented on August 13, 2024

We need @Yaying-llnl-summer to write down in the comment area about which variables in the benchmarks are exposing the tools' problems. Based on the information, we can then remove unnecessary variables.

@Yaying-llnl-summer The tests you are adding need

  1. better commenting

  2. removing unnecessary variables and statements

  3. justification about the new ones are not just duplicating existing programs. The new ones exposing tools' new problems.

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.