Skip to content

Commit

Permalink
Show compilation/runtime information at VR startup
Browse files Browse the repository at this point in the history
When VR is started we now show much more information about VR than
before. The previous state was quite messy, didn't include much
information, and wasn't coherent depending on how the code was compiled.

Additionally now the configuration file name is shown when it's loaded.

Signed-off-by: Rodrigo Tobar <[email protected]>
  • Loading branch information
rtobar committed May 27, 2021
1 parent 600a552 commit 8fb8b64
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 9 deletions.
42 changes: 34 additions & 8 deletions src/main.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
\todo remove array mpi_idlist and mpi_indexlist as these arrays are unnecessary
\todo alter unbinding/sortbybindingenergy calls since seems a waste of cpu cycles
*/
#include <algorithm>
#include <iterator>
#include <sstream>
#include <unistd.h>

#include "compilation_info.h"
#include "stf.h"
#include "logging.h"
#include "timer.h"
Expand All @@ -34,6 +39,34 @@ void finish_vr(Options &opt)
#endif
}

void show_version_info(int argc, char *argv[])
{
LOG_RANK0(info) << "VELOCIraptor git version: " << git_sha1();
LOG_RANK0(info) << "VELOCIraptor compiled with: " << vr::get_cxx_flags() << " " << vr::get_macros();
LOG_RANK0(info) << "VELOCIraptor was built on: " << vr::get_compilation_date();

char cwd[PATH_MAX];
std::ostringstream os;
LOG_RANK0(info) << "VELOCIraptor running at: " << getcwd(cwd, PATH_MAX);
std::copy(argv, argv + argc, std::ostream_iterator<char *>(os, " "));
LOG_RANK0(info) << "VELOCIraptor started with command line: " << os.str();

// MPI/OpenMP information
LOG_RANK0(info) << "VELOCIratptor MPI support: "
#ifdef USEMPI
<< "yes, " << NProcs << " MPI ranks";
#else
<< "no";
#endif

LOG_RANK0(info) << "VELOCIratptor OpenMP support: "
#ifdef USEOPENMP
<< "yes, " << omp_get_max_threads() << " OpenMP threads, OpenMP version " << _OPENMP;
#else
<< "no";
#endif
}

int main(int argc,char **argv)
{
#ifdef USEMPI
Expand All @@ -53,7 +86,6 @@ int main(int argc,char **argv)
//and this processes' rank is
MPI_Comm_rank(MPI_COMM_WORLD,&ThisTask);

if (ThisTask == 0) cout<<"Running VELOCIraptor "<<git_sha1()<<endl;
#ifdef USEOPENMP
// Check the threading support level
if (provided < required)
Expand All @@ -78,13 +110,7 @@ int main(int argc,char **argv)
nthreads=1;
#endif

#ifdef USEMPI
if (ThisTask==0) cout<<"VELOCIraptor/STF running with MPI. Number of mpi threads: "<<NProcs<<endl;
#endif
#ifdef USEOPENMP
if (ThisTask==0) cout<<"VELOCIraptor/STF running with OpenMP. Number of openmp threads: "<<nthreads<<endl;
if (ThisTask==0) cout<<"VELOCIraptor/STF running with OpenMP version "<< _OPENMP << endl;
#endif
show_version_info(argc, argv);

#ifdef SWIFTINTERFACE
cout<<"Built with SWIFT interface enabled when running standalone VELOCIraptor. Should only be enabled when running VELOCIraptor as a library from SWIFT. Exiting..."<<endl;
Expand Down
2 changes: 1 addition & 1 deletion src/ui.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ void GetArgs(int argc, char *argv[], Options &opt)
}
if(configflag){
if (ThisTask==0)
LOG(info) << "Reading config file";
LOG(info) << "Reading config file " << opt.pname;
GetParamFile(opt);
}
else {
Expand Down

0 comments on commit 8fb8b64

Please sign in to comment.