Skip to contentSkip to conversation

devtools: parallelize ABI check

PATCH Superseded Thomas Monjalon 4 participants 13 messages Jan 7, 2023 – Jan 18, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devtools: parallelize ABI check

Generation and comparison of ABI dumps are done on multiple cores thanks to xargs -P0.
It can accelerate this long step by 5 in my tests.

xargs reports a global error if one of the process has an error.

Running a shell function with xargs requires to export it with -f.

---
 devtools/check-abi.sh | 33 ++++++++++++++++++++-------------
 devtools/gen-abi.sh   |  5 +++--
 2 files changed, 23 insertions(+), 15 deletions(-)
devtools/check-abi.sh +20 -13
index c583eae2fd..e2fa49217d 100755
@@ -34,19 +34,10 @@ else
 	ABIDIFF_OPTIONS="$ABIDIFF_OPTIONS --headers-dir2 $incdir2"
 fi
 
-error=
-for dump in $(find $refdir -name "*.dump"); do
-	name=$(basename $dump)
-	dump2=$(find $newdir -name $name)
-	if [ -z "$dump2" ] || [ ! -e "$dump2" ]; then
-		echo "Error: cannot find $name in $newdir" >&2
-		error=1
-		continue
-	fi
-	abidiff $ABIDIFF_OPTIONS $dump $dump2 || {
+run_diff() { # <dump1> <dump2>
+	abidiff $ABIDIFF_OPTIONS $1 $2 || {
 		abiret=$?
-		echo "Error: ABI issue reported for 'abidiff $ABIDIFF_OPTIONS $dump $dump2'" >&2
-		error=1
+		echo "Error: ABI issue reported for 'abidiff $ABIDIFF_OPTIONS $1 $2'" >&2
 		echo
 		if [ $(($abiret & 3)) -ne 0 ]; then
 			echo "ABIDIFF_ERROR|ABIDIFF_USAGE_ERROR, this could be a script or environment issue." >&2
@@ -58,7 +49,23 @@ for dump in $(find $refdir -name "*.dump"); do
 			echo "ABIDIFF_ABI_INCOMPATIBLE_CHANGE, this change breaks the ABI." >&2
 		fi
 		echo
+		return $abiret
 	}
-done
+}
+export -f run_diff
+
+error=
+for dump in $(find $refdir -name "*.dump"); do
+	name=$(basename $dump)
+	dump2=$(find $newdir -name $name)
+	if [ -z "$dump2" ] || [ ! -e "$dump2" ]; then
+		echo "Error: cannot find $name in $newdir" >&2
+		error=1
+		continue
+	fi
+	echo $dump $dump2
+done |
+xargs -n2 -P0 sh -c 'run_diff $0 $1' ||
+error=1
 
 [ -z "$error" ] || [ -n "$warnonly" ]
devtools/gen-abi.sh +3 -2
index f15a3b9aaf..61f7510ea1 100755
@@ -22,5 +22,6 @@ for f in $(find $installdir -name "*.so.*"); do
 	fi
 
 	libname=$(basename $f)
-	abidw --out-file $dumpdir/${libname%.so*}.dump $f
-done
+	echo $dumpdir/${libname%.so*}.dump $f
+done |
+xargs -n2 -P0 abidw --out-file
Signature · 1 line
2.39.0
#1 lore raw

PATCH v2 1/1 devtools: parallelize ABI check

Generation and comparison of ABI dumps are done on multiple cores thanks to xargs -P0.
It can accelerate this long step by 5 in my tests.

xargs reports a global error if one of the process has an error.

Running a shell function with xargs requires to export it with -f, and that is a specific capability of bash.

---
v2:
- find dump2 inside the function
- force bash because of export -f

---
 devtools/check-abi.sh | 20 +++++++++++++-------
 devtools/gen-abi.sh   |  5 +++--
 2 files changed, 16 insertions(+), 9 deletions(-)
devtools/check-abi.sh +13 -7
index c583eae2fd..4409f65ccd 100755
@@ -1,4 +1,4 @@
-#!/bin/sh -e
+#!/bin/bash -e
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright (c) 2019 Red Hat, Inc.
 
@@ -34,19 +34,18 @@ else
 	ABIDIFF_OPTIONS="$ABIDIFF_OPTIONS --headers-dir2 $incdir2"
 fi
 
-error=
-for dump in $(find $refdir -name "*.dump"); do
+run_diff() { # <dump1> <dir2>
+	dump=$1
+	newdir=$2
 	name=$(basename $dump)
 	dump2=$(find $newdir -name $name)
 	if [ -z "$dump2" ] || [ ! -e "$dump2" ]; then
 		echo "Error: cannot find $name in $newdir" >&2
-		error=1
-		continue
+		return 1
 	fi
 	abidiff $ABIDIFF_OPTIONS $dump $dump2 || {
 		abiret=$?
 		echo "Error: ABI issue reported for 'abidiff $ABIDIFF_OPTIONS $dump $dump2'" >&2
-		error=1
 		echo
 		if [ $(($abiret & 3)) -ne 0 ]; then
 			echo "ABIDIFF_ERROR|ABIDIFF_USAGE_ERROR, this could be a script or environment issue." >&2
@@ -58,7 +57,14 @@ for dump in $(find $refdir -name "*.dump"); do
 			echo "ABIDIFF_ABI_INCOMPATIBLE_CHANGE, this change breaks the ABI." >&2
 		fi
 		echo
+		return 1
 	}
-done
+}
+export -f run_diff
+
+error=
+find $refdir -name "*.dump" |
+xargs -n1 -P0 sh -c 'run_diff $0 '$newdir ||
+error=1
 
 [ -z "$error" ] || [ -n "$warnonly" ]
devtools/gen-abi.sh +3 -2
index f15a3b9aaf..61f7510ea1 100755
@@ -22,5 +22,6 @@ for f in $(find $installdir -name "*.so.*"); do
 	fi
 
 	libname=$(basename $f)
-	abidw --out-file $dumpdir/${libname%.so*}.dump $f
-done
+	echo $dumpdir/${libname%.so*}.dump $f
+done |
+xargs -n2 -P0 abidw --out-file
Signature · 1 line
2.39.0
Tested-by on v2 1/1
#2 lore raw
Quoted 6 lines · Thomas Monjalon

Generation and comparison of ABI dumps are done on multiple cores thanks to xargs -P0.
It can accelerate this long step by 5 in my tests.

xargs reports a global error if one of the process has an error.

Quoted 8 lines

Running a shell function with xargs requires to export it with -f, and that is a specific capability of bash.

---
v2:
- find dump2 inside the function
- force bash because of export -f

It reduces script runtime ~2mins in my test.

#3 lore raw

PATCH v3 1/1 devtools: parallelize ABI check

In reply to Thomas Monjalon

Generation and comparison of ABI dumps are done on multiple cores thanks to xargs -P0.
It can accelerate this long step by 5 in my tests.

xargs reports a global error if one of the process has an error.

Running a shell function with xargs requires to export it with -f, and that is a specific capability of bash.

---
v2:
- find dump2 inside the function
- force bash because of export -f
v3:
- revert to POSIX sh
- use POSIX eval instead of export -f (issues on Ubuntu)

---
 devtools/check-abi.sh | 21 +++++++++++++--------
 devtools/gen-abi.sh   |  5 +++--
 2 files changed, 16 insertions(+), 10 deletions(-)
devtools/check-abi.sh +13 -8
index c583eae2fd..d58c867c60 100755
@@ -34,19 +34,18 @@ else
 	ABIDIFF_OPTIONS="$ABIDIFF_OPTIONS --headers-dir2 $incdir2"
 fi
 
-error=
-for dump in $(find $refdir -name "*.dump"); do
+export diff_func='run_diff() {
+	dump=$1
+	newdir=$2
 	name=$(basename $dump)
 	dump2=$(find $newdir -name $name)
 	if [ -z "$dump2" ] || [ ! -e "$dump2" ]; then
 		echo "Error: cannot find $name in $newdir" >&2
-		error=1
-		continue
-	fi
+		return 1
+	fi;
 	abidiff $ABIDIFF_OPTIONS $dump $dump2 || {
 		abiret=$?
-		echo "Error: ABI issue reported for 'abidiff $ABIDIFF_OPTIONS $dump $dump2'" >&2
-		error=1
+		echo "Error: ABI issue reported for abidiff $ABIDIFF_OPTIONS $dump $dump2" >&2
 		echo
 		if [ $(($abiret & 3)) -ne 0 ]; then
 			echo "ABIDIFF_ERROR|ABIDIFF_USAGE_ERROR, this could be a script or environment issue." >&2
@@ -58,7 +57,13 @@ for dump in $(find $refdir -name "*.dump"); do
 			echo "ABIDIFF_ABI_INCOMPATIBLE_CHANGE, this change breaks the ABI." >&2
 		fi
 		echo
+		return 1
 	}
-done
+}'
+
+error=
+find $refdir -name "*.dump" |
+xargs -n1 -P0 sh -c 'eval "$diff_func"; run_diff $0 '$newdir ||
+error=1
 
 [ -z "$error" ] || [ -n "$warnonly" ]
