gpt4 book ai didi

c++ - 为什么此代码使用 openMP 提供 SIGABRT?

转载 作者:太空宇宙 更新时间:2023-11-04 12:12:05 25 4
gpt4 key购买 nike

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

为什么这段代码不能并行工作?我找不到原因。

回溯输出如下:

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

最佳答案

http://hpc.sourceforge.net/ 下载最后一个 gcc(目前为 4.8) .

OpenMP 的错误已修复

关于c++ - 为什么此代码使用 openMP 提供 SIGABRT?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9351501/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com