Improve Coccinelle Parallelisation
v4 cover Improve Coccinelle Parallelisation
Presently, Coccinelle uses at most one thread per core to improve performance in machines with more than 2 hyperthreads. Modify coccicheck to use all available threads in machines upto 4 hyperthreads. Further, modify the coccicheck script to improve portability.
Modify documentation to reflect the same.
Sumera Priyadarsini (3):
scripts: coccicheck: Add quotes to improve portability
scripts: coccicheck: Change default condition for parallelism
Documentation: Coccinelle: Modify Parallelisation information in docs
Documentation/dev-tools/coccinelle.rst | 6 ++++-- scripts/coccicheck | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-)
Signature · 1 line
2.25.1
PATCH v4 1/3 scripts: coccicheck: Add quotes to improve portability
While fetching the number of threads per core with lscpu, the [:digit:] set is used for translation of digits from 0-9. However, using [:digit:] instead of "[:digit:]" does not seem to work uniformly for some shell types and configurations (such as zsh).
Therefore, modify coccicheck to use double quotes around the [:digit:] set for uniformity and better portability.
--- scripts/coccicheck | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/coccicheck +1 -1
@@ -76,7 +76,7 @@ else fi # Use only one thread per core by default if hyperthreading is enabled - THREADS_PER_CORE=$(lscpu | grep "Thread(s) per core: " | tr -cd [:digit:]) + THREADS_PER_CORE=$(lscpu | grep "Thread(s) per core: " | tr -cd "[:digit:]") if [ -z "$J" ]; then NPROC=$(getconf _NPROCESSORS_ONLN) if [ $THREADS_PER_CORE -gt 1 -a $NPROC -gt 2 ] ; then
Signature · 1 line
2.25.1
Re: [Cocci] [PATCH v4 1/3] scripts: coccicheck: Add quotes to improve portability
Quoted 10 lines · Sumera Priyadarsini
While fetching the number of threads per core with lscpu, the [:digit:] set is used for translation of digits from 0-9. However, using [:digit:] instead of "[:digit:]" does not seem to work uniformly for some shell types and configurations (such as zsh).
Therefore, modify coccicheck to use double quotes around the [:digit:] set for uniformity and better portability.
Signed-off-by Sumera Priyadarsini <[email protected]>
Applied, thanks.
Quoted 25 lines
--- scripts/coccicheck | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/coccicheck +1
-2@@ -76,7 +76,7 @@ else fi # Use only one thread per core by default if hyperthreading is enabled - THREADS_PER_CORE=$(lscpu | grep "Thread(s) per core: " | tr -cd [:digit:]) + THREADS_PER_CORE=$(lscpu | grep "Thread(s) per core: " | tr -cd "[:digit:]") if [ -z "$J" ]; then NPROC=$(getconf _NPROCESSORS_ONLN) if [ $THREADS_PER_CORE -gt 1 -a $NPROC -gt 2 ] ; then --2.25.1
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
PATCH v4 2/3 scripts: coccicheck: Change default condition for parallelism
In reply to Sumera PriyadarsiniCurrently, Coccinelle uses at most one thread per core by default in machines with more than 2 hyperthreads. However, for systems with only 4 hyperthreads, this does not improve performance.
Modify coccicheck to use all available threads in machines with upto 4 hyperthreads.
--- scripts/coccicheck | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/coccicheck +1 -1
@@ -79,7 +79,7 @@ else THREADS_PER_CORE=$(lscpu | grep "Thread(s) per core: " | tr -cd "[:digit:]") if [ -z "$J" ]; then NPROC=$(getconf _NPROCESSORS_ONLN) - if [ $THREADS_PER_CORE -gt 1 -a $NPROC -gt 2 ] ; then + if [ $THREADS_PER_CORE -gt 1 -a $NPROC -gt 4 ] ; then NPROC=$((NPROC/2)) fi else
Signature · 1 line
2.25.1
Re: [Cocci] [PATCH v4 2/3] scripts: coccicheck: Change default condition for parallelism
Quoted 8 lines · Sumera Priyadarsini
Currently, Coccinelle uses at most one thread per core by default in machines with more than 2 hyperthreads. However, for systems with only 4 hyperthreads, this does not improve performance.
Modify coccicheck to use all available threads in machines with upto 4 hyperthreads.
Signed-off-by Sumera Priyadarsini <[email protected]>
Applied, thanks.
Quoted 25 lines
--- scripts/coccicheck | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/coccicheck +1
-2@@ -79,7 +79,7 @@ else THREADS_PER_CORE=$(lscpu | grep "Thread(s) per core: " | tr -cd "[:digit:]") if [ -z "$J" ]; then NPROC=$(getconf _NPROCESSORS_ONLN) - if [ $THREADS_PER_CORE -gt 1 -a $NPROC -gt 2 ] ; then + if [ $THREADS_PER_CORE -gt 1 -a $NPROC -gt 4 ] ; then NPROC=$((NPROC/2)) fi else --2.25.1
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
PATCH v4 3/3 Documentation: Coccinelle: Modify Parallelisation information in docs
In reply to Sumera PriyadarsiniThis patchset modifies coccicheck to use at most one thread per core by default in machines with more than 4 hyperthreads for optimal performance. Modify documentation in coccinelle.rst to reflect the same.
--- Documentation/dev-tools/coccinelle.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Documentation/dev-tools/coccinelle.rst +4 -2
@@ -130,8 +130,10 @@ To enable verbose messages set the V= variable, for example:: Coccinelle parallelization -------------------------- -By default, coccicheck tries to run as parallel as possible. To change -the parallelism, set the J= variable. For example, to run across 4 CPUs:: +By default, coccicheck uses at most 1 thread per core in a machine +with more than 4 hyperthreads. In a machine with upto 4 threads, +all threads are used. To change the parallelism, set the J= variable. +For example, to run across 4 CPUs:: make coccicheck MODE=report J=4
Signature · 1 line
2.25.1
Re: [Cocci] [PATCH v4 3/3] Documentation: Coccinelle: Modify Parallelisation information in docs
Quoted 5 lines · Sumera Priyadarsini
This patchset modifies coccicheck to use at most one thread per core by default in machines with more than 4 hyperthreads for optimal performance. Modify documentation in
coccinelle.rstto reflect the same.Signed-off-by Sumera Priyadarsini <[email protected]>
Jonathan, will you take this patch?
thanks,
julia
Quoted 29 lines
--- Documentation/dev-tools/coccinelle.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)Documentation/dev-tools/coccinelle.rst +4
-3@@ -130,8 +130,10 @@ To enable verbose messages set the V= variable, for example:: Coccinelle parallelization -------------------------- -By default, coccicheck tries to run as parallel as possible. To change -the parallelism, set the J= variable. For example, to run across 4 CPUs:: +By default, coccicheck uses at most 1 thread per core in a machine +with more than 4 hyperthreads. In a machine with upto 4 threads, +all threads are used. To change the parallelism, set the J= variable. +For example, to run across 4 CPUs:: make coccicheck MODE=report J=4 --2.25.1
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci