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

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

$
0
0

Not precomputing D might also save memory so the computation can be performed on a Pi.
I'll clean up my C code before posting it. I wonder if it will run on the Pi 4.
Scratchy meowed that storing the distance along the active route spoils the cache and commented out my performance tuning. To further save memory the coordinates were changed from double to float. I'm pretty sure that cat is as spoiled as the cache, but the computation did run a few seconds faster after that.

Code:

tsp -- Traveling salesman problem using ruin and recreateFNAME=mona-lisa100K.tspcright(R)=100000cleft(R)=100000dright(R)=6187394.684765dleft(R)=6187394.684765ops=704982704Total computation time 82.4101 seconds.Rate is 8.55456 Mops/sec.
Without any changes the C code running on a 2GB Pi 4 yields

Code:

tsp -- Traveling salesman problem using ruin and recreateFNAME=mona-lisa100K.tspcright(R)=100000cleft(R)=100000dright(R)=6187394.684765dleft(R)=6187394.684765ops=704982704Total execution time 494.935 seconds.Rate is 1.42439 Mops/sec.
Although it takes six times longer to finish, due to the fixed seed used for the random number generator the answer is exactly the same. I wonder how the Pi 5 would fare.

Statistics: Posted by ejolson — Fri Aug 29, 2025 3:02 am



Viewing all articles
Browse latest Browse all 8093

Trending Articles