eri*_*eri 32 python linux makefile build
我从源tar编译python.一切正常,但测试运行2小时和两次.如何绕过这些测试?
0:16:20 [178/405] test_inspect
0:16:26 [179/405] test_int
0:16:27 [180/405] test_int_literal
0:16:27 [181/405] test_io
0:18:18 [182/405] test_ioctl -- test_io passed in 1 min 51 sec
0:18:19 [183/405] test_ipaddress
0:18:22 [184/405] test_isinstance
0:18:23 [185/405] test_iter
0:18:24 [186/405] test_iterlen
0:18:25 [187/405] test_itertools
0:19:09 [188/405] test_json -- test_itertools passed in 44 sec
0:19:30 [189/405] test_keyword
Run Code Online (Sandbox Code Playgroud)
结果
make 7724,86s user 188,63s system 101% cpu 2:10:18,93 total
Run Code Online (Sandbox Code Playgroud)
我像这样分发它
PYTHON_VERSION = 3.6.1
PYTHON_URL = https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz
wget -O dl/Python-${PYTHON_VERSION}.tar.xz ${PYTHON_URL}
cd dl
tar xf Python-${PYTHON_VERSION}.tar.xz
mkdir -p dl/Python-${PYTHON_VERSION}-build/
cd Python-${PYTHON_VERSION}
./configure --enable-optimizations --prefix=$$(pwd)-build --cache-file=$$(pwd)/cache-file
Run Code Online (Sandbox Code Playgroud)
此命令运行测试两次:
make -C dl/Python-${PYTHON_VERSION} -j8
make -C dl/Python-${PYTHON_VERSION} -j8 install
Run Code Online (Sandbox Code Playgroud)
ps这是另一个make文件的一部分.
小智 47
configure选项--enable-optimizations使运行的测试套件能够生成用于分析Python的数据.生成的python二进制文件在执行python代码时具有更好的性能.这里提到了改进
From configure help:
--enable-optimizations Enable expensive optimizations (PGO, etc). Disabled by default.
Run Code Online (Sandbox Code Playgroud)
来自维基百科
profile-guided optimisation uses the results of profiling test runs of the instrumented program to optimize the final generated code.
Run Code Online (Sandbox Code Playgroud)
简而言之,在使用--enable-optimizations时不应跳过测试,因为通过运行测试生成了分析所需的数据.您可以运行make -j8 build_all
后跟make -j8 install
跳过测试一次(测试仍然会以install
目标运行),但这会破坏目的.您可以改为删除configure标志以获得更好的构建时间.
我在构建Python时通过指示以下方式跳过了测试运行,进行了一些(快速)研究:
--without-tests
,--disable-tests
,--skip-tests
)前者没有结果。后者(通过在Makefile模板中查看)揭示了这样一个事实,即通过调用$ {PYTHON_SRC_DIR} /Tools/scripts/run_tests.py(设置一些内容并调用另一个脚本,再调用另一个脚本,... 来调用测试执行)。 )。
请注意,我在Python 3.5(.4)和Python 3.6(.4)上找到了该文件,但在Python 2.7(.14)上却找不到。更多的研究表明,可以跳过(上面的)测试运行。您需要做的是:
make -C dl/Python-${PYTHON_VERSION} -j8 EXTRATESTOPTS=--list-tests install
Run Code Online (Sandbox Code Playgroud)
注意事项:
EXTRATESTOPTS=--list-tests
在启动(内部)make之前将其设置为环境变量。@ EDIT0:
在@amohr发表评论后,我决定多玩点游戏,因此我进行了整个过程:
make install
在具有2个CPU的Lnx(Ubtu 16)计算机上,一次(完整)测试运行大约需要24分钟。这是我的发现(Python 3.6):
make test
),其通过援引安装目标关于1 日试运行,通过检查Makefile文件,和化妆的输出,这就是我发现,在发生2 次(补充)的步骤:
-fprofile-generate
被替换-fprofile-use -fprofile-correction
(支票[GNU.GCC]:选项,控制优化的更多详细信息)),以利用在前面的(子)所产生的个人资料信息的步骤跳过第一次测试运行将自动暗示没有优化。实现方式:
make build_all
(在2 次步骤) -一个由其他的答案提示
这是configure(with)生成的(根)Makefile的片段: --enable-optimizations
all: profile-opt
build_all: check-clean-src $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks \
Programs/_testembed python-config
Run Code Online (Sandbox Code Playgroud)这里是一个没有它的人:
all: build_all
build_all: check-clean-src $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks \
Programs/_testembed python-config
Run Code Online (Sandbox Code Playgroud)如图所示,运行:
configure --enable-optimizations
make build_all
等同于:
configure
make
手动修改(根)生成文件 1之间ST(configure --enable-optimizations
)和2 次(化妆)步骤:
PROFILE_TASK=-m test.regrtest --pgo
(对我来说是绕线〜250)--list-tests
在末尾优化构建的默认构建目标包括运行测试。要跳过它们,请尝试:
make -C dl/Python-${PYTHON_VERSION} -j8 build_all
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
15956 次 |
最近记录: |