I am using omp with visual studio 2019 and c++. But it keeps giving me the hint "C6993: code analysis ignores OpenMP". Does that mean omp will run the program in a single thread? Why? Following is the code. I have measured the time before and after I add omp, it does seems to run in parallel, then why it gives me the c6993 hint?
#pragma omp parallel for
for (int i = 0; i < nodeCount; i++)
{
if (masses[i] != 0)
{
predictPositions[i].x() += deltaX[i * 6];
predictPositions[i].y() += deltaX[i * 6 + 1];
predictPositions[i].z() += deltaX[i * 6 + 2];
}
}
Microsoft describes this warning as follows:
This warning indicates that the Code Analyzer has encountered Open MP pragmas that it cannot analyze.
At least as I read it, this means the code should still run in parallel, but the Code Analyzer (a sort-of separate thing) doesn't understand the OpenMP pragmas, so it isn't sure how to analyze the code.
I'd guess is that analyzes it as if it were purely single-threaded (or maybe it simply doesn't analyze that block of code--the description doesn't really tell us enough to be sure). If memory serves, with some of the older versions it used to say something about single threaded, which I took to mean it analyzed the code as if it were single threaded, and the warning was just telling you that it's aware there's threading going on, but it's not going to take that into account in analyzing the code (and I'd guess that's how it still works).
Given the pragma you're showing (about as simple and common as OpenMP pragmas get), it looks like this probably applies to essentially all code that uses OpenMP at all (though I guess it could still work with the OpenMP 4 SIMD directives).
https://learn.microsoft.com/en-us/cpp/code-quality/c6993?view=vs-2019