- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
If I have a DO loop where the values of array B are assigned to array A in the form:
DO N=N1,N2
A(:,N)=B(:,N)
ENDDO
Will parallelizing it in OpenMP like below work, or do i need to explicitly loop through the first index:
!$OMP PARALLEL DO
!$OMP& PRIVATE(N)
DO N=N1,N2
A(:,N)=B(:,N)
ENDDO
What if, instead of an array B on the right-hand side, it is a scalar?
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your code will work in parallel, even with scalar.
For small arrays you might want to avoid the parallel code. For large arrays, you might want to limit the number of threads to 2-4 as you will soon hit a memory bandwidth situation.
Jim Dempsey
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, Jim.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page