Skip to content
Snippets Groups Projects
Commit cecff3df authored by Jean-Baptiste Keck's avatar Jean-Baptiste Keck
Browse files

init

parent f515d732
No related branches found
No related tags found
1 merge request!16MPI operators
......@@ -2,9 +2,26 @@
Python package dedicated to flow simulation using particular methods
on hybrid architectures (MPI-GPU)
"""
import psutil
import psutil, signal, traceback, threading, sys, os, warnings
from functools import wraps
from hysop.deps import __builtin__, print_function, os, sys, warnings, traceback
from hysop.deps import __builtin__, print_function
# Register debug signals (SIGUSR1(10)=print the main stack, SIGUSR2(12)=print the stack of all threads)
def dumpstack(signal, frame):
traceback.print_stack()
def dumpstacks(signal, frame):
#https://stackoverflow.com/questions/132058/showing-the-stack-trace-from-a-running-python-application
id2name = dict([(th.ident, th.name) for th in threading.enumerate()])
code = []
for threadId, stack in sys._current_frames().items():
code.append("\n# Thread: %s(%d)" % (id2name.get(threadId,""), threadId))
for filename, lineno, name, line in traceback.extract_stack(stack):
code.append('File: "%s", line %d, in %s' % (filename, lineno, name))
if line:
code.append(" %s" % (line.strip()))
print("\n".join(code))
signal.signal(signal.SIGUSR1, dumpstack)
signal.signal(signal.SIGUSR2, dumpstacks)
def get_env(target, default_value):
target = 'HYSOP_{}'.format(target)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment