Software Archive
Read-only legacy content
17061 Discussions

Is this a bug for icc

Wei_Pan
Beginner
864 Views

The following program causes a runtime crash reducer_impl.cpp:527: cilk assertion failed: h

My compiler is icc 13.1.1 on Ubuntu 12.04. 

[cpp]
#include <cilk/reducer.h>
#include <cilk/reducer_opadd.h> 
#include <cilk/cilk.h> 
#include void empty() {} 
std::atomic n; 
int test(int *x) { 
  cilk::reducer_opadd r; 
  n = 40000; 
  while (n--) { 
    cilk_spawn empty(); 
  } 
  return 0;

int main() {
  int x = 1;
  return test(&x);
}
[/cpp]

0 Kudos
4 Replies
Wei_Pan
Beginner
864 Views

There are some missing pieces due to the formating
std::atomic should be std::atmoic<unsigned>

and


cilk::reducer_opadd should be cilk::reducer_opadd<unsigned> 

0 Kudos
ARCH_R_Intel
Employee
864 Views

Thanks for reporting this bug.  I was able to reproduce the problem even without using an atomic variable (see below)   I'll forward it to the right folk.  

- Arch

[cpp]

#include <cilk/reducer_opadd.h>

#include <cilk/cilk.h>

void empty() {}

int main() {
  cilk::reducer_opadd<unsigned> r;
  int n = 40000;
  while (n--) {
    cilk_spawn empty();
  }
  return 0;
}

[/cpp]

0 Kudos
ARCH_R_Intel
Employee
864 Views

A work-around for now is to insert a cilk_sync right before the destructor for r runs.  

0 Kudos
Wei_Pan
Beginner
864 Views

Thanks! I was not sure if there is a limit on the number of spawns and confirms this is a bug or not.

0 Kudos
Reply