Skip to content

Commit

Permalink
[test/cilksan] Port tests to use new reducer implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
neboat committed Jul 7, 2022
1 parent 2839f7a commit b4abed1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions test/cilksan/TestCases/reducer-lock-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

#include <stdio.h>
#include <cilk/cilk.h>
#include <cilk/reducer_opadd.h>
#include <cilk/opadd_reducer.h>
#include <chrono>
#include <thread>
#include <pthread.h>

int main() {
cilk::reducer_opadd<int> sum;
cilk::opadd_reducer<int> sum;
int rsum = 0;
int lsum = 0;
pthread_mutex_t mtex;
Expand All @@ -22,8 +22,8 @@ int main() {
lsum += i;
pthread_mutex_unlock(&mtex);
}
printf("%p\n%p\n%p\n",(void*)&(sum.get_value()),(void*)&rsum,(void*)&lsum);
printf("%d\n%d\n%d\n",sum.get_value(),rsum,lsum);
printf("%p\n%p\n%p\n",(void*)&(sum),(void*)&rsum,(void*)&lsum);
printf("%d\n%d\n%d\n",sum,rsum,lsum);
}

// CHECK: Race detected on location [[RSUM:[0-9a-f]+]]
Expand Down
8 changes: 4 additions & 4 deletions test/cilksan/TestCases/sum-ints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <type_traits>
#include <random>

#include <cilk/reducer_opadd.h>
#include <cilk/opadd_reducer.h>
#include <cilk/cilk_api.h>

#include <cilk/cilksan.h>
Expand Down Expand Up @@ -320,11 +320,11 @@ sum_t accum_spawn (num_t n) {
*/
sum_t accum_reducer (num_t n) {

cilk::reducer_opadd<sum_t> sum(0);
cilk::opadd_reducer<sum_t> sum(0);
cilk_for (num_t i = 0; i < n; i++)
*sum += i;
sum += i;

return sum.get_value();
return sum;

}

Expand Down
8 changes: 4 additions & 4 deletions test/cilksan/TestCases/sum-vector-int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#include <random>
#include <unistd.h>

#include <cilk/reducer_opadd.h>
#include <cilk/opadd_reducer.h>

#ifdef WLS
#include <cilk/cilk_api.h>
Expand Down Expand Up @@ -361,11 +361,11 @@ sum_t accum_spawn (num_vec_t const & vals) {
*/
sum_t accum_reducer (num_vec_t const & vals) {

cilk::reducer_opadd<sum_t> sum(0);
cilk::opadd_reducer<sum_t> sum(0);
cilk_for (auto i = 0; i < vals.size(); i++)
*sum += vals[i];
sum += vals[i];

return sum.get_value();
return sum;

}

Expand Down

0 comments on commit b4abed1

Please sign in to comment.