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

Class TestCompile

tests/sol_execbench/driver/test_problem_packager.py:186–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184
185
186class TestCompile:
187 def test_returns_command_and_artifact_path(
188 self, tmp_path, definition, workloads, cuda_solution, config
189 ):
190 pkg = _make_packager(tmp_path, definition, workloads, cuda_solution, config)
191 cmd, artifact_path = pkg.compile()
192 assert cmd == ["python", "build_ext.py"]
193 assert artifact_path.endswith("benchmark_kernel.so")
194
195 def test_build_ext_staged(
196 self, tmp_path, definition, workloads, cuda_solution, config
197 ):
198 pkg = _make_packager(tmp_path, definition, workloads, cuda_solution, config)
199 pkg.compile()
200 build_ext = pkg.output_dir / "build_ext.py"
201 assert build_ext.exists()
202 ast.parse(build_ext.read_text())
203
204 def test_gencode_injected_for_blackwell(
205 self, tmp_path, definition, workloads, cuda_solution, config
206 ):
207 pkg = _make_packager(tmp_path, definition, workloads, cuda_solution, config)
208 pkg.compile()
209 sol = json.loads((pkg.output_dir / "solution.json").read_text())
210 cuda_cflags = sol["spec"]["compile_options"]["cuda_cflags"]
211 assert any("sm_100a" in f for f in cuda_cflags)
212
213 def test_gencode_not_injected_when_explicit(
214 self, tmp_path, definition, workloads, config
215 ):
216 sol_dict = {
217 **_CUDA_SOLUTION_DICT,
218 "spec": {
219 **_CUDA_SOLUTION_DICT["spec"],
220 "compile_options": {"cuda_cflags": ["-arch=sm_90"]},
221 },
222 }
223 solution = Solution(**sol_dict)
224 pkg = _make_packager(tmp_path, definition, workloads, solution, config)
225 pkg.compile()
226 sol = json.loads((pkg.output_dir / "solution.json").read_text())
227 cuda_cflags = sol["spec"]["compile_options"]["cuda_cflags"]
228 assert cuda_cflags == ["-arch=sm_90"]
229
230 def test_asserts_on_python_solution(
231 self, tmp_path, definition, workloads, python_solution, config
232 ):
233 pkg = _make_packager(tmp_path, definition, workloads, python_solution, config)
234 with pytest.raises(AssertionError, match="C\\+\\+/CUDA"):
235 pkg.compile()
236
237
238# ── execute() ─────────────────────────────────────────────────────────────────

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected