OpenACC は if ステートメントを効率的に処理しないため、使用を避けるようにする必要があると聞きました。
たとえば、デバイス/OpenACC で次のようなことを行う (いくつかの if ステートメントでループする) のは良くありません。
for (m=0; m<polygon2.num_vertices; m++) {
polygon2Vertex1 = listOfpolygon2Vertex[m];
if ((m+1) == polygon2.num_vertices){
// last vertex, so we get last and the first vertex
polygon2Vertex2 = listOfpolygon2Vertex[0];
} else {
// not the last vertex, so we get [m] and [m+1] vertex
polygon2Vertex2 = listOfpolygon2Vertex[m+1];
}
result = doIntersect(polygon1Vertex1, polygon1Vertex2, polygon2Vertex1, polygon2Vertex2);
if (result==1){
// found that these 2 edges intersect.
// no need to further check
break;
}
}
それは本当ですか?もしそうなら、OpenACC で if ステートメントを処理するにはどうすればよいですか?