





import inspect
import os
import unittest

import torch

import accelerate
from accelerate import debug_launcher
from accelerate.test_utils import (
    execute_subprocess_async,
    require_cpu,
    require_multi_gpu,
    require_single_gpu,
    test_sync,
)
from accelerate.utils import patch_environment


class 						_lowerCAmelCase(						unittest.TestCase):

  """simple docstring"""







  def 		SCREAMING_SNAKE_CASE__	( self     )-> Optional[int]:
     __A				 =       inspect.getfile(accelerate.test_utils     )
     __A				 =       os.path.sep.join(mod_file.split(os.path.sep     )[:-1] + ['''scripts''', '''test_sync.py''']     )

  @require_cpu
  def 		SCREAMING_SNAKE_CASE__	( self     )-> Optional[int]:
     debug_launcher(test_sync.main  ,    num_processes=1     )

  @require_cpu
  def 		SCREAMING_SNAKE_CASE__	( self     )-> Any:
     debug_launcher(test_sync.main     )

  @require_single_gpu
  def 		SCREAMING_SNAKE_CASE__	( self     )-> Tuple:
     test_sync.main()





  @require_multi_gpu
  def 		SCREAMING_SNAKE_CASE__	( self     )-> Union[str, Any]:
     print(f"Found {torch.cuda.device_count()} devices."     )
     __A				 =       ['''torchrun''', f"--nproc_per_node={torch.cuda.device_count()}", self.test_file_path]
     with patch_environment(omp_num_threads=1     ):
        execute_subprocess_async(UpperCAmelCase  ,    env=os.environ.copy()     )








from __future__ import annotations

import sys
def 				__UpperCamelCase  (		snake_case    ,	snake_case     )  ->						tuple[int, int]:


   '''simple docstring'''







   if abs(snake_case     ) == 1:
      return a, 0
   elif abs(snake_case     ) == 1:
      return 0, b

   __A ,						__A				 =       a, b
   __A ,						__A				 =       1, 0
   __A ,						__A				 =       0, 1

   while remainder != 0:
      __A				 =       old_remainder // remainder
      __A ,						__A				 =       remainder, old_remainder - quotient * remainder
      __A ,						__A				 =       coeff_a, old_coeff_a - quotient * coeff_a
      __A ,						__A				 =       coeff_b, old_coeff_b - quotient * coeff_b

   # sign correction for negative numbers
   if a < 0:
      __A				 =       -old_coeff_a
   if b < 0:
      __A				 =       -old_coeff_b

   return old_coeff_a, old_coeff_b
def 				__UpperCamelCase  (		)  ->						Tuple:


   '''simple docstring'''







   if len(sys.argv     ) < 3:
      print('''2 integer arguments required'''     )
      return 1
   __A				 =       int(sys.argv[1]     )
   __A				 =       int(sys.argv[2]     )
   print(extended_euclidean_algorithm(snake_case    ,	snake_case     )     )
   return 0


if __name__ == "__main__":
    raise SystemExit(main())

