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

CMakeLists update for issue 148 #149

Merged
merged 7 commits into from
Mar 15, 2018
Merged

Conversation

ndellingwood
Copy link
Contributor

Address request in issue #148 to check for
CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS=ON when Cuda is enabled.
If it is not on, error out at configuration.

Address request in issue kokkos#148 to check for
CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS=ON when Cuda is enabled. If it
is not on, error out at configuration.
@ndellingwood
Copy link
Contributor Author

Tested that this 1) errors out at configuration with Cuda8 if CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS is not set on and 2) that it configures properly when the variable is set.

@srajama1
Copy link
Contributor

Is there a problem with always having this ON when CUDA is enabled ? I don't know why we would error out, force the user to set it and reconfigure again. If it is needed can we just set it ON for CUDA.

Copy link
Contributor

@mhoemmen mhoemmen left a comment

Choose a reason for hiding this comment

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

Thanks @ndellingwood ! I suggested a couple changes.

CMakeLists.txt Outdated
@@ -75,6 +75,10 @@ TRIBITS_ADD_OPTION_AND_DEFINE(
LIST(APPEND DEVICE_LIST "<Cuda,CudaUVMSpace>")
ENDIF()

IF(NOT CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS)
Copy link
Contributor

Choose a reason for hiding this comment

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

IF(NOT (DEFINED(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS)) OR (NOT CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS))

etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS is defined by default. (CMake options have three possible states: NOT DEFINED, FALSE, and TRUE.) The above will check for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mhoemmen I didn't realize that, thanks for the catch!

CMakeLists.txt Outdated
@@ -75,6 +75,10 @@ TRIBITS_ADD_OPTION_AND_DEFINE(
LIST(APPEND DEVICE_LIST "<Cuda,CudaUVMSpace>")
ENDIF()

IF(NOT CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS)
MESSAGE( FATAL_ERROR "Kokkos-Kernels configuration failed: CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS is required be set to ON when compiling with Cuda." )
Copy link
Contributor

Choose a reason for hiding this comment

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

Incorrect grammar; try this:

The CMake option CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS is either undefined or OFF.  Please set CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS:BOOL=ON when building with CUDA.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mhoemmen made the change, thanks!

Fix if check and grammar, suggestions from @mhoemmen
@ndellingwood
Copy link
Contributor Author

Updated PR with suggested changes

@ndellingwood
Copy link
Contributor Author

@bartlettroscoe I added a check in kokkos-kernels for CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS when Cuda is enabled; should this check be moved within Trilinos and, if Cuda and kokkos-kernels are enabled, turn CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS=ON by default so users don't have to reconfigure like @srajama1 mentioned?

@bartlettroscoe
Copy link
Contributor

@bartlettroscoe I added a check in kokkos-kernels for CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS when Cuda is enabled; should this check be moved within Trilinos and, if Cuda and kokkos-kernels are enabled, turn CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS=ON by default so users don't have to reconfigure like @srajama1 mentioned?

This file gets processed as part of the Trilinos CMake configure as well so it should be active there as well. In fact, any TriBITS configure of this package will have this check.

mhoemmen
mhoemmen previously approved these changes Feb 14, 2018
@mhoemmen
Copy link
Contributor

Thanks @ndellingwood ! :D

Copy link
Contributor

@mhoemmen mhoemmen left a comment

Choose a reason for hiding this comment

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

Thanks @ndellingwood ! I have a few questions:

  1. Does a CUDA build with complex OFF actually need this option? If not, then the message isn't quite accurate, though it doesn't hurt.
  2. Does this option work with all supported host compilers for CUDA builds? If not, then we should add a check for the host compiler, just so we don't force users to do something that doesn't work.

@ndellingwood
Copy link
Contributor Author

Thanks @mhoemmen!

  1. I don't believe the Cuda build with complex OFF requires this, I can update so the message and check is more specific.
  2. I have not tested against all supported host compilers, though from the Tribits documentation the possible issues involving use of CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS seem to stem from combination of OS + CMake version + compiler. I'm not sure how to adequately address this, as testing of host compilers from sems modules on a Linux OS may give false confidence that a compiler is compatible, whereas another combo of CMake + OS may fail.

@mhoemmen
Copy link
Contributor

@ndellingwood wrote:

I don't believe the Cuda build with complex OFF requires this, I can update so the message and check is more specific.

I'm not too worried about this bit, as long as the build settings work in both complex ON and OFF cases, but it's still helpful to know, so thanks :-) .

I'm not sure how to adequately address this, as testing of host compilers from sems modules on a Linux OS may give false confidence that a compiler is compatible, whereas another combo of CMake + OS may fail.

If we don't test it, it doesn't exist ;-) . I would say, let's discover this rather than trying to guess. If somebody reports on a new platform that it doesn't work, we can change the message then.

Addresses issue kokkos#148. The check for
CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS enabled is only necessary when
complex+double+Cuda with ETI occurs.
@ndellingwood
Copy link
Contributor Author

@crtrott requested the FATAL_ERROR be changed to WARNING in CMakeLists.txt
Updated the PR with improved message and more restricted check (Cuda and complex double enabled) as suggested, and changed replaced with WARNING.
Since the FATAL_ERROR was replaced by a WARNING no one will be forced to use this option which potentially may not work with some combo of host compiler + OS + CMake version.

@srajama1 since CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS will not be enabled by default (discussion and links in issue #176), I think this PR is ready.

@ndellingwood
Copy link
Contributor Author

@srajama1 README updated with comment for usage CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS when building with Trilinos.

Copy link
Contributor

@mhoemmen mhoemmen left a comment

Choose a reason for hiding this comment

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

I'm OK with this for now, but please see note. Thanks @ndellingwood !

@@ -75,6 +75,10 @@ TRIBITS_ADD_OPTION_AND_DEFINE(
LIST(APPEND DEVICE_LIST "<Cuda,CudaUVMSpace>")
ENDIF()

IF( Trilinos_ENABLE_COMPLEX_DOUBLE AND ((NOT DEFINED CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS) OR (NOT CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS)) )
Copy link
Contributor

Choose a reason for hiding this comment

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

This is fine, though it may be possible to turn OFF KokkosKernels_INST_COMPLEX_DOUBLE even if Trilinos_ENABLE_COMPLEX_DOUBLE is ON.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mhoemmen Thanks for the catch! I'm guessing most users use Trilinos_ENABLE_COMPLEX_DOUBLE so I think I should leave that and add a check for KokkosKernels_INST_COMPLEX_DOUBLE also, does this sound correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

@ndellingwood What about stand-alone builds? Does Trilinos_ENABLE_COMPLEX_DOUBLE even exist in that case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mhoemmen I'm not sure that kokkos-kernels has standalone CMake support, I think for standalone builds the Makefile system should be used but I may be wrong.

@ndellingwood ndellingwood deleted the issue-148 branch August 30, 2018 19:53
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.

4 participants