Is this a bug for icc

Is this a bug for icc

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. 

#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); 
} 

publicaciones de 5 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

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> 

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

#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;
}

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

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

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya