Skip to content

Commit 75a97f4

Browse files
authored
test: Fix L0_backend_python for Ubuntu 24.04 base (#7789)
1 parent 63ed43c commit 75a97f4

File tree

7 files changed

+65
-41
lines changed

7 files changed

+65
-41
lines changed

qa/L0_backend_python/bls/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ rm -fr *.log ./models *.txt *.xml
3838
# FIXME: [DLIS-5970] Until Windows supports GPU tensors, only test CPU
3939
if [[ ${TEST_WINDOWS} == 0 ]]; then
4040
pip3 uninstall -y torch
41-
pip3 install torch==1.13.0+cu117 -f https://download.pytorch.org/whl/torch_stable.html
41+
pip3 install torch==2.3.1+cu118 -f https://download.pytorch.org/whl/torch_stable.html
4242

4343
mkdir -p models/bls/1/
4444
cp ../../python_models/bls/model.py models/bls/1/

qa/L0_backend_python/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ get_shm_pages() {
3232

3333
install_conda() {
3434
rm -rf ./miniconda
35-
file_name="Miniconda3-py310_23.11.0-2-Linux-x86_64.sh"
35+
file_name="Miniconda3-py312_24.9.2-0-Linux-x86_64.sh"
3636
wget https://repo.anaconda.com/miniconda/$file_name
3737

3838
# install miniconda in silent mode

qa/L0_backend_python/decoupled/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pip3 uninstall -y torch
3737
if [[ ${TEST_WINDOWS} == 1 ]]; then
3838
pip3 install torch==1.13.0 -f https://download.pytorch.org/whl/torch_stable.html
3939
else
40-
pip3 install torch==1.13.0+cu117 -f https://download.pytorch.org/whl/torch_stable.html
40+
pip3 install torch==2.3.1+cu118 -f https://download.pytorch.org/whl/torch_stable.html
4141
fi
4242

4343
RET=0

qa/L0_backend_python/env/test.sh

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ install_conda
4747
create_conda_env "3.7" "python-3-7"
4848
conda install numpy=1.20.1 -y
4949
conda install tensorflow=2.1.0 -y
50-
conda install -c conda-forge libstdcxx-ng=12 -y
50+
conda install -c conda-forge libstdcxx-ng=14 -y
5151

5252
PY37_VERSION_STRING="Python version is 3.7, NumPy version is 1.20.1, and Tensorflow version is 2.1.0"
5353
create_python_backend_stub
@@ -71,7 +71,7 @@ path_to_conda_pack="$PWD/python-3-7-1"
7171
create_conda_env_with_specified_path "3.7" $path_to_conda_pack
7272
conda install numpy=1.20.3 -y
7373
conda install tensorflow=2.1.0 -y
74-
conda install -c conda-forge libstdcxx-ng=12 -y
74+
conda install -c conda-forge libstdcxx-ng=14 -y
7575

7676
PY37_1_VERSION_STRING="Python version is 3.7, NumPy version is 1.20.3, and Tensorflow version is 2.1.0"
7777
create_python_backend_stub
@@ -90,7 +90,7 @@ conda deactivate
9090
# Tensorflow 2.1.0 only works with Python 3.4 - 3.7. Successful execution of
9191
# the Python model indicates that the environment has been setup correctly.
9292
create_conda_env "3.6" "python-3-6"
93-
conda install -c conda-forge libstdcxx-ng=12 -y
93+
conda install -c conda-forge libstdcxx-ng=14 -y
9494
conda install numpy=1.18.1 -y
9595
conda install tensorflow=2.1.0 -y
9696
PY36_VERSION_STRING="Python version is 3.6, NumPy version is 1.18.1, and Tensorflow version is 2.1.0"
@@ -110,22 +110,23 @@ cp python_backend/builddir/triton_python_backend_stub ./models/python_3_6
110110
conda deactivate
111111

112112
# Test conda env without custom Python backend stub This environment should
113-
# always use the default Python version shipped in the container. For Ubuntu 22.04
114-
# it is Python 3.10 and for Ubuntu 20.04 is 3.8
115-
path_to_conda_pack='$$TRITON_MODEL_DIRECTORY/python_3_10_environment.tar.gz'
116-
create_conda_env "3.10" "python-3-10"
117-
conda install -c conda-forge libstdcxx-ng=12 -y
118-
conda install numpy=1.23.4 -y
119-
conda install tensorflow=2.10.0 -y
120-
PY310_VERSION_STRING="Python version is 3.10, NumPy version is 1.23.4, and Tensorflow version is 2.10.0"
121-
conda pack -o python3.10.tar.gz
122-
mkdir -p models/python_3_10/1/
123-
cp ../../python_models/python_version/config.pbtxt ./models/python_3_10
124-
cp python3.10.tar.gz models/python_3_10/python_3_10_environment.tar.gz
125-
(cd models/python_3_10 && \
126-
sed -i "s/^name:.*/name: \"python_3_10\"/" config.pbtxt && \
113+
# always use the default Python version shipped in the container. For Ubuntu
114+
# 24.04 it is Python 3.12, for Ubuntu 22.04 is Python 3.10 and for Ubuntu 20.04
115+
# is 3.8.
116+
path_to_conda_pack='$$TRITON_MODEL_DIRECTORY/python_3_12_environment.tar.gz'
117+
create_conda_env "3.12" "python-3-12"
118+
conda install -c conda-forge libstdcxx-ng=14 -y
119+
conda install numpy=1.26.4 -y
120+
conda install tensorflow=2.16.2 -y
121+
PY312_VERSION_STRING="Python version is 3.12, NumPy version is 1.26.4, and Tensorflow version is 2.16.2"
122+
conda pack -o python3.12.tar.gz
123+
mkdir -p models/python_3_12/1/
124+
cp ../../python_models/python_version/config.pbtxt ./models/python_3_12
125+
cp python3.12.tar.gz models/python_3_12/python_3_12_environment.tar.gz
126+
(cd models/python_3_12 && \
127+
sed -i "s/^name:.*/name: \"python_3_12\"/" config.pbtxt && \
127128
echo "parameters: {key: \"EXECUTION_ENV_PATH\", value: {string_value: \"$path_to_conda_pack\"}}" >> config.pbtxt)
128-
cp ../../python_models/python_version/model.py ./models/python_3_10/1/
129+
cp ../../python_models/python_version/model.py ./models/python_3_12/1/
129130
conda deactivate
130131
rm -rf ./miniconda
131132

@@ -140,7 +141,7 @@ kill $SERVER_PID
140141
wait $SERVER_PID
141142

142143
set +e
143-
for EXPECTED_VERSION_STRING in "$PY36_VERSION_STRING" "$PY37_VERSION_STRING" "$PY37_1_VERSION_STRING" "$PY310_VERSION_STRING"; do
144+
for EXPECTED_VERSION_STRING in "$PY36_VERSION_STRING" "$PY37_VERSION_STRING" "$PY37_1_VERSION_STRING" "$PY312_VERSION_STRING"; do
144145
grep "$EXPECTED_VERSION_STRING" $SERVER_LOG
145146
if [ $? -ne 0 ]; then
146147
cat $SERVER_LOG
@@ -198,21 +199,21 @@ if [ "$SERVER_PID" == "0" ]; then
198199
fi
199200

200201
# The environment should be extracted
201-
curl -v -X POST localhost:8000/v2/repository/models/python_3_10/load
202-
touch -m models/python_3_10/1/model.py
202+
curl -v -X POST localhost:8000/v2/repository/models/python_3_12/load
203+
touch -m models/python_3_12/1/model.py
203204
# The environment should not be re-extracted
204-
curl -v -X POST localhost:8000/v2/repository/models/python_3_10/load
205-
touch -m models/python_3_10/python_3_10_environment.tar.gz
205+
curl -v -X POST localhost:8000/v2/repository/models/python_3_12/load
206+
touch -m models/python_3_12/python_3_12_environment.tar.gz
206207
# The environment should be re-extracted
207-
curl -v -X POST localhost:8000/v2/repository/models/python_3_10/load
208+
curl -v -X POST localhost:8000/v2/repository/models/python_3_12/load
208209

209210
kill $SERVER_PID
210211
wait $SERVER_PID
211212

212213
set +e
213214

214-
PY310_ENV_EXTRACTION="Extracting Python execution env"
215-
if [ `grep -c "${PY310_ENV_EXTRACTION}" ${SERVER_LOG}` != "2" ]; then
215+
PY312_ENV_EXTRACTION="Extracting Python execution env"
216+
if [ `grep -c "${PY312_ENV_EXTRACTION}" ${SERVER_LOG}` != "2" ]; then
216217
cat $SERVER_LOG
217218
echo -e "\n***\n*** Python execution environment should be extracted exactly twice. \n***"
218219
RET=1
@@ -275,8 +276,8 @@ aws s3 rm "${BUCKET_URL_SLASH}" --recursive --include "*"
275276
# Test with EXECUTION_ENV_PATH outside the model directory
276277
sed -i "s/TRITON_MODEL_DIRECTORY\/python_3_6_environment/TRITON_MODEL_DIRECTORY\/..\/python_3_6_environment/" models/python_3_6/config.pbtxt
277278
mv models/python_3_6/python_3_6_environment.tar.gz models
278-
sed -i "s/\$\$TRITON_MODEL_DIRECTORY\/python_3_10_environment/s3:\/\/triton-bucket-${CI_JOB_ID}\/python_3_10_environment/" models/python_3_10/config.pbtxt
279-
mv models/python_3_10/python_3_10_environment.tar.gz models
279+
sed -i "s/\$\$TRITON_MODEL_DIRECTORY\/python_3_12_environment/s3:\/\/triton-bucket-${CI_JOB_ID}\/python_3_12_environment/" models/python_3_12/config.pbtxt
280+
mv models/python_3_12/python_3_12_environment.tar.gz models
280281

281282
aws s3 cp models/ "${BUCKET_URL_SLASH}" --recursive --include "*"
282283

@@ -295,7 +296,7 @@ kill $SERVER_PID
295296
wait $SERVER_PID
296297

297298
set +e
298-
for EXPECTED_VERSION_STRING in "$PY36_VERSION_STRING" "$PY310_VERSION_STRING"; do
299+
for EXPECTED_VERSION_STRING in "$PY36_VERSION_STRING" "$PY312_VERSION_STRING"; do
299300
grep "$EXPECTED_VERSION_STRING" $SERVER_LOG
300301
if [ $? -ne 0 ]; then
301302
cat $SERVER_LOG

qa/L0_backend_python/io/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ RET=0
3838
rm -fr *.log ./models
3939

4040
pip3 uninstall -y torch
41-
pip3 install torch==1.13.0+cu117 -f https://download.pytorch.org/whl/torch_stable.html
41+
pip3 install torch==2.3.1+cu118 -f https://download.pytorch.org/whl/torch_stable.html
4242

4343
# IOTest.test_ensemble_io
4444
TRIALS="default decoupled"

qa/L0_backend_python/setup_python_enviroment.sh

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2727
RET=0
2828
set -e
29-
if [ ${PYTHON_ENV_VERSION} = "10" ]; then
29+
if [ ${PYTHON_ENV_VERSION} = "12" ]; then
3030
echo No need to set up anything for default python3.${PYTHON_ENV_VERSION}
3131
exit $RET
3232
fi
@@ -39,7 +39,7 @@ BASE_SERVER_ARGS="--model-repository=${MODELDIR}/models --log-verbose=1 --disabl
3939
PYTHON_BACKEND_BRANCH=$PYTHON_BACKEND_REPO_TAG
4040
SERVER_ARGS=$BASE_SERVER_ARGS
4141
SERVER_LOG="./inference_server.log"
42-
export PYTHON_ENV_VERSION=${PYTHON_ENV_VERSION:="10"}
42+
export PYTHON_ENV_VERSION=${PYTHON_ENV_VERSION:="12"}
4343
RET=0
4444
EXPECTED_VERSION_STRINGS=""
4545

@@ -55,7 +55,7 @@ conda update -n base -c defaults conda -y
5555
# been setup correctly.
5656
if [ ${PYTHON_ENV_VERSION} = "8" ]; then
5757
create_conda_env "3.8" "python-3-8"
58-
conda install -c conda-forge libstdcxx-ng=12 -y
58+
conda install -c conda-forge libstdcxx-ng=14 -y
5959
conda install numpy=1.23.4 -y
6060
conda install tensorflow=2.10.0 -y
6161
EXPECTED_VERSION_STRING="Python version is 3.8, NumPy version is 1.23.4, and Tensorflow version is 2.10.0"
@@ -78,7 +78,7 @@ fi
7878
# been setup correctly.
7979
if [ ${PYTHON_ENV_VERSION} = "9" ]; then
8080
create_conda_env "3.9" "python-3-9"
81-
conda install -c conda-forge libstdcxx-ng=12 -y
81+
conda install -c conda-forge libstdcxx-ng=14 -y
8282
conda install numpy=1.23.4 -y
8383
conda install tensorflow=2.10.0 -y
8484
EXPECTED_VERSION_STRING="Python version is 3.9, NumPy version is 1.23.4, and Tensorflow version is 2.10.0"
@@ -96,13 +96,36 @@ if [ ${PYTHON_ENV_VERSION} = "9" ]; then
9696
cp python_backend/builddir/triton_python_backend_stub ./models/python_3_9
9797
fi
9898

99+
# Create a model with python 3.10 version
100+
# Successful execution of the Python model indicates that the environment has
101+
# been setup correctly.
102+
if [ ${PYTHON_ENV_VERSION} = "10" ]; then
103+
create_conda_env "3.10" "python-3-10"
104+
conda install -c conda-forge libstdcxx-ng=14 -y
105+
conda install tensorflow=2.10.0 -y
106+
conda install numpy=1.23.4 -y
107+
EXPECTED_VERSION_STRING="Python version is 3.10, NumPy version is 1.23.4, and Tensorflow version is 2.10.0"
108+
create_python_backend_stub
109+
conda-pack -o python3.10.tar.gz
110+
path_to_conda_pack="$PWD/python-3-10"
111+
mkdir -p $path_to_conda_pack
112+
tar -xzf python3.10.tar.gz -C $path_to_conda_pack
113+
mkdir -p models/python_3_10/1/
114+
cp ../python_models/python_version/config.pbtxt ./models/python_3_10
115+
(cd models/python_3_10 && \
116+
sed -i "s/^name:.*/name: \"python_3_10\"/" config.pbtxt && \
117+
echo "parameters: {key: \"EXECUTION_ENV_PATH\", value: {string_value: \"$path_to_conda_pack\"}}">> config.pbtxt)
118+
cp ../python_models/python_version/model.py ./models/python_3_10/1/
119+
cp python_backend/builddir/triton_python_backend_stub ./models/python_3_10
120+
fi
121+
99122
# Create a model with python 3.11 version
100123
# Successful execution of the Python model indicates that the environment has
101124
# been setup correctly.
102125
if [ ${PYTHON_ENV_VERSION} = "11" ]; then
103126
create_conda_env "3.11" "python-3-11"
104127
conda install tensorflow=2.12.0 -y
105-
conda install -c conda-forge libstdcxx-ng=12 -y
128+
conda install -c conda-forge libstdcxx-ng=14 -y
106129
conda install numpy=1.23.5 -y
107130
EXPECTED_VERSION_STRING="Python version is 3.11, NumPy version is 1.23.5, and Tensorflow version is 2.12.0"
108131
create_python_backend_stub

qa/L0_backend_python/test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ rm -fr *.log ./models
8080

8181
python3 --version | grep "3.12" > /dev/null
8282
if [ $? -ne 0 ]; then
83-
echo -e "Expecting Python default version to be: Python 3.10 but actual version is $(python3 --version)"
83+
echo -e "Expecting Python default version to be: Python 3.12 but actual version is $(python3 --version)"
8484
exit 1
8585
fi
8686

@@ -169,7 +169,7 @@ cp ../python_models/dlpack_identity/config.pbtxt ./models/dlpack_identity
169169

170170

171171
if [ "$TEST_JETSON" == "0" ] && [[ ${TEST_WINDOWS} == 0 ]]; then
172-
pip3 install torch==1.13.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
172+
pip3 install torch==2.3.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
173173
else
174174
# GPU tensor tests are disabled on jetson
175175
pip3 install torch==1.13.0 -f https://download.pytorch.org/whl/torch_stable.html
@@ -444,7 +444,7 @@ if [ "$TEST_JETSON" == "0" ]; then
444444
done
445445

446446
# [DLIS-5969]: Incorporate env test for windows
447-
if [[ ${PYTHON_ENV_VERSION} = "10" ]] && [[ ${TEST_WINDOWS} == 0 ]]; then
447+
if [[ ${PYTHON_ENV_VERSION} = "12" ]] && [[ ${TEST_WINDOWS} == 0 ]]; then
448448
# In 'env' test we use miniconda for dependency management. No need to run
449449
# the test in a virtual environment.
450450
set +e

0 commit comments

Comments
 (0)