Ich habe gehört, dass OpenACC if-Anweisung nicht effizient behandelt und sollte versuchen, es zu vermeiden.ist If-Anweisung schlecht für OpenACC?
Zum Beispiel ist es nicht gut (mit ein paar if-Anweisung Schleife) in dem Gerät, so etwas zu tun/OpenACC:
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;
}
}
ist es wahr? Wenn ja, was kann ich tun, um if-Anweisungen in OpenACC zu behandeln?