Detect NVPROF (legacy CUDA profiler). Returns: ToolInfo with availability, path, version
(self)
| 807 | # ============================================================================ |
| 808 | |
| 809 | def detect_nvprof(self) -> ToolInfo: |
| 810 | """ |
| 811 | Detect NVPROF (legacy CUDA profiler). |
| 812 | |
| 813 | Returns: |
| 814 | ToolInfo with availability, path, version |
| 815 | """ |
| 816 | if 'nvprof' in self._cache: |
| 817 | return self._cache['nvprof'] |
| 818 | |
| 819 | # Check PATH |
| 820 | nvprof_path = shutil.which('nvprof') |
| 821 | |
| 822 | if nvprof_path: |
| 823 | version = self._get_tool_version(nvprof_path, ['--version']) |
| 824 | info = ToolInfo( |
| 825 | available=True, |
| 826 | path=nvprof_path, |
| 827 | version=version |
| 828 | ) |
| 829 | self._cache['nvprof'] = info |
| 830 | return info |
| 831 | |
| 832 | # Check CUDA directories |
| 833 | cuda_paths = self._get_cuda_common_paths() |
| 834 | |
| 835 | for cuda_path in cuda_paths: |
| 836 | nvprof_bin = cuda_path / 'bin' / ('nvprof.exe' if self.platform == 'Windows' else 'nvprof') |
| 837 | |
| 838 | if nvprof_bin.exists(): |
| 839 | version = self._get_tool_version(str(nvprof_bin), ['--version']) |
| 840 | info = ToolInfo( |
| 841 | available=True, |
| 842 | path=str(nvprof_bin), |
| 843 | version=version |
| 844 | ) |
| 845 | self._cache['nvprof'] = info |
| 846 | return info |
| 847 | |
| 848 | # Not found (but this is OK - it's deprecated) |
| 849 | error = "nvprof is deprecated. Use nsys (Nsight Systems) instead." |
| 850 | info = ToolInfo( |
| 851 | available=False, |
| 852 | error=error |
| 853 | ) |
| 854 | self._cache['nvprof'] = info |
| 855 | return info |
| 856 | |
| 857 | # ============================================================================ |
| 858 | # Helper Methods |
no test coverage detected