-
Notifications
You must be signed in to change notification settings - Fork 42
AI-Dynamo updates. #791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
AI-Dynamo updates. #791
Changes from all commits
b9b6321
aa41405
c68c14d
0d17820
0acad0b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -298,25 +298,75 @@ def _run_genai_perf(self, job: KubernetesJob) -> None: | |||||||||||||||||||||||||||||||||||||||||
| raise TypeError("Test definition must be an instance of AIDynamoTestDefinition") | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| genai_perf_results_path = "/tmp/cloudai/genai-perf" | ||||||||||||||||||||||||||||||||||||||||||
| frontend_pod = self._get_dynamo_pod_by_role(role="frontend") | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| genai_perf_cmd = ["genai-perf", "profile", f"--artifact-dir={genai_perf_results_path}"] | ||||||||||||||||||||||||||||||||||||||||||
| for k, v in tdef.cmd_args.genai_perf.model_dump( | ||||||||||||||||||||||||||||||||||||||||||
| exclude={"extra_args", "extra-args"}, exclude_none=True | ||||||||||||||||||||||||||||||||||||||||||
| ).items(): | ||||||||||||||||||||||||||||||||||||||||||
| genai_perf_cmd.append(f"--{k}={v}") | ||||||||||||||||||||||||||||||||||||||||||
| if extra_args := tdef.cmd_args.genai_perf.extra_args: | ||||||||||||||||||||||||||||||||||||||||||
| genai_perf_cmd.extend(extra_args.split()) | ||||||||||||||||||||||||||||||||||||||||||
| logging.debug(f"GenAI perf arguments: {genai_perf_cmd=}") | ||||||||||||||||||||||||||||||||||||||||||
| # Copy wrapper script and calc_percentile_csv script to the pod | ||||||||||||||||||||||||||||||||||||||||||
| wrapper_script_path = tdef.genai_perf_script.installed_path | ||||||||||||||||||||||||||||||||||||||||||
| calc_csv_script_path = tdef.calc_percentile_csv.installed_path | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| frontend_pod = self._get_dynamo_pod_by_role(role="frontend") | ||||||||||||||||||||||||||||||||||||||||||
| pod_wrapper_path = "/tmp/genai_perf.sh" | ||||||||||||||||||||||||||||||||||||||||||
| pod_calc_csv_path = "/tmp/calc_percentile_csv.py" | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| logging.debug(f"Copying wrapper script {wrapper_script_path} to pod {frontend_pod}") | ||||||||||||||||||||||||||||||||||||||||||
| cp_wrapper_cmd = f"kubectl cp {wrapper_script_path} {self.default_namespace}/{frontend_pod}:{pod_wrapper_path}" | ||||||||||||||||||||||||||||||||||||||||||
| subprocess.run(cp_wrapper_cmd, shell=True, capture_output=True, text=True, check=True) | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| logging.debug(f"Copying calc_percentile_csv script {calc_csv_script_path} to pod {frontend_pod}") | ||||||||||||||||||||||||||||||||||||||||||
| cp_calc_cmd = f"kubectl cp {calc_csv_script_path} {self.default_namespace}/{frontend_pod}:{pod_calc_csv_path}" | ||||||||||||||||||||||||||||||||||||||||||
| subprocess.run(cp_calc_cmd, shell=True, capture_output=True, text=True, check=True) | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| logging.debug(f"Executing genai-perf in pod={frontend_pod} cmd={genai_perf_cmd}") | ||||||||||||||||||||||||||||||||||||||||||
| # Make wrapper script executable | ||||||||||||||||||||||||||||||||||||||||||
| chmod_cmd = ["chmod", "+x", pod_wrapper_path] | ||||||||||||||||||||||||||||||||||||||||||
| logging.debug(f"Making wrapper script executable in pod {frontend_pod}") | ||||||||||||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||||||||||||
| lazy.k8s.stream.stream( | ||||||||||||||||||||||||||||||||||||||||||
| self.core_v1.connect_get_namespaced_pod_exec, | ||||||||||||||||||||||||||||||||||||||||||
| name=frontend_pod, | ||||||||||||||||||||||||||||||||||||||||||
| namespace=self.default_namespace, | ||||||||||||||||||||||||||||||||||||||||||
| command=chmod_cmd, | ||||||||||||||||||||||||||||||||||||||||||
| stderr=True, | ||||||||||||||||||||||||||||||||||||||||||
| stdin=False, | ||||||||||||||||||||||||||||||||||||||||||
| stdout=True, | ||||||||||||||||||||||||||||||||||||||||||
| tty=False, | ||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||
| except lazy.k8s.client.ApiException as e: | ||||||||||||||||||||||||||||||||||||||||||
| logging.error(f"Error making wrapper script executable in pod '{frontend_pod}': {e}") | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| # Build genai-perf command arguments | ||||||||||||||||||||||||||||||||||||||||||
| genai_perf_cmd_parts = ["genai-perf", "profile", f"--artifact-dir={genai_perf_results_path}"] | ||||||||||||||||||||||||||||||||||||||||||
| if tdef.cmd_args.genai_perf.args: | ||||||||||||||||||||||||||||||||||||||||||
| for k, v in tdef.cmd_args.genai_perf.args.model_dump(exclude_none=True).items(): | ||||||||||||||||||||||||||||||||||||||||||
| genai_perf_cmd_parts.append(f"--{k}={v}") | ||||||||||||||||||||||||||||||||||||||||||
| if extra_args := tdef.cmd_args.genai_perf.extra_args: | ||||||||||||||||||||||||||||||||||||||||||
| if isinstance(extra_args, str): | ||||||||||||||||||||||||||||||||||||||||||
| genai_perf_cmd_parts.extend(extra_args.split()) | ||||||||||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||||||||||
| genai_perf_cmd_parts.extend(extra_args) | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| # Build wrapper command with proper parameters | ||||||||||||||||||||||||||||||||||||||||||
| report_file = "genai_perf_report.csv" | ||||||||||||||||||||||||||||||||||||||||||
| wrapper_cmd = [ | ||||||||||||||||||||||||||||||||||||||||||
| "/bin/bash", | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+345
to
+349
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check if |
||||||||||||||||||||||||||||||||||||||||||
| pod_wrapper_path, | ||||||||||||||||||||||||||||||||||||||||||
| "--result_dir", | ||||||||||||||||||||||||||||||||||||||||||
| genai_perf_results_path, | ||||||||||||||||||||||||||||||||||||||||||
| "--report_file", | ||||||||||||||||||||||||||||||||||||||||||
| report_file, | ||||||||||||||||||||||||||||||||||||||||||
| "--calc_percentile_csv_script", | ||||||||||||||||||||||||||||||||||||||||||
| pod_calc_csv_path, | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+347
to
+356
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrapper flag mismatch: 🔧 Proposed fix- "--report_file",
+ "--report_name",📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
| "--gpus_per_node", | ||||||||||||||||||||||||||||||||||||||||||
| str(self.gpus_per_node), | ||||||||||||||||||||||||||||||||||||||||||
| "--", | ||||||||||||||||||||||||||||||||||||||||||
| *genai_perf_cmd_parts, | ||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| logging.debug(f"Executing genai-perf wrapper in pod={frontend_pod} cmd={wrapper_cmd}") | ||||||||||||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||||||||||||
| genai_results = lazy.k8s.stream.stream( | ||||||||||||||||||||||||||||||||||||||||||
| self.core_v1.connect_get_namespaced_pod_exec, | ||||||||||||||||||||||||||||||||||||||||||
| name=frontend_pod, | ||||||||||||||||||||||||||||||||||||||||||
| namespace=self.default_namespace, | ||||||||||||||||||||||||||||||||||||||||||
| command=genai_perf_cmd, | ||||||||||||||||||||||||||||||||||||||||||
| command=wrapper_cmd, | ||||||||||||||||||||||||||||||||||||||||||
| stderr=True, | ||||||||||||||||||||||||||||||||||||||||||
| stdin=False, | ||||||||||||||||||||||||||||||||||||||||||
| stdout=True, | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -326,7 +376,7 @@ def _run_genai_perf(self, job: KubernetesJob) -> None: | |||||||||||||||||||||||||||||||||||||||||
| with (job.test_run.output_path / "genai_perf.log").open("w") as f: | ||||||||||||||||||||||||||||||||||||||||||
| f.write(genai_results) | ||||||||||||||||||||||||||||||||||||||||||
| except lazy.k8s.client.ApiException as e: | ||||||||||||||||||||||||||||||||||||||||||
| logging.error(f"Error executing genai-perf command in pod '{frontend_pod}': {e}") | ||||||||||||||||||||||||||||||||||||||||||
| logging.error(f"Error executing genai-perf wrapper command in pod '{frontend_pod}': {e}") | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
karya0 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||
| cp_logs_cmd = " ".join( | ||||||||||||||||||||||||||||||||||||||||||
| [ | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.