devtools/gen-abi.sh +3 -2
index f15a3b9aaf..61f7510ea1 100755
@@ -22,5 +22,6 @@ for f in $(find $installdir -name "*.so.*"); do
 	fi
 
 	libname=$(basename $f)
-	abidw --out-file $dumpdir/${libname%.so*}.dump $f
-done
+	echo $dumpdir/${libname%.so*}.dump $f
+done |
+xargs -n2 -P0 abidw --out-file
Signature · 1 line
2.39.0
#4 lore raw
Quoted 9 lines · Thomas Monjalon

Generation and comparison of ABI dumps are done on multiple cores thanks to xargs -P0.
It can accelerate this long step by 5 in my tests.

xargs reports a global error if one of the process has an error.

Running a shell function with xargs requires to export it with -f, and that is a specific capability of bash.

Commit-log needs update based on changes in v3.

Quoted 13 lines

---
v2:
- find dump2 inside the function
- force bash because of export -f
v3:
- revert to POSIX sh
- use POSIX eval instead of export -f (issues on Ubuntu)

---
 devtools/check-abi.sh | 21 +++++++++++++--------
 devtools/gen-abi.sh   |  5 +++--
 2 files changed, 16 insertions(+), 10 deletions(-)
#5 lore raw
In reply to Thomas Monjalon
Quoted 57 lines · Thomas Monjalon

