   ! -------------------------------
   ! Intro to Open MP programming
   ! -------------------------------
        PROGRAM Hello 

        INTEGER :: nthreads, myid
	INTEGER, EXTERNAL :: OMP_GET_THREAD_NUM, OMP_GET_NUM_THREADS 


   ! Make the values of nthreads and myid PRIVATE to each thread 

   !$OMP PARALLEL PRIVATE(nthreads, myid)

        !! Every thread does this
        myid = OMP_GET_THREAD_NUM() 
        print *, ' Hello I am thread ', myid

   ! If I am the master node print number of threads 

	!! Only thread 0 does this
        IF (myid == 0) THEN 
          nthreads = OMP_GET_NUM_THREADS() 
          print *, ' Number of threads = ', nthreads 
        end if 

   !$OMP END PARALLEL 
        END 
