



'''simple docstring'''
from __future__ import annotations


def 	lowercase_						( lowerCAmelCase__						:	str			):

			"""simple docstring"""





			__UpperCAmelCase :   int
			__UpperCAmelCase :   list[str]    					=  list(lowerCAmelCase__			)
			__UpperCAmelCase					,	__UpperCAmelCase :   int    					=  _vector[:-1], int(_vector[-1]			)
			__UpperCAmelCase :   list[int]    					=  [int(lowerCAmelCase__			) for digit in __vector]

			vector.reverse()
			for i, digit in enumerate(lowerCAmelCase__			):
						if i & 1 == 0:
									__UpperCAmelCase :   int    					=  digit * 2
									if doubled > 9:
												doubled -= 9
									check_digit += doubled
						else:
									check_digit += digit

			return check_digit % 10 == 0


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					assert is_luhn('''79927398713''')
					assert not is_luhn('''79927398714''')









'''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()					)




