- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Considering
real A(10000), B(10000)
If A and B are on host (CPU), copying A to B is easy:
B=A
What if A and B are on device (GPU) ? Code below is not neat enough:
!$OMP TARGET DEFAULTMAP(present: aggregate)
!$OMP TEAMS DISTRIBUTE PARALLEL DO
do i=1,10000
B(i)=A(i)
enddo
!$OMP END TARGET
Is there any neat expression?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OpenMP doesn't recognize Fortran array expressions as loopnests, to allow them under OMP DO directives.
What you have here is about the "neatest" idiom you can use.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OpenMP doesn't recognize Fortran array expressions as loopnests, to allow them under OMP DO directives.
What you have here is about the "neatest" idiom you can use.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>OpenMP doesn't recognize Fortran array expressions as loopnests,
This should be fixable. IOW the language features supported on the host should be available on the target.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm no expert on OpenMP but
!#OMP PARALLEL WORKSHARE
B=A
!$OMP END PARALLEL WORKSHARE
works on my tests and runs faster than
!$OMP PARALLEL DO
DO I=1,N
B(I)=A(I)
END DO
!OMP END PARALLEL DO.
If you have a whole bunch of them with no serial bits between then wrapping the whole lot in a !$OMP PARALLEL/END PARALLEL and then just using !$OMP WORKSHARE/END WORKSHARE or !$OMP DO/END DO gives a nano second or two of speed up, presumably because of the OMP setup overhead.
Please tell me if it is unsafe as I've just spent half a day adding a few hundred of them to implied do array assignments in my code.
Cheers
Kim

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page