Friday, September 20, 2024

Re: gcc, fortran and OpenMP

> johannes@thyssentishman.com wrote:

> I couldn't find a way to compile
> calculix-ccx without OpenMP support and I have zero knowledge on
> fortran
> to find out if this can be patched.

There's a few issues with OpenMP on OpenBSD. As I understand it, there
are
ports that presume that OpenMP is present but build-dependencies are
fairly
complicated. So the ports people turn it off as it needs too much
effort
to support.

"In theory", theory is you can run an OpenMP code with OMP_NUM_THREADS=1
and the software Just Works. But as you have seen, without a GOMP
or OMP library (GOMP is for Gnu compilers, OMP comes with LLVM
compilers)
it won't run.

"In practice", it is possible to switch off the OpenMP code, although
there may still be a few omp_num_threads() type calls that can be
stubbed.

In my experience, turning off OpenMP has several dimensions:

- if using cmake, the cmake files can "discover" openmp because the
compiler recognizes a flag. ccmake is your friend here; usually you can
find a way to turn OpenMP off because there are no matching libraries.

- if using gnu build, it's possible to patch out the openmp discovery
code, but this is usually a bit tricky.

- if the code calls something like armadillo which automatically
discovers OpenMP you have to troubleshoot how to turn off OpenMP for
armadillo and also for your code.

- some smart source codes have build flags that control OpenMP or else
supply alternate means (pthreads, TBB) to do the same thing. FFTW3
is one example.

Off topic: you had a reference to VTK and I published a port for
paraview v5.9 which includes VTK a couple of years ago if
you need that.

https://marc.info/?l=openbsd-ports&m=161367923419324&w=2

Hope this helps

John

No comments:

Post a Comment