From b8b9170f9df44fab6480ed0a561c778d306ed657 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Wed, 23 Dec 2020 16:07:14 -0500 Subject: [PATCH] Remove Unix::Processors dependency --- ci/ci-install.bash | 4 ++-- ci/docker/buildenv/Dockerfile | 2 +- docs/install.adoc | 1 - docs/internals.adoc | 2 +- test_regress/driver.pl | 15 ++++++++++----- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/ci/ci-install.bash b/ci/ci-install.bash index 66216d5ff..7e0e4a398 100755 --- a/ci/ci-install.bash +++ b/ci/ci-install.bash @@ -55,7 +55,7 @@ if [ "$CI_BUILD_STAGE_NAME" = "build" ]; then sudo apt-get install libsystemc libsystemc-dev fi if [ "$COVERAGE" = 1 ]; then - yes yes | sudo cpan -fi Unix::Processors Parallel::Forker + yes yes | sudo cpan -fi Parallel::Forker fi if [ "$M32" = 1 ]; then sudo apt-get install gcc-multilib g++-multilib @@ -100,7 +100,7 @@ elif [ "$CI_BUILD_STAGE_NAME" = "test" ]; then if [ "$CI_RUNS_ON" != "ubuntu-14.04" ]; then CI_CPAN_REPO=https://cpan.org fi - yes yes | sudo cpan -M $CI_CPAN_REPO -fi Unix::Processors Parallel::Forker + yes yes | sudo cpan -M $CI_CPAN_REPO -fi Parallel::Forker install-vcddiff autoconf diff --git a/ci/docker/buildenv/Dockerfile b/ci/docker/buildenv/Dockerfile index 6f9dd3539..7e6682357 100644 --- a/ci/docker/buildenv/Dockerfile +++ b/ci/docker/buildenv/Dockerfile @@ -40,7 +40,7 @@ RUN apt-get update \ WORKDIR /tmp -RUN cpan install -fi Unix::Processors Parallel::Forker +RUN cpan install -fi Parallel::Forker RUN git clone https://github.com/veripool/vcddiff.git && \ make -C vcddiff && \ diff --git a/docs/install.adoc b/docs/install.adoc index 65ae632f3..ef88b1dce 100644 --- a/docs/install.adoc +++ b/docs/install.adoc @@ -100,7 +100,6 @@ Those developing Verilator itself may also want these (see internals.adoc): sudo apt-get install gdb asciidoctor graphviz cmake clang clang-format gprof lcov cpan install Pod::Perldoc - cpan install Unix::Processors cpan install Parallel::Forker ==== Install SystemC diff --git a/docs/internals.adoc b/docs/internals.adoc index c8eb93f70..11df4107a 100644 --- a/docs/internals.adoc +++ b/docs/internals.adoc @@ -697,7 +697,7 @@ Verilator problem. When enabling the long tests, some additional PERL modules are needed, which you can install using cpan. - cpan install Unix::Processors + cpan install Parallel::Forker There are some traps to avoid when running regression tests diff --git a/test_regress/driver.pl b/test_regress/driver.pl index f4214443f..61360b7e3 100755 --- a/test_regress/driver.pl +++ b/test_regress/driver.pl @@ -249,12 +249,17 @@ sub parameter { } } +our $_Max_Procs; sub max_procs { - my $ok = eval " - use Unix::Processors; - return Unix::Processors->new->max_online; - "; - return $ok; + if (!defined $_Max_Procs) { + $_Max_Procs = `python3 -c 'import multiprocessing\nprint(multiprocessing.cpu_count())'`; + chomp $_Max_Procs; + if ($_Max_Procs < 2) { + $_Max_Procs = 2; + warn "driver.pl: Python didn't find at least two CPUs\n"; + } + } + return $_Max_Procs; } sub calc_threads {