Generation and comparison of ABI dumps are done on multiple cores thanks to xargs -P0.
It can accelerate this long step by 5 in my tests.

xargs reports a global error if one of the process has an error.

Running a shell function with xargs requires to export it with -f, and that is a specific capability of bash.

---
v2:
- find dump2 inside the function
- force bash because of export -f
v3:
- revert to POSIX sh
- use POSIX eval instead of export -f (issues on Ubuntu)

---
 devtools/check-abi.sh | 21 +++++++++++++--------
 devtools/gen-abi.sh   |  5 +++--
 2 files changed, 16 insertions(+), 10 deletions(-)
devtools/check-abi.sh +6 -7
index c583eae2fd..d58c867c60 100755
@@ -34,19 +34,18 @@ else
        ABIDIFF_OPTIONS="$ABIDIFF_OPTIONS --headers-dir2 $incdir2"
 fi
 
-error=
-for dump in $(find $refdir -name "*.dump"); do
+export diff_func='run_diff() {
+       dump=$1
+       newdir=$2
        name=$(basename $dump)
        dump2=$(find $newdir -name $name)
        if [ -z "$dump2" ] || [ ! -e "$dump2" ]; then
                echo "Error: cannot find $name in $newdir" >&2
-               error=1
-               continue
-       fi
+               return 1
+       fi;
        abidiff $ABIDIFF_OPTIONS $dump $dump2 || {
                abiret=$?
-               echo "Error: ABI issue reported for 'abidiff $ABIDIFF_OPTIONS $dump $dump2'" >&2
-               error=1
+               echo "Error: ABI issue reported for abidiff $ABIDIFF_OPTIONS $dump $dump2" >&2
                echo
                if [ $(($abiret & 3)) -ne 0 ]; then
                        echo "ABIDIFF_ERROR|ABIDIFF_USAGE_ERROR, this could be a script or environment issue." >&2
@@ -58,7 +57,13 @@ for dump in $(find $refdir -name "*.dump"); do
                        echo "ABIDIFF_ABI_INCOMPATIBLE_CHANGE, this change breaks the ABI." >&2
                fi

devtools/check-abi.sh for dump in $(find $refdir -name "*.dump"); do · line 67

Quoted 10 lines
devtools/check-abi.sh +7 -1
                echo
+               return 1
        }
