Test historical build fingerprints with their pinned renderer
This commit is contained in:
1 parent
3a374faace
commit
11e96a188b
1 file changed
+13
-7
@@ -249,35 +249,41 @@ class ProjectedPairsTests(unittest.TestCase):
|
|||||||
self.assertFalse(assess(incomplete)["comparisons"][3]["passed"])
|
self.assertFalse(assess(incomplete)["comparisons"][3]["passed"])
|
||||||
|
|
||||||
def test_pinned_build_sources_match_host_generated_inputs(self):
|
def test_pinned_build_sources_match_host_generated_inputs(self):
|
||||||
"""The pinned fingerprints are what today's compiler generates from the qualified
|
"""Check the pinned fingerprints using NUMERICAL_REVISION's renderer and kernels.
|
||||||
NUMERICAL_REVISION kernels; the current kernels may legitimately differ."""
|
The imported LBMConfig is unchanged from that revision; this is a host
|
||||||
|
build-input check, not a reconstruction of the historical CUDA toolchain."""
|
||||||
|
import importlib.util
|
||||||
import tarfile
|
import tarfile
|
||||||
from CelerisLab.cuda import compiler_v2
|
|
||||||
|
|
||||||
kernels = "src/CelerisLab/lbm/kernels"
|
kernels = "src/CelerisLab/lbm/kernels"
|
||||||
|
renderer = "src/CelerisLab/cuda/compiler_v2.py"
|
||||||
if subprocess.run(["git", "-C", str(REPO), "cat-file", "-e",
|
if subprocess.run(["git", "-C", str(REPO), "cat-file", "-e",
|
||||||
f"{NUMERICAL_REVISION}^{{commit}}"], capture_output=True).returncode:
|
f"{NUMERICAL_REVISION}^{{commit}}"], capture_output=True).returncode:
|
||||||
self.fail(f"{NUMERICAL_REVISION} is not in this clone; the pinned build "
|
self.fail(f"{NUMERICAL_REVISION} is not in this clone; the pinned build "
|
||||||
"sources cannot be checked")
|
"sources cannot be checked")
|
||||||
archive = subprocess.run(["git", "-C", str(REPO), "archive", "--format=tar",
|
archive = subprocess.run(["git", "-C", str(REPO), "archive", "--format=tar",
|
||||||
NUMERICAL_REVISION, kernels],
|
NUMERICAL_REVISION, kernels, renderer],
|
||||||
capture_output=True, check=True).stdout
|
capture_output=True, check=True).stdout
|
||||||
with tempfile.TemporaryDirectory() as snapshot:
|
with tempfile.TemporaryDirectory() as snapshot:
|
||||||
with tarfile.open(fileobj=io.BytesIO(archive)) as tar:
|
with tarfile.open(fileobj=io.BytesIO(archive)) as tar:
|
||||||
tar.extractall(snapshot)
|
tar.extractall(snapshot)
|
||||||
with patch.object(compiler_v2, "_KERNEL_DIR", str(Path(snapshot) / kernels)):
|
spec = importlib.util.spec_from_file_location(
|
||||||
|
"CelerisLab.cuda._compiler_a135252", Path(snapshot) / renderer)
|
||||||
|
compiler = importlib.util.module_from_spec(spec)
|
||||||
|
spec.loader.exec_module(compiler)
|
||||||
|
with patch.object(compiler, "_KERNEL_DIR", str(Path(snapshot) / kernels)):
|
||||||
for size in (128, 256):
|
for size in (128, 256):
|
||||||
with self.subTest(size=size):
|
with self.subTest(size=size):
|
||||||
cfg = replace(run_case.config(size, 100), nx=10, ny=10)
|
cfg = replace(run_case.config(size, 100), nx=10, ny=10)
|
||||||
cfg.validate()
|
cfg.validate()
|
||||||
root = compiler_v2.generate_config(cfg)
|
root = compiler.generate_config(cfg)
|
||||||
try:
|
try:
|
||||||
actual = json.loads((Path(root) / ".celeris-build").read_text())
|
actual = json.loads((Path(root) / ".celeris-build").read_text())
|
||||||
expected = build_metadata(size)
|
expected = build_metadata(size)
|
||||||
self.assertEqual(actual, {key: expected[key] for key in
|
self.assertEqual(actual, {key: expected[key] for key in
|
||||||
("source_sha256", "config", "n_objects")})
|
("source_sha256", "config", "n_objects")})
|
||||||
finally:
|
finally:
|
||||||
compiler_v2.cleanup_build_dir(root)
|
compiler.cleanup_build_dir(root)
|
||||||
|
|
||||||
def test_source_preflight_requires_clean_exact_revision_and_tree(self):
|
def test_source_preflight_requires_clean_exact_revision_and_tree(self):
|
||||||
import oracle
|
import oracle
|
||||||
|
|||||||
Reference in new issue
Block a user