Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7530

Off topic discussion • Re: A bit of Raspberry with 144C/288T

$
0
0
The code Scratchy wrote to find a best insertion point reads as

Code:

        double e=dist(c,t)+dist(t,d)-dist(c,d);        if(e<m){            m=e; b=c; p=1;        } else if(e==m){            p++;            if(rdice(p)==0){                m=e; b=c;            }        }
viewtopic.php?p=2337894#p2337894
...
I tried to implement the count determination (p=1 / p++) with openmp.
No success with "parallel for reduction()" min workaround.

Then I looked at the posting I already pointed to again:
https://stackoverflow.com/questions/282 ... y#28276420
At top there is code without reduction, and easier to understand.

So I implemented that, this is new version without maximum code and without parallel for reduction:
https://raw.githubusercontent.com/Herma ... insert.cpp

Until now I did openmp development on my Pi5 and when something worked, commited it, did git pull on one of my many cores servers, compiled and verified that it works there as well.

I cannot do this anymore, since I ran into a new openmp, this time PiOS only, bug.
I use "DBG" define to allow for PiOS debugging, if that is not defined (on x86_64 Ubuntu) all asserts work fine:

Code:

hermann@7950x:~/RR/tsp/openmp$ cpplint --filter=-legal/copyright best_insert.cppDone processing best_insert.cpphermann@7950x:~/RR/tsp/openmp$ g++ -O3 -fopenmp best_insert.cpphermann@7950x:~/RR/tsp/openmp$ OMP_PROC_BIND=true numactl -C 0-15 time ./a.out61.53user 0.02system 0:03.85elapsed 1599%CPU (0avgtext+0avgdata 6656maxresident)k0inputs+0outputs (0major+561minor)pagefaults 0swapshermann@7950x:~/RR/tsp/openmp$ 

The assert that fails quite some times is the last here:

Code:

pi@raspberrypi5:~/RR/tsp/openmp $ head -96 best_insert.cpp | tail     assert(min == mia[s][0]);    assert(min == delta(s, succ[s]));    assert(min == delta(s, pos));#ifdef DBG    if (scnt[s] != cnt)      std::cerr << s << " sct[s]=" << scnt[s] << " cnt=" << cnt << "\n";#else    assert(cnt == scnt[s]);#endifpi@raspberrypi5:~/RR/tsp/openmp $ 
Here is what happens on my Bookworm Pi5 64bit PiOS. Every time I run this, different differences between stored counts determined by sequential run in array scnt[] (with 99856× ones and 144× twos) and computed count "cnt" are reported.

@ejolson or somebody else:
Can you please store the version linked to above, compile and run and then explain what is wrong with PiOS runtime?
PiOS_openmp_bug.png

Statistics: Posted by HermannSW — Tue Sep 23, 2025 9:47 pm



Viewing all articles
Browse latest Browse all 7530

Trending Articles