"""simple docstring"""
import importlib
import sys
from argparse import REMAINDER, ArgumentParser
from pathlib import Path

import torch_xla.distributed.xla_multiprocessing as xmp



def 					UpperCamelCase					(       )      ->Optional[int]:
    _lowerCamelCase	: Any       =       ArgumentParser(
        description=(
            '''PyTorch TPU distributed training launch '''
            '''helper utility that will spawn up '''
            '''multiple distributed processes'''
        ) )

    # Optional arguments for the launch helper
    parser.add_argument('''--num_cores'''						,	type=lowerCamelCase_						,	default=1						,	help='''Number of TPU cores to use (1 or 8).''' )

    # positional
    parser.add_argument(
        '''training_script'''						,	type=lowerCamelCase_						,	help=(
            '''The full path to the single TPU training '''
            '''program/script to be launched in parallel, '''
            '''followed by all the arguments for the '''
            '''training script'''
        )						,	)

    # rest from the training program
    parser.add_argument('''training_script_args'''						,	nargs=lowerCamelCase_ )

    return parser.parse_args()



def 					UpperCamelCase					(       )      ->str:
    _lowerCamelCase	: int       =       parse_args()

    # Import training_script as a module.
    _lowerCamelCase	: Optional[int]       =       Path(args.training_script )
    sys.path.append(str(script_fpath.parent.resolve() ) )
    _lowerCamelCase	: Union[str, Any]       =       script_fpath.stem
    _lowerCamelCase	: Tuple       =       importlib.import_module(lowerCamelCase_ )

    # Patch sys.argv
    _lowerCamelCase	: Any       =       [args.training_script] + args.training_script_args + ['''--tpu_num_cores''', str(args.num_cores )]
    xmp.spawn(mod._mp_fn						,	args=()						,	nprocs=args.num_cores )


if __name__ == "__main__":
  main()










def     a     (		lowerCamelCase_						,  lowerCamelCase_							):






				'''simple docstring'''
				lowercase__  					=     len(lowerCamelCase_							)
				lowercase__  					=     [[False] * (required_sum + 1) for _ in range(arr_len + 1							)]

				# for each arr value, a sum of zero(0) can be formed by not taking any element
				# hence True/1
				for i in range(arr_len + 1							):
								lowercase__  					=     True

				# sum is not zero and set is empty then false
				for i in range(1						,  required_sum + 1							):
								lowercase__  					=     False

				for i in range(1						,  arr_len + 1							):
								for j in range(1						,  required_sum + 1							):
												if arr[i - 1] > j:
																lowercase__  					=     subset[i - 1][j]
												if arr[i - 1] <= j:
																lowercase__  					=     subset[i - 1][j] or subset[i - 1][j - arr[i - 1]]

				return subset[arr_len][required_sum]


if __name__ == "__main__":
							import doctest

							doctest.testmod()




