


"""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_huggingface_suite,
    require_multi_gpu,
    require_single_gpu,
)
from accelerate.utils import patch_environment



@require_huggingface_suite
class 			_UpperCAmelCase (							unittest.TestCase				):






		'''simple docstring'''

		def 				SCREAMING_SNAKE_CASE  (self					):





			'''simple docstring'''

			__snake_case	:						int						=				inspect.getfile(accelerate.test_utils					)
			__snake_case	:						List[Any]						=				os.path.sep.join(
			    mod_file.split(os.path.sep					)[:-1] + ['''scripts''', '''external_deps''', '''test_metrics.py''']					)

			from accelerate.test_utils.scripts.external_deps import test_metrics  # noqa: F401

			__snake_case	:						Any						=				test_metrics



		@require_cpu
		def 				SCREAMING_SNAKE_CASE  (self					):





			'''simple docstring'''

			debug_launcher(self.test_metrics.main				,       num_processes=1					)



		@require_cpu
		def 				SCREAMING_SNAKE_CASE  (self					):





			'''simple docstring'''

			debug_launcher(self.test_metrics.main					)



		@require_single_gpu
		def 				SCREAMING_SNAKE_CASE  (self					):





			'''simple docstring'''

			self.test_metrics.main()



		@require_multi_gpu
		def 				SCREAMING_SNAKE_CASE  (self					):





			'''simple docstring'''

			print(f"""Found {torch.cuda.device_count()} devices."""					)
			__snake_case	:						str						=				['''torchrun''', f"""--nproc_per_node={torch.cuda.device_count()}""", self.test_file_path]
			with patch_environment(omp_num_threads=1					):
				execute_subprocess_async(a_				,       env=os.environ.copy()					)







import os




def  __magic_name__ (   )			->   str:
				__lowerCamelCase    					=	os.path.join(os.path.dirname(__lowerCAmelCase							)		,  '''num.txt'''							)
				with open(__lowerCAmelCase							) as file_hand:
								return str(sum(int(__lowerCAmelCase							) for line in file_hand							)							)[:10]


if __name__ == "__main__":
					print(solution())



