Showing results for 
Search instead for 
Did you mean: 

Unsigned Variable Problem with OpenMP.

We have a library which has abilities on doing multi-precision operations. Our demand is to provide parallelizm on current serial algorithms of our library. Therefore, Intel's OpenMP library is selected for this aim. However some problems occured when we use multi-precision or unsigned integers in the code that we want to parallelize.

We know that OpenMP does not support unsigned variables in loop parallelizations (for loops), the question we want to ask is if this condition is valid all parts of OpenMP library or not, in other words can we put a multi-precision or unsigned operand between the paranthesis of shared or private clauses?

Thanks for your interest...

0 Kudos
2 Replies
Black Belt

Pending a more expert reply, my take would be:

Signed or unsigned of the same storage size would not make a difference to OpenMP, except, as you noticed, for counting loop chunks. Multi-precision operands would have to be recognized as an appropriate sized array object.

Black Belt

You can certainly place arrays in shared and private clauses.

A multi-precision integer (int 64, int 128, int 256, ...) and depending on processor you can perform an interlockedcompare and exchange on up to 16 bytes / 128 bits(see CMPXCHG16B). For anything larger than that you would require mutexes or special wait free programming style.

As long as your library does not use global (static) buffers, and as long as your callers do not assume atomic operations then you should not require special programming considerations.

Jim Dempsey