-done
+}'
+
+error=
+find $refdir -name "*.dump" |
+xargs -n1 -P0 sh -c 'eval "$diff_func"; run_diff $0 '$newdir ||
+error=1

Do we need to pass $newdir ?
Like, for example, ABIDIFF_OPTIONS seems inherited, right?

Otherwise this trick looks to work.

Signature · 1 line
David Marchand
#6 lore raw

11/01/2023 15:11, David Marchand:

Quoted 7 lines · Thomas Monjalon

devtools/check-abi.sh for dump in $(find $refdir -name "*.dump"); do · line 67

Quoted 3 lines
devtools/check-abi.sh +3 -0
+find $refdir -name "*.dump" |
+xargs -n1 -P0 sh -c 'eval "$diff_func"; run_diff $0 '$newdir ||
+error=1

Do we need to pass $newdir ?
Like, for example, ABIDIFF_OPTIONS seems inherited, right?

Actually ABIDIFF_OPTIONS was empty when calling the function. I'll pass it as well.

#7 lore raw

PATCH v4 1/1 devtools: parallelize ABI check

In reply to Thomas Monjalon

Generation and comparison of ABI dumps are done on multiple cores thanks to xargs -P0.
It can accelerate this long step by 5 in my tests.

xargs reports a global error if one of the process has an error.

Running a shell function with xargs requires to export it. POSIX shell does not support function export except using an "eval trick". Required variables are also exported.

---
v2:
- find dump2 inside the function
- force bash because of export -f
v3:
- revert to POSIX sh
- use POSIX eval instead of export -f (issues on Ubuntu)
v4:
- export all required variables
- remove useless stdout echo calls

---
 devtools/check-abi.sh | 23 +++++++++++++----------
 devtools/gen-abi.sh   |  5 +++--
 2 files changed, 16 insertions(+), 12 deletions(-)
devtools/check-abi.sh +13 -10
index c583eae2fd..31eceb42e6 100755
@@ -34,20 +34,18 @@ else
 	ABIDIFF_OPTIONS="$ABIDIFF_OPTIONS --headers-dir2 $incdir2"
 fi
 
-error=
-for dump in $(find $refdir -name "*.dump"); do
+export newdir ABIDIFF_OPTIONS
+export diff_func='run_diff() {
+	dump=$1
 	name=$(basename $dump)
 	dump2=$(find $newdir -name $name)
 	if [ -z "$dump2" ] || [ ! -e "$dump2" ]; then
 		echo "Error: cannot find $name in $newdir" >&2
-		error=1
-		continue
-	fi
+		return 1
+	fi;
 	abidiff $ABIDIFF_OPTIONS $dump $dump2 || {
 		abiret=$?
-		echo "Error: ABI issue reported for 'abidiff $ABIDIFF_OPTIONS $dump $dump2'" >&2
-		error=1
-		echo
+		echo "Error: ABI issue reported for abidiff $ABIDIFF_OPTIONS $dump $dump2" >&2
 		if [ $(($abiret & 3)) -ne 0 ]; then
 			echo "ABIDIFF_ERROR|ABIDIFF_USAGE_ERROR, this could be a script or environment issue." >&2
 		fi
@@ -57,8 +55,13 @@ for dump in $(find $refdir -name "*.dump"); do
 		if [ $(($abiret & 8)) -ne 0 ]; then
 			echo "ABIDIFF_ABI_INCOMPATIBLE_CHANGE, this change breaks the ABI." >&2
 		fi
-		echo
+		return 1
 	}
