MCPcopy Create free account
hub / github.com/NVIDIA/SOL-ExecBench / build_custom_solution

Function build_custom_solution

scripts/run_dataset.py:139–164  ·  view source on GitHub ↗

Wrap an external ``solution.py`` file as a Solution dict.

(definition: dict, solution_py: Path)

Source from the content-addressed store, hash-verified

137
138
139def build_custom_solution(definition: dict, solution_py: Path) -> dict:
140 """Wrap an external ``solution.py`` file as a Solution dict."""
141 name = definition["name"]
142 code = solution_py.read_text()
143 dps = _infer_dps(code, definition)
144 code = code.replace("stream", "strm")
145
146 return {
147 "name": f"custom_{name}",
148 "definition": name,
149 "author": "run_dataset",
150 "description": f"Custom solution from {solution_py.name}.",
151 "spec": {
152 "languages": ["pytorch"],
153 "target_hardware": ["LOCAL"],
154 "entry_point": "solution.py::run",
155 "dependencies": ["torch"],
156 "destination_passing_style": dps,
157 },
158 "sources": [
159 {
160 "path": "solution.py",
161 "content": code,
162 }
163 ],
164 }
165
166
167def build_reference_solution(definition: dict) -> dict:

Callers 1

Calls 1

_infer_dpsFunction · 0.85

Tested by

no test coverage detected