Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

about OMP_set_num_threads()

stydofe1
Beginner
272 Views

I am using Intel composer XE 2011.I have some simple codes as below to test the function OMP_set_num_threads, the program freezes once entering the parallel region.

call OMP_set_num_threads(4)

!$omp parallel

print *, 'hello parallel'

!$omp end parallel



It works fine if I use clause instead.

!$omp parallel num_threads(4)

print *, 'hello parallel'

!$omp end parallel


What am I missing in using the routine OMP_set_num_threads?

0 Kudos
2 Replies
Steven_L_Intel1
Employee
272 Views
0 Kudos
jimdempseyatthecove
Honored Contributor III
272 Views
Did you include

USE OMP_LIB

Are you using IMPLICIT NONE?

If you are not using IMPLICIT NONE the compiler will not report that you may have forgotten to have USE OMP_LIB to declare the proper interface for OMP_set_num_threads (which are not necessarily what the default calling sequence is).

Jim Dempsey
0 Kudos
Reply