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

Adjusted OpenMP flags #431

Merged
merged 5 commits into from
Dec 1, 2021
Merged

Adjusted OpenMP flags #431

merged 5 commits into from
Dec 1, 2021

Conversation

ravil-mobile
Copy link
Collaborator

@ravil-mobile ravil-mobile commented Nov 26, 2021

  • bumped min. required CMake version to 3.10
    to guarantee CMake support of OpenMP
  • removed custom FindOpenMP.cmake from SeisSol
  • removed hard-coded openmp compiler and linker flags

Tested with gcc, intel and clang and it worked well for both c++ and fortran compilers

* bumped min. required CMake version to 3.10
to guarantee CMake support of OpenMP
* removed custom FindOpenMP.cmake from SeisSol
* removed hardcoded openmp compiler and linker flags
* split compilation of generated code with the main
seissol source files
* added OpenMP flags through imported target
* rearrange targets
Copy link
Contributor

@krenzland krenzland left a comment

Choose a reason for hiding this comment

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

Cool! Looks mostly good, some comments

CMakeLists.txt Outdated
target_link_libraries(SeisSol-lib PUBLIC OpenMP::OpenMP_Fortran)

find_package(OpenMP_Offloading QUIET)
# Note: there is a conflict between OpenMP offloading and libsxmm
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a comment here why that is

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added

  # Note: there may be a conflict between OpenMP offloading and libsxmm.
  # A collision can happen due to -march flags for CPUs and OpenMP GPU target
  # (e.g. with clang -Xopenmp-target -march=sm_75). Therefore, we separate
  # compilations for the source and generated codes and apply different
  # imported OpenMP targets to them.

CMakeLists.txt Outdated

# Note: we need to provide a support for Eigen backend
# for both gencode and SeisSol
target_include_directories(SeisSol-gencode PUBLIC
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, why is this PUBLIC? Shouldn't this be private?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So, as the comment says we need eigen (and yateto) headers for the code generated by yateto (in case of Eigen backend) and SeisSol-lib. If it is PRIVATE then the includes will be applied only for SeisSol-gencode target.

Copy link
Contributor

Choose a reason for hiding this comment

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

But aren't we using the headers anyway for SeisSol-lib? I'm not sure whether doing it this way might hide some dependencies. Probably doesn't matter much.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, we are using. I mean the path to eigen will be applied to SeisSol-gencode and everything which depends on SeisSol-gencode. In our case, it is SeisSol-lib and so on (SeisSol-bin, SeisSol-proxy, tests, etc.).

)

target_include_directories(SeisSol-gencode PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/submodules/yateto/include
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this here twice?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

you're right. I will remove it


cmake_push_check_state()

set(_PARENT_CMAKE_CXX_STANDARD ${CMAKE_CXX_STANDARD})
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this needed? We are using CMAKE_CXX_STANDARD 17 anyway?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess I can remove CMAKE_CXX_STANDARD from this file. I started with a copy of FindFILESYSTEM.cmake file and forgot to remove it.

In case of FindFILESYSTEM.cmake, in general, one doesn't know whether CMAKE_CXX_STANDARD 17 has already been set. It was just a generalization in case of somebody decides to re-use the file for other sub-projects.

ravil added 2 commits November 29, 2021 17:41
* enforce to build SeisSol-gencode before SeisSol-device-lib
@ravil-mobile

This comment has been minimized.

@krenzland krenzland merged commit 6934f7f into master Dec 1, 2021
@krenzland krenzland deleted the ravil/openmp branch December 1, 2021 16:05
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