Skip to content

Commit 9dfb146

Browse files
authored
Merge branch 'bartgol/eamxx/avoid-full-rebuild-when-git-sha-changes' (PR #7589)
Avoid a full rebuild of eamxx when the git sha changes and cmake is triggered by make. [BFB]
2 parents b356e25 + e90ac21 commit 9dfb146

File tree

7 files changed

+29
-14
lines changed

7 files changed

+29
-14
lines changed

components/eamxx/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -589,11 +589,9 @@ if (NOT DEFINED ENV{SCREAM_FAKE_ONLY})
589589
${CMAKE_CURRENT_BINARY_DIR}/src/eamxx_config.h
590590
F90_FILE ${CMAKE_CURRENT_BINARY_DIR}/src/eamxx_config.f)
591591

592-
# Generate eamxx_config.h and eamxx_config.f
593-
include (EkatUtils)
594-
EkatConfigFile(${CMAKE_CURRENT_SOURCE_DIR}/src/eamxx_config.h.in
595-
${CMAKE_CURRENT_BINARY_DIR}/src/eamxx_config.h
596-
F90_FILE ${CMAKE_CURRENT_BINARY_DIR}/src/eamxx_config.f)
592+
# Generate eamxx_version.h
593+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/eamxx_version.h.in
594+
${CMAKE_CURRENT_BINARY_DIR}/src/eamxx_version.h)
597595
else()
598596
# This is a "fake" build of scream, to stress test the testing scripts.
599597
# We only need to build something in our tests folder

components/eamxx/src/control/atmosphere_driver.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "share/util/eamxx_utils.hpp"
1414
#include "share/io/eamxx_io_utils.hpp"
1515
#include "share/property_checks/mass_and_energy_conservation_check.hpp"
16+
#include "eamxx_version.h"
1617

1718
#include <ekat_assert.hpp>
1819
#include <ekat_string_utils.hpp>

components/eamxx/src/eamxx_config.h.in

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,4 @@
5252
// Whether or not small kernels are used in SHOC
5353
#cmakedefine SCREAM_SHOC_SMALL_KERNELS
5454

55-
// The sha of the last commit
56-
#define EAMXX_GIT_VERSION "${EAMXX_GIT_VERSION}"
57-
58-
// The version of EAMxx
59-
#define EAMXX_VERSION "${EAMXX_VERSION_MAJOR}.${EAMXX_VERSION_MINOR}.${EAMXX_VERSION_PATCH}"
60-
6155
#endif
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#ifndef SCREAM_VERSION_H
2+
#define SCREAM_VERSION_H
3+
4+
// The sha of the last commit
5+
#define EAMXX_GIT_VERSION "${EAMXX_GIT_VERSION}"
6+
7+
// The version of EAMxx
8+
#define EAMXX_VERSION "${EAMXX_VERSION_MAJOR}.${EAMXX_VERSION_MINOR}.${EAMXX_VERSION_PATCH}"
9+
10+
#endif

components/eamxx/src/share/eamxx_config.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "eamxx_config.hpp"
22
#include "eamxx_session.hpp"
33
#include "eamxx_types.hpp"
4+
#include "eamxx_version.h"
45

56
#include <ekat_kokkos_session.hpp>
67
#include <ekat_arch.hpp>
@@ -9,12 +10,20 @@
910

1011
namespace scream {
1112

13+
std::string eamxx_version () {
14+
return EAMXX_VERSION;
15+
}
16+
17+
std::string eamxx_git_version () {
18+
return EAMXX_GIT_VERSION;
19+
}
20+
1221
std::string eamxx_config_string() {
1322
std::string config = "\n-------- EKAT CONFIGS --------\n\n";
1423
config += "Active AVX settings: " + ekat::active_avx_string () + "\n";
1524
config += "Compiler Id: " + ekat::compiler_id_string () + "\n";
1625
config += ekat::kokkos_config_string();
17-
config += "\n-------- SCREAM CONFIGS --------\n\n";
26+
config += "\n-------- EAMXX CONFIGS --------\n\n";
1827
config += " sizeof(Real) = " + std::to_string(sizeof(Real)) + "\n";
1928
config += " default pack size = " + std::to_string(SCREAM_PACK_SIZE) + "\n";
2029
config += " default FPE mask: " +

components/eamxx/src/share/eamxx_config.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
namespace scream {
1818

19+
std::string eamxx_version ();
20+
std::string eamxx_git_version ();
21+
1922
std::string eamxx_config_string();
2023

2124
// Utils to set/get whether leap year is used or not

components/eamxx/src/share/io/eamxx_output_manager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -901,8 +901,8 @@ void OutputManager::set_file_header(const IOFileSpecs& file_specs)
901901

902902
set_str_att("case",p.get<std::string>("caseid","NONE"));
903903
set_str_att("source","E3SM Atmosphere Model (EAMxx)");
904-
set_str_att("eamxx_version",EAMXX_VERSION);
905-
set_str_att("git_version",p.get<std::string>("git_version",EAMXX_GIT_VERSION));
904+
set_str_att("eamxx_version",eamxx_version());
905+
set_str_att("git_version",p.get<std::string>("git_version",eamxx_git_version()));
906906
set_str_att("hostname",p.get<std::string>("hostname","UNKNOWN"));
907907
set_str_att("username",p.get<std::string>("username","UNKNOWN"));
908908
set_str_att("atm_initial_conditions_file",p.get<std::string>("initial_conditions_file","NONE"));

0 commit comments

Comments
 (0)