acprof 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- acprof/__init__.py +3 -0
- acprof/__main__.py +5 -0
- acprof/_bundle/.dockerignore +20 -0
- acprof/_bundle/LICENSE +202 -0
- acprof/_bundle/NOTICE +43 -0
- acprof/_bundle/acprof/__init__.py +3 -0
- acprof/_bundle/acprof/__main__.py +5 -0
- acprof/_bundle/acprof/analysis/__init__.py +1 -0
- acprof/_bundle/acprof/analysis/audit.py +276 -0
- acprof/_bundle/acprof/analysis/comparison.py +364 -0
- acprof/_bundle/acprof/analysis/compatibility.py +223 -0
- acprof/_bundle/acprof/analysis/conditions.py +185 -0
- acprof/_bundle/acprof/analysis/independent_comparison.py +191 -0
- acprof/_bundle/acprof/analysis/latency_model.py +1106 -0
- acprof/_bundle/acprof/analysis/latency_report.py +577 -0
- acprof/_bundle/acprof/analysis/model.py +276 -0
- acprof/_bundle/acprof/analysis/precision.py +51 -0
- acprof/_bundle/acprof/analysis/uncertainty.py +144 -0
- acprof/_bundle/acprof/application/__init__.py +1 -0
- acprof/_bundle/acprof/application/download.py +14 -0
- acprof/_bundle/acprof/application/errors.py +5 -0
- acprof/_bundle/acprof/application/notifications.py +302 -0
- acprof/_bundle/acprof/application/preparation.py +333 -0
- acprof/_bundle/acprof/application/resources.py +66 -0
- acprof/_bundle/acprof/application/run.py +462 -0
- acprof/_bundle/acprof/application/terminal_log.py +136 -0
- acprof/_bundle/acprof/artifact_layout.py +261 -0
- acprof/_bundle/acprof/artifacts.py +161 -0
- acprof/_bundle/acprof/capabilities.py +404 -0
- acprof/_bundle/acprof/cli/__init__.py +1 -0
- acprof/_bundle/acprof/cli/audit.py +74 -0
- acprof/_bundle/acprof/cli/auto.py +41 -0
- acprof/_bundle/acprof/cli/backfill_compute.py +498 -0
- acprof/_bundle/acprof/cli/compare.py +34 -0
- acprof/_bundle/acprof/cli/coverage.py +70 -0
- acprof/_bundle/acprof/cli/doctor.py +47 -0
- acprof/_bundle/acprof/cli/inspect.py +101 -0
- acprof/_bundle/acprof/cli/load.py +190 -0
- acprof/_bundle/acprof/cli/main.py +64 -0
- acprof/_bundle/acprof/cli/model_store.py +22 -0
- acprof/_bundle/acprof/cli/plot.py +211 -0
- acprof/_bundle/acprof/cli/posthoc.py +113 -0
- acprof/_bundle/acprof/cli/probe.py +186 -0
- acprof/_bundle/acprof/cli/report.py +35 -0
- acprof/_bundle/acprof/cli/results.py +37 -0
- acprof/_bundle/acprof/cli/run.py +54 -0
- acprof/_bundle/acprof/cli/stats.py +94 -0
- acprof/_bundle/acprof/cli/tui.py +65 -0
- acprof/_bundle/acprof/config.py +177 -0
- acprof/_bundle/acprof/container/__init__.py +1 -0
- acprof/_bundle/acprof/container/compat/__init__.py +1 -0
- acprof/_bundle/acprof/container/compat/transformers_dynamic.py +54 -0
- acprof/_bundle/acprof/container/compat/transformers_model_types.json +1091 -0
- acprof/_bundle/acprof/container/compute_profile_runner.py +392 -0
- acprof/_bundle/acprof/container/download_model.py +165 -0
- acprof/_bundle/acprof/container/execution.py +73 -0
- acprof/_bundle/acprof/container/handlers/__init__.py +298 -0
- acprof/_bundle/acprof/container/handlers/audio.py +743 -0
- acprof/_bundle/acprof/container/handlers/custom_pipeline.py +74 -0
- acprof/_bundle/acprof/container/handlers/cv.py +321 -0
- acprof/_bundle/acprof/container/handlers/diffusion.py +728 -0
- acprof/_bundle/acprof/container/handlers/moss.py +64 -0
- acprof/_bundle/acprof/container/handlers/multimodal.py +609 -0
- acprof/_bundle/acprof/container/handlers/nlp.py +747 -0
- acprof/_bundle/acprof/container/handlers/onnx_tasks.py +231 -0
- acprof/_bundle/acprof/container/handlers/onnxruntime.py +90 -0
- acprof/_bundle/acprof/container/handlers/structured.py +185 -0
- acprof/_bundle/acprof/container/handlers/timeseries.py +178 -0
- acprof/_bundle/acprof/container/load_policy.py +81 -0
- acprof/_bundle/acprof/container/loading_quality.py +48 -0
- acprof/_bundle/acprof/container/local_pipeline.py +31 -0
- acprof/_bundle/acprof/container/model_files.py +280 -0
- acprof/_bundle/acprof/container/model_probe.py +80 -0
- acprof/_bundle/acprof/container/onnx_session.py +150 -0
- acprof/_bundle/acprof/container/runtime_manifest.py +150 -0
- acprof/_bundle/acprof/container/runtime_validate.py +156 -0
- acprof/_bundle/acprof/container/server.py +209 -0
- acprof/_bundle/acprof/container/torch_execution.py +55 -0
- acprof/_bundle/acprof/container/validation.py +172 -0
- acprof/_bundle/acprof/cpu_affinity.py +35 -0
- acprof/_bundle/acprof/dependency_locks.py +129 -0
- acprof/_bundle/acprof/experiment.py +356 -0
- acprof/_bundle/acprof/extensions/__init__.py +294 -0
- acprof/_bundle/acprof/extensions/builtin/manifest.json +3591 -0
- acprof/_bundle/acprof/extensions/onnxruntime/manifest.json +191 -0
- acprof/_bundle/acprof/extensions/schema.py +238 -0
- acprof/_bundle/acprof/extensions/transformers/4.57.6.json +1639 -0
- acprof/_bundle/acprof/extensions/transformers/5.10.4.json +1812 -0
- acprof/_bundle/acprof/failures.py +115 -0
- acprof/_bundle/acprof/hardware_conditions.py +18 -0
- acprof/_bundle/acprof/hf_download.py +143 -0
- acprof/_bundle/acprof/hf_endpoints.py +62 -0
- acprof/_bundle/acprof/hf_transport.py +238 -0
- acprof/_bundle/acprof/host/__init__.py +1 -0
- acprof/_bundle/acprof/host/automation.py +161 -0
- acprof/_bundle/acprof/host/client.py +520 -0
- acprof/_bundle/acprof/host/collection_history.py +77 -0
- acprof/_bundle/acprof/host/collection_workflow.py +285 -0
- acprof/_bundle/acprof/host/command.py +119 -0
- acprof/_bundle/acprof/host/container_lifecycle.py +225 -0
- acprof/_bundle/acprof/host/container_state.py +128 -0
- acprof/_bundle/acprof/host/coverage_state.py +259 -0
- acprof/_bundle/acprof/host/detect.py +669 -0
- acprof/_bundle/acprof/host/docker_runtime.py +359 -0
- acprof/_bundle/acprof/host/doctor.py +158 -0
- acprof/_bundle/acprof/host/env_utils.py +233 -0
- acprof/_bundle/acprof/host/execution_conditions.py +87 -0
- acprof/_bundle/acprof/host/gpu_device.py +66 -0
- acprof/_bundle/acprof/host/hardware_conditions.py +130 -0
- acprof/_bundle/acprof/host/images/__init__.py +1 -0
- acprof/_bundle/acprof/host/images/dependencies.py +169 -0
- acprof/_bundle/acprof/host/images/environment.py +313 -0
- acprof/_bundle/acprof/host/images/graph.py +143 -0
- acprof/_bundle/acprof/host/images/identity.py +6 -0
- acprof/_bundle/acprof/host/images/inventory.py +445 -0
- acprof/_bundle/acprof/host/images/runtime.py +457 -0
- acprof/_bundle/acprof/host/images/scan.py +154 -0
- acprof/_bundle/acprof/host/input_plan.py +1056 -0
- acprof/_bundle/acprof/host/interface_probe.py +141 -0
- acprof/_bundle/acprof/host/largest_scale_probe.py +566 -0
- acprof/_bundle/acprof/host/matrix_plan.py +98 -0
- acprof/_bundle/acprof/host/measurement/__init__.py +1 -0
- acprof/_bundle/acprof/host/measurement/boundary.py +162 -0
- acprof/_bundle/acprof/host/measurement/capture.py +139 -0
- acprof/_bundle/acprof/host/measurement/checkpoint.py +275 -0
- acprof/_bundle/acprof/host/measurement/config.py +212 -0
- acprof/_bundle/acprof/host/measurement/diagnostics.py +247 -0
- acprof/_bundle/acprof/host/measurement/energy_validation.py +172 -0
- acprof/_bundle/acprof/host/measurement/errors.py +25 -0
- acprof/_bundle/acprof/host/measurement/execution.py +396 -0
- acprof/_bundle/acprof/host/measurement/load.py +237 -0
- acprof/_bundle/acprof/host/measurement/metrics.py +975 -0
- acprof/_bundle/acprof/host/measurement/monitors.py +143 -0
- acprof/_bundle/acprof/host/measurement/publication.py +171 -0
- acprof/_bundle/acprof/host/measurement/requests.py +97 -0
- acprof/_bundle/acprof/host/measurement/types.py +82 -0
- acprof/_bundle/acprof/host/model_coverage.py +337 -0
- acprof/_bundle/acprof/host/model_errors.py +116 -0
- acprof/_bundle/acprof/host/model_inspection.py +107 -0
- acprof/_bundle/acprof/host/model_schema.py +35 -0
- acprof/_bundle/acprof/host/model_store.py +733 -0
- acprof/_bundle/acprof/host/network_preflight.py +229 -0
- acprof/_bundle/acprof/host/orchestrator.py +1133 -0
- acprof/_bundle/acprof/host/permissions.py +117 -0
- acprof/_bundle/acprof/host/platform_metadata.py +63 -0
- acprof/_bundle/acprof/host/posthoc/__init__.py +12 -0
- acprof/_bundle/acprof/host/posthoc/backfill.py +415 -0
- acprof/_bundle/acprof/host/posthoc/context.py +400 -0
- acprof/_bundle/acprof/host/posthoc/plans.py +597 -0
- acprof/_bundle/acprof/host/posthoc/service.py +303 -0
- acprof/_bundle/acprof/host/posthoc/storage.py +491 -0
- acprof/_bundle/acprof/host/preflight.py +370 -0
- acprof/_bundle/acprof/host/profiling/__init__.py +1 -0
- acprof/_bundle/acprof/host/profiling/compute.py +436 -0
- acprof/_bundle/acprof/host/profiling/compute_plan.py +261 -0
- acprof/_bundle/acprof/host/profiling/execution.py +547 -0
- acprof/_bundle/acprof/host/profiling/execution_plan.py +576 -0
- acprof/_bundle/acprof/host/profiling/progress.py +83 -0
- acprof/_bundle/acprof/host/profiling/support.py +252 -0
- acprof/_bundle/acprof/host/profiling/tools/__init__.py +1 -0
- acprof/_bundle/acprof/host/profiling/tools/advisor.py +164 -0
- acprof/_bundle/acprof/host/profiling/tools/compute_parsers.py +409 -0
- acprof/_bundle/acprof/host/profiling/tools/execution_environment.py +135 -0
- acprof/_bundle/acprof/host/profiling/tools/execution_parsers.py +364 -0
- acprof/_bundle/acprof/host/profiling/tools/massif.py +418 -0
- acprof/_bundle/acprof/host/profiling/tools/ncu.py +696 -0
- acprof/_bundle/acprof/host/profiling/tools/nsys.py +326 -0
- acprof/_bundle/acprof/host/profiling/tools/tool_discovery.py +229 -0
- acprof/_bundle/acprof/host/profiling/tools/torch.py +158 -0
- acprof/_bundle/acprof/host/result_cleanup.py +65 -0
- acprof/_bundle/acprof/host/run_state.py +639 -0
- acprof/_bundle/acprof/host/runtime_settings.py +10 -0
- acprof/_bundle/acprof/host/runtime_validation.py +302 -0
- acprof/_bundle/acprof/host/source_bundle.py +96 -0
- acprof/_bundle/acprof/host/startup_probe.py +95 -0
- acprof/_bundle/acprof/host/static_metadata.py +936 -0
- acprof/_bundle/acprof/host/task_support.py +121 -0
- acprof/_bundle/acprof/installation.py +26 -0
- acprof/_bundle/acprof/latency_slo.py +62 -0
- acprof/_bundle/acprof/messages.py +26 -0
- acprof/_bundle/acprof/metric_registry.py +315 -0
- acprof/_bundle/acprof/model_candidates.py +297 -0
- acprof/_bundle/acprof/model_contract.py +234 -0
- acprof/_bundle/acprof/model_dependencies.py +93 -0
- acprof/_bundle/acprof/model_dependency_domain.py +45 -0
- acprof/_bundle/acprof/model_dependency_eval.py +438 -0
- acprof/_bundle/acprof/model_dependency_flow.py +200 -0
- acprof/_bundle/acprof/model_evidence.py +115 -0
- acprof/_bundle/acprof/model_metadata_analysis.py +156 -0
- acprof/_bundle/acprof/model_repository.py +149 -0
- acprof/_bundle/acprof/model_resolution.py +129 -0
- acprof/_bundle/acprof/model_review.py +155 -0
- acprof/_bundle/acprof/model_source_analysis.py +299 -0
- acprof/_bundle/acprof/model_spec.py +204 -0
- acprof/_bundle/acprof/model_support.py +105 -0
- acprof/_bundle/acprof/model_transforms.py +81 -0
- acprof/_bundle/acprof/monitors/__init__.py +1 -0
- acprof/_bundle/acprof/monitors/common.py +63 -0
- acprof/_bundle/acprof/monitors/energy_cpu.py +651 -0
- acprof/_bundle/acprof/monitors/energy_nvml.py +381 -0
- acprof/_bundle/acprof/monitors/gpu_metrics.py +123 -0
- acprof/_bundle/acprof/monitors/interfaces.py +74 -0
- acprof/_bundle/acprof/monitors/perf_mips.py +617 -0
- acprof/_bundle/acprof/monitors/rapl_topology.py +100 -0
- acprof/_bundle/acprof/monitors/resource_metrics.py +472 -0
- acprof/_bundle/acprof/monitors/resource_readers.py +435 -0
- acprof/_bundle/acprof/monitors/resource_usage.py +450 -0
- acprof/_bundle/acprof/monitors/sampling.py +79 -0
- acprof/_bundle/acprof/network_policy.py +182 -0
- acprof/_bundle/acprof/notifications.py +279 -0
- acprof/_bundle/acprof/packet/__init__.py +1 -0
- acprof/_bundle/acprof/packet/merge_packet_latency.py +369 -0
- acprof/_bundle/acprof/packet/sniff_parse_pcap.py +240 -0
- acprof/_bundle/acprof/pixel_metrics.py +103 -0
- acprof/_bundle/acprof/platform.py +180 -0
- acprof/_bundle/acprof/plotting/__init__.py +1 -0
- acprof/_bundle/acprof/plotting/config.py +487 -0
- acprof/_bundle/acprof/plotting/data.py +236 -0
- acprof/_bundle/acprof/plotting/diagnostics.py +747 -0
- acprof/_bundle/acprof/plotting/latency.py +638 -0
- acprof/_bundle/acprof/plotting/metrics.py +648 -0
- acprof/_bundle/acprof/plotting/plotly-LICENSE.txt +21 -0
- acprof/_bundle/acprof/plotting/report.py +66 -0
- acprof/_bundle/acprof/plotting/styles.py +111 -0
- acprof/_bundle/acprof/precision.py +42 -0
- acprof/_bundle/acprof/preparation_events.py +78 -0
- acprof/_bundle/acprof/progress_events.py +105 -0
- acprof/_bundle/acprof/quality.py +153 -0
- acprof/_bundle/acprof/resource_budget.py +29 -0
- acprof/_bundle/acprof/result_csv.py +263 -0
- acprof/_bundle/acprof/result_layers.py +365 -0
- acprof/_bundle/acprof/run_args.py +223 -0
- acprof/_bundle/acprof/run_options.py +225 -0
- acprof/_bundle/acprof/runtime_dependencies.py +195 -0
- acprof/_bundle/acprof/runtime_profiles.py +258 -0
- acprof/_bundle/acprof/runtime_settings.py +72 -0
- acprof/_bundle/acprof/source_identity.py +68 -0
- acprof/_bundle/acprof/telemetry.py +225 -0
- acprof/_bundle/acprof/testing/__init__.py +1 -0
- acprof/_bundle/acprof/testing/evidence.py +117 -0
- acprof/_bundle/acprof/testing/plugin.py +126 -0
- acprof/_bundle/acprof/testing/provenance.py +53 -0
- acprof/_bundle/acprof/testing/sharding.py +14 -0
- acprof/_bundle/acprof/tui/__init__.py +1 -0
- acprof/_bundle/acprof/tui/app.py +934 -0
- acprof/_bundle/acprof/tui/app_contracts.py +43 -0
- acprof/_bundle/acprof/tui/catalog_controller.py +120 -0
- acprof/_bundle/acprof/tui/commands.py +209 -0
- acprof/_bundle/acprof/tui/configuration_controller.py +436 -0
- acprof/_bundle/acprof/tui/diagnostics.py +340 -0
- acprof/_bundle/acprof/tui/downloads.py +56 -0
- acprof/_bundle/acprof/tui/environment.py +248 -0
- acprof/_bundle/acprof/tui/experiment_catalog.py +279 -0
- acprof/_bundle/acprof/tui/experiment_controller.py +132 -0
- acprof/_bundle/acprof/tui/experiment_picker.py +273 -0
- acprof/_bundle/acprof/tui/field_validation.py +62 -0
- acprof/_bundle/acprof/tui/i18n.py +57 -0
- acprof/_bundle/acprof/tui/image_controller.py +525 -0
- acprof/_bundle/acprof/tui/images.py +737 -0
- acprof/_bundle/acprof/tui/input.py +191 -0
- acprof/_bundle/acprof/tui/localization_controller.py +110 -0
- acprof/_bundle/acprof/tui/log.py +310 -0
- acprof/_bundle/acprof/tui/model_candidates.py +278 -0
- acprof/_bundle/acprof/tui/model_controller.py +111 -0
- acprof/_bundle/acprof/tui/model_input.py +12 -0
- acprof/_bundle/acprof/tui/model_store.py +166 -0
- acprof/_bundle/acprof/tui/preflight_controller.py +271 -0
- acprof/_bundle/acprof/tui/preparation.py +269 -0
- acprof/_bundle/acprof/tui/presentation.py +46 -0
- acprof/_bundle/acprof/tui/process.py +111 -0
- acprof/_bundle/acprof/tui/process_controller.py +218 -0
- acprof/_bundle/acprof/tui/profile_controller.py +109 -0
- acprof/_bundle/acprof/tui/progress.py +195 -0
- acprof/_bundle/acprof/tui/recovery.py +114 -0
- acprof/_bundle/acprof/tui/recovery_controller.py +169 -0
- acprof/_bundle/acprof/tui/rendering.py +75 -0
- acprof/_bundle/acprof/tui/reports.py +303 -0
- acprof/_bundle/acprof/tui/result_controller.py +279 -0
- acprof/_bundle/acprof/tui/review_inputs.py +54 -0
- acprof/_bundle/acprof/tui/run_form.py +125 -0
- acprof/_bundle/acprof/tui/run_planning.py +97 -0
- acprof/_bundle/acprof/tui/run_results.py +175 -0
- acprof/_bundle/acprof/tui/scrollbar.py +65 -0
- acprof/_bundle/acprof/tui/settings.py +203 -0
- acprof/_bundle/acprof/tui/slash_controller.py +95 -0
- acprof/_bundle/acprof/tui/stages.py +97 -0
- acprof/_bundle/acprof/tui/storage.py +150 -0
- acprof/_bundle/acprof/tui/table.py +213 -0
- acprof/_bundle/acprof/tui/themes.py +112 -0
- acprof/_bundle/acprof/tui/translation_catalog.py +1861 -0
- acprof/_bundle/acprof/tui/tui.tcss +373 -0
- acprof/_bundle/acprof/tui/views.py +706 -0
- acprof/_bundle/acprof/window_records.py +165 -0
- acprof/_bundle/acprof/workloads/__init__.py +222 -0
- acprof/_bundle/acprof/workloads/audio.py +621 -0
- acprof/_bundle/acprof/workloads/contract.py +116 -0
- acprof/_bundle/acprof/workloads/cv.py +240 -0
- acprof/_bundle/acprof/workloads/diffusion.py +410 -0
- acprof/_bundle/acprof/workloads/multimodal.py +329 -0
- acprof/_bundle/acprof/workloads/nlp.py +151 -0
- acprof/_bundle/acprof/workloads/structured.py +151 -0
- acprof/_bundle/acprof/workloads/timeseries.py +69 -0
- acprof/_bundle/assets/audio/librispeech-clean-test-en-30s/audio.wav +0 -0
- acprof/_bundle/assets/audio/librispeech-clean-test-en-30s/source.json +81 -0
- acprof/_bundle/dockerfiles/environment_tools.py +314 -0
- acprof/_bundle/dockerfiles/locks/audio-cpu.artifacts.json +503 -0
- acprof/_bundle/dockerfiles/locks/audio-cpu.txt +143 -0
- acprof/_bundle/dockerfiles/locks/audio-cu124.artifacts.json +600 -0
- acprof/_bundle/dockerfiles/locks/audio-cu124.txt +171 -0
- acprof/_bundle/dockerfiles/locks/audio-cu128.artifacts.json +544 -0
- acprof/_bundle/dockerfiles/locks/audio-cu128.txt +155 -0
- acprof/_bundle/dockerfiles/locks/custom-multimodal-cpu.artifacts.json +510 -0
- acprof/_bundle/dockerfiles/locks/custom-multimodal-cpu.txt +145 -0
- acprof/_bundle/dockerfiles/locks/custom-multimodal-cu124.artifacts.json +607 -0
- acprof/_bundle/dockerfiles/locks/custom-multimodal-cu124.txt +173 -0
- acprof/_bundle/dockerfiles/locks/custom-multimodal-cu128.artifacts.json +642 -0
- acprof/_bundle/dockerfiles/locks/custom-multimodal-cu128.txt +183 -0
- acprof/_bundle/dockerfiles/locks/cv-cpu.artifacts.json +279 -0
- acprof/_bundle/dockerfiles/locks/cv-cpu.txt +79 -0
- acprof/_bundle/dockerfiles/locks/cv-cu124.artifacts.json +376 -0
- acprof/_bundle/dockerfiles/locks/cv-cu124.txt +107 -0
- acprof/_bundle/dockerfiles/locks/cv-cu128.artifacts.json +411 -0
- acprof/_bundle/dockerfiles/locks/cv-cu128.txt +117 -0
- acprof/_bundle/dockerfiles/locks/diffusion-cpu.artifacts.json +335 -0
- acprof/_bundle/dockerfiles/locks/diffusion-cpu.txt +95 -0
- acprof/_bundle/dockerfiles/locks/diffusion-cu124.artifacts.json +432 -0
- acprof/_bundle/dockerfiles/locks/diffusion-cu124.txt +123 -0
- acprof/_bundle/dockerfiles/locks/diffusion-cu128.artifacts.json +467 -0
- acprof/_bundle/dockerfiles/locks/diffusion-cu128.txt +133 -0
- acprof/_bundle/dockerfiles/locks/moss-transformers5104.artifacts.json +621 -0
- acprof/_bundle/dockerfiles/locks/moss-transformers5104.txt +177 -0
- acprof/_bundle/dockerfiles/locks/multimodal-transformers4576.artifacts.json +635 -0
- acprof/_bundle/dockerfiles/locks/multimodal-transformers4576.txt +181 -0
- acprof/_bundle/dockerfiles/locks/nlp-cpu.artifacts.json +363 -0
- acprof/_bundle/dockerfiles/locks/nlp-cpu.txt +103 -0
- acprof/_bundle/dockerfiles/locks/nlp-cu124.artifacts.json +460 -0
- acprof/_bundle/dockerfiles/locks/nlp-cu124.txt +131 -0
- acprof/_bundle/dockerfiles/locks/nlp-cu128.artifacts.json +495 -0
- acprof/_bundle/dockerfiles/locks/nlp-cu128.txt +141 -0
- acprof/_bundle/dockerfiles/locks/onnxruntime-cpu.artifacts.json +261 -0
- acprof/_bundle/dockerfiles/locks/onnxruntime-cpu.txt +73 -0
- acprof/_bundle/dockerfiles/locks/platform-cpu.artifacts.json +99 -0
- acprof/_bundle/dockerfiles/locks/platform-cpu.txt +27 -0
- acprof/_bundle/dockerfiles/locks/platform-cu124.artifacts.json +196 -0
- acprof/_bundle/dockerfiles/locks/platform-cu124.txt +55 -0
- acprof/_bundle/dockerfiles/locks/platform-cu128.artifacts.json +231 -0
- acprof/_bundle/dockerfiles/locks/platform-cu128.txt +65 -0
- acprof/_bundle/dockerfiles/locks/platform-python-cpu.artifacts.json +37 -0
- acprof/_bundle/dockerfiles/locks/platform-python-cpu.txt +9 -0
- acprof/_bundle/dockerfiles/locks/structured-cpu.artifacts.json +279 -0
- acprof/_bundle/dockerfiles/locks/structured-cpu.txt +79 -0
- acprof/_bundle/dockerfiles/locks/structured-cu124.artifacts.json +376 -0
- acprof/_bundle/dockerfiles/locks/structured-cu124.txt +107 -0
- acprof/_bundle/dockerfiles/locks/structured-cu128.artifacts.json +411 -0
- acprof/_bundle/dockerfiles/locks/structured-cu128.txt +117 -0
- acprof/_bundle/dockerfiles/locks/system-trixie-amd64.json +620 -0
- acprof/_bundle/dockerfiles/locks/timeseries-cpu.artifacts.json +314 -0
- acprof/_bundle/dockerfiles/locks/timeseries-cpu.txt +89 -0
- acprof/_bundle/dockerfiles/locks/timeseries-cu124.artifacts.json +411 -0
- acprof/_bundle/dockerfiles/locks/timeseries-cu124.txt +117 -0
- acprof/_bundle/dockerfiles/locks/timeseries-cu128.artifacts.json +446 -0
- acprof/_bundle/dockerfiles/locks/timeseries-cu128.txt +127 -0
- acprof/_bundle/dockerfiles/locks/transformers5104-cpu.artifacts.json +594 -0
- acprof/_bundle/dockerfiles/locks/transformers5104-cpu.txt +169 -0
- acprof/_bundle/dockerfiles/locks/transformers5104-cu124.artifacts.json +691 -0
- acprof/_bundle/dockerfiles/locks/transformers5104-cu124.txt +197 -0
- acprof/_bundle/dockerfiles/locks/transformers5104-cu128.artifacts.json +726 -0
- acprof/_bundle/dockerfiles/locks/transformers5104-cu128.txt +207 -0
- acprof/_bundle/dockerfiles/platform.Dockerfile +22 -0
- acprof/_bundle/dockerfiles/requirements/audio.in +5 -0
- acprof/_bundle/dockerfiles/requirements/custom-multimodal.in +2 -0
- acprof/_bundle/dockerfiles/requirements/cv.in +4 -0
- acprof/_bundle/dockerfiles/requirements/diffusion.in +6 -0
- acprof/_bundle/dockerfiles/requirements/moss-transformers5104.in +9 -0
- acprof/_bundle/dockerfiles/requirements/multimodal-transformers4576.in +3 -0
- acprof/_bundle/dockerfiles/requirements/nlp.in +7 -0
- acprof/_bundle/dockerfiles/requirements/onnxruntime.in +9 -0
- acprof/_bundle/dockerfiles/requirements/service.in +8 -0
- acprof/_bundle/dockerfiles/requirements/structured.in +4 -0
- acprof/_bundle/dockerfiles/requirements/timeseries.in +2 -0
- acprof/_bundle/dockerfiles/requirements/timm.in +1 -0
- acprof/_bundle/dockerfiles/requirements/transformers5104.in +4 -0
- acprof/_bundle/dockerfiles/runtime-final.Dockerfile +34 -0
- acprof/_bundle/dockerfiles/runtime-model.Dockerfile +19 -0
- acprof/_bundle/dockerfiles/runtime.Dockerfile +23 -0
- acprof/_bundle/examples/coverage/regression.json +17 -0
- acprof/_bundle/examples/hardware-validation.json +19 -0
- acprof/_bundle/examples/multimodal/ultravox.model.json +29 -0
- acprof/_bundle/examples/nlp/smoke.py +111 -0
- acprof/_bundle/examples/onnxruntime/fixtures.py +164 -0
- acprof/_bundle/examples/onnxruntime/iris.json +16 -0
- acprof/_bundle/examples/onnxruntime/iris.model.json +7 -0
- acprof/_bundle/examples/onnxruntime/real_models.py +155 -0
- acprof/_bundle/examples/onnxruntime/smoke.py +68 -0
- acprof/_bundle/examples/structured/chronos_smoke.py +56 -0
- acprof/_bundle/examples/structured/export_models.py +71 -0
- acprof/_bundle/examples/structured/smoke.py +71 -0
- acprof/_bundle/licenses/CC-BY-4.0.txt +156 -0
- acprof/analysis/__init__.py +1 -0
- acprof/analysis/audit.py +276 -0
- acprof/analysis/comparison.py +364 -0
- acprof/analysis/compatibility.py +223 -0
- acprof/analysis/conditions.py +185 -0
- acprof/analysis/independent_comparison.py +191 -0
- acprof/analysis/latency_model.py +1106 -0
- acprof/analysis/latency_report.py +577 -0
- acprof/analysis/model.py +276 -0
- acprof/analysis/precision.py +51 -0
- acprof/analysis/uncertainty.py +144 -0
- acprof/application/__init__.py +1 -0
- acprof/application/download.py +14 -0
- acprof/application/errors.py +5 -0
- acprof/application/notifications.py +302 -0
- acprof/application/preparation.py +333 -0
- acprof/application/resources.py +66 -0
- acprof/application/run.py +462 -0
- acprof/application/terminal_log.py +136 -0
- acprof/artifact_layout.py +261 -0
- acprof/artifacts.py +161 -0
- acprof/capabilities.py +404 -0
- acprof/cli/__init__.py +1 -0
- acprof/cli/audit.py +74 -0
- acprof/cli/auto.py +41 -0
- acprof/cli/backfill_compute.py +498 -0
- acprof/cli/compare.py +34 -0
- acprof/cli/coverage.py +70 -0
- acprof/cli/doctor.py +47 -0
- acprof/cli/inspect.py +101 -0
- acprof/cli/load.py +190 -0
- acprof/cli/main.py +64 -0
- acprof/cli/model_store.py +22 -0
- acprof/cli/plot.py +211 -0
- acprof/cli/posthoc.py +113 -0
- acprof/cli/probe.py +186 -0
- acprof/cli/report.py +35 -0
- acprof/cli/results.py +37 -0
- acprof/cli/run.py +54 -0
- acprof/cli/stats.py +94 -0
- acprof/cli/tui.py +65 -0
- acprof/config.py +177 -0
- acprof/container/__init__.py +1 -0
- acprof/container/compat/__init__.py +1 -0
- acprof/container/compat/transformers_dynamic.py +54 -0
- acprof/container/compat/transformers_model_types.json +1091 -0
- acprof/container/compute_profile_runner.py +392 -0
- acprof/container/download_model.py +165 -0
- acprof/container/execution.py +73 -0
- acprof/container/handlers/__init__.py +298 -0
- acprof/container/handlers/audio.py +743 -0
- acprof/container/handlers/custom_pipeline.py +74 -0
- acprof/container/handlers/cv.py +321 -0
- acprof/container/handlers/diffusion.py +728 -0
- acprof/container/handlers/moss.py +64 -0
- acprof/container/handlers/multimodal.py +609 -0
- acprof/container/handlers/nlp.py +747 -0
- acprof/container/handlers/onnx_tasks.py +231 -0
- acprof/container/handlers/onnxruntime.py +90 -0
- acprof/container/handlers/structured.py +185 -0
- acprof/container/handlers/timeseries.py +178 -0
- acprof/container/load_policy.py +81 -0
- acprof/container/loading_quality.py +48 -0
- acprof/container/local_pipeline.py +31 -0
- acprof/container/model_files.py +280 -0
- acprof/container/model_probe.py +80 -0
- acprof/container/onnx_session.py +150 -0
- acprof/container/runtime_manifest.py +150 -0
- acprof/container/runtime_validate.py +156 -0
- acprof/container/server.py +209 -0
- acprof/container/torch_execution.py +55 -0
- acprof/container/validation.py +172 -0
- acprof/cpu_affinity.py +35 -0
- acprof/dependency_locks.py +129 -0
- acprof/experiment.py +356 -0
- acprof/extensions/__init__.py +294 -0
- acprof/extensions/builtin/manifest.json +3591 -0
- acprof/extensions/onnxruntime/manifest.json +191 -0
- acprof/extensions/schema.py +238 -0
- acprof/extensions/transformers/4.57.6.json +1639 -0
- acprof/extensions/transformers/5.10.4.json +1812 -0
- acprof/failures.py +115 -0
- acprof/hardware_conditions.py +18 -0
- acprof/hf_download.py +143 -0
- acprof/hf_endpoints.py +62 -0
- acprof/hf_transport.py +238 -0
- acprof/host/__init__.py +1 -0
- acprof/host/automation.py +161 -0
- acprof/host/client.py +520 -0
- acprof/host/collection_history.py +77 -0
- acprof/host/collection_workflow.py +285 -0
- acprof/host/command.py +119 -0
- acprof/host/container_lifecycle.py +225 -0
- acprof/host/container_state.py +128 -0
- acprof/host/coverage_state.py +259 -0
- acprof/host/detect.py +669 -0
- acprof/host/docker_runtime.py +359 -0
- acprof/host/doctor.py +158 -0
- acprof/host/env_utils.py +233 -0
- acprof/host/execution_conditions.py +87 -0
- acprof/host/gpu_device.py +66 -0
- acprof/host/hardware_conditions.py +130 -0
- acprof/host/images/__init__.py +1 -0
- acprof/host/images/dependencies.py +169 -0
- acprof/host/images/environment.py +313 -0
- acprof/host/images/graph.py +143 -0
- acprof/host/images/identity.py +6 -0
- acprof/host/images/inventory.py +445 -0
- acprof/host/images/runtime.py +457 -0
- acprof/host/images/scan.py +154 -0
- acprof/host/input_plan.py +1056 -0
- acprof/host/interface_probe.py +141 -0
- acprof/host/largest_scale_probe.py +566 -0
- acprof/host/matrix_plan.py +98 -0
- acprof/host/measurement/__init__.py +1 -0
- acprof/host/measurement/boundary.py +162 -0
- acprof/host/measurement/capture.py +139 -0
- acprof/host/measurement/checkpoint.py +275 -0
- acprof/host/measurement/config.py +212 -0
- acprof/host/measurement/diagnostics.py +247 -0
- acprof/host/measurement/energy_validation.py +172 -0
- acprof/host/measurement/errors.py +25 -0
- acprof/host/measurement/execution.py +396 -0
- acprof/host/measurement/load.py +237 -0
- acprof/host/measurement/metrics.py +975 -0
- acprof/host/measurement/monitors.py +143 -0
- acprof/host/measurement/publication.py +171 -0
- acprof/host/measurement/requests.py +97 -0
- acprof/host/measurement/types.py +82 -0
- acprof/host/model_coverage.py +337 -0
- acprof/host/model_errors.py +116 -0
- acprof/host/model_inspection.py +107 -0
- acprof/host/model_schema.py +35 -0
- acprof/host/model_store.py +733 -0
- acprof/host/network_preflight.py +229 -0
- acprof/host/orchestrator.py +1133 -0
- acprof/host/permissions.py +117 -0
- acprof/host/platform_metadata.py +63 -0
- acprof/host/posthoc/__init__.py +12 -0
- acprof/host/posthoc/backfill.py +415 -0
- acprof/host/posthoc/context.py +400 -0
- acprof/host/posthoc/plans.py +597 -0
- acprof/host/posthoc/service.py +303 -0
- acprof/host/posthoc/storage.py +491 -0
- acprof/host/preflight.py +370 -0
- acprof/host/profiling/__init__.py +1 -0
- acprof/host/profiling/compute.py +436 -0
- acprof/host/profiling/compute_plan.py +261 -0
- acprof/host/profiling/execution.py +547 -0
- acprof/host/profiling/execution_plan.py +576 -0
- acprof/host/profiling/progress.py +83 -0
- acprof/host/profiling/support.py +252 -0
- acprof/host/profiling/tools/__init__.py +1 -0
- acprof/host/profiling/tools/advisor.py +164 -0
- acprof/host/profiling/tools/compute_parsers.py +409 -0
- acprof/host/profiling/tools/execution_environment.py +135 -0
- acprof/host/profiling/tools/execution_parsers.py +364 -0
- acprof/host/profiling/tools/massif.py +418 -0
- acprof/host/profiling/tools/ncu.py +696 -0
- acprof/host/profiling/tools/nsys.py +326 -0
- acprof/host/profiling/tools/tool_discovery.py +229 -0
- acprof/host/profiling/tools/torch.py +158 -0
- acprof/host/result_cleanup.py +65 -0
- acprof/host/run_state.py +639 -0
- acprof/host/runtime_settings.py +10 -0
- acprof/host/runtime_validation.py +302 -0
- acprof/host/source_bundle.py +96 -0
- acprof/host/startup_probe.py +95 -0
- acprof/host/static_metadata.py +936 -0
- acprof/host/task_support.py +121 -0
- acprof/installation.py +26 -0
- acprof/latency_slo.py +62 -0
- acprof/messages.py +26 -0
- acprof/metric_registry.py +315 -0
- acprof/model_candidates.py +297 -0
- acprof/model_contract.py +234 -0
- acprof/model_dependencies.py +93 -0
- acprof/model_dependency_domain.py +45 -0
- acprof/model_dependency_eval.py +438 -0
- acprof/model_dependency_flow.py +200 -0
- acprof/model_evidence.py +115 -0
- acprof/model_metadata_analysis.py +156 -0
- acprof/model_repository.py +149 -0
- acprof/model_resolution.py +129 -0
- acprof/model_review.py +155 -0
- acprof/model_source_analysis.py +299 -0
- acprof/model_spec.py +204 -0
- acprof/model_support.py +105 -0
- acprof/model_transforms.py +81 -0
- acprof/monitors/__init__.py +1 -0
- acprof/monitors/common.py +63 -0
- acprof/monitors/energy_cpu.py +651 -0
- acprof/monitors/energy_nvml.py +381 -0
- acprof/monitors/gpu_metrics.py +123 -0
- acprof/monitors/interfaces.py +74 -0
- acprof/monitors/perf_mips.py +617 -0
- acprof/monitors/rapl_topology.py +100 -0
- acprof/monitors/resource_metrics.py +472 -0
- acprof/monitors/resource_readers.py +435 -0
- acprof/monitors/resource_usage.py +450 -0
- acprof/monitors/sampling.py +79 -0
- acprof/network_policy.py +182 -0
- acprof/notifications.py +279 -0
- acprof/packet/__init__.py +1 -0
- acprof/packet/merge_packet_latency.py +369 -0
- acprof/packet/sniff_parse_pcap.py +240 -0
- acprof/pixel_metrics.py +103 -0
- acprof/platform.py +180 -0
- acprof/plotting/__init__.py +1 -0
- acprof/plotting/config.py +487 -0
- acprof/plotting/data.py +236 -0
- acprof/plotting/diagnostics.py +747 -0
- acprof/plotting/latency.py +638 -0
- acprof/plotting/metrics.py +648 -0
- acprof/plotting/plotly-LICENSE.txt +21 -0
- acprof/plotting/report.css +61 -0
- acprof/plotting/report.html +68 -0
- acprof/plotting/report.js +295 -0
- acprof/plotting/report.py +66 -0
- acprof/plotting/styles.py +111 -0
- acprof/plotting/view_model.js +145 -0
- acprof/precision.py +42 -0
- acprof/preparation_events.py +78 -0
- acprof/progress_events.py +105 -0
- acprof/quality.py +153 -0
- acprof/resource_budget.py +29 -0
- acprof/result_csv.py +263 -0
- acprof/result_layers.py +365 -0
- acprof/run_args.py +223 -0
- acprof/run_options.py +225 -0
- acprof/runtime_dependencies.py +195 -0
- acprof/runtime_profiles.py +258 -0
- acprof/runtime_settings.py +72 -0
- acprof/source_identity.py +68 -0
- acprof/telemetry.py +225 -0
- acprof/testing/__init__.py +1 -0
- acprof/testing/evidence.py +117 -0
- acprof/testing/plugin.py +126 -0
- acprof/testing/provenance.py +53 -0
- acprof/testing/sharding.py +14 -0
- acprof/tui/__init__.py +1 -0
- acprof/tui/app.py +934 -0
- acprof/tui/app_contracts.py +43 -0
- acprof/tui/catalog_controller.py +120 -0
- acprof/tui/commands.py +209 -0
- acprof/tui/configuration_controller.py +436 -0
- acprof/tui/diagnostics.py +340 -0
- acprof/tui/downloads.py +56 -0
- acprof/tui/environment.py +248 -0
- acprof/tui/experiment_catalog.py +279 -0
- acprof/tui/experiment_controller.py +132 -0
- acprof/tui/experiment_picker.py +273 -0
- acprof/tui/field_validation.py +62 -0
- acprof/tui/i18n.py +57 -0
- acprof/tui/image_controller.py +525 -0
- acprof/tui/images.py +737 -0
- acprof/tui/input.py +191 -0
- acprof/tui/localization_controller.py +110 -0
- acprof/tui/log.py +310 -0
- acprof/tui/model_candidates.py +278 -0
- acprof/tui/model_controller.py +111 -0
- acprof/tui/model_input.py +12 -0
- acprof/tui/model_store.py +166 -0
- acprof/tui/preflight_controller.py +271 -0
- acprof/tui/preparation.py +269 -0
- acprof/tui/presentation.py +46 -0
- acprof/tui/process.py +111 -0
- acprof/tui/process_controller.py +218 -0
- acprof/tui/profile_controller.py +109 -0
- acprof/tui/progress.py +195 -0
- acprof/tui/recovery.py +114 -0
- acprof/tui/recovery_controller.py +169 -0
- acprof/tui/rendering.py +75 -0
- acprof/tui/reports.py +303 -0
- acprof/tui/result_controller.py +279 -0
- acprof/tui/review_inputs.py +54 -0
- acprof/tui/run_form.py +125 -0
- acprof/tui/run_planning.py +97 -0
- acprof/tui/run_results.py +175 -0
- acprof/tui/scrollbar.py +65 -0
- acprof/tui/settings.py +203 -0
- acprof/tui/slash_controller.py +95 -0
- acprof/tui/stages.py +97 -0
- acprof/tui/storage.py +150 -0
- acprof/tui/table.py +213 -0
- acprof/tui/themes.py +112 -0
- acprof/tui/translation_catalog.py +1861 -0
- acprof/tui/tui.tcss +373 -0
- acprof/tui/views.py +706 -0
- acprof/window_records.py +165 -0
- acprof/workloads/__init__.py +222 -0
- acprof/workloads/audio.py +621 -0
- acprof/workloads/contract.py +116 -0
- acprof/workloads/cv.py +240 -0
- acprof/workloads/diffusion.py +410 -0
- acprof/workloads/multimodal.py +329 -0
- acprof/workloads/nlp.py +151 -0
- acprof/workloads/structured.py +151 -0
- acprof/workloads/timeseries.py +69 -0
- acprof-0.3.0.dist-info/METADATA +117 -0
- acprof-0.3.0.dist-info/RECORD +704 -0
- acprof-0.3.0.dist-info/WHEEL +4 -0
- acprof-0.3.0.dist-info/entry_points.txt +2 -0
- acprof-0.3.0.dist-info/licenses/LICENSE +202 -0
- acprof-0.3.0.dist-info/licenses/NOTICE +43 -0
- acprof-0.3.0.dist-info/licenses/licenses/CC-BY-4.0.txt +156 -0
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
"""Best-effort run webhook events isolated from runtime and measurement logic."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import csv
|
|
5
|
+
import sys
|
|
6
|
+
import time
|
|
7
|
+
from dataclasses import dataclass, replace
|
|
8
|
+
|
|
9
|
+
from acprof.host.orchestrator import MatrixProgress
|
|
10
|
+
from acprof.host.profiling.progress import ProfilerProgress
|
|
11
|
+
from acprof.notifications import (
|
|
12
|
+
NotificationConfigError,
|
|
13
|
+
NotificationError,
|
|
14
|
+
NotificationEvent,
|
|
15
|
+
WeComWebhookNotifier,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@dataclass
|
|
20
|
+
class RunNotificationContext:
|
|
21
|
+
"""Mutable lifecycle state; the webhook itself is never logged or persisted."""
|
|
22
|
+
|
|
23
|
+
notifier: WeComWebhookNotifier
|
|
24
|
+
model_id: str
|
|
25
|
+
output_dir: str
|
|
26
|
+
started_at: float
|
|
27
|
+
run_command: str = ""
|
|
28
|
+
total_cases: int | None = None
|
|
29
|
+
event: NotificationEvent | None = None
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _result_status_counts(result_csv: str) -> tuple[int, int]:
|
|
35
|
+
result_rows = 0
|
|
36
|
+
error_rows = 0
|
|
37
|
+
with open(result_csv, encoding="utf-8", newline="") as f:
|
|
38
|
+
for row in csv.DictReader(f):
|
|
39
|
+
result_rows += 1
|
|
40
|
+
if str(row.get("status") or "").strip().lower() == "error":
|
|
41
|
+
error_rows += 1
|
|
42
|
+
return result_rows, error_rows
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _send_notification_event(
|
|
46
|
+
context: RunNotificationContext,
|
|
47
|
+
event: NotificationEvent,
|
|
48
|
+
*,
|
|
49
|
+
success_message: str,
|
|
50
|
+
) -> None:
|
|
51
|
+
"""Deliver one event without allowing notification errors to escape."""
|
|
52
|
+
try:
|
|
53
|
+
context.notifier.send(event)
|
|
54
|
+
except NotificationError as exc:
|
|
55
|
+
print(f"[notify][WARN] 企业微信通知发送失败:{exc}", file=sys.stderr)
|
|
56
|
+
except Exception as exc:
|
|
57
|
+
# Unknown provider errors may embed request details. Print only the
|
|
58
|
+
# exception type so credentials can never be copied into terminal logs.
|
|
59
|
+
print(
|
|
60
|
+
"[notify][WARN] 企业微信通知发送失败:"
|
|
61
|
+
f"{type(exc).__name__}",
|
|
62
|
+
file=sys.stderr,
|
|
63
|
+
)
|
|
64
|
+
else:
|
|
65
|
+
print(success_message)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class RunNotifications:
|
|
70
|
+
"""An isolated notification context for exactly one application owner."""
|
|
71
|
+
|
|
72
|
+
def __init__(self) -> None:
|
|
73
|
+
self.context: RunNotificationContext | None = None
|
|
74
|
+
|
|
75
|
+
def active(self) -> bool:
|
|
76
|
+
"""Whether a current run has an enabled notification sink."""
|
|
77
|
+
return self.context is not None
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def reset(self) -> None:
|
|
81
|
+
"""Clear the previous run's sensitive notification context."""
|
|
82
|
+
self.context = None
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def activate(
|
|
86
|
+
self,
|
|
87
|
+
*,
|
|
88
|
+
provider: str,
|
|
89
|
+
model_id: str,
|
|
90
|
+
output_dir: str,
|
|
91
|
+
started_at: float,
|
|
92
|
+
run_command: str,
|
|
93
|
+
) -> None:
|
|
94
|
+
"""Configure a notifier without making any network request."""
|
|
95
|
+
|
|
96
|
+
self.context = None
|
|
97
|
+
if provider == "none":
|
|
98
|
+
return
|
|
99
|
+
if provider not in {"auto", "wecom"}:
|
|
100
|
+
print(f"[notify][WARN] Unsupported notification provider: {provider}")
|
|
101
|
+
return
|
|
102
|
+
|
|
103
|
+
try:
|
|
104
|
+
notifier = WeComWebhookNotifier.from_env()
|
|
105
|
+
except NotificationConfigError as exc:
|
|
106
|
+
if provider == "wecom":
|
|
107
|
+
print(f"[notify][WARN] 企业微信通知未启用:{exc}", file=sys.stderr)
|
|
108
|
+
return
|
|
109
|
+
|
|
110
|
+
self.context = RunNotificationContext(
|
|
111
|
+
notifier=notifier,
|
|
112
|
+
model_id=model_id,
|
|
113
|
+
output_dir=output_dir,
|
|
114
|
+
started_at=started_at,
|
|
115
|
+
run_command=run_command,
|
|
116
|
+
)
|
|
117
|
+
print(
|
|
118
|
+
"[notify] 企业微信通知已启用;实验开始、每个 profiler 阶段和 case "
|
|
119
|
+
"结束后、实验结束时发送通知"
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def notify_started(self) -> None:
|
|
124
|
+
"""Report the command before preflight/build work and any measurements."""
|
|
125
|
+
context = self.context
|
|
126
|
+
if context is None:
|
|
127
|
+
return
|
|
128
|
+
|
|
129
|
+
event = NotificationEvent(
|
|
130
|
+
status="started",
|
|
131
|
+
model_id=context.model_id,
|
|
132
|
+
output_dir=context.output_dir,
|
|
133
|
+
elapsed_seconds=time.perf_counter() - context.started_at,
|
|
134
|
+
run_command=context.run_command,
|
|
135
|
+
detail="命令已启动,正在执行环境预检",
|
|
136
|
+
)
|
|
137
|
+
_send_notification_event(
|
|
138
|
+
context,
|
|
139
|
+
event,
|
|
140
|
+
success_message="[notify] 企业微信实验开始通知已发送",
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def update_plan(
|
|
145
|
+
self,
|
|
146
|
+
*,
|
|
147
|
+
model_id: str,
|
|
148
|
+
output_dir: str,
|
|
149
|
+
total_cases: int,
|
|
150
|
+
) -> None:
|
|
151
|
+
context = self.context
|
|
152
|
+
if context is None:
|
|
153
|
+
return
|
|
154
|
+
context.model_id = model_id
|
|
155
|
+
context.output_dir = output_dir
|
|
156
|
+
context.total_cases = total_cases
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def record_completion(
|
|
160
|
+
self,
|
|
161
|
+
*,
|
|
162
|
+
final_csv: str | None,
|
|
163
|
+
completed_cases: int,
|
|
164
|
+
) -> None:
|
|
165
|
+
"""Create a completion event after all measurements and result writes."""
|
|
166
|
+
context = self.context
|
|
167
|
+
if context is None:
|
|
168
|
+
return
|
|
169
|
+
|
|
170
|
+
result_rows: int | None = None
|
|
171
|
+
error_rows: int | None = None
|
|
172
|
+
detail: str | None = None
|
|
173
|
+
if final_csv:
|
|
174
|
+
try:
|
|
175
|
+
result_rows, error_rows = _result_status_counts(final_csv)
|
|
176
|
+
except (OSError, csv.Error, UnicodeError) as exc:
|
|
177
|
+
detail = f"结果已生成,但通知摘要读取失败({type(exc).__name__})"
|
|
178
|
+
|
|
179
|
+
if not final_csv or result_rows == 0:
|
|
180
|
+
status = "no_results"
|
|
181
|
+
if detail is None:
|
|
182
|
+
detail = "本次运行未产生结果数据行"
|
|
183
|
+
elif (
|
|
184
|
+
(error_rows or 0) > 0
|
|
185
|
+
or (
|
|
186
|
+
context.total_cases is not None
|
|
187
|
+
and completed_cases < context.total_cases
|
|
188
|
+
)
|
|
189
|
+
):
|
|
190
|
+
status = "partial"
|
|
191
|
+
else:
|
|
192
|
+
status = "success"
|
|
193
|
+
|
|
194
|
+
context.event = NotificationEvent(
|
|
195
|
+
status=status,
|
|
196
|
+
model_id=context.model_id,
|
|
197
|
+
output_dir=context.output_dir,
|
|
198
|
+
elapsed_seconds=time.perf_counter() - context.started_at,
|
|
199
|
+
total_cases=context.total_cases,
|
|
200
|
+
completed_cases=completed_cases,
|
|
201
|
+
result_rows=result_rows,
|
|
202
|
+
error_rows=error_rows,
|
|
203
|
+
final_csv=final_csv,
|
|
204
|
+
detail=detail,
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def record_termination(self, status: str, detail: str) -> None:
|
|
209
|
+
context = self.context
|
|
210
|
+
if context is None:
|
|
211
|
+
return
|
|
212
|
+
context.event = NotificationEvent(
|
|
213
|
+
status=status,
|
|
214
|
+
model_id=context.model_id,
|
|
215
|
+
output_dir=context.output_dir,
|
|
216
|
+
elapsed_seconds=time.perf_counter() - context.started_at,
|
|
217
|
+
total_cases=context.total_cases,
|
|
218
|
+
detail=detail,
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def notify_profiler(self, progress: ProfilerProgress) -> None:
|
|
223
|
+
"""Report one finished profiler stage before any next probe or CSV sweep."""
|
|
224
|
+
context = self.context
|
|
225
|
+
if context is None:
|
|
226
|
+
return
|
|
227
|
+
|
|
228
|
+
event = NotificationEvent(
|
|
229
|
+
status=f"profiler_{progress.status}",
|
|
230
|
+
model_id=context.model_id,
|
|
231
|
+
output_dir=context.output_dir,
|
|
232
|
+
elapsed_seconds=time.perf_counter() - context.started_at,
|
|
233
|
+
profiler=progress.profiler,
|
|
234
|
+
profile_elapsed_seconds=progress.elapsed_seconds,
|
|
235
|
+
profile_samples=progress.total_samples,
|
|
236
|
+
profile_error_samples=progress.error_samples,
|
|
237
|
+
detail=progress.detail or None,
|
|
238
|
+
)
|
|
239
|
+
_send_notification_event(
|
|
240
|
+
context,
|
|
241
|
+
event,
|
|
242
|
+
success_message=(
|
|
243
|
+
f"[notify] 企业微信 Profiler 通知已发送:{progress.profiler} "
|
|
244
|
+
f"({progress.status})"
|
|
245
|
+
),
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
def notify_case(self, progress: MatrixProgress) -> None:
|
|
250
|
+
"""Send progress only after run_single_case has stopped its resources."""
|
|
251
|
+
context = self.context
|
|
252
|
+
if context is None:
|
|
253
|
+
return
|
|
254
|
+
|
|
255
|
+
result_rows: int | None = None
|
|
256
|
+
error_rows: int | None = None
|
|
257
|
+
summary_note = ""
|
|
258
|
+
if progress.result_csv:
|
|
259
|
+
try:
|
|
260
|
+
result_rows, error_rows = _result_status_counts(progress.result_csv)
|
|
261
|
+
except (OSError, csv.Error, UnicodeError) as exc:
|
|
262
|
+
summary_note = f";结果摘要读取失败({type(exc).__name__})"
|
|
263
|
+
|
|
264
|
+
detail = (
|
|
265
|
+
f"刚完成:CPU={progress.cpu}, MEM={progress.mem}GB, GPU={progress.gpu}"
|
|
266
|
+
f"{summary_note}"
|
|
267
|
+
)
|
|
268
|
+
event = NotificationEvent(
|
|
269
|
+
status="progress",
|
|
270
|
+
model_id=context.model_id,
|
|
271
|
+
output_dir=context.output_dir,
|
|
272
|
+
elapsed_seconds=time.perf_counter() - context.started_at,
|
|
273
|
+
total_cases=progress.total_cases,
|
|
274
|
+
completed_cases=progress.completed_cases,
|
|
275
|
+
result_rows=result_rows,
|
|
276
|
+
error_rows=error_rows,
|
|
277
|
+
detail=detail,
|
|
278
|
+
)
|
|
279
|
+
_send_notification_event(
|
|
280
|
+
context,
|
|
281
|
+
event,
|
|
282
|
+
success_message=(
|
|
283
|
+
"[notify] 企业微信进度通知已发送:"
|
|
284
|
+
f"case {progress.completed_cases}/{progress.total_cases}"
|
|
285
|
+
),
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
def deliver(self, terminal_log: str | None = None) -> None:
|
|
290
|
+
"""Send the recorded event best-effort without changing command outcome."""
|
|
291
|
+
context = self.context
|
|
292
|
+
if context is None or context.event is None:
|
|
293
|
+
return
|
|
294
|
+
|
|
295
|
+
event = context.event
|
|
296
|
+
if terminal_log:
|
|
297
|
+
event = replace(event, terminal_log=terminal_log)
|
|
298
|
+
_send_notification_event(
|
|
299
|
+
context,
|
|
300
|
+
event,
|
|
301
|
+
success_message="[notify] 企业微信最终通知已发送",
|
|
302
|
+
)
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
"""Prepare and restore immutable model/runtime evidence before a collection matrix."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import sys
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import TYPE_CHECKING
|
|
9
|
+
|
|
10
|
+
from acprof.application.errors import CollectionFailed
|
|
11
|
+
from acprof.application.notifications import RunNotifications
|
|
12
|
+
from acprof.artifact_layout import ArtifactLayout
|
|
13
|
+
from acprof.artifacts import read_json_object
|
|
14
|
+
from acprof.capabilities import (
|
|
15
|
+
Capability,
|
|
16
|
+
CapabilityReport,
|
|
17
|
+
apply_extension,
|
|
18
|
+
apply_profiler_plan,
|
|
19
|
+
apply_runtime_validation,
|
|
20
|
+
measurement_report,
|
|
21
|
+
)
|
|
22
|
+
from acprof.config import SCALING_DIMENSIONS
|
|
23
|
+
from acprof.host.collection_history import (
|
|
24
|
+
COLLECTION_HISTORY_NAME,
|
|
25
|
+
empty_collection_history,
|
|
26
|
+
write_collection_history_json,
|
|
27
|
+
)
|
|
28
|
+
from acprof.host.gpu_device import selected_gpu_device
|
|
29
|
+
|
|
30
|
+
if TYPE_CHECKING:
|
|
31
|
+
from acprof.host.detect import TaskInfo
|
|
32
|
+
from acprof.host.images.runtime import ImageInfo
|
|
33
|
+
from acprof.host.input_plan import PlannedInputScales
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dataclass
|
|
37
|
+
class PreparedRuntime:
|
|
38
|
+
task_info: TaskInfo
|
|
39
|
+
image_info: ImageInfo
|
|
40
|
+
planned_input_scales: PlannedInputScales
|
|
41
|
+
compute_profile_plan_file: str
|
|
42
|
+
execution_profile_plan_file: str
|
|
43
|
+
capability_report: CapabilityReport
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def apply_profiler_plan_file(
|
|
47
|
+
capability_report: CapabilityReport,
|
|
48
|
+
plan_path: str,
|
|
49
|
+
*,
|
|
50
|
+
source: str,
|
|
51
|
+
) -> None:
|
|
52
|
+
if not plan_path or not Path(plan_path).is_file():
|
|
53
|
+
return
|
|
54
|
+
apply_profiler_plan(
|
|
55
|
+
capability_report,
|
|
56
|
+
read_json_object(plan_path, label=source.replace("_", " ")),
|
|
57
|
+
source=source,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def prepare_runtime(args, *, run_state, task_info, output_dir, cpu_list, mem_list,
|
|
62
|
+
gpu_list, run_command, cgroup_version, cgroup_collection_mode,
|
|
63
|
+
rapl_topology, preflight_measurements, latency_slo,
|
|
64
|
+
workflow=None, project_dir: str, notices: RunNotifications) -> PreparedRuntime:
|
|
65
|
+
"""Build or restore the runtime and persist evidence before the matrix."""
|
|
66
|
+
from acprof.host.collection_workflow import PreparationWorkflow
|
|
67
|
+
from acprof.host.images.runtime import prepare_image
|
|
68
|
+
from acprof.host.input_plan import input_plan_summary, plan_input_scales
|
|
69
|
+
workflow = workflow or PreparationWorkflow()
|
|
70
|
+
from acprof.host.static_metadata import (
|
|
71
|
+
collect_static_meta,
|
|
72
|
+
enrich_static_meta,
|
|
73
|
+
enrich_static_meta_from_compute_plan,
|
|
74
|
+
enrich_static_meta_from_execution_plan,
|
|
75
|
+
enrich_static_meta_from_input_plan,
|
|
76
|
+
write_static_meta_json,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
compute_profile_disabled = args.compute_profile_tool == "none"
|
|
80
|
+
total_cases = len(cpu_list) * len(mem_list) * len(gpu_list)
|
|
81
|
+
layout = ArtifactLayout.discover(output_dir)
|
|
82
|
+
static_meta_json = str(layout.path("static_meta.json"))
|
|
83
|
+
collection_history_json = str(layout.path(COLLECTION_HISTORY_NAME))
|
|
84
|
+
if run_state.ready:
|
|
85
|
+
(task_info, image_info, planned_input_scales, compute_profile_plan_file,
|
|
86
|
+
execution_profile_plan_file) = run_state.restore_runtime()
|
|
87
|
+
workflow.emit("input", "passed", input_plan=input_plan_summary(task_info, planned_input_scales))
|
|
88
|
+
notices.update_plan(model_id=task_info.model_id, output_dir=output_dir,
|
|
89
|
+
total_cases=total_cases)
|
|
90
|
+
print(f"[resume] 恢复实验 {run_state.data['run_id']},复用原镜像和输入计划")
|
|
91
|
+
saved_meta = read_json_object(static_meta_json, label="static metadata")
|
|
92
|
+
capability_report = CapabilityReport.from_dict(saved_meta.get("capability_report", {
|
|
93
|
+
"profiling_mode": args.profiling_mode,
|
|
94
|
+
}))
|
|
95
|
+
validation_status = saved_meta.get("runtime_validation", {}).get("status", "not_run")
|
|
96
|
+
workflow.emit("runtime", "passed" if validation_status == "ok" else
|
|
97
|
+
"not_started" if validation_status == "not_run" else "failed",
|
|
98
|
+
detail=f"restored immutable runtime; saved validation: {validation_status}")
|
|
99
|
+
if validation_status != "ok":
|
|
100
|
+
raise RuntimeError("saved runtime validation is not successful: " + str(validation_status)
|
|
101
|
+
+ "; start a new experiment to validate without changing frozen resume evidence")
|
|
102
|
+
else:
|
|
103
|
+
task_info.model_download_policy = args.model_download_policy
|
|
104
|
+
from acprof.host.images.runtime import configure_runtime_profile
|
|
105
|
+
from acprof.host.interface_probe import probe_interface
|
|
106
|
+
workflow.run("interface", configure_runtime_profile, task_info)
|
|
107
|
+
workflow.run("interface", probe_interface, task_info, output_dir,
|
|
108
|
+
timeout_seconds=args.request_timeout_seconds)
|
|
109
|
+
try:
|
|
110
|
+
image_info = workflow.run("image", prepare_image,
|
|
111
|
+
task_info, project_dir, reuse_existing=not (args.rebuild_image or workflow.rebuild_environment),
|
|
112
|
+
)
|
|
113
|
+
except (RuntimeError, OSError) as exc:
|
|
114
|
+
print(f"\n[build][ERROR] {exc}", file=sys.stderr)
|
|
115
|
+
raise CollectionFailed(str(exc)) from exc
|
|
116
|
+
|
|
117
|
+
os.makedirs(output_dir, exist_ok=True)
|
|
118
|
+
if task_info.model_resolution:
|
|
119
|
+
from acprof.model_contract import write_model_resolution
|
|
120
|
+
write_model_resolution(task_info, output_dir)
|
|
121
|
+
|
|
122
|
+
scaling_cfg = SCALING_DIMENSIONS.get(task_info.task_family)
|
|
123
|
+
input_scale_type = scaling_cfg.param_name if scaling_cfg else ""
|
|
124
|
+
|
|
125
|
+
static_meta = collect_static_meta(
|
|
126
|
+
task_info=task_info,
|
|
127
|
+
image_info=image_info,
|
|
128
|
+
batch_size=args.batch_size,
|
|
129
|
+
input_scale_type=input_scale_type,
|
|
130
|
+
run_command=run_command,
|
|
131
|
+
cgroup_version=cgroup_version,
|
|
132
|
+
cgroup_collection_mode=cgroup_collection_mode,
|
|
133
|
+
compute_profile_enabled=not compute_profile_disabled,
|
|
134
|
+
execution_profile_enabled=args.execution_profile_tool != "none",
|
|
135
|
+
profiling_mode=args.profiling_mode,
|
|
136
|
+
gpu_device=selected_gpu_device(),
|
|
137
|
+
)
|
|
138
|
+
capability_report = measurement_report(
|
|
139
|
+
args.profiling_mode, gpu_modes=gpu_list, compute_tool=args.compute_profile_tool,
|
|
140
|
+
execution_tool=args.execution_profile_tool,
|
|
141
|
+
dram_energy=args.dram_energy,
|
|
142
|
+
rapl_topology=rapl_topology,
|
|
143
|
+
)
|
|
144
|
+
capability_report.measurement.update({name: item for name, item in preflight_measurements.items() if isinstance(item, Capability)})
|
|
145
|
+
from acprof.extensions import select_extension
|
|
146
|
+
apply_extension(capability_report, select_extension(task_info))
|
|
147
|
+
static_meta = enrich_static_meta(static_meta, {
|
|
148
|
+
"capability_report": capability_report.to_dict(), "latency_slo": latency_slo,
|
|
149
|
+
})
|
|
150
|
+
write_static_meta_json(static_meta, static_meta_json)
|
|
151
|
+
write_collection_history_json(
|
|
152
|
+
empty_collection_history(),
|
|
153
|
+
collection_history_json,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
# ── Step 4: Run profiling matrix ──
|
|
157
|
+
try:
|
|
158
|
+
planned_input_scales = workflow.run("input", plan_input_scales,
|
|
159
|
+
task_info=task_info,
|
|
160
|
+
image_info=image_info,
|
|
161
|
+
cpu_list=cpu_list,
|
|
162
|
+
mem_list=mem_list,
|
|
163
|
+
gpu_list=gpu_list,
|
|
164
|
+
batch_size=args.batch_size,
|
|
165
|
+
output_dir=output_dir,
|
|
166
|
+
input_scales=args.input_scales,
|
|
167
|
+
workload_spec_path=args.workload_spec,
|
|
168
|
+
input_scale_policy=args.input_scale_policy,
|
|
169
|
+
)
|
|
170
|
+
except Exception as exc:
|
|
171
|
+
print(f"\n[scale][ERROR] {exc}", file=sys.stderr)
|
|
172
|
+
raise CollectionFailed(str(exc)) from exc
|
|
173
|
+
|
|
174
|
+
workflow.emit("input", "passed", input_plan=input_plan_summary(task_info, planned_input_scales))
|
|
175
|
+
|
|
176
|
+
static_meta = enrich_static_meta_from_input_plan(
|
|
177
|
+
static_meta,
|
|
178
|
+
planned_input_scales,
|
|
179
|
+
)
|
|
180
|
+
write_static_meta_json(static_meta, static_meta_json)
|
|
181
|
+
compute_profile_plan_file = ""
|
|
182
|
+
from acprof.host.runtime_validation import validate_runtime
|
|
183
|
+
from acprof.host.static_metadata import enrich_static_meta
|
|
184
|
+
def validate_selected_runtime():
|
|
185
|
+
try:
|
|
186
|
+
report = validate_runtime(
|
|
187
|
+
task_info=task_info, image_info=image_info, planned=planned_input_scales,
|
|
188
|
+
cpu_list=cpu_list, mem_list=mem_list, gpu_list=gpu_list, output_dir=output_dir,
|
|
189
|
+
timeout_seconds=args.request_timeout_seconds,
|
|
190
|
+
)
|
|
191
|
+
if report.get("status") != "ok":
|
|
192
|
+
raise RuntimeError("collection requires successful runtime validation on every requested device: "
|
|
193
|
+
+ str(report.get("status")))
|
|
194
|
+
except Exception:
|
|
195
|
+
if workflow.interactive:
|
|
196
|
+
from acprof.host.collection_workflow import retain_validation_failure
|
|
197
|
+
try:
|
|
198
|
+
retain_validation_failure(output_dir)
|
|
199
|
+
except (OSError, ValueError) as archive_error:
|
|
200
|
+
print(f"[runtime-check][WARN] Cannot archive validation failure: {archive_error}", file=sys.stderr)
|
|
201
|
+
raise
|
|
202
|
+
return report
|
|
203
|
+
|
|
204
|
+
try:
|
|
205
|
+
validation = workflow.run("runtime", validate_selected_runtime)
|
|
206
|
+
apply_runtime_validation(
|
|
207
|
+
capability_report, validation,
|
|
208
|
+
environment_id=image_info.runtime_environment.get("environment_id", ""),
|
|
209
|
+
)
|
|
210
|
+
static_meta = enrich_static_meta(static_meta, {"runtime_validation": validation,
|
|
211
|
+
"model_resolution": task_info.model_resolution})
|
|
212
|
+
write_static_meta_json(static_meta, static_meta_json)
|
|
213
|
+
except (RuntimeError, OSError, ValueError) as exc:
|
|
214
|
+
print(f"[runtime-check][ERROR] {exc}", file=sys.stderr)
|
|
215
|
+
raise CollectionFailed(str(exc)) from exc
|
|
216
|
+
total_cases = len(cpu_list) * len(mem_list) * len(gpu_list)
|
|
217
|
+
notices.update_plan(
|
|
218
|
+
model_id=task_info.model_id,
|
|
219
|
+
output_dir=output_dir,
|
|
220
|
+
total_cases=total_cases,
|
|
221
|
+
)
|
|
222
|
+
if compute_profile_disabled:
|
|
223
|
+
reason = "--compute-profile-tool none"
|
|
224
|
+
print(f"[compute] Compute profiling disabled by {reason}")
|
|
225
|
+
else:
|
|
226
|
+
workflow.emit("compute_profile", "running")
|
|
227
|
+
try:
|
|
228
|
+
from acprof.host.profiling.compute import collect_compute_profile_plan
|
|
229
|
+
|
|
230
|
+
compute_profile_plan_file = collect_compute_profile_plan(
|
|
231
|
+
task_info=task_info,
|
|
232
|
+
image_tag=image_info.tag,
|
|
233
|
+
cpu_list=cpu_list,
|
|
234
|
+
mem_list=mem_list,
|
|
235
|
+
gpu_list=gpu_list,
|
|
236
|
+
output_dir=output_dir,
|
|
237
|
+
input_scale_plan_file=planned_input_scales.plan_file,
|
|
238
|
+
advisor_root=args.advisor_root,
|
|
239
|
+
ncu_root=args.ncu_root,
|
|
240
|
+
advisor_repeat=args.advisor_repeat,
|
|
241
|
+
torch_profiler_repeat=args.torch_profiler_repeat,
|
|
242
|
+
ncu_repeat=args.ncu_repeat,
|
|
243
|
+
keep_profiles=args.keep_compute_profiles,
|
|
244
|
+
compute_profile_cpus=args.compute_profile_cpus,
|
|
245
|
+
compute_profile_mem=args.compute_profile_mem,
|
|
246
|
+
compute_profile_tool=args.compute_profile_tool,
|
|
247
|
+
progress_callback=(
|
|
248
|
+
notices.notify_profiler
|
|
249
|
+
if notices.active()
|
|
250
|
+
else None
|
|
251
|
+
),
|
|
252
|
+
)
|
|
253
|
+
static_meta = enrich_static_meta_from_compute_plan(
|
|
254
|
+
static_meta,
|
|
255
|
+
compute_profile_plan_file,
|
|
256
|
+
)
|
|
257
|
+
write_static_meta_json(static_meta, static_meta_json)
|
|
258
|
+
workflow.emit("compute_profile", "passed")
|
|
259
|
+
except Exception as exc:
|
|
260
|
+
workflow.emit("compute_profile", "failed", detail=str(exc))
|
|
261
|
+
print(f"[compute][WARN] Compute profiling unavailable: {exc}")
|
|
262
|
+
|
|
263
|
+
execution_profile_plan_file = ""
|
|
264
|
+
if args.execution_profile_tool == "none":
|
|
265
|
+
print(
|
|
266
|
+
"[execution-profile] Massif/Nsight Systems profiling disabled "
|
|
267
|
+
"(enable with --execution-profile-tool)"
|
|
268
|
+
)
|
|
269
|
+
else:
|
|
270
|
+
workflow.emit("execution_profile", "running")
|
|
271
|
+
try:
|
|
272
|
+
from acprof.host.profiling.execution import (
|
|
273
|
+
ExecutionProfileOptions,
|
|
274
|
+
ExecutionProfileRequest,
|
|
275
|
+
ProfilerSampling,
|
|
276
|
+
collect_execution_profile_plan,
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
execution_profile_plan_file = collect_execution_profile_plan(
|
|
280
|
+
ExecutionProfileRequest(
|
|
281
|
+
task_info=task_info, image_tag=image_info.tag,
|
|
282
|
+
cpu_list=cpu_list, mem_list=mem_list, gpu_list=gpu_list,
|
|
283
|
+
output_dir=output_dir,
|
|
284
|
+
input_scale_plan_file=planned_input_scales.plan_file,
|
|
285
|
+
),
|
|
286
|
+
options=ExecutionProfileOptions(
|
|
287
|
+
tool_mode=args.execution_profile_tool,
|
|
288
|
+
massif=ProfilerSampling(
|
|
289
|
+
sampling=args.massif_sampling, repeat=args.massif_repeat,
|
|
290
|
+
reference_cpu=args.massif_reference_cpu,
|
|
291
|
+
reference_mem=args.massif_reference_mem,
|
|
292
|
+
),
|
|
293
|
+
nsys=ProfilerSampling(
|
|
294
|
+
sampling=args.nsys_sampling, repeat=args.nsys_repeat,
|
|
295
|
+
reference_cpu=args.nsys_reference_cpu,
|
|
296
|
+
reference_mem=args.nsys_reference_mem,
|
|
297
|
+
),
|
|
298
|
+
nsys_root=args.nsys_root, keep_profiles=args.keep_execution_profiles,
|
|
299
|
+
),
|
|
300
|
+
progress_callback=(
|
|
301
|
+
notices.notify_profiler
|
|
302
|
+
if notices.active()
|
|
303
|
+
else None
|
|
304
|
+
),
|
|
305
|
+
)
|
|
306
|
+
static_meta = enrich_static_meta_from_execution_plan(
|
|
307
|
+
static_meta,
|
|
308
|
+
execution_profile_plan_file,
|
|
309
|
+
)
|
|
310
|
+
write_static_meta_json(static_meta, static_meta_json)
|
|
311
|
+
workflow.emit("execution_profile", "passed")
|
|
312
|
+
except Exception as exc:
|
|
313
|
+
workflow.emit("execution_profile", "failed", detail=str(exc))
|
|
314
|
+
print(
|
|
315
|
+
"[execution-profile][WARN] Execution profiling unavailable: "
|
|
316
|
+
f"{exc}"
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
for plan_path, source in ((compute_profile_plan_file, "compute_profile_plan"),
|
|
320
|
+
(execution_profile_plan_file, "execution_profile_plan")):
|
|
321
|
+
apply_profiler_plan_file(capability_report, plan_path, source=source)
|
|
322
|
+
static_meta = enrich_static_meta(static_meta, {"capability_report": capability_report.to_dict()})
|
|
323
|
+
write_static_meta_json(static_meta, static_meta_json)
|
|
324
|
+
from acprof.artifacts import atomic_write_json
|
|
325
|
+
atomic_write_json(layout.path("capability_report.json"), capability_report.to_dict())
|
|
326
|
+
if not capability_report.to_dict()["requested_measurements_available"]:
|
|
327
|
+
print("[capability][WARN] 所请求的 profiler 尚有缺失或失败;详见 capability_report.json,不视为完整画像。")
|
|
328
|
+
run_state.bind_runtime(task_info, image_info, planned_input_scales,
|
|
329
|
+
compute_profile_plan_file, execution_profile_plan_file)
|
|
330
|
+
|
|
331
|
+
return PreparedRuntime(task_info, image_info, planned_input_scales,
|
|
332
|
+
compute_profile_plan_file, execution_profile_plan_file,
|
|
333
|
+
capability_report)
|