Problems using OpenMP

Pedro Giffuni pfg at FreeBSD.org
Thu Jun 1 04:50:01 UTC 2017



On 05/31/17 21:45, Steve Kargl wrote:
> On Wed, May 31, 2017 at 08:56:18PM -0500, Pedro Giffuni wrote:
>> FWIW, I tried using OpenMP in a port (hypre) and I thought the option
>> would be something as simple as this:
>>
>> OPENMP_CONFIGURE_WITH=    openmp
>> OPENMP_CONFIGURE_USES=    compiler:openmp
>>
>> Unfortunately that is not enough:
>>
>> ...
>>
>> In file included from ./_hypre_utilities.h:16:
>> ./HYPRE_utilities.h:29:10: fatal error: 'omp.h' file not found
>> #include <omp.h>
>>            ^~~~~~~
>> --- amg_linklist.o ---
>> ...
>>
>> And the file is here:
>>
>> /usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd11.0/5.4.0/include/omp.h
>> /usr/local/llvm39/lib/clang/3.9.1/include/omp.h
>>
>> Which is not really clean to include :(. Any suggestion?
>>
> This is similar to the problem with having to find -Wl,-L/usr/local/... to
> find gfortran's shared libraries.  For gfortran you can do
>
> #! /bin/sh
> LD_LIBRARY_PATH=$HOME/work/lib
> export LD_LIBRARY_PATH
> LD_RUN_PATH=$HOME/work/lib
> export LD_RUN_PATH
> PATH=$HOME/work/bin:$PATH
> gfortran $@
>
> gcc has a C_INCLUDE_PATH environmental variable.  Don't know if this
> works with gfortran or if there is a GFORTRAN_INCLUDE_PATH.
This is C, the fortran interface is used for external libraries. OK.. it's
interesting to know that, I didn't want to include it in the CFLAGS.
What I am finding is that all these packages are in early stages of
OpenMP adoption and generally prefer MPI.

For now I am trying to use threads whenever it is an option.

>
> This does not work with flang as she does not support LD_LIBRARY_PATH or
> LD_RUN_PATH.  For openmp, and in particularly for the old fashion omp.h
> file, you'll need to add an appropriate -I/path/to/omp... stuff to your
> FFLAGS.  You can add -I/usr/local/flang/include to /usr/local/bin/flang
> as it is a simple Bourne shell script.
>
The packages I am porting were created by the labs that sponsored
flang so I guess they will figure it out ;).

Thanks!

Pedro.


More information about the freebsd-ports mailing list