Topic: OpenMP

Hi,
I have decided to give OpenMP a first try with the brand new SF 1.34 (winXP, 32bit).
After setting the  environment variable OMP_NUM_THREADS=2
I tried to compile a simple project with -fopenmp option.
It did not work:

build\test1.o:D:\Projects\SimpleFortran\OpenMp/test1.f90:7: undefined reference to `omp_get_num_threads'
build\test1.o:D:\Projects\SimpleFortran\OpenMp/test1.f90:7: undefined reference to `omp_get_thread_num'
build\test1.o: In function `a1_':
D:\Projects\SimpleFortran\OpenMp/test1.f90:7: undefined reference to `GOMP_parallel_start'
D:\Projects\SimpleFortran\OpenMp/test1.f90:7: undefined reference to `GOMP_parallel_end'.

Then I added -lgomp directive to the linker. Still no success, with different and much more cryptic
messages like:

c:/program files/simply fortran/mingw-w64/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/lib/../lib32\libgomp.a(team.o): In function `gomp_mutex_destroy':
f:\workspace\gcc\obj\gcc\x86_64-w64-mingw32\32\libgomp/../../../../../src/gcc-4.7.2/libgomp/config/posix/mutex.h:54: undefined reference to `_imp__pthread_mutex_destroy'


Any ideas what to do next? Thanks in advance.

Carlos Herrera

Re: OpenMP

Carlos,

You were almost there.  You also need to add the directive "-lpthread" to the linker.  Your linker options should look like:

-lgomp -lpthread

Let me know if you have any other issues, and keep us posted on your progress.

Jeff Armstrong
Approximatrix, LLC

Re: OpenMP

Jeff,

Thank you, now it compiles (SF 1.35). However, OpenMp program
runs slower... But it is another story, I believe....
BTW, I think there are still some problems with project management.
Clean project button deletes also exe files which belong to
other projects residing in the same folder.

Best regards,
Carlos Herrera