1- #! /bin/bash
1+ #! /bin/bash
22
3- set -ex
3+ set -ex
44
5- install_ubuntu () {
6- # NVIDIA dockers for RC releases use tag names like `11.0-cudnn9-devel-ubuntu18.04-rc`,
7- # for this case we will set UBUNTU_VERSION to `18.04-rc` so that the Dockerfile could
8- # find the correct image. As a result, here we have to check for
9- # "$UBUNTU_VERSION" == "18.04"*
10- # instead of
11- # "$UBUNTU_VERSION" == "18.04"
12- if [[ " $UBUNTU_VERSION " == " 20.04" * ]]; then
13- cmake3=" cmake=3.16*"
14- maybe_libiomp_dev=" "
15- elif [[ " $UBUNTU_VERSION " == " 22.04" * ]]; then
16- cmake3=" cmake=3.22*"
17- maybe_libiomp_dev=" "
18- elif [[ " $UBUNTU_VERSION " == " 24.04" * ]]; then
19- cmake3=" cmake=3.28*"
20- maybe_libiomp_dev=" "
21- else
22- cmake3=" cmake=3.5*"
23- maybe_libiomp_dev=" libiomp-dev"
24- fi
5+ install_ubuntu () {
6+ # NVIDIA dockers for RC releases use tag names like `11.0-cudnn9-devel-ubuntu18.04-rc`,
7+ # for this case we will set UBUNTU_VERSION to `18.04-rc` so that the Dockerfile could
8+ # find the correct image. As a result, here we have to check for
9+ # "$UBUNTU_VERSION" == "18.04"*
10+ # instead of
11+ # "$UBUNTU_VERSION" == "18.04"
12+ if [[ " $UBUNTU_VERSION " == " 20.04" * ]]; then
13+ cmake3=" cmake=3.16*"
14+ maybe_libiomp_dev=" "
15+ elif [[ " $UBUNTU_VERSION " == " 22.04" * ]]; then
16+ cmake3=" cmake=3.22*"
17+ maybe_libiomp_dev=" "
18+ elif [[ " $UBUNTU_VERSION " == " 24.04" * ]]; then
19+ cmake3=" cmake=3.28*"
20+ maybe_libiomp_dev=" "
21+ else
22+ cmake3=" cmake=3.5*"
23+ maybe_libiomp_dev=" libiomp-dev"
24+ fi
2525
26- if [[ " $CLANG_VERSION " == 15 ]]; then
27- maybe_libomp_dev=" libomp-15-dev"
28- elif [[ " $CLANG_VERSION " == 12 ]]; then
29- maybe_libomp_dev=" libomp-12-dev"
30- elif [[ " $CLANG_VERSION " == 10 ]]; then
31- maybe_libomp_dev=" libomp-10-dev"
32- else
33- maybe_libomp_dev=" "
34- fi
26+ if [[ " $CLANG_VERSION " == 15 ]]; then
27+ maybe_libomp_dev=" libomp-15-dev"
28+ elif [[ " $CLANG_VERSION " == 12 ]]; then
29+ maybe_libomp_dev=" libomp-12-dev"
30+ elif [[ " $CLANG_VERSION " == 10 ]]; then
31+ maybe_libomp_dev=" libomp-10-dev"
32+ else
33+ maybe_libomp_dev=" "
34+ fi
3535
36- # Install common dependencies
37- apt-get update
38- # TODO: Some of these may not be necessary
39- ccache_deps=" asciidoc docbook-xml docbook-xsl xsltproc"
40- deploy_deps=" libffi-dev libbz2-dev libreadline-dev libncurses5-dev libncursesw5-dev libgdbm-dev libsqlite3-dev uuid-dev tk-dev"
41- numpy_deps=" gfortran"
42- apt-get install -y --no-install-recommends \
43- $ccache_deps \
44- $numpy_deps \
45- ${deploy_deps} \
46- ${cmake3} \
47- apt-transport-https \
48- autoconf \
49- automake \
50- build-essential \
51- ca-certificates \
52- curl \
53- git \
54- libatlas-base-dev \
55- libc6-dbg \
56- ${maybe_libiomp_dev} \
57- libyaml-dev \
58- libz-dev \
59- libjemalloc2 \
60- libjpeg-dev \
61- libasound2-dev \
62- libsndfile-dev \
63- ${maybe_libomp_dev} \
64- software-properties-common \
65- wget \
66- sudo \
67- vim \
68- jq \
69- libtool \
70- vim \
71- unzip \
72- gpg-agent \
73- gdb \
74- bc
36+ # Install common dependencies
37+ apt-get update
38+ # TODO: Some of these may not be necessary
39+ ccache_deps=" asciidoc docbook-xml docbook-xsl xsltproc"
40+ deploy_deps=" libffi-dev libbz2-dev libreadline-dev libncurses5-dev libncursesw5-dev libgdbm-dev libsqlite3-dev uuid-dev tk-dev"
41+ numpy_deps=" gfortran"
42+ apt-get install -y --no-install-recommends \
43+ $ccache_deps \
44+ $numpy_deps \
45+ ${deploy_deps} \
46+ ${cmake3} \
47+ apt-transport-https \
48+ autoconf \
49+ automake \
50+ build-essential \
51+ ca-certificates \
52+ curl \
53+ git \
54+ libatlas-base-dev \
55+ libc6-dbg \
56+ ${maybe_libiomp_dev} \
57+ libyaml-dev \
58+ libz-dev \
59+ libjemalloc2 \
60+ libjpeg-dev \
61+ libasound2-dev \
62+ libsndfile-dev \
63+ ${maybe_libomp_dev} \
64+ software-properties-common \
65+ wget \
66+ sudo \
67+ vim \
68+ jq \
69+ libtool \
70+ vim \
71+ unzip \
72+ gpg-agent \
73+ gdb \
74+ bc
7575
76- # Should resolve issues related to various apt package repository cert issues
77- # see: https://github.com/pytorch/pytorch/issues/65931
78- apt-get install -y libgnutls30
76+ # Should resolve issues related to various apt package repository cert issues
77+ # see: https://github.com/pytorch/pytorch/issues/65931
78+ apt-get install -y libgnutls30
7979
80- # Cleanup package manager
81- apt-get autoclean && apt-get clean
82- rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
83- }
80+ # Cleanup package manager
81+ apt-get autoclean && apt-get clean
82+ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
83+ }
8484
85- install_centos () {
86- # Need EPEL for many packages we depend on.
87- # See http://fedoraproject.org/wiki/EPEL
88- yum --enablerepo=extras install -y epel-release
85+ install_centos () {
86+ # Need EPEL for many packages we depend on.
87+ # See http://fedoraproject.org/wiki/EPEL
88+ # extras repo is not there for CentOS 9 and epel-release is already part of repo list
89+ if [[ $OS_VERSION == 9 ]]; then
90+ yum install -y epel-release
91+ ALLOW_ERASE=" --allowerasing"
92+ else
93+ yum --enablerepo=extras install -y epel-release
94+ ALLOW_ERASE=" "
95+ fi
8996
90- ccache_deps=" asciidoc docbook-dtds docbook-style-xsl libxslt"
91- numpy_deps=" gcc-gfortran"
92- yum install -y \
97+ ccache_deps=" asciidoc docbook-dtds docbook-style-xsl libxslt"
98+ numpy_deps=" gcc-gfortran"
99+ # Note: protobuf-c-{compiler,devel} on CentOS are too old to be used
100+ # for Caffe2. That said, we still install them to make sure the build
101+ # system opts to build/use protoc and libprotobuf from third-party.
102+ yum install -y $ALLOW_ERASE \
93103 $ccache_deps \
94104 $numpy_deps \
95105 autoconf \
@@ -106,24 +116,34 @@ install_centos() {
106116 glibc-headers \
107117 glog-devel \
108118 libstdc++-devel \
109- libsndfile-devel \
110119 make \
111- opencv-devel \
112120 sudo \
113121 wget \
114122 vim \
115123 unzip \
116124 gdb
117125
126+ if [[ $OS_VERSION == 9 ]]
127+ then
128+ dnf --enablerepo=crb -y install libsndfile-devel
129+ yum install -y procps
130+ else
131+ yum install -y \
132+ opencv-devel \
133+ libsndfile-devel
134+ fi
135+
118136 # Cleanup
119137 yum clean all
120138 rm -rf /var/cache/yum
121139 rm -rf /var/lib/yum/yumdb
122140 rm -rf /var/lib/yum/history
123141}
124142
125- # Install base packages depending on the base OS
126143ID=$( grep -oP ' (?<=^ID=).+' /etc/os-release | tr -d ' "' )
144+ OS_VERSION=$( grep -oP ' (?<=^VERSION_ID=).+' /etc/os-release | tr -d ' "' )
145+
146+ # Install base packages depending on the base OS
127147case " $ID " in
128148 ubuntu)
129149 install_ubuntu
0 commit comments