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

Allow CMake to configure with nvc++ #14370

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bernhardmgruber
Copy link
Contributor

This PR is a successor to #14139, allowing CMake to configure ROOT when nvc++ is used as C++ compiler.

@phsft-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@bellenot
Copy link
Member

@phsft-bot build

@phsft-bot
Copy link
Collaborator

Starting build on ROOT-performance-centos8-multicore/soversion, ROOT-ubuntu2204/nortcxxmod, ROOT-ubuntu2004/python3, mac12arm/cxx20, windows10/default
How to customize builds

@hahnjo
Copy link
Member

hahnjo commented Jan 17, 2024

I'm not sure this is a good idea: We know that nvc++ cannot build a working ROOT, so I don't think we should make it easier for users to shoot themselves into the foot...

@phsft-bot
Copy link
Collaborator

Build failed on ROOT-performance-centos8-multicore/soversion.
Running on olbdw-01.cern.ch:/data/sftnight/workspace/root-pullrequests-build
See console output.

Failing tests:

@pcanal
Copy link
Member

pcanal commented Jan 17, 2024

so I don't think we should make it easier for users to shoot themselves into the foot...

Isn't one of those user the NVidia engineer(s) that needs to build ROOT to fix the compiler?

@@ -20,6 +20,10 @@ list(APPEND DAVIX_LIBRARIES ${DAVIX_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}da
list(APPEND DAVIX_LIBRARIES ${DAVIX_PREFIX}/src/DAVIX-build/deps/curl-install/usr/lib/${CMAKE_STATIC_LIBRARY_PREFIX}curl${CMAKE_STATIC_LIBRARY_SUFFIX})

string(REPLACE "-Werror " "" DAVIX_CXX_FLAGS "${CMAKE_CXX_FLAGS} ")
if (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't that be upstreamed in the DAVIX repository?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably. Here is a PR: cern-fts/davix#110

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged upstream, but no new release of davix yet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A version of Davix with this fix has been release, and the ROOT builtin davix was updated to it.

The first commit of this PR is not needed anymore.

@@ -560,9 +560,13 @@ if(PYTHON_VERSION_STRING_Development_Other)
endif()

#---RConfigure.h---------------------------------------------------------------------------------------------
try_compile(has__cplusplus "${CMAKE_BINARY_DIR}" SOURCES "${CMAKE_SOURCE_DIR}/config/__cplusplus.cxx"
if (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC")
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dM -E /dev/null OUTPUT_VARIABLE __cplusplus_PPout)
Copy link
Member

@pcanal pcanal Jan 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is try_compile not working for NVHPC ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using try_compile would work as well:

   try_compile(has__cplusplus "${CMAKE_BINARY_DIR}" SOURCES "${CMAKE_SOURCE_DIR}/config/__cplusplus.cxx"
            COMPILE_DEFINITIONS -dM -E OUTPUT_VARIABLE __cplusplus_PPout)

But it would be irritating, since the source file is not actually read and compiled by the compiler. I cannot put /dev/null here, because that does not exist on Windows :) The importance is to compile with -dM -E, which asks the compiler to dump all predefined macros. The pragma message in __cplusplus.cxx is not supported by nvc++, so nothing is printed during compilation.

Copy link
Member

@pcanal pcanal Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah so semantically we probably need:

try_compile(has__cplusplus ...)
if ( has__cplusplus is empty )
   go the slower route
endif()

alternatively if it was actually resulted in a different code (but it likely is not)

has_pragma_message) = test (or aquire somehow) that compiler support pragma message
if (has_pragma_test)
    use try_compiler
else()
    use the slower route
endif()

i.e. this fix is not a priori dependent of a specific compiler.

@hahnjo
Copy link
Member

hahnjo commented Jan 17, 2024

so I don't think we should make it easier for users to shoot themselves into the foot...

Isn't one of those user the NVidia engineer(s) that needs to build ROOT to fix the compiler?

They can fix their compiler by building upstream LLVM, I don't see the point.

@pcanal
Copy link
Member

pcanal commented Jan 17, 2024

They can fix their compiler by building upstream LLVM, I don't see the point.

Humm ... so we are sure they is no other bad interactions?

But anyway furthermore, if we put stuff that is 'needed' (i.e. handling genuine difference not bugs in the compiler) then we will be ready when they are.

@hahnjo
Copy link
Member

hahnjo commented Jan 17, 2024

They can fix their compiler by building upstream LLVM, I don't see the point.

Humm ... so we are sure they is no other bad interactions?

We don't know because we never get to that part: My memory is that to this date, we never had a working rootcling_stage1 compiled by nvc++ and consequently never got past libCore.

Copy link

Test Results

     9 files       9 suites   1d 21h 50m 56s ⏱️
 2 490 tests  2 490 ✅ 0 💤 0 ❌
21 378 runs  21 378 ✅ 0 💤 0 ❌

Results for commit 7396b43.

@bernhardmgruber
Copy link
Contributor Author

But anyway furthermore, if we put stuff that is 'needed' (i.e. handling genuine difference not bugs in the compiler) then we will be ready when they are.

I fully agree here. Just because nvc++ cannot compile ROOT now does not mean we should make it even harder to get there. Especially, since I already invested the time to find out what's needed in cmake. And they are actually fairly small, so I am also not proposing a maintenance nightmare.

@hahnjo
Copy link
Member

hahnjo commented Jan 19, 2024

But anyway furthermore, if we put stuff that is 'needed' (i.e. handling genuine difference not bugs in the compiler) then we will be ready when they are.

I fully agree here. Just because nvc++ cannot compile ROOT now does not mean we should make it even harder to get there. Especially, since I already invested the time to find out what's needed in cmake. And they are actually fairly small, so I am also not proposing a maintenance nightmare.

IMHO it sends the wrong signal that nvc++ would be supported. I'm still not seeing the point of having build system support for a "broken" compiler (for our purposes).

@pcanal
Copy link
Member

pcanal commented Jan 19, 2024

IMHO it sends the wrong signal that nvc++ would be supported. I'm still not seeing the point of having build system support for a "broken" compiler (for our purposes).

A fair point but I fail to see how it has an consequence for this PR. As is the master does not reject nvc++ is just fails in some weird ways (that are fixed by this PR) and some weirder ways (bug in the compiler).

ie. Not merging this PR would not send the signal that nvc++ is not supported, it would only make it harder to support it in the future and make it more annoying than it should be to try the next version (because then this PR needs to then be hand applied (if by some miracle the tester remembers or knows about this PR) or re-discovererd-and-re-implemented).

The 'right' way to express the point you make is:
(a) merge the best possible version of this PR
(b) explicitly warn or error out upon seeing a known broken version of nvc++.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants