Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
23 Views

Threads counter

Dear All,

I'm learning OpenMP. I wrote a basic program (attached below), to display threads number. As I have a Core 2 Duo, I was expecting to see in the output window.

Thread number : , 1

Thread number : , 2

But I can se only

Thread number : , 1

It means that my application can see only one thread! Do someone no why? Of course I have use /Qparallel mode

Best regards,

Didace


program test_parallel

use omp_lib

!$OMP PARALLEL DEFAULT(SHARED)

write(*,*)
write(*,'(17h Thread number : ,i1)') 1 + OMP_GET_THREAD_NUM()
write(*,*)

!$OMP END PARALLEL

end program test_parallel
0 Kudos
3 Replies
Highlighted
23 Views

Quoting - ekeom
It means that my application can see only one thread! Do someone no why? Of course I have use /Qparallel mode

Hi!

To me, your program looks OK. The problem should be the /Qparallel switch you've used to compile your code. /Qparallel only enables parallel code generation, but not OpenMP compilation. You should use /Qopenmp to turn on OpenMP support. Then, your code should print the expected results.

Cheers,
-michael

0 Kudos
Highlighted
Beginner
23 Views


Hi!

To me, your program looks OK. The problem should be the /Qparallel switch you've used to compile your code. /Qparallel only enables parallel code generation, but not OpenMP compilation. You should use /Qopenmp to turn on OpenMP support. Then, your code should print the expected results.

Cheers,
-michael

Hello Michael,

Thank you for your answer. You are propbably right, I have a quick look on the on line help. Yes I should use /Qopenmp. But I don't know where I can find it, with Visual Studio graphical inteface.

Best regards,

Didace
0 Kudos
Highlighted
Beginner
23 Views


Hi!

To me, your program looks OK. The problem should be the /Qparallel switch you've used to compile your code. /Qparallel only enables parallel code generation, but not OpenMP compilation. You should use /Qopenmp to turn on OpenMP support. Then, your code should print the expected results.

Cheers,
-michael

Hello Michael,

It me again. I have found how to active /Qopenmp.

Best regrads,

Didace
0 Kudos