- #1
JoAuSc
- 198
- 1
I'm trying to get a fortran 77 program to run faster on a computer with a dual-core processer, so I'm trying to learn how OpenMP works. Unfortunately, I can't get the "hello world" file on the wikipedia page to compile.
(Here's the code:
I'm using G77 as a compiler. I think I'm supposed to compile it as
I get the following error:
I don't think the problem's that g77 doesn't accept openmp, because if I have
without the filename, it has a different error message than replacing "-openmp" with "-gdfgs" or something, specifically,
rather than
Could someone who knows something about g77 or openMP help me?
(Here's the code:
Code:
PROGRAM HELLO
INTEGER ID, NTHRDS
INTEGER OMP_GET_THREAD_NUM, OMP_GET_NUM_THREADS
!$OMP PARALLEL PRIVATE(ID)
ID = OMP_GET_THREAD_NUM()
PRINT *, 'HELLO WORLD FROM THREAD', ID
!$OMP BARRIER
IF ( ID .EQ. 0 ) THEN
NTHRDS = OMP_GET_NUM_THREADS()
PRINT *, 'THERE ARE', NTHRDS, 'THREADS'
END IF
!$OMP END PARALLEL
END
I'm using G77 as a compiler. I think I'm supposed to compile it as
Code:
...> g77 HelloWorld.f -openmp
I get the following error:
Code:
/tmp/cc2XahMo.o(.text+0xe): In function 'MAIN__':
: undefined reference to 'omp_get_thread_num__'
/tmp/cc2XahMo.o(.text+0x75): In function 'MAIN__':
: undefined reference to 'omp_get_num_threads__'
collect2: ld returned 1 exit status
I don't think the problem's that g77 doesn't accept openmp, because if I have
Code:
...> g77 -openmp
without the filename, it has a different error message than replacing "-openmp" with "-gdfgs" or something, specifically,
Code:
g77: no input files; unwilling to write output files
Code:
g77: no input files
Could someone who knows something about g77 or openMP help me?