-
Notifications
You must be signed in to change notification settings - Fork 371
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
CMake: Improve handling of Albany and related packages #5950
Conversation
@@ -257,6 +257,8 @@ | |||
<env name="PERL5LIB">/global/cfs/cdirs/e3sm/perl/lib/perl5-only-switch</env> | |||
<env name="FI_CXI_RX_MATCH_MODE">software</env> | |||
<env name="MPICH_COLL_SYNC">MPI_Bcast</env> | |||
<env name="Albany_ROOT">$SHELL{if [ -z "$Albany_ROOT" ]; then echo /global/common/software/e3sm/mali_tpls/albany-e3sm-serial-release-gcc; else echo "$Albany_ROOT"; fi}</env> |
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.
The pattern for setting up ${Package}_ROOT is established here. It's a bit messy so I'm wondering if it would be better to move this login into the cmake macro file for the machine?
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.
There's a better bash syntax:
Albany_ROOT=${Albany_ROOT:=/global/common/software/e3sm/mali_tpls/albany-e3sm-serial-release-gcc}
The ${VAR:=default}
syntax expands to ${VAR}
if VAR
is defined, otherwise it expands to default
. E.g.:
$ export FOO=foo
$ export BAR=${FOO:=bar} && echo $BAR
foo
$ export BAR={FOOBAR:=bar} && echo $BAR
bar
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.
@bartgol , I tried that at first. The problem is that the CIME regex will incorrectly match the first }
as terminating the SHELL command, so you can use that character in your syntax.
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.
Looks much cleaner. I left a suggestion for the bash env var. I think it may be a bit cleaner, but up to you.
@@ -257,6 +257,8 @@ | |||
<env name="PERL5LIB">/global/cfs/cdirs/e3sm/perl/lib/perl5-only-switch</env> | |||
<env name="FI_CXI_RX_MATCH_MODE">software</env> | |||
<env name="MPICH_COLL_SYNC">MPI_Bcast</env> | |||
<env name="Albany_ROOT">$SHELL{if [ -z "$Albany_ROOT" ]; then echo /global/common/software/e3sm/mali_tpls/albany-e3sm-serial-release-gcc; else echo "$Albany_ROOT"; fi}</env> |
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.
There's a better bash syntax:
Albany_ROOT=${Albany_ROOT:=/global/common/software/e3sm/mali_tpls/albany-e3sm-serial-release-gcc}
The ${VAR:=default}
syntax expands to ${VAR}
if VAR
is defined, otherwise it expands to default
. E.g.:
$ export FOO=foo
$ export BAR=${FOO:=bar} && echo $BAR
foo
$ export BAR={FOOBAR:=bar} && echo $BAR
bar
@@ -205,65 +205,6 @@ if (USE_PETSC) | |||
set(PETSC_LIB ${PETSC_LIBRARIES}) | |||
endif() | |||
|
|||
if (USE_TRILINOS) |
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.
So much better than what we had...
endif() | ||
|
||
# Albany depends on Trilinos | ||
if (USE_ALBANY OR USE_TRILINOS) |
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.
This is fine, but for the record, I think that USE_ALBANY
here is redundant. find_package(ALBANY REQUIRED)
will also call find_package(Trilinos REQUIRED)
. If a CMake package is installed well, it is responsible of finding all its TPLs when you call find_package(YOUR_PKG)
.
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.
It looks like this is a deficiency with the Albany cmake system. I tried without USE_ALBANY
check for Trilinos and I got this error:
CMake Error at /global/common/software/e3sm/mali_tpls/albany-e3sm-serial-release-gcc/lib64/Albany/cmake/albany-targets.cmake:61 (set_target_properties):
The link interface of target "albanyLib" contains:
Panzer::all_libs
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
/global/common/software/e3sm/mali_tpls/albany-e3sm-serial-release-gcc/lib64/Albany/cmake/AlbanyConfig.cmake:28 (include)
cmake/find_dep_packages.cmake:45 (find_package)
CMakeLists.txt:124 (include)
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.
Ah, we are probably not packaging albany that well.. :/
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.
I am going through our cmake stuff, and indeed we lack a lot of stuff to consider us "good cmake citizens"... I will fix it at some point.
@mperego , there are some deficiencies in the Albany Cmake system that are causing me problems:
If I fix (2) by manually editing the link line (replace -lmpasInterface with Since these problems aren't related to E3SM, I'm going to push ahead with this PR unless you say otherwise. |
I removed all instances of ALBANY_PATH from the Cmake macros. This means that the |
We're fixing other issues with our cmake logic (lots of legacy stuff, and some not-so-great cmake usage here and there). I'll keep in mind these issues in the process. |
CMake: Improve handling of Albany and related packages Specifically: * Albany * Trilinos * Kokkos This PR establishes the new paradigm of setting ${Package}_ROOT to find the packages we need. So far, I am very happy with how this is going. You can see how much cleaner it is to do things the CMake-3 so you don't have to micro-manage flags. In order to be consistent, changes kokkos override env var from KOKKOS_PATH to Kokkos_ROOT. Fixes #5786 [BFB] * jgfouca/cmake_albany: Remove obsolete references to ALBANY_PATH in cmake macros Improve Kokkos handling CMake: Improve handling of Albany and related packages
Thanks, @bartgol ! Merged to next. |
Thanks a lot @jgfouca! This looks so much cleaner. Looking forward to trying this out. |
I found the culprit. Albany was not exporting the |
The lack of export was causing link errors in E3SM, as noted in E3SM-Project/E3SM#5950.
The lack of export was causing link errors in E3SM, as noted in E3SM-Project/E3SM#5950.
Specifically:
This PR establishes the new paradigm of setting ${Package}_ROOT to find the packages we need. So far, I am very happy with how this is going. You can see how much cleaner it is to do things the CMake-3 so you don't have to micro-manage flags.
This PR is currently WIP because I was not able to fully test it on pm-cpu due to permissions issues with the boost that was used to build Trilinos.
In order to be consistent, changes kokkos override env var from KOKKOS_PATH to Kokkos_ROOT.
Fixes #5786