simon_brooke,
@simon_brooke@mastodon.scot avatar

I've spent some of today finding bottlenecks in my world-simulating cellular automaton, and I can now simulate 10,000 years of history from the middle of the Ice Age to the middle of the Iron Age over 40,000 square kilometres (at kilometre scale) in slightly under two minutes of wall-clock time. It's utterly caning my poor computer, but it doesn't crash.


The state of my poor computer in the middle of a simulation run. Memory is maxed out (garbage collection is clearly the major bottleneck) and eight of my twelve processor cores are also maxed out.

bthalpin,
@bthalpin@mastodon.social avatar

@simon_brooke All the more impressive that this is powered by a wind generator (+solar) that you had to repair yourself!

simon_brooke,
@simon_brooke@mastodon.scot avatar

@bthalpin hey, it's because we've a storm rolling through that I have enough power to run big simulations!

pmonks,
@pmonks@sfba.social avatar

@simon_brooke makes it so easy to burn down a CPU. And I don’t mean that in a “it’s inefficient” way, I mean it in a “it makes it trivial to write highly concurrent code” way.

simon_brooke,
@simon_brooke@mastodon.scot avatar

@pmonks aye, indeed. I'm mapping this rule-set across 40,000 cells (a 200x200 raster), and it's balancing the load amazingly evenly over the available processors. I find that really impressive.

https://github.com/simon-brooke/mw-ui/blob/master/resources/public/rulesets/settlement.txt

pmonks,
@pmonks@sfba.social avatar

@simon_brooke The JVM is a work of art, and Clojure makes it pleasant to use!

jenselbaek,
@jenselbaek@mastodon.social avatar

@simon_brooke Wow. All I managed to do was this: http://jenselbaek.dk/game-of-life.php

simon_brooke,
@simon_brooke@mastodon.scot avatar

@jenselbaek well, yours works! I had MicroWorld live on the net for about five years, but the processor load got really silly so I don't have it public any more.

pmonks,
@pmonks@sfba.social avatar

@simon_brooke Just out of interest, are you using virtual threads for this? May not help much if it’s CPU-bound, but I’ve found them to give substantial speedups for I/O and mixed workloads.

simon_brooke,
@simon_brooke@mastodon.scot avatar

@pmonks Surprisingly, I'm just using the stock map function. About ten years ago, working on this exact problem, I put a lot of work into trying to write my own map functions which I hoped would be more efficient at parallelisation than the standard Clojure implementation; but they none of them were.

It really is astonishingly good.

pmonks,
@pmonks@sfba.social avatar

@simon_brooke I use pmap quite heavily for (often good enough) naive parallelism, and wrote a virtual thread version that doesn’t chunk that’s even better on JVMs that support it: https://github.com/pmonks/embroidery

simon_brooke,
@simon_brooke@mastodon.scot avatar

@pmonks H'mmm, thanks, that looks extremely pretty!

  • All
  • Subscribed
  • Moderated
  • Favorites
  • gamedev
  • InstantRegret
  • ngwrru68w68
  • everett
  • mdbf
  • modclub
  • rosin
  • khanakhh
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • Youngstown
  • GTA5RPClips
  • slotface
  • kavyap
  • JUstTest
  • ethstaker
  • osvaldo12
  • normalnudes
  • tacticalgear
  • cisconetworking
  • cubers
  • Durango
  • Leos
  • anitta
  • tester
  • megavids
  • provamag3
  • lostlight
  • All magazines