Topic: OpenMP in Simply Fortran
Hi Jeff,
I'm learning OpenMP to parallel my project, mainly in large loops. I've learnt some basics of it and it seems straightforward. But I got problems.
So here's what my code looks like (simplified):
integer:: nz=1000,nb=1000,i,j
real(8):: a(nz,nb),b(nz,nb)
!$OMP PARALLEL DO
do j=1,nb
do i=1,nz
a(i,j)=b(i,j)^2+b(i,j)
end do
end do
!$OMP END PRALLEL DO
With -fopenmp flag under project-fortran compiler, I get the following errors:
D:\SkyDrive\CIES 1995-2007\simulate_fortran/./valuef_prOct4.f90:171: undefined reference to `GOMP_parallel_start'
D:\SkyDrive\CIES 1995-2007\simulate_fortran/./valuef_prOct4.f90:171: undefined reference to `GOMP_parallel_end'
D:\SkyDrive\CIES 1995-2007\simulate_fortran/./valuef_prOct4.f90:216: undefined reference to `GOMP_parallel_start'
D:\SkyDrive\CIES 1995-2007\simulate_fortran/./valuef_prOct4.f90:216: undefined reference to `GOMP_parallel_end'
build\valuef_prOct4.o:D:\SkyDrive\CIES 1995-2007\simulate_fortran/./valuef_prOct4.f90:171: undefined reference to `omp_get_num_threads'
build\valuef_prOct4.o:D:\SkyDrive\CIES 1995-2007\simulate_fortran/./valuef_prOct4.f90:171: undefined reference to `omp_get_thread_num'
build\valuef_prOct4.o:D:\SkyDrive\CIES 1995-2007\simulate_fortran/./valuef_prOct4.f90:216: undefined reference to `omp_get_num_threads'
build\valuef_prOct4.o:D:\SkyDrive\CIES 1995-2007\simulate_fortran/./valuef_prOct4.f90:216: undefined reference to `omp_get_thread_num'
collect2.exe: error: ld returned 1 exit status
Error(E42): Last command making (Project.exe) returned a bad status
Error(E02): Make execution terminated
It seems I need to specify number of threads? But this example neither specifies that. What could be wrong? Thanks a lot!
Best,
Wenya