o  iV) @sddlmZddlZddlZddlZddlZddlZddlmZddl m Z ddl Z ddl Z ddlZddlmZddlmZddlmZmZmZzed\ZZeoXed d d kZWneeefyjd ZZYnwejd d d kZ ed\Z!Z"e"re!j#ndZ$gdZ%ddZ&ddZ'ej(fddZ)ddZ*d/ddZ+ej(fd0d d!Z,d/d"d#Z-ej(fd0d$d%Z.ej(fd0d&d'Z/ed(d)d*d+Gd,d-d-Ze0d.kre/dSdS)1) annotationsN) OrderedDict)TextIO) deprecated) IgniteInfo)OptionalImportErrorget_package_versionoptional_importzmonai._CZ BUILD_MONAI01F USE_META_DICTpsutilz!NOT INSTALLED or UNKNOWN VERSION.) print_configget_system_infoprint_system_info get_gpu_infoprint_gpu_infoprint_debug_info USE_COMPILEDr rcCs*t}tj|d<tjj|d<tj|d<|S)z6 Read the package versions into a dictionary. ZMONAIZNumpyZPytorch)rmonai __version__npversion full_versiontorchoutputr[/home/dell461/cl/sdc2/last_ska_mid/HISourceFinder-master-l/src/monai/config/deviceconfig.pyget_config_values6s    rcCst}td|d<td|d<td|d<td|d<td |d <td |d <td |d <td|d<td|d<td|d<td|d<t|d<td|d<td|d<td|d<td|d<td|d<td|d<|S)z? Read the optional package versions into a dictionary. ignitezPytorch IgniteZitkZITKZnibabelZNibabelZskimagez scikit-imagescipyPILZPillow tensorboardZ TensorboardZgdown torchvisionZ TorchVisiontqdmZlmdbr pandasZeinopsZ transformersZmlflowZnrrdZpynrrdZclearml)rrpsutil_versionrrrrget_optional_config_valuesCs(                 r(cCstD]\}}t|d||ddqtdtdtdttdtjt }t |dtj }td ||ddtd |ddt D]\}}t|d||ddqMtd |ddtd |ddd S)z~ Print the package versions to `file`. Args: file: `print()` text stream file. Defaults to `sys.stdout`. z version: TfileflushzMONAI flags: HAS_EXT = z, USE_COMPILED = z, USE_META_DICT = zMONAI rev id: z zMONAI __file__: z Optional dependencies:zF For details about installing the optional dependencies, please visit:z^ https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies N)ritemsprintHAS_EXTrr r__revision_id__getpassZgetuserresub__file__r()r*kvusernameZmasked_file_pathrrrr_s  rcCs:zt|r|n|||<WdStyd||<YdSw)NzUNKNOWN for given OS)callable BaseException)in_dictkeyfnrrr _dict_appendxs  r<returnrcs,t}t|dtj|ddkr$t|dtjttdr#t|dtjn7|ddkr3t|ddd n(td }t d | Wd n1sJwYr[t|d fdd t|dtjt|dtj t|dtj t|dtj tst|ddd |St}|t|d|jt|d|jt|d|jt|ddd t|ddd t|ddd t|ddd t|d d!d t|d"d#d t|d$d%d t|d&d'd tt|d(fd)d t|d*fd+d t|d,fd-d Wd |S1swY|S).z3 Get system info as an ordered dictionary. SystemWindowsz Win32 version win32_editionz Win32 editionDarwinz Mac versioncSs tdS)Nr)platformmac_verrrrr z!get_system_info..z/etc/os-releasezPRETTY_NAME="(.*)"Nz Linux versioncs dS)N)groupr) linux_verrrrDs ZPlatformZ ProcessorZMachinezPython versionz`psutil` missingcSsdS)Nzrun `pip install monai[psutil]`rrrrrrDz Process nameZCommandz Open fileszNum physical CPUscS tjddS)NFlogicalr cpu_countrrrrrDrEzNum logical CPUscSrJ)NTrKrMrrrrrDrEzNum usable CPUscSsttSN)lenr ProcessZ cpu_affinityrrrrrDz CPU usage (%)cSrJ)NTZpercpu)r Z cpu_percentrrrrrDrEzCPU freq. (MHz)cSsttjdddS)NFrSr)roundr Zcpu_freqrrrrrDsz#Load avg. in last 1, 5, 15 mins (%)cSsddtDS)NcSs"g|] }t|tddqS)drF)rTr rN).0xrrr s"5get_system_info....)r getloadavgrrrrrDszDisk usage (%)cSsttjSrO)r disk_usageosgetcwdpercentrrrrrDrRzAvg. sensor temp. (Celsius)cSs$ttddtDdS)NcSsg|] }|D]}|jqqSr)current)rVZsublistitemrrrrXsrYrF)rrTmeanr Zsensors_temperaturesvaluesrrrrrDszTotal physical memory (GB)ctjddSN@rF)rTtotalrmemrrrDrRzAvailable memory (GB)crcrd)rT availablerrgrrrDrRzUsed memory (GB)crcrd)rTusedrrgrrrDrR)rr<rBsystem win32_verhasattrr@openr1searchread processormachinepython_version has_psutilr rQZoneshotnameZcmdline open_filesvirtual_memory)rZrel_fpr)rHrhrrsd      rr*rNonecCsFts td|dddStD]\}}t|d||ddqdS)z Print system info to `file`. Requires the optional library, `psutil`. Args: file: `print()` text stream file. Defaults to `sys.stdout`. z)`psutil` required for `print_system_info`Tr): N)rtr-rr,r*r4r5rrrrs rcst}tjt|dfddt|ddd|dr&t|dddtjjt|dfd dt|d tj d t|d tj d rVt|d fd ddkrjt|dtjj t|dtjj t D]Y}tj|}t|d|d|jt|d|dt|jt|d|dt|jt|d|d|jt|d|dt|jddt|d|d|jd|jqn|S)NzNum GPUscSrOrr)num_gpusrrrDrIzget_gpu_info..zHas CUDAcSsttjSrO)boolrcuda is_availablerrrrrDsz CUDA versioncSstjjSrO)rrrrrrrrDz cuDNN enabledcstSrO)r~r cudnn_verrrrDrZNVIDIA_TF32_OVERRIDEZ TORCH_ALLOW_TF32_CUBLAS_OVERRIDEz cuDNN versioncr|rOrrrrrrDrIrzCurrent devicez'Library compiled for CUDA architectureszGPU z Namez Is integratedz Is multi GPU boardz Multi processor countz Total memory (GB)rerFz CUDA capability (maj.min).)rrr device_countr<backendscudnnrr\environgetcurrent_device get_arch_listrangeget_device_propertiesrur~ is_integratedis_multi_gpu_boardmulti_processor_countrT total_memorymajorminor)rgpuZgpu_infor)rr}rrs0     $rcCs0tD]\}}t|d||ddqdS)zr Print GPU info to `file`. Args: file: `print()` text stream file. Defaults to `sys.stdout`. rzTr)N)rr,r-r{rrrrsrcCstd|ddtd|ddtd|ddt|td|ddtdtd|ddt|td|ddtdtd|ddt|dS) z Print config (installed dependencies, etc.) and system info for debugging. Args: file: `print()` text stream file. Defaults to `sys.stdout`. z ================================Tr)zPrinting MONAI config...z! ================================zPrinting system config...zPrinting GPU config...N)r-rrr)r*rrrrs rz1.4.0z1.6.0z2Please use `monai.utils.enums.IgniteInfo` instead.)sinceremoved msg_suffixc@seZdZdZejZdS)rzXDeprecated Import of IgniteInfo enum, which was moved to `monai.utils.enums.IgniteInfo`.N)__name__ __module__ __qualname____doc__ _IgniteInfoOPT_IMPORT_VERSIONrrrrr s r__main__)r=r)r*rr=ry)1 __future__rr0r\rBr1sys collectionsrtypingrnumpyrrrZmonai.utils.deprecate_utilsrmonai.utils.enumsrrmonai.utils.modulerrr _r.getenvr ImportErrorAttributeErrorrrr r rtrr'__all__rr(stdoutrr<rrrrrrrrrrsL           ; "