Skip to content

Commit

Permalink
Add more information to run (git version + hostname)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Rettenberger committed Nov 28, 2016
1 parent 063f506 commit c4ed661
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ com.apple.timemachine.supported
# Kernel generator
*.exe

# Generated files
src/version.h

## C++
# Compiled Object files
*.slo
Expand Down
9 changes: 8 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import commands
import arch
import memlayout
import libs
import utils.gitversion

# print the welcome message
print '********************************************'
Expand Down Expand Up @@ -248,6 +249,10 @@ if not env['generatedKernels'] and ( env['parallelization'] == 'omp' or env['par
if not env.has_key('memLayout'):
env['memLayout'] = memlayout.guessMemoryLayout(env)

# Detect SeisSol version
seissol_version = utils.gitversion.get(env)
print 'Compiling SeisSol version:', seissol_version

#
# preprocessor, compiler and linker
#
Expand Down Expand Up @@ -430,7 +435,6 @@ if env['compileMode'] in ['relWithDebInfo', 'release']:
#
# Basic preprocessor defines
#

# set precompiler mode for the number of quantities and basis functions
env.Append(CPPDEFINES=['CONVERGENCE_ORDER='+env['order']])
env.Append(CPPDEFINES=['NUMBER_OF_QUANTITIES=' + str(numberOfQuantities[ env['equations'] ]), 'NUMBER_OF_RELAXATION_MECHANISMS=' + str(env['numberOfMechanisms'])])
Expand Down Expand Up @@ -597,6 +601,9 @@ elif env['compiler'] == 'gcc':
env.sourceFiles = []
env.generatedTestSourceFiles = []

# Generate the version file
utils.gitversion.generateHeader(env, target='#/src/version.h')

Export('env')
SConscript('generated_code/SConscript', variant_dir='#/'+env['buildDir'], src_dir='#/', duplicate=0)
SConscript('src/SConscript', variant_dir='#/'+env['buildDir'], src_dir='#/', duplicate=0)
Expand Down
19 changes: 15 additions & 4 deletions src/SeisSol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,20 @@
* Main C++ SeisSol file
*/

#include "Parallel/MPI.h"

#include "SeisSol.h"
#include <unistd.h>

#ifdef _OPENMP
#include <omp.h>
#endif // _OPENMP

#include "utils/args.h"

#include "SeisSol.h"
#include "Parallel/MPI.h"

// Autogenerated file
#include "version.h"

bool seissol::SeisSol::init(int argc, char* argv[])
{
MPI::mpi.init(argc, argv);
Expand All @@ -68,8 +72,15 @@ bool seissol::SeisSol::init(int argc, char* argv[])
<< "(generated kernels)"
#endif // GENERATEDKERNELS
;
logInfo(rank) << "Version:" << VERSION_STRING;

if (MPI::mpi.rank() == 0) {
char hostname[HOST_NAME_MAX+1];
if (gethostname(hostname, HOST_NAME_MAX+1) == 0)
logInfo() << "Running on:" << hostname;
}

#ifdef _OPENMP
logInfo(rank) << "Version:" << SEISSOL_VERSION_STRING;
logInfo(rank) << "Using OMP with #threads/rank:" << omp_get_max_threads();
#ifdef USE_MPI
#ifdef USE_COMM_THREAD
Expand Down
2 changes: 0 additions & 2 deletions src/SeisSol.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@
#include "ResultWriter/AsyncIO.h"
#include "ResultWriter/WaveFieldWriter.h"

#define SEISSOL_VERSION_STRING "SVN Mainline"

class MeshReader;

namespace seissol
Expand Down
2 changes: 1 addition & 1 deletion submodules/scons-tools
Submodule scons-tools updated 1 files
+105 −0 utils/gitversion.py

0 comments on commit c4ed661

Please sign in to comment.