Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

Are Pure Subroutine Locals Safe

mattsdad
Beginner
110 Views

I have a very large amount of code in a multi-body simulator that I have made parallel. All the subroutines in the parallel section are pure, and all the data passed into the top level of this section iscleanly divided by body. So each entry into the per bodypropagation is split off into a parallel task by an OMP Parallel Do statement.

My concern is will the local data in the pure subroutines ever "cross wires" due to parallel read-modify-write?

Do I need to use mutexes or critical sections in the pure subroutines?

0 Kudos
3 Replies
TimP
Black Belt
110 Views
It doesn't sound like you have a problem, if you have enabled these data to be thread local. You might want to try Intel Thread Checker.
allyn_shell
Beginner
110 Views
Does thread local mean that every subroutine must have all of its local data specified as a thread variable?
mattsdad
Beginner
110 Views

tim18:
if you have enabled these data to be thread local

Does that apply to every variable in every subroutine individually?

Reply