-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnoxfile.py
55 lines (46 loc) · 1.17 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
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
"""
base_image = "nvidia/cuda:11.6.0-cudnn8-devel-ubuntu20.04"
pyhf_version = "0.7.0"
pyhf_backend = "jax"
cuda_version = base_image.split(":")[-1].split("-devel")[0]
session.run("docker", "pull", base_image, external=True)
session.run(
"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}",
"--tag",
f"pyhf/cuda:latest-{pyhf_backend}",
".",
external=True,
)
@nox.session()
def test(session):
session.run(
"docker",
"run",
"--rm",
"-ti",
"--gpus",
"all",
"pyhf/cuda:latest-jax",
external=True,
)