Access same function in parallel

General OpenMP discussion

Access same function in parallel

Postby open_coder » Mon Jan 14, 2019 3:56 am

Is it possible to access Same function in parallel for different data with thread safe ?
For example, I want to run Dijkstra algorithm in parallel for common source but different destination using same function.
Posts: 9
Joined: Mon Oct 29, 2018 9:42 pm

Re: Access same function in parallel

Postby MarkB » Wed Jan 16, 2019 7:29 am

Yes, it is possible, but not guaranteed! You have to ensure that there are no race conditions (where more than one thread accesses the same memory location, and at least one access is a write), and be aware that race conditions may occur on implicitly shared data (such as global variables or static local variables) accessed inside the function.
Posts: 771
Joined: Thu Jan 08, 2009 10:12 am
Location: EPCC, University of Edinburgh

Return to Using OpenMP

Who is online

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