-done
+}'
+
+error=
+find $refdir -name "*.dump" |
+xargs -n1 -P0 sh -c 'eval "$diff_func"; run_diff $0' ||
+error=1
 
 [ -z "$error" ] || [ -n "$warnonly" ]
devtools/gen-abi.sh +3 -2
index f15a3b9aaf..61f7510ea1 100755
@@ -22,5 +22,6 @@ for f in $(find $installdir -name "*.so.*"); do
 	fi
 
 	libname=$(basename $f)
-	abidw --out-file $dumpdir/${libname%.so*}.dump $f
-done
+	echo $dumpdir/${libname%.so*}.dump $f
+done |
+xargs -n2 -P0 abidw --out-file
Signature · 1 line
2.39.0
Acked-by on v4 1/1
#8 lore raw
Quoted 25 lines · Thomas Monjalon

Generation and comparison of ABI dumps are done on multiple cores thanks to xargs -P0.
It can accelerate this long step by 5 in my tests.

xargs reports a global error if one of the process has an error.

Running a shell function with xargs requires to export it. POSIX shell does not support function export except using an "eval trick". Required variables are also exported.

devtools/check-abi.sh +2 -2
index c583eae2fd..31eceb42e6 100755
@@ -34,20 +34,18 @@ else
        ABIDIFF_OPTIONS="$ABIDIFF_OPTIONS --headers-dir2 $incdir2"
 fi
 
-error=
-for dump in $(find $refdir -name "*.dump"); do
+export newdir ABIDIFF_OPTIONS
+export diff_func='run_diff() {

devtools/check-abi.sh else · line 45

Quoted 10 lines
devtools/check-abi.sh +3 -3
+       dump=$1
        name=$(basename $dump)
        dump2=$(find $newdir -name $name)
        if [ -z "$dump2" ] || [ ! -e "$dump2" ]; then
                echo "Error: cannot find $name in $newdir" >&2
-               error=1
-               continue
-       fi
+               return 1
+       fi;

No need for ; here.
This can be fixed when applying (I tested both your patch and with this small fix).

Quoted 15 lines
devtools/check-abi.sh +2 -4
        abidiff $ABIDIFF_OPTIONS $dump $dump2 || {
                abiret=$?
-               echo "Error: ABI issue reported for 'abidiff $ABIDIFF_OPTIONS $dump $dump2'" >&2
-               error=1
-               echo
+               echo "Error: ABI issue reported for abidiff $ABIDIFF_OPTIONS $dump $dump2" >&2
                if [ $(($abiret & 3)) -ne 0 ]; then
                        echo "ABIDIFF_ERROR|ABIDIFF_USAGE_ERROR, this could be a script or environment issue." >&2
                fi
@@ -57,8 +55,13 @@ for dump in $(find $refdir -name "*.dump"); do
                if [ $(($abiret & 8)) -ne 0 ]; then
                        echo "ABIDIFF_ABI_INCOMPATIBLE_CHANGE, this change breaks the ABI." >&2
                fi
-               echo
+               return 1

devtools/check-abi.sh for dump in $(find $refdir -name "*.dump"); do · line 67

Quoted 10 lines
devtools/check-abi.sh +6 -1
        }
-done
+}'
+
+error=
+find $refdir -name "*.dump" |
+xargs -n1 -P0 sh -c 'eval "$diff_func"; run_diff $0' ||
+error=1
 
 [ -z "$error" ] || [ -n "$warnonly" ]

For the record, on my system, calling this script is ~5 times faster:
- before
real 0m5,447s
user 0m4,497s
sys 0m0,937s

- after
real 0m1,202s
user 0m10,784s
sys 0m2,027s

