




'''simple docstring'''






def 		a_(			lowerCamelCase   )					->List[str]:






       '''simple docstring'''




       return -num if num < 0 else num




def 		a_(			lowerCamelCase   )					->Tuple:






       '''simple docstring'''




       if len(lowerCAmelCase__   ) == 0:
              raise ValueError('''abs_min() arg is an empty sequence'''   )
       lowercase	:		List[str]    =   x[0]
       for i in x:
              if abs_val(lowerCAmelCase__   ) < abs_val(lowerCAmelCase__   ):
                     lowercase	:		List[Any]    =   i
       return j




def 		a_(			lowerCamelCase   )					->Tuple:






       '''simple docstring'''




       if len(lowerCAmelCase__   ) == 0:
              raise ValueError('''abs_max() arg is an empty sequence'''   )
       lowercase	:		Tuple    =   x[0]
       for i in x:
              if abs(lowerCAmelCase__   ) > abs(lowerCAmelCase__   ):
                     lowercase	:		Optional[int]    =   i
       return j




def 		a_(			lowerCamelCase   )					->Optional[int]:






       '''simple docstring'''




       if len(lowerCAmelCase__   ) == 0:
              raise ValueError('''abs_max_sort() arg is an empty sequence'''   )
       return sorted(lowerCAmelCase__ ,					key=lowerCAmelCase__   )[-1]




def 		a_(			)					->List[str]:






       '''simple docstring'''




       assert abs_val(0   ) == 0
       assert abs_val(34   ) == 34
       assert abs_val(-1000_0000_0000   ) == 1000_0000_0000

       lowercase	:		List[str]    =   [-3, -1, 2, -11]
       assert abs_max(lowerCAmelCase__   ) == -11
       assert abs_max_sort(lowerCAmelCase__   ) == -11
       assert abs_min(lowerCAmelCase__   ) == -1


if __name__ == "__main__":
      import doctest

      doctest.testmod()

      test_abs_val()
      print(abs_val(-34))  # --> 34









'''simple docstring'''
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 _A	(     unittest.TestCase     ):





		def 				__A							(  self					)							->  Optional[Any]:

					'''simple docstring'''
					__UpperCAmelCase :   int    					=  inspect.getfile(accelerate.test_utils					)
					__UpperCAmelCase :   int    					=  os.path.sep.join(mod_file.split(os.path.sep					)[:-1] + ["""scripts""", """test_sync.py"""]					)





		@require_cpu
		def 				__A							(  self					)							->  Optional[Any]:

					'''simple docstring'''
					debug_launcher(test_sync.main			,							num_processes=1					)





		@require_cpu
		def 				__A							(  self					)							->  Optional[Any]:

					'''simple docstring'''
					debug_launcher(test_sync.main					)





		@require_single_gpu
		def 				__A							(  self					)							->  Tuple:

					'''simple docstring'''
					test_sync.main()





		@require_multi_gpu
		def 				__A							(  self					)							->  List[Any]:

					'''simple docstring'''
					print(f'Found {torch.cuda.device_count()} devices.'					)
					__UpperCAmelCase :   List[str]    					=  ["""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()					)




