Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

OpenMP and MPI with Intel Fortran

Elsayed_A_
Beginner
365 Views

Does Intel Fortran student version has OpenMP and MPI?

I am new to parallel programming. I got this error when I run the following code.

------------------------------------------------------------------------------------------------------------------

1>Console1.obj : error LNK2019: unresolved external symbol _OMP_GET_THREAD_NUM referenced in function _MAIN__
1>Console1.obj : error LNK2019: unresolved external symbol _OMP_GET_NUM_THREADS referenced in function _MAIN__
1>Debug\Console1.exe : fatal error LNK1120: 2 unresolved externals

-----------------------------------------------------------------------------------------------------------------

PROGRAM HELLO
    INTEGER NTHREADS, TID, OMP_GET_NUM_THREADS, OMP_GET_THREAD_NUM
! FORKA TEAM OF THREADS WITH EACH THREAD HAVING A PRIVATE TID VARIABLE
!$OMP PARALLEL PRIVATE(TID)

    ! OBTAIN AND PRINT THREAD ID
      TID = OMP_GET_THREAD_NUM()
      PRINT*, 'HELLO TO WORLD FROM THREAD = ', TID
      
    ! ONLY MASTER THREAD DOES THIS 
      IF(TID .EQ. 0) THEN
          NTHREADS = OMP_GET_NUM_THREADS()
          PRINT*, 'NUMBER OF THREADS = ', NTHREADS
      END IF
      
    ! ALL THREADS JOIN MASTER THREAD AND DISBAND
!$OMP END PARALLEL
END PROGRAM HELLO

0 Kudos
1 Reply
TimP
Honored Contributor III
365 Views

If you wish the option to make a non openmp build by omitting -Qopenmp, the standard method involves -fpp with #if _OPENMP conditional compilation.

0 Kudos
Reply