- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have three questions for OpenMP
- 1st question:
!$OMP PARALLEL DO
do=1, 20
:
end do
!$OMP END PARALLEL DO
----- after making f90 codeI put into the this line "export OMP_NUM_THREADS=4"
or put into "CALL OMP_SET_NUM_THREADS(4)"in f90 code. That's it..
Is it corrected or not?
- 2ndquestion:
Is it impossibe to make parellel programmingwithout do-loop?
do nz=1,nnm
!$OMP PARALLEL DO
read(1) nn
read(1) (((x(ln(i,j,k,n,nz)),i=1,img(n,nz)),j=1,jmg(n,nz)),k=1,kmg(n,nz))
read(1) (((yl(ln(i,j,k,n,nz)),i=1,img(n,nz)),j=1,jmg(n,nz)),k=1,kmg(n,nz))
!$OMP END PARALLEL DO
end do
- 3rd question:
Before do-loop,if there is if-loop, it make error message? Is it impossible?
However, if the order of directive and if-loopis exchanged,it is OK...
Is therethe othermethod?
!$OMP PARALLEL DO
if(i>= 21) then
do i=1, 20
:
end do
end if
!$OMP END PARALLEL DO
- 1st question:
!$OMP PARALLEL DO
do=1, 20
:
end do
!$OMP END PARALLEL DO
----- after making f90 codeI put into the this line "export OMP_NUM_THREADS=4"
or put into "CALL OMP_SET_NUM_THREADS(4)"in f90 code. That's it..
Is it corrected or not?
- 2ndquestion:
Is it impossibe to make parellel programmingwithout do-loop?
do nz=1,nnm
!$OMP PARALLEL DO
read(1) nn
read(1) (((x(ln(i,j,k,n,nz)),i=1,img(n,nz)),j=1,jmg(n,nz)),k=1,kmg(n,nz))
read(1) (((yl(ln(i,j,k,n,nz)),i=1,img(n,nz)),j=1,jmg(n,nz)),k=1,kmg(n,nz))
!$OMP END PARALLEL DO
end do
- 3rd question:
Before do-loop,if there is if-loop, it make error message? Is it impossible?
However, if the order of directive and if-loopis exchanged,it is OK...
Is therethe othermethod?
!$OMP PARALLEL DO
if(i>= 21) then
do i=1, 20
:
end do
end if
!$OMP END PARALLEL DO
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is no use for an END PARALLEL DO combination directive. OMP DO ends automatically at the closure of the DO loop. It works only with a DO loop, not even with a FOR loop. If you have OMP DO inside OMP PARALLEL, then you need OMP END PARALLEL for Fortran, unlike C where the parallel region is set off by {} (and so is not easily distinguished from non-OMP usage).
PARALLEL WORKSHARE , parallel sections, and tasks are available for appropriate usage. It wouldn't normally make sense to put a parallel region which doesn't use OMP DO inside a DO loop. WORKSHARE is over rated by some of those who advocate it.
You might do well to consult a textbook, but there are plenty of examples and tutorials on line as well. Amazingly enough, you can believe much of what you read on this topic.
PARALLEL WORKSHARE , parallel sections, and tasks are available for appropriate usage. It wouldn't normally make sense to put a parallel region which doesn't use OMP DO inside a DO loop. WORKSHARE is over rated by some of those who advocate it.
You might do well to consult a textbook, but there are plenty of examples and tutorials on line as well. Amazingly enough, you can believe much of what you read on this topic.
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