(opt, device_id, error_queue)
run process
run process
run process
def run(opt, device_id, error_queue):
    """ run process """
    try:
        gpu_rank = onmt.utils.distributed.multi_init(opt, device_id)
        if gpu_rank != opt.gpu_ranks[device_id]:
            raise AssertionError("An error occurred in \
                  Distributed initialization")
        single_main(opt, device_id)
    except KeyboardInterrupt:
        pass  # killed by parent, do nothing
    except Exception:
        # propagate exception to parent process, keeping original traceback
        import traceback
        error_queue.put((opt.gpu_ranks[device_id], traceback.format_exc()))
def run ( opt , device_id , error_queue ) : try : gpu_rank = onmt . utils . distributed . multi_init ( opt , device_id ) if gpu_rank != opt . gpu_ranks [ device_id ] : raise AssertionError ( "An error occurred in \
                  Distributed initialization" ) single_main ( opt , device_id ) except KeyboardInterrupt : pass # killed by parent, do nothing except Exception : # propagate exception to parent process, keeping original traceback import traceback error_queue . put ( ( opt . gpu_ranks [ device_id ] , traceback . format_exc ( ) ) )