Skip to content

Commit 16492ff

Browse files
committed
Added code to print the LBANN version number in the print callback on
setup. The version number is currently derived from the latest git tag.
1 parent 68175b5 commit 16492ff

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
project(LBANN)
22
cmake_minimum_required(VERSION 2.8.12)
3-
set(LBANN_MAJOR_VERSION 0)
4-
set(LBANN_MINOR_VERSION 9)
3+
#set(LBANN_MAJOR_VERSION 0)
4+
#set(LBANN_MINOR_VERSION 91)
5+
6+
# Get the git version so that we can embed it into the executable
7+
execute_process(COMMAND git describe --abbrev=7 --dirty --always --tags OUTPUT_VARIABLE GIT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
8+
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLBANN_VERSION=\\\"${GIT_VERSION}\\\"" )
59

610
################################################################
711
# Options

include/lbann/callbacks/lbann_callback_print.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ namespace lbann {
3939
class lbann_callback_print : public lbann_callback {
4040
public:
4141
lbann_callback_print(int _batch_interval = 1) : lbann_callback(_batch_interval) {}
42+
void setup(model* m);
4243
void on_epoch_begin(model* m);
4344
void on_epoch_end(model* m);
4445
void on_test_end(model* m);

src/callbacks/lbann_callback_print.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@
3131

3232
namespace lbann {
3333

34+
void lbann_callback_print::setup(model* m) {
35+
#ifdef LBANN_VERSION
36+
lbann_comm* comm = m->get_comm();
37+
if (comm->am_world_master()) {
38+
std::cout << "Training with LLNL LBANN version " << LBANN_VERSION << endl;
39+
}
40+
#endif
41+
}
42+
3443
void lbann_callback_print::on_epoch_begin(model* m) {
3544
lbann_comm* comm = m->get_comm();
3645
if (comm->am_world_master()) {

0 commit comments

Comments
 (0)