PeleLM icon indicating copy to clipboard operation
PeleLM copied to clipboard

Unable to compile with OpenMP

Open jAnirudh opened this issue 3 years ago • 3 comments

Hi, I was trying to compile FlameSheet with USE_OMP = True but got the following error while compling AMReX_FABUTIL_2D.F

Compiling AMReX_FABUTIL_2D.F ...
In file included from /home/amrex/Src/Base/AMReX_REAL.H:4,
                 from /home/amrex/Src/Extern/amrdata/AMReX_FABUTIL_2D.F:9:
tmp_build_dir/s/2d.gnu.OMP.EXE/AMReX_Config.H:57:2: error: #error libamrex was built with OpenMP
   57 | #error libamrex was built with OpenMP
      |  ^~~~~

Any leads on what might be causing this? I was able to the compile and run the case using with mpi. Thanks!

jAnirudh avatar Oct 17 '21 12:10 jAnirudh

Try USE_OMP=TRUE

drummerdoc avatar Oct 18 '21 02:10 drummerdoc

Hi!

The same error persists with USE_OMP=TRUE as well.

I was mucking about and noticed the following: Lines 56-58 of the config file AMReX_Config.H read:

#if defined(AMREX_USE_OMP) && !defined(_OPENMP)
#error libamrex was built with OpenMP
#endif

The variable AMREX_USE_OMP is defined at line 6 in AMReX_Config.H but there is no definition of _OPENMP.

I tried the very dumb thing of simply commenting out the lines

    print("#if defined(AMREX_USE_OMP) && !defined(_OPENMP)")
    print('#error libamrex was built with OpenMP')
    print("#endif")

in the amrex/Tools/libamrex/mkconfig.py script. This got rid of the compilation error but when running the executable I got a segfault:

~/PeleLM/Exec/RegTests/FlameSheet$ ./PeleLM2d.gnu.OMP.ex inputs.2d-regt
OMP initialized with 4 OMP threads
AMReX (21.10-34-gbe5294eefb20-dirty) initialized
Successfully read inputs file ... 
Creating ReactorBase instance: ReactorCvode
free(): double free detected in tcache 2
SIGABRT
Segfault
Segmentation fault (core dumped)

I'm guessing there is possibly some issue in the OpenMP directives somewhere.

jAnirudh avatar Oct 18 '21 05:10 jAnirudh

It looks like an issue down in PelePhysics. I'll try that to reproduce the issue and fix that.

esclapez avatar Oct 18 '21 19:10 esclapez