Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102751058
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, Feb 23, 19:49
Size
527 B
Mime Type
text/x-c
Expires
Tue, Feb 25, 19:49 (2 d)
Engine
blob
Format
Raw Data
Handle
24413963
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