Professional Documents
Culture Documents
Неудачная попытка сравнить PVS-Studio (VivaMP) и Intel C/C++ ("Parallel Lint")
Неудачная попытка сравнить PVS-Studio (VivaMP) и Intel C/C++ ("Parallel Lint")
: : 07.10.2009
" Studio (VivaMP) Intel C/C++ Compiler ("Parallel Lint"). "Parallel Lint" . . . .
PVS , ,
PVS-Studio (VivaMP) , OpenMP , VivaMP Visual Studio 2005/2008 [1]. Intel C/C++ Compiler ("Parallel Lint") , Intel C/C++ "Parallel Lint" Intel C/C++ "Parallel Lint" Visual Studio 2005/2008. Lint" , Compiler ("Parallel Lint" overview)". . ,
/ ++ OpenMP.
. PVS-Studio
11.1. ,
OpenMP Intel C/C++ Intel C/C++. "Parallel "Static Analysis and Intel C/C++
ParallelSample, OpenMP.
, ,
ParallelSample Lint"
Intel C/C++ Compiler . , MKL, TBB, , IA64 , .
11.1.038 , , , ParallelSample.
ParallelSample . "Catastrophic error: unable to obtain mapped memory (see pch_diag.txt)", N1.
N1.
pch_diag.txt
, ( .
N2.
N3).
N3. ,
ParallelSample.
DLL. "C++ Build Environment for applications running on IA-32" "C++ Build Environment for applications running on Intel(R) 64", " ", N4.
ParallelSample
. , . " "
Intel C++ "Parallel Lint" , Intel C++ "Parallel Lint". EXE. , ( N5. ).
. "Parallel Lint" -
N5.
. )
, (cpp-
),
(cppN6.
N7.
N8-N10:
N8.
Configuration Manager.
N9. .
N11.
"Diagnostics" Lint".
"Parallel
N12.
. N13). ParallelSample
N13.
, . . , 23 VivaMP. VivaMP 6 . . Intel C++) PVS-Studio) 5 , OpenMP , ("Parallel Lint"). 1. 2. , ParallelSample. , VivaMP , : "32 ++" [2] OpenMP 3. , OpenMP [3]. Intel C++ ("Parallel Lint") Intel C++. . Intel C++ Parallel Lint. , Parallel Lint. 23 . . , , - 2. parallel_lint, . . , OpenMP. , Intel C++ 5 . ,
parallel_lint ( ParallelSample ( ,
VivaMP.
. . ,
Presently, there's no such list in our current product release, other than what's presented in the compiler documentation under Parallel Lint section. But, we are developing description and examples for all messages, planned as of now for our next major release. Will keep you updated as soon as the release containing such a list is out. Appreciate your patience till then. . . . . . . Intel C++ , "Parallel Lint" , "Parallel Lint" , , , , .
, . : 1. 2. , ParallelSample. , ++" "OpenMP 3. parallel_lint, . N1 Lint". , Lint"). OpenMP . VivaMP , Intel C++ ("Parallel Lint") , , ,
. , 500 VivaMP.
N1.
PVS -Studio
, 1.
, :
#pragma omp for for(int i = 0; i < 100; i++) { ... }
N1
parallel
parallel. . ,
. ,
#pragma omp parallel { #pragma omp for for(int i = 0; i < 100; i++) ... }
"for" "parallel",
"parallel" "sections"
, :
"for",
2.
, ( . :
omp
omp. Parallel Lint), .
#pragma single
3.
, . .
for
"for", , :
4.
, , . , . :
#pragma omp parallel for for(int i = 0; i < 100; i++) { #pragma omp parallel for for(int j = 0; j < 100; j++) ... }
5.
order
for "for" "ordered", "ordered". :
V1005.
6.
OpenMP, . OpenMP, Visual C++. , . PVS-Studio "Pedantic Mode". , . C++. , . Visual C++. N14. #include <omp.h> <omp.h> "#pragma omp parallel for" ,
<omp.h>
vcomp.lib/vcompd.lib. , omp.h. , .
. , parallel_lint, Intel
N14.
Visual C++
Intel C++,
7. omp_set_num_threads
omp_set_num_threads "parallel". ++ .
#pragma omp parallel { omp_set_num_threads(2); }
8.
omp_unset_lock omp_unset_nest_lock
#pragma omp parallel sections { #pragma omp section { omp_set_lock(&my Lock); } }
omp_set_lock, omp_set_nest_lock, . :
9. omp_get_num_threads
. omp_get_num_threads :
, .
omp_get_num_threads "32
, . OpenMP
4,
++" PVS-Studio. ,
Parallel Sample,
omp_get_num_threads, PVS-Studio:
bool b = omp_get_num_threads() == 2;
10. omp_set_nested
omp_set_nested "parallel".
#pragma omp parallel { omp_set_nested(2); }
omp_set_nested "single",
#pragma omp parallel { #pragma omp master { omp_set_nested(2); } }
, :
"master"
11.
, . : : printf, OpenGL.
,
#pragma omp parallel { #pragma omp critical { printf("abcd"); } }
: PVS-Studio (VivaMP): Intel C++ (Parallel Lint): , VivaMP , . Parallel Lint , , , . V1201. error #12158. : .
12. flush
flush flush , :
int *t; ... #pragma omp flush(t)
, , , . flush , . . OpenMP ,
. , ,
13.
threadprivate . OpenMP :
threadprivate
, threadprivate ++" [2]. . "32
14.
.
.
. :
:
#pragma omp parallel num_threads(2) { #pragma omp critical { static int cachedResult = ComputeSomethingSlowly(); ... } }
warning #12246.
15.
. .
int a = 0;
.
, :
#pragma omp parallel for num_threads(4) for (int i = 0; i < 100000; i++) { a++; }
:
int a = 0; #pragma omp parallel for num_threads(4) for (int i = 0; i < 100000; i++) { #pragma omp atomic a++; }
: PVS-Studio (VivaMP): Intel C++ (Parallel Lint): V1204. warning #12246, warning #12247, warning #12248.
16.
. ,
int i; int factorial[10]; factorial[0]=1; #pragma omp parallel for for (i=1; i < 10; i++) {
.
. :
17.
. . .
.
,
. :
void dangerousFunction(int& param); void dangerousFunction2(int* param); int a = 0; #pragma omp parallel num_threads(4) { #pragma omp for for (int i = 0; i < 100000; i++) { dangerousFunction(a); dangerousFunction2(&a); } }
18.
. .
.
. :
MyClass obj;
#pragma omp parallel for num_threa ds(2) for (int i = 0; i < 100000; i++) { obj.nonConstMethod(); }
19.
"private", "firstprivate" "threadprivate" ( :
int *arr; #pragma omp parallel for private(arr)
).
, . . ,
int arr[4]; #pragma omp parallel for private(arr)
, ,
20.
lastprivate , , :
#pragma omp sections lastprivate(a) { #pragma omp section
lastprivate
. , , .
21.
( lastprivate, firstprivate. flush . :
int a = 1;
flush.
flush ), threadprivate, private,
, .
#pragma omp parallel for private(a) for (int i = 10; i < 100; ++i) { #pragma omp flush(a); ... }
22.
. :
y
flush.
"flush" , "flush" ,
flush
barrier;
y y y y y y y y
critical; ordered; parallel; for; sections; single; parallel for; parallel sections; :
. .
23.
. , :
try {
.
OpenMP,
throw
, .
#pragma omp parallel for num_threads(4) for(int i = 0; i < 4; i++) { throw 1; } } catch (...) { }
:
size_t errCount = 0; #pragma omp parallel for num_threads(4) reduction(+: errCount) for(int i = 0; i < 4; i++) { try {
24.
. "new"
.
OpenMP,
new
, .
:
try { #pragma omp parallel for num_threads(4) for(int i = 0; i < 4; i++) { float *ptr = new (MyPlacement) float[1000]; delete [] ptr; } } catch (std::bad_alloc &) { }
V1302.
25.
. , :
.
OpenMP, , .
void MyThrowFoo() throw(...) { throw 1; } try { #pragma omp parallel for num_threads(4) for(int i = 0; i < 4; i++) { MyThrowFoo(); } } catch (...) { }
26.
. omp_init_lock
omp_lock_t / omp_nest_lock_t omp_init_lock / omp_init_nest_lock. omp_set_lock . :
omp_lock_t myLock;
27.
.
, "private" "lastprivate" . :
28.
, "private", "threadprivate" . :
#pragma omp parallel private(a) { ... } b = a;
"firstprivate".
: PVS-Studio (VivaMP): Intel C++ (Parallel Lint): . error #12352, error #12358.
29.
, : PVS-Studio (VivaMP): Intel C++ (Parallel Lint): . . "firstprivate" "lastprivate" .
30.
omp_set_lock, , . OpenMP,
y y y y y
"atomic". , . :
atomic , ,
x binop= expr x++ ++x x---x , expr , binop atomic , ( , +, *, -, /, &, ^, |, <<,
>>. ).
: PVS-Studio (VivaMP): .
31.
, , , . : ( threadprivate, firstprivate, private lastprivate); , ( , "p" master : single). . , ,
#pragma omp parallel for private(p) for (i=1; i<10; i++) { #pragma omp critical p = 0; ... }
32.
reduction
reduction, . ,
, . ,
abcde:
#pragma omp parallel for reduction (+:sum, abcde) for (i=1; i<999; i++) { sum = sum + a[i];
, OpenMP . , . PVS-Studio (VivaMP) Intel C/C++ ("Parallel Lint") . , . : Intel C/C++ ("Parallel Lint"):
y
, Intel C/C++, ;
,
y
; Intel C++
. PVS-Studio (VivaMP):
y y y
, , , ,
y y
; ,
1.
. 1796251700.html
PVS-Studio. http://www.viva64.com/art-4-1-
2.