Quoted 14 lines
devtools/gen-abi.sh +3 -3
index f15a3b9aaf..61f7510ea1 100755
@@ -22,5 +22,6 @@ for f in $(find $installdir -name "*.so.*"); do
        fi
 
        libname=$(basename $f)
-       abidw --out-file $dumpdir/${libname%.so*}.dump $f
-done
+       echo $dumpdir/${libname%.so*}.dump $f
+done |
+xargs -n2 -P0 abidw --out-file
--
Quoted 2 lines

2.39.0

- before
real 0m8,237s
user 0m7,704s
sys 0m0,504s

- after
real 0m2,517s
user 0m14,145s
sys 0m0,766s

Ferruh, I am seeing quite different numbers for running those scripts (clearly not of the minute order).
I switched to testing/building in tmpfs some time ago.
It requires a good amount of memory (I empirically allocated 40G), but maybe worth a try for you?

In any case, this patch lgtm.

Signature · 1 line
David Marchand
#9 lore raw
Quoted 108 lines · David Marchand
Quoted 25 lines · Thomas Monjalon

Generation and comparison of ABI dumps are done on multiple cores thanks to xargs -P0.
It can accelerate this long step by 5 in my tests.

xargs reports a global error if one of the process has an error.

Running a shell function with xargs requires to export it. POSIX shell does not support function export except using an "eval trick". Required variables are also exported.

devtools/check-abi.sh +2 -2
index c583eae2fd..31eceb42e6 100755
@@ -34,20 +34,18 @@ else
        ABIDIFF_OPTIONS="$ABIDIFF_OPTIONS --headers-dir2 $incdir2"
 fi
 
-error=
-for dump in $(find $refdir -name "*.dump"); do
+export newdir ABIDIFF_OPTIONS
+export diff_func='run_diff() {

devtools/check-abi.sh else · line 45

Quoted 10 lines
devtools/check-abi.sh +3 -3
+       dump=$1
        name=$(basename $dump)
        dump2=$(find $newdir -name $name)
        if [ -z "$dump2" ] || [ ! -e "$dump2" ]; then
                echo "Error: cannot find $name in $newdir" >&2
-               error=1
-               continue
-       fi
+               return 1
+       fi;

No need for ; here.
This can be fixed when applying (I tested both your patch and with this small fix).

Quoted 15 lines
devtools/check-abi.sh +2 -4
        abidiff $ABIDIFF_OPTIONS $dump $dump2 || {
                abiret=$?
-               echo "Error: ABI issue reported for 'abidiff $ABIDIFF_OPTIONS $dump $dump2'" >&2
-               error=1
-               echo
+               echo "Error: ABI issue reported for abidiff $ABIDIFF_OPTIONS $dump $dump2" >&2
                if [ $(($abiret & 3)) -ne 0 ]; then
                        echo "ABIDIFF_ERROR|ABIDIFF_USAGE_ERROR, this could be a script or environment issue." >&2
                fi
@@ -57,8 +55,13 @@ for dump in $(find $refdir -name "*.dump"); do
                if [ $(($abiret & 8)) -ne 0 ]; then
                        echo "ABIDIFF_ABI_INCOMPATIBLE_CHANGE, this change breaks the ABI." >&2
                fi
-               echo
+               return 1

devtools/check-abi.sh for dump in $(find $refdir -name "*.dump"); do · line 67

Quoted 10 lines
devtools/check-abi.sh +6 -1
        }
-done
+}'
+
+error=
+find $refdir -name "*.dump" |
+xargs -n1 -P0 sh -c 'eval "$diff_func"; run_diff $0' ||
+error=1
 
 [ -z "$error" ] || [ -n "$warnonly" ]

For the record, on my system, calling this script is ~5 times faster:
- before
real 0m5,447s
user 0m4,497s
sys 0m0,937s

- after
real 0m1,202s
user 0m10,784s
sys 0m2,027s

Quoted 14 lines
devtools/gen-abi.sh +3 -3
index f15a3b9aaf..61f7510ea1 100755
@@ -22,5 +22,6 @@ for f in $(find $installdir -name "*.so.*"); do
        fi
 
        libname=$(basename $f)
