Ejemplo n.º 1
0
def synapse_logger_stop(profile_hw=False):
    syn_log = SynapseLoggerHelpers.synapse_logger()
    if syn_log:
        if profile_hw:
            if hvd.size() == 1 or hvd.rank() == 0:
                syn_log.stop_hw_profile()
        syn_log.command("disable")
    else:
        logging.warning(
            "Synapse logger has not been enabled. Unable to start logging.")
Ejemplo n.º 2
0
 def synapse_logger():
     if not SynapseLoggerHelpers._syn_logger_init_done and SynapseLoggerHelpers._synapse_logger_required(
     ):
         import sys
         import habana_frameworks.tensorflow as htf
         sys.path.insert(0, htf.sysconfig.get_lib_dir())
         import py_synapse_logger as syn_log
         SynapseLoggerHelpers._syn_logger = syn_log
         SynapseLoggerHelpers._syn_logger_init_done = True
         syn_log.command("disable")
     return SynapseLoggerHelpers._syn_logger
Ejemplo n.º 3
0
 def synapse_logger():
     if not SynapseLoggerHelpers._syn_logger_init_done and SynapseLoggerHelpers._synapse_logger_required(
     ):
         import sys
         new_path = os.path.join(os.environ["BUILD_ROOT_LATEST"])
         sys.path.insert(0, new_path)
         import py_synapse_logger as syn_log
         SynapseLoggerHelpers._syn_logger = syn_log
         SynapseLoggerHelpers._syn_logger_init_done = True
         syn_log.command("disable")
     return SynapseLoggerHelpers._syn_logger
Ejemplo n.º 4
0
 def _setup_synapse_logger(log_name_prefix=""):
     syn_log = SynapseLoggerHelpers.synapse_logger()
     if not syn_log:
         logger_required = SynapseLoggerHelpers._synapse_logger_required()
         assert not logger_required, "SynapseLoggerHelpers.synapse_logger() returns None when logger is enabled"
         return
     syn_log.command("stop_data_capture")
     if log_name_prefix:
         synapse_logger_set_file_name = "file_name={}".format(
             "{}.local.synapse_log".format(log_name_prefix))
         syn_log.command(synapse_logger_set_file_name)
         syn_log.command("category_mask=0x3")
         if SynapseLoggerHelpers._synapse_logger_type(
         ) == SynapseLoggerType.ALL:
             syn_log.command("restart")
Ejemplo n.º 5
0
def synapse_logger_start(step_idx, profile_hw=False):
    syn_log = SynapseLoggerHelpers.synapse_logger()
    if syn_log:
        log_name_prefix = "worker_{}_step_{}".format(hvd.rank(), step_idx)
        synapse_logger_set_file_name = "file_name={}".format(
            "{}.local.synapse_log".format(log_name_prefix))
        syn_log.command(synapse_logger_set_file_name)
        syn_log.command("category_mask=0x3")
        syn_log.command("restart")
        if profile_hw:
            if hvd.size() == 1 or hvd.rank() == 0:
                syn_log.start_hw_profile()
    else:
        logging.warning(
            "Synapse logger has not been enabled. Unable to start logging.")