Optimization workflow - SIMPLE and CLEAR.
(self)
| 102 | return None |
| 103 | |
| 104 | def _optimize_workflow(self): |
| 105 | """Optimization workflow - SIMPLE and CLEAR.""" |
| 106 | |
| 107 | # Check API key |
| 108 | if not self.cache_manager.has_api_key(): |
| 109 | console.print("\n[yellow]⚠️ API key required[/yellow]") |
| 110 | self._setup_api_key() |
| 111 | if not self.cache_manager.has_api_key(): |
| 112 | return |
| 113 | |
| 114 | # Find CUDA files |
| 115 | console.print("\n[cyan]Looking for CUDA files...[/cyan]") |
| 116 | cuda_files = self._find_cuda_files() |
| 117 | |
| 118 | if not cuda_files: |
| 119 | questions = [inquirer.Confirm('recursive', message="No files found. Search subdirectories?", default=True)] |
| 120 | answers = inquirer.prompt(questions) |
| 121 | if answers and answers['recursive']: |
| 122 | cuda_files = self._find_cuda_files(recursive=True) |
| 123 | |
| 124 | if not cuda_files: |
| 125 | console.print("[red]No CUDA files found[/red]\n") |
| 126 | return |
| 127 | |
| 128 | # Select file |
| 129 | console.print(f"\n[dim]Found {len(cuda_files)} CUDA file(s)[/dim]") |
| 130 | selected_file = self._select_file(cuda_files) |
| 131 | if not selected_file: |
| 132 | return |
| 133 | |
| 134 | # Parse kernels |
| 135 | console.print(f"\n[cyan]Parsing {selected_file.name}...[/cyan]") |
| 136 | kernels = self._parse_kernels(selected_file) |
| 137 | |
| 138 | if not kernels: |
| 139 | console.print("[red]No kernels found[/red]\n") |
| 140 | return |
| 141 | |
| 142 | # Select kernels |
| 143 | console.print(f"[dim]Found {len(kernels)} kernel(s)[/dim]") |
| 144 | selected_kernels = self._select_kernels(kernels) |
| 145 | if not selected_kernels: |
| 146 | return |
| 147 | |
| 148 | # Get options |
| 149 | options = self._get_options(len(selected_kernels)) |
| 150 | if not options: |
| 151 | return |
| 152 | |
| 153 | # Optimize |
| 154 | console.print() |
| 155 | self._run_optimization(selected_file, selected_kernels, options) |
| 156 | |
| 157 | def _find_cuda_files(self, recursive: bool = False) -> List[Path]: |
| 158 | """Find CUDA files.""" |
no test coverage detected