-       abidw --out-file $dumpdir/${libname%.so*}.dump $f
-done
+       echo $dumpdir/${libname%.so*}.dump $f
+done |
+xargs -n2 -P0 abidw --out-file
--
Quoted 2 lines

2.39.0

- before
real 0m8,237s
user 0m7,704s
sys 0m0,504s

- after
real 0m2,517s
user 0m14,145s
sys 0m0,766s

Quoted 6 lines

Ferruh, I am seeing quite different numbers for running those scripts (clearly not of the minute order).
I switched to testing/building in tmpfs some time ago.
It requires a good amount of memory (I empirically allocated 40G), but maybe worth a try for you?

I run 'test-meson-builds.sh' script directly and yes I am getting different numbers although there is still improvement, not in scale with what you are getting, with v4 I have following:

- before

real    10m3.248s
user    39m8.664s
sys     14m52.870s

- after

real    7m49.086s
user    39m59.507s
sys     15m0.598s

What I am running exactly is:
time DPDK_ABI_REF_VERSION=v22.11.1 DPDK_ABI_REF_DIR=/tmp/dpdk-abiref DPDK_ABI_REF_SRC=.../dpdk-stable/ ./devtools/test-meson-builds.sh

Quoted 5 lines

In any case, this patch lgtm.

#10 lore raw
Quoted 78 lines · Ferruh Yigit
Quoted 66 lines
Quoted 15 lines
        abidiff $ABIDIFF_OPTIONS $dump $dump2 || {
                abiret=$?
devtools/check-abi.sh +2 -4
-               echo "Error: ABI issue reported for 'abidiff $ABIDIFF_OPTIONS $dump $dump2'" >&2
-               error=1
-               echo
+               echo "Error: ABI issue reported for abidiff $ABIDIFF_OPTIONS $dump $dump2" >&2
                if [ $(($abiret & 3)) -ne 0 ]; then
                        echo "ABIDIFF_ERROR|ABIDIFF_USAGE_ERROR, this could be a script or environment issue." >&2
                fi
@@ -57,8 +55,13 @@ for dump in $(find $refdir -name "*.dump"); do
                if [ $(($abiret & 8)) -ne 0 ]; then
                        echo "ABIDIFF_ABI_INCOMPATIBLE_CHANGE, this change breaks the ABI." >&2
                fi
-               echo
+               return 1

devtools/check-abi.sh for dump in $(find $refdir -name "*.dump"); do · line 67

Quoted 10 lines
devtools/check-abi.sh +6 -1
        }
-done
+}'
+
+error=
+find $refdir -name "*.dump" |
+xargs -n1 -P0 sh -c 'eval "$diff_func"; run_diff $0' ||
+error=1
 
 [ -z "$error" ] || [ -n "$warnonly" ]

For the record, on my system, calling this script is ~5 times faster:
- before
real 0m5,447s
user 0m4,497s
sys 0m0,937s

- after
real 0m1,202s
user 0m10,784s
sys 0m2,027s

Quoted 14 lines
devtools/gen-abi.sh +3 -3
index f15a3b9aaf..61f7510ea1 100755
@@ -22,5 +22,6 @@ for f in $(find $installdir -name "*.so.*"); do
        fi
 
        libname=$(basename $f)
-       abidw --out-file $dumpdir/${libname%.so*}.dump $f
-done
+       echo $dumpdir/${libname%.so*}.dump $f
+done |
+xargs -n2 -P0 abidw --out-file
--
Quoted 2 lines

2.39.0

- before
real 0m8,237s
user 0m7,704s
sys 0m0,504s

- after
real 0m2,517s
user 0m14,145s
sys 0m0,766s

Quoted 6 lines

Ferruh, I am seeing quite different numbers for running those scripts (clearly not of the minute order).
I switched to testing/building in tmpfs some time ago.
It requires a good amount of memory (I empirically allocated 40G), but maybe worth a try for you?

