Module: Torch::TorchRun

Defined in:
lib/torch/torchrun.rb

Defined Under Namespace

Classes: Error, Launcher, Parser

Constant Summary collapse

SIGNALS =
%w[INT TERM QUIT].freeze

Class Method Summary collapse

Class Method Details

.start(argv, out: $stdout, err: $stderr) ⇒ Object



144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/torch/torchrun.rb', line 144

def start(argv, out: $stdout, err: $stderr)
  parser = Parser.new
  options, script, script_args = parser.parse(argv)
  status = Launcher.new(options, script, script_args, out: out, err: err).run
  exit(status)
rescue OptionParser::ParseError => e
  err.puts(e.message)
  err.puts(parser)
  exit(2)
rescue Error => e
  err.puts("torchrun: #{e.message}")
  exit(1)
end