struct change in parallel section

Use this forum to discuss the book: Using OpenMP - Portable Shared Memory Parallel Programming, by Barbara Chapman, Gabriele Jost and Ruud van der Pas Read the viewtopic.php?f=8&t=465 for book info and to download the examples. Post your feedback about the book and examples to this forum

struct change in parallel section

Postby gpone » Mon Oct 04, 2010 6:56 am

I have a structure like this:
struct CSGNode
{
int type;
int index;
int parentIndex;
int leftChild,rightChild;
int sphereIndex;
Interval * intervals;
int intervalsCount;
BoundingBox bbox;
};

which stores infos about csg intervals;
I can do in parallel section things like:
definitions:
firstprivate(csgTree)
Interval it;
CSGNode * csgTree
CSGNode el;


content:
csgTree[el.index].sphereIndex = el.sphereIndex;
it.sphereIndex = el.sphereIndex;
int ind = csgTree[el.index].intervalsCount;
csgTree[el.index].intervals[ind] = it;


but cannot do:
csgTree[el.index].intervalsCount++;
because the program crushes while runtime. Can anyone give me a hint why postincrementation on struct element is not possible and program crushes? If I tried to do
csgTree[el.index].intervalsCount = ind +1; it also crushes ! I don't know why. What is going wrong with struct management in open mp?
Thanks in advance,
Greg
gpone
 
Posts: 2
Joined: Mon Oct 04, 2010 6:45 am

Return to Using OpenMP - The Book and Examples

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests