[Omp] slow performance

Ruud van der Pas Ruud.Vanderpas at Sun.COM
Mon Dec 27 00:44:56 PST 2004


Hi Andrew,

> Second, as pointed out by Alexander Spiegel, I should declare "id" 
> variable as thread private, this really help a lot, although I am still 
> not fully understand that yet, anyway thanks Alex!

As "id" is shared now, multiple threads will access the same cache
line, more or less at the same time. The value of "id" is not only
undefined as a result, but the contention for the same cache line
will cause a performance loss as well. I think the same is true
for variable "pi".

Kind regards,
Ruud
---------------------------------------------------------------------
Senior Staff Engineer                   Email: ruud.vanderpas at sun.com
Scalable Systems Group                  Phone: +31-33-4515000 (x15920)
Sun Microsystems                        Fax  : +31-33-4515001
---------------------------------------------------------------------




More information about the Omp mailing list