-
Notifications
You must be signed in to change notification settings - Fork 1
/
noxfile.py
62 lines (52 loc) · 1.51 KB
/
noxfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from datetime import datetime
from pathlib import Path
import nox
# Default sessions to run if no session handles are passed
nox.options.sessions = ["build"]
DIR = Path(__file__).parent.resolve()
@nox.session()
def build(session):
"""
Build image
"""
default_image = "nvidia/cuda:11.6.0-cudnn8-devel-ubuntu20.04"
target_images = [
default_image,
"nvidia/cuda:11.2.2-devel-ubuntu20.04",
"nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04",
]
pyhf_version = "0.7.2"
pyhf_backend = "jax"
for base_image in target_images:
cuda_version = base_image.split(":")[-1].split("-devel")[0]
session.run("docker", "pull", base_image, external=True)
run_command = [
"docker",
"build",
"--file",
"docker/Dockerfile",
"--build-arg",
f"BASE_IMAGE={base_image}",
"--build-arg",
f"PYHF_VERSION={pyhf_version}",
"--build-arg",
f"PYHF_BACKEND={pyhf_backend}",
"--tag",
f"pyhf/cuda:{pyhf_version}-{pyhf_backend}-cuda-{cuda_version}",
]
if base_image == default_image:
run_command += ["--tag", f"pyhf/cuda:latest-{pyhf_backend}"]
run_command += "."
session.run(*run_command, external=True)
@nox.session()
def test(session):
session.run(
"docker",
"run",
"--rm",
"-ti",
"--gpus",
"all",
"pyhf/cuda:latest-jax",
external=True,
)