Newbie: for loops and object utilization/protection

General OpenMP discussion

Newbie: for loops and object utilization/protection

Postby inte » Sat May 10, 2008 11:49 am

hello.
I'm trying to multithread a for-loop which invokes severeal c++ methodes , which are utilizing distinct c++ objects.
I made the straight-forward-effort using

#pragma omp parallel for

However, when multithreading, I'm running into trouble:

*** set a breakpoint in malloc_error_break to debug
testprog(24480,0xb071b000) malloc: *** error for object 0x182d640: double free
*** set a breakpoint in malloc_error_break to debug
testprog(24480,0xb081f000) malloc: *** error for object 0x183d600: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Segmentation fault
.
.
The calculations done by the methods are independend. Therefore I'm a bit confused _WHY_ the different threads are trying to utilize the same objects. (setting OMP_NUM_THREADS to 1 solves the issue, so it has to be related to threading)
I guess I would have to find a way to let every thread have its own objects.
But how I can I do this?
Most examples I found are about private variables in order to avoid race conditions, but not about objects.
Any help appreciated!
Thanks,
Chris
inte
 
Posts: 1
Joined: Sat May 10, 2008 11:32 am

Return to Using OpenMP

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 7 guests