Hi All,
Question on OpenMP for multi-threaded code:
Are all global variables shared by the threads? How does one make certain global variable private to master thread?
Thanks
PS: It is a C code.
Hi All,
Question on OpenMP for multi-threaded code:
Are all global variables shared by the threads? How does one make certain global variable private to master thread?
Thanks
PS: It is a C code.
if i recall correctly
#pragma omp threadprivate
global variables are a bit tricky, if they has to be initialized, you have to use copyfirst directive (i think that is correct name). also threadprivate variables may carry a significant penalty, on some implementations variable access becomes a function call.