Pytorch retinanet - multi gpu issue

Training runs on a server with a single gpu 1080ti however it isn’t running on another workstation with 2 rtx 2080 ti nvlink with the error:

Traceback (most recent call last):
File “”, line 1, in
File “/opt/conda/lib/python3.6/multiprocessing/spawn.py”, line 105, in spawn_main
exitcode = _main(fd)
File “/opt/conda/lib/python3.6/multiprocessing/spawn.py”, line 114, in _main
prepare(preparation_data)
File “/opt/conda/lib/python3.6/multiprocessing/spawn.py”, line 225, in prepare
_fixup_main_from_path(data[‘init_main_from_path’])
File “/opt/conda/lib/python3.6/multiprocessing/spawn.py”, line 277, in _fixup_main_from_path
run_name=“mp_main”)
File “/opt/conda/lib/python3.6/runpy.py”, line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File “/opt/conda/lib/python3.6/runpy.py”, line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File “/opt/conda/lib/python3.6/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home/elib/Dev/Retinanet_PT/UseExample_train.py”, line 39, in
main.main(args)
File “/home/elib/Dev/Retinanet_PT/retinanet/main.py”, line 185, in main
torch.multiprocessing.spawn(worker, args=(args, world, model, state), nprocs=world)
File “/opt/conda/lib/python3.6/site-packages/torch/multiprocessing/spawn.py”, line 158, in spawn
process.start()
File “/opt/conda/lib/python3.6/multiprocessing/process.py”, line 105, in start
self._popen = self._Popen(self)
File “/opt/conda/lib/python3.6/multiprocessing/context.py”, line 284, in _Popen
return Popen(process_obj)
File “/opt/conda/lib/python3.6/multiprocessing/popen_spawn_posix.py”, line 32, in init
super().init(process_obj)
File “/opt/conda/lib/python3.6/multiprocessing/popen_fork.py”, line 19, in init
self._launch(process_obj)
File “/opt/conda/lib/python3.6/multiprocessing/popen_spawn_posix.py”, line 42, in _launch
prep_data = spawn.get_preparation_data(process_obj._name)
File “/opt/conda/lib/python3.6/multiprocessing/spawn.py”, line 143, in get_preparation_data
_check_not_importing_main()
File “/opt/conda/lib/python3.6/multiprocessing/spawn.py”, line 136, in _check_not_importing_main
is not going to be frozen to produce an executable.’’’)
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.

I figured out:
a script that goes to multiple gpu has to include main. Works now