Skip to content
Snippets Groups Projects
Commit e659ed1c authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Added compiler name and version to the greeting message and HDF5 output.

Former-commit-id: a6b730e23ea9189d8c1da1278426abe1453b3811
parent 07fc51c5
No related branches found
No related tags found
No related merge requests found
......@@ -356,6 +356,8 @@ void writeCodeDescription(hid_t h_file) {
if (h_grpcode < 0) error("Error while creating code group");
writeAttribute_s(h_grpcode, "Code Version", package_version());
writeAttribute_s(h_grpcode, "Compiler Name", compiler_name());
writeAttribute_s(h_grpcode, "Compiler Version", compiler_version());
writeAttribute_s(h_grpcode, "Git Branch", git_branch());
writeAttribute_s(h_grpcode, "Git Revision", git_revision());
......
......@@ -45,7 +45,6 @@ const char *git_branch(void) {
return branch;
}
/**
* @brief The version of SWIFT
*/
......@@ -61,13 +60,50 @@ const char *package_description(void) {
static char buf[256];
static int initialised = 0;
if (!initialised) {
sprintf(buf, "SWIFT version: %s, at revision: %s, branch: %s",
sprintf(buf, "SWIFT version: %s, at revision: %s, branch: %s",
PACKAGE_VERSION, GIT_REVISION, GIT_BRANCH);
initialised = 1;
}
return buf;
}
const char *compiler_name(void) {
#if defined(__INTEL_COMPILER)
static const char *compiler = "ICC";
#elif defined(__clang__)
static const char *compiler = "LLVM/Clang";
#elif defined(__xlc__)
static const char *compiler = "IBM XL";
#elif defined(__GNUC__)
static const char *compiler = "GCC";
#else
static const char *compiler = "Unknown Compiler";
#endif
return compiler;
}
const char *compiler_version(void) {
static char version[256];
#if defined(__INTEL_COMPILER)
const int major = __INTEL_COMPILER / 100;
const int minor = __INTEL_COMPILER - major * 100;
sprintf(version, "%i.%i.%i", major, minor, __INTEL_COMPILER_BUILD_DATE);
#elif defined(__clang__)
sprintf(version, "%i.%i.%i", __clang_major__, __clang_minor__,
__clang_patchlevel__);
#elif defined(__xlc__)
const int major = __IBMC__ / 100;
const int minor = (__IBMC__ - major * 100) / 10;
const int patch = (__IBMC__ - major * 100 - minor * 10);
sprintf(version, "%i.%i.%i", major, minor, patch);
#elif defined(__GNUC__)
sprintf(version, "%i.%i.%i", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
#else
sprintf(version, "---");
#endif
return version;
}
/**
* @brief Prints a greeting message to the standard output containing code
* version and revision number
......@@ -83,6 +119,7 @@ void greetings(void) {
printf(" SPH With Inter-dependent Fine-grained Tasking\n\n");
printf(" Version : %s\n", package_version());
printf(" Revision: %s, branch: %s\n", git_revision(), git_branch());
printf(" Webpage : www.swiftsim.com\n\n");
printf(" Revision: %s, Branch: %s\n", git_revision(), git_branch());
printf(" Webpage : www.swiftsim.com\n");
printf(" Compiler: %s, Version: %s\n\n", compiler_name(), compiler_version());
}
......@@ -22,7 +22,7 @@
/**
* @file version.h
* @brief Package version and git revision sha.
* @brief Package version, git revision sha and compiler info.
*/
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
......@@ -33,6 +33,8 @@ const char* package_description(void);
const char* package_version(void);
const char* git_revision(void);
const char* git_branch(void);
const char* compiler_name(void);
const char* compiler_version(void);
void greetings(void);
#endif /* SWIFT_VERSION_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment