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 http://openmp.org/forum/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
Post Reply
gpone

struct change in parallel section

Post by gpone »

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

Post Reply