Commit 926d1779 authored by Lukas Riedel's avatar Lukas Riedel 📝

added debug hook for parallel debugging to parallel.cc

parent 3a6634a4
......@@ -56,6 +56,22 @@ int main(int argc, char** argv)
const std::string outputPath = inifile.get<std::string>("output.outputPath");
const bool adaptivity = inifile.get<bool>("adaptivity.useAdaptivity");
// Allow for a debugger as gdb or lldb to hook into the process, even if run in parallel
// (by manually setting the variable i to a nonzero value)
bool debugMode = inifile.get<bool>("misc.debugMode");
if (debugMode)
{
int i = 0;
char hostname[256];
gethostname(hostname, sizeof(hostname));
if(helper.rank()==0)
std::cout << "Debug mode activated. Use your debugger to set the variable 'i' to a value > 0 in each process" << std::endl;
printf("PID %d on %s ready for attachment\n", getpid(), hostname);
fflush(stdout);
while (0 == i)
sleep(5);
}
// Attempt to create output directory
mkdir(outputPath.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
int result = access(outputPath.c_str(), W_OK);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment