File size: 1,080 Bytes
f78d5a7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Create the pinned inference environment and build its CUDA convolution kernel."""

import argparse
import os
import subprocess
import sys
from pathlib import Path

from cuda_toolchain import configure


def main():
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--venv", default=".venv", help="Destination environment")
    args = parser.parse_args()
    root = Path(__file__).resolve().parent
    venv = Path(args.venv).resolve()
    configure(install=True)
    subprocess.run([sys.executable, "-m", "pip", "install", "uv==0.12.17"], check=True)
    subprocess.run(
        [sys.executable, "-m", "uv", "sync", "--project", str(root), "--locked",
         "--python", "3.13.15"],
        env=os.environ | {"UV_PROJECT_ENVIRONMENT": str(venv)}, check=True,
    )
    subprocess.run(
        [str(venv / "bin/python"), str(root / "build_causal_conv.py"),
         "--output", str(venv / "kernel-build"), "--install"], check=True,
    )
    print("Ready. Run examples with " + str(venv / "bin/python"))


if __name__ == "__main__":
    main()