Skip to content

Commit 5a9513b

Browse files
authored
cherry pick fix mac ci random fail (#18437)
* fix mac ci random fail * use platform instead test=release/1.5
1 parent 157f138 commit 5a9513b

File tree

4 files changed

+29
-11
lines changed

4 files changed

+29
-11
lines changed

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,17 @@ RUN localedef -i en_US -f UTF-8 en_US.UTF-8
9292
# specify sphinx version as 1.5.6 and remove -U option for [pip install -U
9393
# sphinx-rtd-theme] since -U option will cause sphinx being updated to newest
9494
# version(1.7.1 for now), which causes building documentation failed.
95-
RUN pip3 --no-cache-dir install -U wheel py-cpuinfo==4.0.0 && \
95+
RUN pip3 --no-cache-dir install -U wheel py-cpuinfo==5.0.0 && \
9696
pip3 --no-cache-dir install -U docopt PyYAML sphinx==1.5.6 && \
9797
pip3 --no-cache-dir install sphinx-rtd-theme==0.1.9 recommonmark && \
98-
pip3.6 --no-cache-dir install -U wheel py-cpuinfo==4.0.0 && \
98+
pip3.6 --no-cache-dir install -U wheel py-cpuinfo==5.0.0 && \
9999
pip3.6 --no-cache-dir install -U docopt PyYAML sphinx==1.5.6 && \
100100
pip3.6 --no-cache-dir install sphinx-rtd-theme==0.1.9 recommonmark && \
101-
pip3.7 --no-cache-dir install -U wheel py-cpuinfo==4.0.0 && \
101+
pip3.7 --no-cache-dir install -U wheel py-cpuinfo==5.0.0 && \
102102
pip3.7 --no-cache-dir install -U docopt PyYAML sphinx==1.5.6 && \
103103
pip3.7 --no-cache-dir install sphinx-rtd-theme==0.1.9 recommonmark && \
104104
easy_install -U pip && \
105-
pip --no-cache-dir install -U pip setuptools wheel py-cpuinfo==4.0.0 && \
105+
pip --no-cache-dir install -U pip setuptools wheel py-cpuinfo==5.0.0 && \
106106
pip --no-cache-dir install -U docopt PyYAML sphinx==1.5.6 && \
107107
pip --no-cache-dir install sphinx-rtd-theme==0.1.9 recommonmark
108108

paddle/scripts/Dockerfile.tmp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,17 @@ RUN localedef -i en_US -f UTF-8 en_US.UTF-8
9292
# specify sphinx version as 1.5.6 and remove -U option for [pip install -U
9393
# sphinx-rtd-theme] since -U option will cause sphinx being updated to newest
9494
# version(1.7.1 for now), which causes building documentation failed.
95-
RUN pip3 --no-cache-dir install -U wheel py-cpuinfo==4.0.0 && \
95+
RUN pip3 --no-cache-dir install -U wheel py-cpuinfo==5.0.0 && \
9696
pip3 --no-cache-dir install -U docopt PyYAML sphinx==1.5.6 && \
9797
pip3 --no-cache-dir install sphinx-rtd-theme==0.1.9 recommonmark && \
98-
pip3.6 --no-cache-dir install -U wheel py-cpuinfo==4.0.0 && \
98+
pip3.6 --no-cache-dir install -U wheel py-cpuinfo==5.0.0 && \
9999
pip3.6 --no-cache-dir install -U docopt PyYAML sphinx==1.5.6 && \
100100
pip3.6 --no-cache-dir install sphinx-rtd-theme==0.1.9 recommonmark && \
101-
pip3.7 --no-cache-dir install -U wheel py-cpuinfo==4.0.0 && \
101+
pip3.7 --no-cache-dir install -U wheel py-cpuinfo==5.0.0 && \
102102
pip3.7 --no-cache-dir install -U docopt PyYAML sphinx==1.5.6 && \
103103
pip3.7 --no-cache-dir install sphinx-rtd-theme==0.1.9 recommonmark && \
104104
easy_install -U pip && \
105-
pip --no-cache-dir install -U pip setuptools wheel py-cpuinfo==4.0.0 && \
105+
pip --no-cache-dir install -U pip setuptools wheel py-cpuinfo==5.0.0 && \
106106
pip --no-cache-dir install -U docopt PyYAML sphinx==1.5.6 && \
107107
pip --no-cache-dir install sphinx-rtd-theme==0.1.9 recommonmark
108108

python/paddle/fluid/core.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,26 @@
5858
raise e
5959

6060
load_noavx = False
61-
if 'avx' in get_cpu_info()['flags']:
61+
62+
has_avx = False
63+
if sys.platform == 'darwin':
64+
try:
65+
has_avx = os.popen('sysctl machdep.cpu.features | grep -i avx').read(
66+
) != ''
67+
except Exception as e:
68+
sys.stderr.write(
69+
'Can not get the AVX flag from machdep.cpu.features.\n')
70+
if not has_avx:
71+
try:
72+
has_avx = os.popen(
73+
'sysctl machdep.cpu.leaf7_features | grep -i avx').read() != ''
74+
except Exception as e:
75+
sys.stderr.write(
76+
'Can not get the AVX flag from machdep.cpu.leaf7_features.\n')
77+
else:
78+
has_avx = 'avx' in get_cpu_info()['flags']
79+
80+
if has_avx:
6281
try:
6382
from .core_avx import *
6483
from .core_avx import __doc__, __file__, __name__, __package__

python/requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@ funcsigs
1616
pyyaml
1717
decorator
1818
prettytable
19-
py-cpuinfo==5.0.0 ; platform_system=="Windows"
20-
py-cpuinfo==4.0.0 ; platform_system!="Windows"
19+
py-cpuinfo==5.0.0

0 commit comments

Comments
 (0)