Skip to content

Commit

Permalink
add parallel driver
Browse files Browse the repository at this point in the history
  • Loading branch information
cldellow committed Oct 5, 2024
1 parent 9dd569b commit 6c90784
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ build/
tilemaker.dSYM/
merged.mbtiles
merged.pmtiles
lockfile

# editor temporaries
*~
Expand Down
21 changes: 21 additions & 0 deletions tile-smush-parallel
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -euo pipefail

# tile-smush doesn't do multithreading, but can be told to operate on only
# a slice of tiles.
#
# To achieve multithreading (without running into sqlite's intra-process mutexes),
# we launch multiple processes that each take a disjoint set of work.

rm -f merged.mbtiles*

pids=()
export SHARDS=16
for i in $(seq 0 $((SHARDS - 1))); do
SHARD=$i ./tile-smush "$@" &
pids[${i}]=$!
done

for pid in ${pids[*]}; do
wait $pid
done

0 comments on commit 6c90784

Please sign in to comment.