I run 'test-meson-builds.sh' script directly and yes I am getting different numbers although there is still improvement, not in scale with what you are getting, with v4 I have following:

- before

Quoted 8 lines
real    10m3.248s
user    39m8.664s
sys     14m52.870s

- after

real    7m49.086s
user    39m59.507s
sys     15m0.598s

Well, yes, I did not realise which apples you were looking at :-). The change looks good in any case.

Signature · 1 line
David Marchand
#11 lore raw
Quoted 83 lines · David Marchand
Quoted 82 lines · Ferruh Yigit
Quoted 66 lines
Quoted 15 lines
        abidiff $ABIDIFF_OPTIONS $dump $dump2 || {
                abiret=$?
devtools/check-abi.sh +2 -4
-               echo "Error: ABI issue reported for 'abidiff $ABIDIFF_OPTIONS $dump $dump2'" >&2
-               error=1
-               echo
+               echo "Error: ABI issue reported for abidiff $ABIDIFF_OPTIONS $dump $dump2" >&2
                if [ $(($abiret & 3)) -ne 0 ]; then
                        echo "ABIDIFF_ERROR|ABIDIFF_USAGE_ERROR, this could be a script or environment issue." >&2
                fi
@@ -57,8 +55,13 @@ for dump in $(find $refdir -name "*.dump"); do
                if [ $(($abiret & 8)) -ne 0 ]; then
                        echo "ABIDIFF_ABI_INCOMPATIBLE_CHANGE, this change breaks the ABI." >&2
                fi
-               echo
+               return 1

devtools/check-abi.sh for dump in $(find $refdir -name "*.dump"); do · line 67

Quoted 10 lines
devtools/check-abi.sh +6 -1
        }
-done
+}'
+
+error=
+find $refdir -name "*.dump" |
+xargs -n1 -P0 sh -c 'eval "$diff_func"; run_diff $0' ||
+error=1
 
 [ -z "$error" ] || [ -n "$warnonly" ]

For the record, on my system, calling this script is ~5 times faster:
- before
real 0m5,447s
user 0m4,497s
sys 0m0,937s

- after
real 0m1,202s
user 0m10,784s
sys 0m2,027s

Quoted 14 lines
devtools/gen-abi.sh +3 -3
index f15a3b9aaf..61f7510ea1 100755
@@ -22,5 +22,6 @@ for f in $(find $installdir -name "*.so.*"); do
        fi
 
        libname=$(basename $f)
-       abidw --out-file $dumpdir/${libname%.so*}.dump $f
-done
+       echo $dumpdir/${libname%.so*}.dump $f
+done |
+xargs -n2 -P0 abidw --out-file
--
Quoted 2 lines

2.39.0

- before
real 0m8,237s
user 0m7,704s
sys 0m0,504s

- after
real 0m2,517s
user 0m14,145s
sys 0m0,766s

Quoted 6 lines

Ferruh, I am seeing quite different numbers for running those scripts (clearly not of the minute order).
I switched to testing/building in tmpfs some time ago.
It requires a good amount of memory (I empirically allocated 40G), but maybe worth a try for you?

I run 'test-meson-builds.sh' script directly and yes I am getting different numbers although there is still improvement, not in scale with what you are getting, with v4 I have following:

- before

real    10m3.248s
user    39m8.664s
sys     14m52.870s
Quoted 8 lines
Quoted 4 lines

- after

real    7m49.086s
user    39m59.507s
sys     15m0.598s

Well, yes, I did not realise which apples you were looking at :-). The change looks good in any case.

Ack

Reviewed-by on v4 1/1 Applied
#12 lore raw
In reply to Thomas Monjalon
Quoted 5 lines · Thomas Monjalon

Generation and comparison of ABI dumps are done on multiple cores thanks to xargs -P0.
It can accelerate this long step by 5 in my tests.

Quoted 8 lines

xargs reports a global error if one of the process has an error.

Running a shell function with xargs requires to export it. POSIX shell does not support function export except using an "eval trick". Required variables are also exported.

Applied, thanks.

Signature · 1 line
David Marchand