Why is this code giving SIGABRT with openMP?

孤街醉人 提交于 2019-12-11 04:43:59

问题


for (int i = 0; i < x_res; i++){ 
    #pragma omp parallel for
    for (int j = 0; j < y_res; j++) {
        Ray hit = s.kd_tree->intersect(rays[i][j]);
    }
}

Why is this code not working in parallel? I cannot find the reason.

The backtrace outputs this:

#0  0x00007fff8ce03bf2 in __psynch_mutexwait ()
#1  0x00007fff8cd331a1 in pthread_mutex_lock ()
#2  0x00000001000027e4 in gomp_barrier_destroy ()
#3  0x000000010000247b in gomp_team_end ()

回答1:


Download the last gcc (4.8 for now) from http://hpc.sourceforge.net/ .

The bug with OpenMP is fixed there



来源:https://stackoverflow.com/questions/9351501/why-is-this-code-giving-sigabrt-with-openmp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!