Skip to content

Commit

Permalink
Fix benchmark by making sure we use Python 3
Browse files Browse the repository at this point in the history
The benchmark runs have been failing since we started requiring Python
3, so this changes fixes the benchmarks by ensuring we always use Python
3.
  • Loading branch information
acozzette committed Oct 29, 2021
1 parent 201c1fc commit ae2aae5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions benchmarks/Makefile.am
Expand Up @@ -165,7 +165,7 @@ python_add_init: protoc_middleman protoc_middleman2
done \
done

python_cpp_pkg_flags = `pkg-config --cflags --libs python`
python_cpp_pkg_flags = `pkg-config --cflags --libs python3`

lib_LTLIBRARIES = libbenchmark_messages.la
libbenchmark_messages_la_SOURCES = python/python_benchmark_messages.cc
Expand All @@ -186,7 +186,7 @@ python-pure-python-benchmark: python_add_init
@echo export DYLD_LIBRARY_PATH=$(top_srcdir)/src/.libs >> python-pure-python-benchmark
@echo export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=\'python\' >> python-pure-python-benchmark
@echo cp $(srcdir)/python/py_benchmark.py tmp >> python-pure-python-benchmark
@echo python tmp/py_benchmark.py '$$@' >> python-pure-python-benchmark
@echo python3 tmp/py_benchmark.py '$$@' >> python-pure-python-benchmark
@chmod +x python-pure-python-benchmark

python-cpp-reflection-benchmark: python_add_init
Expand All @@ -196,7 +196,7 @@ python-cpp-reflection-benchmark: python_add_init
@echo export DYLD_LIBRARY_PATH=$(top_srcdir)/src/.libs >> python-cpp-reflection-benchmark
@echo export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=\'cpp\' >> python-cpp-reflection-benchmark
@echo cp $(srcdir)/python/py_benchmark.py tmp >> python-cpp-reflection-benchmark
@echo python tmp/py_benchmark.py '$$@' >> python-cpp-reflection-benchmark
@echo python3 tmp/py_benchmark.py '$$@' >> python-cpp-reflection-benchmark
@chmod +x python-cpp-reflection-benchmark

python-cpp-generated-code-benchmark: python_add_init libbenchmark_messages.la
Expand All @@ -206,7 +206,7 @@ python-cpp-generated-code-benchmark: python_add_init libbenchmark_messages.la
@echo export DYLD_LIBRARY_PATH=$(top_srcdir)/src/.libs >> python-cpp-generated-code-benchmark
@echo export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=\'cpp\' >> python-cpp-generated-code-benchmark
@echo cp $(srcdir)/python/py_benchmark.py tmp >> python-cpp-generated-code-benchmark
@echo python tmp/py_benchmark.py --cpp_generated '$$@' >> python-cpp-generated-code-benchmark
@echo python3 tmp/py_benchmark.py --cpp_generated '$$@' >> python-cpp-generated-code-benchmark
@chmod +x python-cpp-generated-code-benchmark

python-pure-python: python-pure-python-benchmark
Expand Down
4 changes: 2 additions & 2 deletions kokoro/linux/benchmark/run.sh
Expand Up @@ -23,8 +23,8 @@ popd
./configure CXXFLAGS="-fPIC -O2"
make -j8
pushd python
python setup.py build --cpp_implementation
pip install . --user
python3 setup.py build --cpp_implementation
pip3 install . --user
popd

# build and run Python benchmark
Expand Down

0 comments on commit ae2aae5

Please sign in to comment.