The finished MPI code is atIt looks like there has been some progress with the super cheap cluster. In order to keep the MPI parallel programming examples together, the program for solving the day 24 puzzle will be described atThe kittens are difficult to motivate so this may not work out, but I'm hoping.
viewtopic.php?p=2315193#p2315193
viewtopic.php?p=2316257#p2316257
Since it's also possible to run MPI code on a multi-core SMP machine, I installed MPICH on the Pi 4.
The result
Code:
$ mpirun -n 4 ./mpi24 # Pi 4B 1500 MHzAdvent of Code 2024 Day 24 Crossed Wires (mpi_size=4)Part 1 The z wires output 61495910098126Part 2 Swap wires css,cwt,gdd,jmv,pqt,z05,z09,z37Total execution time 1.23296 seconds.4.69 / 1.23 = 3.81
fold increase in performance over the parallel Go code and even more compared to Chapel.
The algorithm is basically the same. I was a little more careful allocating memory on the stack in C and represented the leaf list used for the topological sort as a n x 3 array rather than an array of slices. Maybe this last change accounts for most of the improvement. It's difficult to tell without testing.
Statistics: Posted by ejolson — Sun May 25, 2025 6:13 am