Skip to content

Compiling on OpenBSD/no OpenMP environment #18

Open
@jg1uaa

Description

@jg1uaa

I am trying jtdx on OpenBSD. This envoronment does not support OpenMP.

Simply configure with cmake .. -DCMAKE_Fortran_COMPILER=egfortran -DQt5_DIR=/usr/local/lib/qt5/cmake/Qt5 and make, OpenMP related error occurs.

ld: error: undefined symbol: omp_get_num_procs_
>>> referenced by decoder.f90
>>>               decoder.f90.o:(multimode_decoder_) in archive libwsjt_fort.a

ld: error: undefined symbol: omp_set_dynamic_
>>> referenced by decoder.f90
>>>               decoder.f90.o:(multimode_decoder_) in archive libwsjt_fort.a
>>> referenced by decoder.f90
>>>               decoder.f90.o:(multimode_decoder_) in archive libwsjt_fort.a

ld: error: undefined symbol: omp_set_nested_
>>> referenced by decoder.f90
>>>               decoder.f90.o:(multimode_decoder_) in archive libwsjt_fort.a
c++: error: linker command failed with exit code 1 (use -v to see invocation)

To suppress this error, add conditional compile to decoder.f90 like this (but I am not clear with FORTRAN, please fix if this diff is not correct.):

diff --git a/lib/decoder.f90 b/lib/decoder.f90
index 09ed9c83..fae212f5 100644
--- a/lib/decoder.f90
+++ b/lib/decoder.f90
@@ -148,7 +148,8 @@ subroutine multimode_decoder(params)
        call tone8myc(); mycall12_00=mycall
      endif
      ndecodes=0; allmessages=""; allsnrs=0; allfreq=0. !init arrays for multithreading decoding
-     numcores=omp_get_num_procs()
+     numcores=1
+     !$ numcores=omp_get_num_procs()
      nuserthr=params%nmt

      numthreads=1 ! fallback
@@ -167,8 +168,8 @@ subroutine multimode_decoder(params)
      endif

 !print *,nuserthr,numcores,numthreads
-     call omp_set_dynamic(.false.)
-     call omp_set_nested(.true.)
+     !$ call omp_set_dynamic(.false.)
+     !$ call omp_set_nested(.true.)

      nfa=params%nfa; nfb=params%nfb; nfqso=params%nfqso; nfawide=params%nfa; nfbwide=params%nfb
      if(params%nfilter) then  ! 160Hz Filter bandwidth, 580Hz Filter bandwidth in Hound mode
@@ -2371,7 +2372,7 @@ endif
      go to 800
   endif

-  call omp_set_dynamic(.true.)
+  !$ call omp_set_dynamic(.true.)
 !!!  !$omp parallel sections num_threads(2) copyin(/timer_private/) shared(ndecoded) if(.true.) !iif() needed on Mac
   !$omp parallel sections num_threads(2) shared(ndecoded) if(.true.) !iif() needed on Mac
   !$omp section

But this causes linker error at last.

ld: error: unable to find library -lwsjt_fort_omp
c++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [CMakeFiles/jtdx.dir/build.make:800: jtdx] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:296: CMakeFiles/jtdx.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2

I think CMakeList.txt also needs to be fixed, but I have no idea.
Can you tell me where I should modify in that file?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions