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++.


In reply to Re^8: Rosetta Code: Long List is Long (faster - llil4vec - OpenMP code) by marioroy
in thread Rosetta Code: Long List is Long by eyepopslikeamosquito

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.