-
Notifications
You must be signed in to change notification settings - Fork 21
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
Configure target flags without modifying global space #20
base: develop
Are you sure you want to change the base?
Configure target flags without modifying global space #20
Conversation
@burlen When you get a chance could you finish reviewing these changes? I would like to get them in to fix some down stream CI. |
+1 on that review. this is affecting WarpX. |
CMake/build.cmake
Outdated
if (NOT MSVC) | ||
if (NOT CMAKE_CXX_FLAGS) | ||
set(tmp "-fPIC -std=c++11 -Wall -Wextra") | ||
string(APPEND CMAKE_CXX_FLAGS "-Wall -Wextra") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider not modifying CMAKE_
variables and instead using target_compile_options
et al.
Thanks a lot for working on modernizing this @kwryankrattiger and @burlen ! 👍 I have a few more comments added that are likely to cause problems in larger software stacks that would integrate you. |
Thanks for your comments! We could potentially get rid of setting clang stdlib and FORCE'ing the cache. Setting the clang stdlib was required on older versions of mac os. However, I don't recall if it was related to Apple's clang or brew'd clang. I think we need to do some testing on Apple to verify that both Apple and brew'd clang works without the flag. The code prior to the changes requested in this PR would only touch In addition, we should only add |
To answer the question what compilers we support on WarpX: generally, the platform specific system compiler. That means macOS:
Windows: (purely informational, since you don't support this platform)
Linux: the recommended compiler for every HPC system we run on
(WarpX: Cray, IBM and Fujitsu support is the only thing I can currently not cover in CI.) |
Sounds good, have added an inline comment what to check for with regards to CMake compiler identification.
Modifying
No, microarchitecture tuning should only be set if opted in, in my opinion. See comment here for the workflows and deployments that will break if added by default: |
Finally getting back around to this, sorry about the long hiatus. I am going to go through all of the comments here in more detail. Thanks @ax3l and @burlen for your comments! I think there is a lot of great feedback here! I agree on the micro-architecture optimization being better as an opt-in. Unless there is an extremely strong argument not to, I think I am going to go the way of the user needs to provide Adding It is a little annoying to set target properties...but I don't think that will be a major problem. The tests are already behind a cmake macro, and there aren't too many targets to wrangle. |
ff8067b
to
1462186
Compare
@burlen @ax3l If you guys don't mind taking one last look at this, I should have resolved the current issues that were brought up in discussion. I also did some updating/testing on the CUDA stuff. The biggest thing was I lowered the standard to 11 for oscillators because the nvidia toolkit v10 on my system doesn't support 17, and 17 is not required to build the sample code. |
SENSEI will only modify the cxx flags if they are not already set. So all one needs to do is set them to something and SENSEI will not modify them. Note that this can include setting to an empty string when you want nothing. The purpose of setting the CXX flags is to give most of our users the best default options. In any case, the compile options that we used to compile SENSEI should not impact Warp at all. Can you explain why Warp is using SENSEI's compile flags? If it's something we are inadvertently exporting, then I think the fix is to stop exporting them rather than change what works for most users. |
@kwryankrattiger This patch has too many different things in it, and some of which aren't quite ready. Please don't keep packing more stuff on this. Make a new PR for new changes so they don't get held up. While the code will compile with only C++11, there is a feature that we used that's only available in CUDA 11 and on. Without this the code will compile but will not work correctly. I didn't see a way in CMake to require CUDA 11, so requiring C++17 (introduced in CUDA 11) seemed like a good alternative. Can you (in a different PR) tell CMake that we require CUDA 11 or newer? In that case we could use C++11. |
@ax3l impressive list. However, I think that the issue is not what SENSEI's defaults compiler flags are, but a more imprtant issue would be if Warp is attempting to make use of SENSEI's compiler flags. I think Warp should only be linking to SENSEI and that it should not be a problem that SENSEI is compiled with one compiler and set of options; and Warp a different compiler and set of options. If the cxx flags used by SENSEI are propagating to Warp then we need to fix that. |
I too would like to know why -O2 is the default. You're wrong about gcc only going up to -O2. -O3 certainly works and adds a number of optimizations.
I'm not convinced we should pursue the target property approach right now. |
@kwryankrattiger The part of this PR that makes SENSEI install relocatable should be merged. Would you please cherry pick this into a separate branch and make a PR for that? I don't think that it makes sense to hold that change up. |
6d0017f
to
795ceae
Compare
@burlen I agree that this should be broken up. Relocatable, Cuda, CXX flags being added to the targets, and the fixes to the tests.
|
Use `add_compiler_options` instead of modifying the CMAKE_CXX_FLAGS directly Use CMAKE_<OPTION> to better support HPC compilers Remove micro architecture flags that are not supported by target system compilers (Fujitsu, Spock/Frontier, etc.)
31c9166
to
7ff877a
Compare
@burlen I think this should be acceptable now based on our conversations here. I am setting the compile options via @ax3l I tested this and there should be no issues propagating flags set for SENSEI to projects that include it as a submodule. |
@@ -1,7 +1,8 @@ | |||
option(BUILD_SHARED_LIBS OFF "Build shared libraries by default") | |||
option(BUILD_STATIC_EXECS OFF "Link executables statically") | |||
option(BUILD_SHARED_LIBS ON "Build shared libraries (default: ON)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default to produce static libraries
@ax3l I think this will fix the downstream package issues, but I am still finishing testing some other workflows.