Calculate the histogram with OpenMP

前端 未结 3 723
礼貌的吻别
礼貌的吻别 2020-12-20 03:56

I want to parallelize this code getting the best performance. \"histogram\" stores number of appareances of a certain colour (there are 10 different colours, so the size of

3条回答
  •  天命终不由人
    2020-12-20 04:50

    With OpenMP 4.5, you can simply use a array reduction in C:

    int histogram[BINS] = {0};
    #pragma omp parallel for reduction(+:hist)
    for(i=0; i

提交回复
热议问题