Simple parallel example with gfortran

General OpenMP discussion

Simple parallel example with gfortran

Postby Yuri » Sun Nov 04, 2012 8:18 am

HI all,

I've the gfortran installed with MinGW compiler suit, I also use the CodeBlocks for convenience and it's configured to work with gfortran properly. If I don't use any OpenMP compiler directives then everything is normal and program works and executes flawlessly. But if I try to add code snippet as :
Code: Select all
Program Fortran_test
integer::test_int
print * , " Hello World"

!!$OMP PARALLEL
!test_int = omp_get_num_procs()
!!$OMP END PARALLEL

print *,test_int
end program


||=== FORTRAN_TEST, Debug ===|
|7|undefined reference to `GOMP_parallel_start'|
|7|undefined reference to `GOMP_parallel_end'|
|8|undefined reference to `omp_get_num_procs_'|
||=== Build finished: 3 errors, 1 warnings ===|

I got the above errors I also set the -fopenmp directive under the compiler settings, but it's still seems unaware of parallel processing is invoked.

Does anybody can help me with this?

Best Regards,
Yuri
 
Posts: 2
Joined: Fri Dec 30, 2011 10:37 pm

Re: Simple parallel example with gfortran

Postby ftinetti » Mon Nov 05, 2012 3:53 am

Hi,

It seems to be that there are problems at the link step. Did you set linker settings?
(project -> Build options... -> linker settings)

HTH,

Fernando.
ftinetti
 
Posts: 575
Joined: Wed Feb 10, 2010 2:44 pm

Re: Simple parallel example with gfortran

Postby Oldboy » Tue Nov 06, 2012 3:04 pm

Too many !
Compare with Hello_omp on John Burkardt's Home Page
Oldboy
 
Posts: 17
Joined: Wed Oct 31, 2012 2:39 am


Return to Using OpenMP

Who is online

Users browsing this forum: Google [Bot] and 15 guests