Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^8: Rosetta Code: Long List is Long (faster - llil4vec - OpenMP code)

by marioroy (Prior)
on Jan 12, 2023 at 11:59 UTC ( [id://11149547]=note: print w/replies, xml ) Need Help??


in reply to Re^7: Rosetta Code: Long List is Long (faster - llil4vec - OpenMP code)
in thread Rosetta Code: Long List is Long

Which is more efficient w.r.t. CPU utilization between g++ and clang++? Let's find out with 30 input files and pay close attention to user times. g++ wins for parallel sort as lesser user time is better considering real times are similar.

cp big1.txt big4.txt cp big2.txt big5.txt cp big3.txt big6.txt cp big1.txt big7.txt cp big2.txt big8.txt cp big3.txt big9.txt cp big1.txt biga.txt cp big2.txt bigb.txt cp big3.txt bigc.txt cp big1.txt bigd.txt cp big2.txt bige.txt cp big3.txt bigf.txt cp big1.txt bigg.txt cp big2.txt bigh.txt cp big3.txt bigi.txt cp big1.txt bigj.txt cp big2.txt bigk.txt cp big3.txt bigl.txt cp big1.txt bigm.txt cp big2.txt bign.txt cp big3.txt bigo.txt cp big1.txt bigp.txt cp big2.txt bigq.txt cp big3.txt bigr.txt cp big1.txt bigs.txt cp big2.txt bigt.txt cp big3.txt bigu.txt

g++

$ g++ -o llil4vec-omp -std=c++20 -fopenmp -Wall -O3 llil4vec.cpp -I./f +ast_io/include $ time OMP_NUM_THREADS=30 ./llil4vec-omp big?.txt >out.txt llil4vec (fixed string length=6) start use OpenMP get properties time : 0.937948 secs sort properties time : 0.494592 secs emplace set sort time : 1.02668 secs write stdout time : 0.50569 secs total time : 2.96497 secs real 0m3.271s <-- total wall time, performs similarly user 0m16.823s <-- nothing unusual, fans seem quiet sys 0m4.188s

clang++

$ clang++ -o llil4vec-omp -std=c++20 -fopenmp -Wall -O3 llil4vec.cpp - +I./fast_io/include $ time OMP_NUM_THREADS=30 ./llil4vec-omp big?.txt >out.txt llil4vec (fixed string length=6) start use OpenMP get properties time : 1.07873 secs sort properties time : 0.717261 secs emplace set sort time : 0.606499 secs write stdout time : 0.437287 secs total time : 2.83984 secs real 0m3.201s <-- total wall time, performs similarly user 0m45.889s <-- system fans noticeably louder sys 0m5.934s

Next, I tried J Script with AVX2 enabled for comparison. 30 threads, specified in the script.

$ time ~/j904/bin/jconsole llil4_p.ijs big?.txt out.txt Read and parse input: 2.43996 Classify, sum, sort: 4.63914 Format and write output: 0.848965 Total time: 7.92807 real 0m7.934s <-- total wall time user 0m24.782s <-- this too, system fans roaring sys 0m26.764s <-- because user and sys combined

I find it interesting for clang++'s user time to be nearly 3x that of g++.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11149547]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-25 09:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found