Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61269047
private.cc
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, May 5, 14:43
Size
527 B
Mime Type
text/x-c
Expires
Tue, May 7, 14:43 (2 d)
Engine
blob
Format
Raw Data
Handle
17488051
Attached To
R11897 phys-743-lecture-codes
private.cc
View Options
#include <iostream>
#include <omp.h>
int
main
()
{
int
a
=
1
,
b
=
2
;
double
c
=
3.
;
std
::
printf
(
"Thread %i sees, a, b, c: %i, %i, %g (before)
\n
"
,
omp_get_thread_num
(),
a
,
b
,
c
);
#pragma omp parallel num_threads(3), private(a), firstprivate(b)
{
std
::
printf
(
"Thread %i sees, a, b, c: %i, %i, %g (inside)
\n
"
,
omp_get_thread_num
(),
a
,
b
,
c
);
c
=
-
1e-3
;
}
std
::
printf
(
"Thread %i sees, a, b, c: %i, %i, %g (after)
\n
"
,
omp_get_thread_num
(),
a
,
b
,
c
);
return
0
;
}
Event Timeline
Log In to Comment