Error when enabling OpenMP offloading: omp_target_is_present has no implict type

Dear community,

I am currently attempting to build ABINIT with OpenMP offloading to GPUs enabled on my workstation.

Running ../configure --with-config-file="myconf.ac9" in the build directory works fine, but at build time (make -j<n>) I get the following error:

-c -o m_xomp.o ../../../../../shared/common/src/12_hide_mpi/m_xomp.F90
../../../../../shared/common/src/12_hide_mpi/m_xomp.F90:515:6:

  515 |  rc = omp_target_is_present(ptr, device_id)
      |      1
Error: Function ‘omp_target_is_present’ at (1) has no IMPLICIT type; did you mean ‘xomp_target_is_present’?

The problem seems to be that gfortran cannot find the routine omp_target_is_present. My initial assumption was that I should add -I/path/to/omp_target_is_present_library to the fortran flags in the config file.

However, I could only find omp_target_is_present to be defined in the file omp_lib.f90.in on GCC’s GitHub repo, and it is nowhere to be found on my machine. I’m therefore not sure about how to proceed.

(I would like to share my config file but I don’t seem to be able to as a new user)

I’ve been granted the “basic” user badge and so I can now share my config file below.
myconf.ac9 (40.3 KB)

Hello nm33 and welcome,

Abinit compilation with omp and gpu is pretty advanced for my current knowledge but I’ll try to assist you as best as I can.

First, I would make sure that libomp was installed as a devel library.

To debug further, we need to determine if the problem is from abinit not correctly linking the library or your omp installation. To do so, I suggest trying to manually compile the faulty line and try to add include and library. The make script gives indication about the directory it is in. For example, here’s an example for the file effpot_xml.c :

cd $ABIPATH/build2/src/78_effpot
mpicc -DHAVE_CONFIG_H -I. -I../../../src/78_effpot -I../..  -I../../shared/common/src/10_defs -I../../../shared/common/src/10_defs -I../../shared/common/src/11_memory_mpi -I../../../shared/common/src/11_memory_mpi -I../../shared/common/src/12_hide_mpi -I../../../shared/common/src/12_hide_mpi -I../../shared/common/src/14_hidewrite -I../../../shared/common/src/14_hidewrite -I../../shared/common/src/16_hideleave -I../../../shared/common/src/16_hideleave -I../../shared/common/src/27_toolbox_oop -I../../../shared/common/src/27_toolbox_oop -I../../shared/common/src/28_numeric_noabirule -I../../../shared/common/src/28_numeric_noabirule -I../../shared/common/src/32_util -I../../../shared/common/src/32_util -I../../src/41_geometry -I../../../src/41_geometry -I../../src/42_parser -I../../../src/42_parser -I../../src/44_abitools -I../../../src/44_abitools -I../../src/44_abitypes_defs -I../../../src/44_abitypes_defs -I../../src/45_geomoptim -I../../../src/45_geomoptim -I../../src/56_recipspace -I../../../src/56_recipspace -I../../src/72_response -I../../../src/72_response -I../../src/77_ddb -I../../../src/77_ddb -I../../src/78_effpot -I../../../src/78_effpot -I../../shared/common/src/incs -I../../../shared/common/src/incs -I../../shared/common/src/mods -I../../../shared/common/src/mods -I../../src/incs -I../../../src/incs -I../../src/mods -I../../../src/mods -I../../shared/libpaw/incs -I../../../shared/libpaw/incs -I../../shared/libpaw/mods -I../../../shared/libpaw/mods -MT effpot_xml.o -MD -MP -MF .deps/effpot_xml.Tpo -c -o effpot_xml.o ../../../src/78_effpot/effpot_xml.c

Finally, to make the ac9 flag more readable, I would suggest to only keep the uncommented line on the file and use a second file template.ac9 where you keep all the comments.
conf.ac9 (1.0 KB)

Best, Olivier