forked from dusty-nv/jetson-containers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
68 lines (45 loc) · 1.75 KB
/
config.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
63
64
65
66
67
import os
from jetson_containers import L4T_VERSION, CUDA_ARCHITECTURES, CUDA_VERSION
def cudnn_package(version, url, deb, packages=None, depends=None, requires=None, default=False):
"""
Generate containers for a particular version of cuDNN installed from debian packages
"""
if not packages:
packages = os.environ.get('CUDNN_PACKAGES', 'libcudnn*-dev libcudnn*-samples')
if not depends:
depends = ['cuda']
cudnn = package.copy()
cudnn['name'] = f'cudnn:{version}'
cudnn['depends'] = depends
cudnn['build_args'] = {
'CUDNN_URL': url,
'CUDNN_DEB': deb,
'CUDNN_PACKAGES': packages,
}
if default:
cudnn['alias'] = 'cudnn'
if requires:
cudnn['requires'] = requires
return cudnn
def cudnn_builtin(version=None, requires=None, default=False):
"""
Backwards-compatability for when cuDNN already installed in base container (like l4t-jetpack)
"""
passthrough = package.copy()
if version is not None:
if not isinstance(version, str):
version = f'{version.major}.{version.minor}'
if default:
passthrough['alias'] = 'cudnn'
passthrough['name'] += f':{version}'
if requires:
passthrough['requires'] = requires
del passthrough['dockerfile']
passthrough['depends'] = ['cuda']
return passthrough
package = [
# JetPack 6
cudnn_package('8.9', 'https://nvidia.box.com/shared/static/ht4li6b0j365ta7b76a6gw29rk5xh8cy.deb', 'cudnn-local-tegra-repo-ubuntu2204-8.9.4.25', requires='==36.*', default=True),
# JetPack 4-5 (cuDNN installed in base container)
cudnn_builtin(requires='<36', default=True),
]