Remove Locks
In the Source window, you located the synchronization objects that caused significant waits while the processor cores were underutilized . To resolve the issue, do the following:
Open the Code Editor
Note
Depending on the sample code version, your source line numbers may slightly differ from the numbers provided in this tutorial.
Click the Source Editor button to open the
nqueens_parallel.f90
file in your default editor:
Remove Locks
The critical section introduced in line 141 protects the global variable from a race condition in a multithreaded application but it spawns a redundant synchronization. To resolve this issue, you may replace the critical section with an atomic operation as follows:
Parent topic: Finding Hotspots
有关编译器优化的更完整信息,请参阅优化通知。