MPI-Parallel output of profiler

This commit is contained in:
Matthias Hochsteger 2019-01-14 13:04:27 +01:00
parent 69363e7ff2
commit 4aa7e76bd1
6 changed files with 20 additions and 11 deletions

View File

@ -35,6 +35,17 @@ namespace ngcore
fclose(prof); // NOLINT
}
if (getenv ("NGPROFILE"))
{
std::string filename = "netgen.prof";
#ifdef PARALLEL
filename += "."+ToString(id);
#endif
if (id == 0) logger->info( "write profile to file {}", filename );
FILE *prof = fopen(filename.c_str(),"w"); // NOLINT
Print (prof);
fclose(prof); // NOLINT
}
}
void NgProfiler :: Print (FILE * prof)

View File

@ -8,6 +8,9 @@
namespace ngcore
{
// parallel netgen
int id = 0, ntasks = 1;
#ifdef WIN32
// windows does demangling in typeid(T).name()
NGCORE_API std::string Demangle(const char* typeinfo) { return typeinfo; }

View File

@ -15,6 +15,9 @@
namespace ngcore
{
// MPI rank, nranks TODO: Rename
extern NGCORE_API int id, ntasks;
NGCORE_API std::string Demangle(const char* typeinfo);
#if defined(__GNUC__)

View File

@ -14,9 +14,8 @@
namespace netgen
{
extern DLL_HEADER int id, ntasks;
using ngcore::id;
using ngcore::ntasks;
#ifdef PARALLEL

View File

@ -4,14 +4,11 @@
// #include <ostream>
// #include <mystdlib.h>
// #include <meshing.hpp>
#include "mpi_interface.hpp"
namespace netgen
{
#ifdef PARALLEL
extern int id;
extern int ntasks;
#endif
DLL_HEADER extern int printmessage_importance;
DLL_HEADER extern int printdots;

View File

@ -50,10 +50,6 @@ namespace netgen
string ngdir = ".";
// parallel netgen
int id = 0, ntasks = 1;
void Ng_PrintDest(const char * s)
{
if (id == 0)