Source code for mcgdb.model.task.environment.openmp.interaction

import gdb

import mcgdb

representation = None

from . import  step, show, \
    graph, sequence, info, start, all_out, \
    task, critical, barrier, sections, \
    attach, stacktree

from . import ayudame_wrapper, ayudame_preload
from . import graph

[docs]def activate(): global representation from .. import representation gdb.Command("omp", gdb.COMMAND_OBSCURE, prefix=1) gdb.Command("omp task", gdb.COMMAND_OBSCURE, prefix=1) gdb.Command("omp critical", gdb.COMMAND_OBSCURE, prefix=1) mcgdb.toggle_activate_submodules(__name__)(do_activate=True, include_self=False) cmd_omp_debug() cmd_omp_sched() cmd_omp_sched_single() cmd_omp_sched_all() cmd_omp_debug_block() cmd_omp_debug_unblock()
[docs]class cmd_omp (gdb.Command): def __init__ (self): gdb.Command.__init__(self, "omp", gdb.COMMAND_OBSCURE, prefix=1)
[docs]class cmd_omp_debug (gdb.Command): def __init__ (self): gdb.Command.__init__(self, "omp debug", gdb.COMMAND_OBSCURE, prefix=1)
[docs] def invoke (self, args, from_tty): activate = "on" in args print("omp debugging activated: {}".format(activate)) from .. import toolbox toolbox.NO_PRINT = not activate
[docs]class cmd_omp_sched (gdb.Command): def __init__ (self): gdb.Command.__init__(self, "omp schedule", gdb.COMMAND_OBSCURE, prefix=1)
[docs] def invoke (self, args, from_tty): if args: print("WARNING: argumment '{}' not parsed.".format(args)) if gdb.parameter("scheduler-locking") == "on": print("single -- Only current worker can run -- scheduler-locking is active") else: print("all -- All workers can run -- scheduler-locking is off")
[docs]class cmd_omp_sched_single (gdb.Command): def __init__ (self): gdb.Command.__init__(self, "omp schedule single", gdb.COMMAND_OBSCURE, prefix=1)
[docs] def invoke (self, args, from_tty): gdb.execute("set scheduler-locking on")
[docs]class cmd_omp_sched_all (gdb.Command): def __init__ (self): gdb.Command.__init__(self, "omp schedule all", gdb.COMMAND_OBSCURE, prefix=1)
[docs] def invoke (self, args, from_tty): gdb.execute("set scheduler-locking off")
[docs]class cmd_omp_debug_block (gdb.Command): def __init__ (self): gdb.Command.__init__(self, "omp debug thread_block", gdb.COMMAND_OBSCURE, prefix=1)
[docs] def invoke (self, args, from_tty): blocker = representation.TaskJob.blockers[representation.TaskJob.preferred_blocked] blocker.block()
[docs]class cmd_omp_debug_unblock (gdb.Command): def __init__ (self): gdb.Command.__init__(self, "omp debug thread_unblock", gdb.COMMAND_OBSCURE, prefix=1)
[docs] def invoke (self, args, from_tty): blocker = representation.TaskJob.blockers[representation.TaskJob.preferred_blocked] blocker.unblock()