Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OMPT build problem when OpenMP is enabled #177

Closed
wants to merge 1 commit into from

Conversation

albestro
Copy link

Problem

I'm trying to build APEX with GCC (via spack) and when I enable OpenMP support I get a building error due to a missing include.

[98%] Building CXX object src/apex/CMakeFiles/apex_ompt.dir/apex_ompt.cpp.o
cd /tmp/ialberto/spack-stage/spack-stage-apex-2.6.3-xjsydnhb2xprb5al3pk6xk5gyk6azatr/spack-src/spack-build-hid37to/src/apex && /project/csstaff/
/tmp/ialberto/spack-stage/spack-stage-apex-2.6.3-xjsydnhb2xprb5al3pk6xk5gyk6azatr/spack-src/src/apex/apex_ompt.cpp:10:10: fatal error: omp-tools
   10 | #include <omp-tools.h>
      |          ^~~~~~~~~~~~~

Quick fix

I had a quick look at it, and I have a quick fix for my use-case.

Since OMP_INCLUDE_DIRS is set by FindOMPT in any case OMPT is found,

if(OMPT_FOUND)
set(OMPT_LIBRARIES ${OMPT_LIBRARY} )
set(OMPT_INCLUDE_DIRS ${OMPT_INCLUDE_DIR} )
set(OMPT_DIR ${OMPT_ROOT})
add_definitions(-DAPEX_HAVE_OMPT)
endif()

I propose to add unconditionally the include directories to the target apex_ompt as per this PR.

Notes

  1. From my basic understanding, the following global include_directories directive can be removed

include_directories(${OMPT_INCLUDE_DIRS})

  1. I'm not sure if this change, if correct, should be applied somehow also to src/apex/CMakeLists_hpx.cmake.

  2. I'm going to open a PR also in spack about this. Depending on the outcome of this PR, I would add a conflict or a patch to the spack package.

  3. Side note: FindOMPT (and probably it is not alone) installs the OMPT as external project in installation path instead of the build folder. If a user set CMAKE_INSTALL_PREFIX (like spack does, but it might be also set to the classic /usr/local/apex), the installation folder will get also OMPT sources and libraries, which I'm not sure it is needed. But this might be a topic for a different issue/PR.

@khuck
Copy link
Collaborator

khuck commented Sep 19, 2023

Thanks for reporting this... the real problem is that GCC doesn't support OMPT, and this is kind of a hacky work-around. It is more reasonable going forward to not build the LLVM OpenMP library for use with GCC, because as it is currently integrated it doesn't support target offload, and is several years out of date.

@albestro
Copy link
Author

Yep, it makes sense.

Would you like to just close and discard this PR without any further change? Probably better to address this on the CMake side explicitly checking and alerting that GCC does not support OMPT?

@khuck
Copy link
Collaborator

khuck commented Sep 20, 2023

I won't discard it, I'll keep it to remind me to disable that configuration combination. Thanks!

khuck added a commit that referenced this pull request Dec 6, 2023
…x. There's no need to build the LLVM runtime to support the non-compliant GCC compiler.
@khuck
Copy link
Collaborator

khuck commented Dec 6, 2023

Resolved with aa25fd3 which disables the APEX_BUILD_OMPT feature.

@khuck khuck closed this Dec 6, 2023
@albestro albestro deleted the quick-fix-build-ompt branch December 7, 2023 14:13
khuck added a commit that referenced this pull request Feb 7, 2024
…x. There's no need to build the LLVM runtime to support the non-compliant GCC compiler.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants