Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[2.0] Bump Python to >= 3.8 #20593

Merged
merged 5 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/link_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: '3.6'
python-version: '3.8'
architecture: x64

- name: Install Dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/os_x_mklbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: '3.6'
python-version: '3.8'
architecture: x64

- name: Install Dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/os_x_staticbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: '3.6'
python-version: '3.8'
architecture: x64

- name: Install Dependencies
Expand Down
4 changes: 2 additions & 2 deletions cd/python/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository -y ppa:deadsnakes/ppa && \
apt-get update && \
apt-get install -y python3.7-dev python3.7-distutils virtualenv wget && \
ln -sf /usr/bin/python3.7 /usr/local/bin/python3 && \
apt-get install -y python3.8-dev python3.8-distutils virtualenv wget && \
ln -sf /usr/bin/python3.8 /usr/local/bin/python3 && \
wget -nv https://bootstrap.pypa.io/get-pip.py && \
python3 get-pip.py

Expand Down
6 changes: 3 additions & 3 deletions ci/docker/Dockerfile.build.centos7
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ RUN yum -y check-update || true && \
# CentOS Software Collections https://www.softwarecollections.org
devtoolset-7 \
devtoolset-8 \
rh-python36 \
rh-python38 \
rh-maven35 \
# Libraries
# Provide clbas headerfiles
Expand Down Expand Up @@ -82,9 +82,9 @@ RUN mkdir ~/openblas && \
CXX="g++ -fPIC" CC="gcc -fPIC" make -j DYNAMIC_ARCH=1 DYNAMIC_OLDER=1 && \
make PREFIX=/usr/local install

# Make Python 3.6 and Maven 3.3 Software Collections available by default during
# Make Python 3.8 and Maven 3.3 Software Collections available by default during
# the following build steps in this Dockerfile
SHELL [ "/usr/bin/scl", "enable", "devtoolset-7", "rh-python36", "rh-maven35" ]
SHELL [ "/usr/bin/scl", "enable", "devtoolset-7", "rh-python38", "rh-maven35" ]

# Install minimum required cmake version
RUN cd /usr/local/src && \
Expand Down
16 changes: 8 additions & 8 deletions ci/docker/runtime_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ sanity_python() {
# $1 -> mxnet_variant: The variant of the libmxnet.so library
cd_unittest_ubuntu() {
set -ex
source /opt/rh/rh-python36/enable
source /opt/rh/rh-python38/enable
export PYTHONPATH=./python/
export MXNET_ONEDNN_DEBUG=0 # Ignored if not present
export MXNET_STORAGE_FALLBACK_LOG_VERBOSE=0
Expand Down Expand Up @@ -925,7 +925,7 @@ unittest_cpp() {

unittest_centos7_cpu() {
set -ex
source /opt/rh/rh-python36/enable
source /opt/rh/rh-python38/enable
cd /work/mxnet
export DMLC_LOG_STACK_TRACE_DEPTH=100
OMP_NUM_THREADS=$(expr $(nproc) / 4) python -m pytest -m 'not serial' -k 'not test_operator' -n 4 --durations=50 --cov-report xml:tests_unittest.xml --verbose tests/python/unittest
Expand All @@ -937,7 +937,7 @@ unittest_centos7_cpu() {

unittest_centos7_gpu() {
set -ex
source /opt/rh/rh-python36/enable
source /opt/rh/rh-python38/enable
cd /work/mxnet
export CUDNN_VERSION=${CUDNN_VERSION:-7.0.3}
export DMLC_LOG_STACK_TRACE_DEPTH=100
Expand Down Expand Up @@ -1368,7 +1368,7 @@ build_static_libmxnet() {
set -ex
pushd .
source /opt/rh/devtoolset-8/enable
source /opt/rh/rh-python36/enable
source /opt/rh/rh-python38/enable
# Opt in to newer GCC C++ ABI. devtoolset defaults to ABI Version 2.
export CXXFLAGS="-fabi-version=11 -fabi-compat-version=7"
local mxnet_variant=${1:?"This function requires a python command as the first argument"}
Expand All @@ -1393,7 +1393,7 @@ cd_package_pypi() {
set -ex
pushd .
source /opt/rh/devtoolset-8/enable
source /opt/rh/rh-python36/enable
source /opt/rh/rh-python38/enable
# Opt in to newer GCC C++ ABI. devtoolset defaults to ABI Version 2.
export CXXFLAGS="-fabi-version=11 -fabi-compat-version=7"
local mxnet_variant=${1:?"This function requires a python command as the first argument"}
Expand All @@ -1404,7 +1404,7 @@ cd_package_pypi() {
# Sanity checks wheel file
cd_integration_test_pypi() {
set -ex
source /opt/rh/rh-python36/enable
source /opt/rh/rh-python38/enable

# install mxnet wheel package
pip3 install --user ./wheel_build/dist/*.whl
Expand Down Expand Up @@ -1438,7 +1438,7 @@ build_static_python_cpu() {
pushd .
export mxnet_variant=cpu
source /opt/rh/devtoolset-8/enable
source /opt/rh/rh-python36/enable
source /opt/rh/rh-python38/enable
# Opt in to newer GCC C++ ABI. devtoolset defaults to ABI Version 2.
export CXXFLAGS="-fabi-version=11 -fabi-compat-version=7"
./ci/publish/python/build.sh
Expand All @@ -1450,7 +1450,7 @@ build_static_python_cu102() {
pushd .
export mxnet_variant=cu102
source /opt/rh/devtoolset-8/enable
source /opt/rh/rh-python36/enable
source /opt/rh/rh-python38/enable
# Opt in to newer GCC C++ ABI. devtoolset defaults to ABI Version 2.
export CXXFLAGS="-fabi-version=11 -fabi-compat-version=7"
./ci/publish/python/build.sh
Expand Down
1 change: 1 addition & 0 deletions docs/python_docs/requirements
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.

numpy>=1.17,<1.20.0
jupyter
Jinja2==2.11.3
sphinx==2.4.0
Expand Down
15 changes: 10 additions & 5 deletions tests/python/dnnl/test_dnnl.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,22 @@ def test_dnnl_ndarray_slice():
# trigger computation on ndarray slice
assert_almost_equal(y[0].asnumpy()[0, 0, 0], np.array(0.056331709))


# In python3.8, functions are only pickable if they are defined in
# the top-level of a module
# https://docs.python.org/3/library/pickle.html#what-can-be-pickled-and-unpickled
class Dummy(gluon.data.Dataset):
def __len__(self):
return 2
def __getitem__(self, key):
return key, np.ones((3, 224, 224)), np.ones((10, ))

@use_np
@pytest.mark.seed(1234)
def test_dnnl_engine_threading():
net = gluon.nn.HybridSequential()
net.add(gluon.nn.Conv2D(channels=32, kernel_size=3, activation=None))
net.initialize(ctx=mx.cpu())
class Dummy(gluon.data.Dataset):
def __len__(self):
return 2
def __getitem__(self, key):
return key, np.ones((3, 224, 224)), np.ones((10, ))

loader = gluon.data.DataLoader(Dummy(), batch_size=2, num_workers=1)

Expand Down