Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 7. Using Automatic Parallelizati... > Enforcing Memory Consistency

Enforcing Memory Consistency

Memory consistency is when the values held in registers by a thread match those held in memory. If another thread modifies a variable held in a register by this thread, the value has become inconsistent and needs to be refetched from memory. OpenMP directives already enforce appropriate memory consistency, so it is rare for it to be a concern for codes parallelized using OpenMP. However, there could be situations where it is necessary to manually enforce consistency.

OpenMP allows the developer to explicitly specify the places in the code where variables need to be saved to memory or loaded from memory using the flush directive. Unless the directive specifies a list of variables, it applies to all the thread visible state. If a list of variables is specified, these variables will either be stored to memory or be reloaded from memory depending on which action is necessary.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint