#5345 closed enhancement (fixed)

Resolve (some of) parallelism bottlenecks in test suites

Reported by: Xi Ruoyao Owned by: Xi Ruoyao
Priority: normal Milestone: 12.1
Component: Book Version: git
Severity: normal Keywords:
Cc:

Description (last modified by Xi Ruoyao)

There are some parallelism bottlenecks in test suites:

  • Autoconf, Libtool, Tar, and maybe others
    • Solution: set TESTSUITEFLAGS=-j$N globally (like MAKEFLAGS)
  • Automake (with more than 4 cores)
    • Solution: set -j $(($N > 4 ? $N : 4)) instead of just -j4
  • OpenSSL
    • Solution: HARNESS_JOBS=$N make test
  • Perl
    • Solution: TEST_JOBS=$N make test_harness
  • Binutils, Libffi, and Findutils
    • Not solvable, limitation of DejaGNU. GCC has managed to resolve the issue but the solution is very complex.
  • Make
    • Not solvable, test suite just does not support parallelism.
  • Vim
    • Not solvable, of course we cannot test an editor in a parallelized way.

Change History (15)

comment:1 by Xi Ruoyao, 15 months ago

Description: modified (diff)

comment:2 by Xi Ruoyao, 15 months ago

Description: modified (diff)

comment:3 by Xi Ruoyao, 15 months ago

Description: modified (diff)

comment:4 by pierre, 15 months ago

WIP: see banch xry111/parallelism

comment:5 by pierre, 15 months ago

bison and kbd, too honor TESTSUITEFLAGS.

Version 0, edited 15 months ago by pierre (next)

in reply to:  6 comment:7 by Xi Ruoyao, 14 months ago

Replying to Xi Ruoyao:

Rebased and added two commits.

Log: https://wiki.linuxfromscratch.org/lfs/log/?rev=xry111/parallelism&stop_rev=trunk

To editors: please review the change. If there is no issue we'll adapt jhalfs to handle this.

comment:8 by pierre, 14 months ago

I am all for it. On IRC, Bruce has proposed an alternative to $(nproc || echo 1), using lscpu. But lscpu, too is not guaranteed to be present on the host, I think. We could parse /proc/cpuinfo, which is almost guaranteed to be on the host (but we have to test with small distros like alpine). Something like:

awk '/siblings/{print $3}' /proc/cpuinfo | tail -n 1

Note that if we need to test with a given number of processors, we can limit them by writing to /sys/devices/system/cpu/cpu<N>/online. Or we can use systemd-run -p AllowedCPUs= (needs systemd obviously) or use cgroup cpuset controller (need to be enabled in kernel). This could be implemented in jhalfs, but users are free to use them too (we can give some explanations).

in reply to:  8 comment:9 by Xi Ruoyao, 14 months ago

Replying to pierre:

I am all for it. On IRC, Bruce has proposed an alternative to $(nproc || echo 1), using lscpu. But lscpu, too is not guaranteed to be present on the host, I think. We could parse /proc/cpuinfo, which is almost guaranteed to be on the host (but we have to test with small distros like alpine). Something like:

awk '/siblings/{print $3}' /proc/cpuinfo | tail -n 1

This command does not work well with a multi-CPU configuration. For example, if there are two Xeon CPUs both has 32 logical cores, the command will just say "32".

comment:10 by Xi Ruoyao, 14 months ago

grep -c '^processor' /proc/cpuinfo

But I'm not sure the first grep version supporting "-c".

in reply to:  10 comment:11 by Xi Ruoyao, 14 months ago

Replying to Xi Ruoyao:

grep -c '^processor' /proc/cpuinfo

But I'm not sure the first grep version supporting "-c".

It's available in grep-2.5.1: https://git.savannah.gnu.org/cgit/grep.git/tree/src/grep.c?h=v2.5.1

comment:12 by pierre, 14 months ago

Not sure why we require grep-2.5.1a or above instead of grep-2.5.1. According to the changelog, the only changes between those versions were packaging and some tests...

comment:13 by Xi Ruoyao, 14 months ago

Hmm, maybe it will be easier to just bump Coreutils minimal version to 8.1 and check if nproc works in host system requirements.

comment:14 by Xi Ruoyao, 12 months ago

Owner: changed from lfs-book to Xi Ruoyao
Status: newassigned

comment:15 by Xi Ruoyao, 12 months ago

Resolution: fixed
Status: assignedclosed

Fixed:

Note: See TracTickets for help on using tickets.