- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am sorry for asking suck a simple question but I am having hard time to execute simple program using multiple cores. I am using Intel Visual Fortran Compiler 9.1 Professional with Microsoft Visual Studio 2005, and I have Intel Core 2 Duo Processor. Here is the code which I am compiling.
program OpenMP
use omp_lib
implicit none
!$omp parallel
print *, 'Hello World'
!$omp end parallel
call system("PAUSE")
end program OpenMP
But I am all the time getting just one Hello World instead of two. Can anyone tell me what I am doing wrong?
Thanks in advance.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use VS 2003 and Intel Fortran 10.x but I guess this might help:
From the project menu select project Properties, select the Fortran branch, then Language. Here you'll find a line with the name 'Process OpenMP Directives'; I guess that you have not set this to Generate Parallel Code.
Check out the documentation for further detail.
Regards
Mark Westwood
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. I have one more question, what exactly going to happen with shared variables when they step in to parallel region, I mean what value they would have. Because right now during debugging I can see that they have totally different values inside parallel region.
For example:
REAL*8 some_num = 10;
INTEGER other_number = 5;
INTEGER I;
!$omp parallel default(none)&
!$omp shared(some_num, other_number)
!$omp do lastprivate(i) schedule(static, 2)
DO I = 2, 10
some_num = some_num + other_number
other_number = other_number + i
END DO
!$omp end do
!$omp end parallel
NOTE: some_number and other_number are not eq to 5 and 10 inside parallel region why?
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could make the other_number consistent by specifying a reduction, and changing the code so that it is not a SAVEd variable (implied by initializing at declaration).
If you used Qparallel and Qpar-report, instead of OpenMP, you might get some diagnostics (possibly obscure) about what is wrong with attempting to parallelize this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for answering, what will happen if I will do something like this:
DO N=1,10 !$omp parallel default(none)&
!$omp shared(N)
!$omp do lastprivate(L, I, J, K) schedule(static,5)
DO L=2,10
I = N + L !here I and L are shared but not N.
J = 0
DO K=L,10
J = J + 1 !here J is shared would it work fine?. &nbs
p;
END DO
END DO
!$omp end do
!$omp end parallel
END DO
What value would have I and J? is it race condition? And in which case I should use !$omp atomic ?
Thanks in advance.

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