An intuitive simple working example of tensorflow distributed!
There is a caravan with:
2 Drivers: Each sends whippings of increasing intensity along a whip to a less worked up horse and then measures the distance covered
2 Horses: Each receives whippings from the whip and takes steps as per that whipping intensity
Launch two horse.py with task_index arguments 0 and 1 respectively, and similarly two rider.py. Launch them in separate windows for a better demonstration.
python3.5 -m distributed_horse_rider.horse 0
python3.5 -m distributed_horse_rider.horse 1
python3.5 -m distributed_horse_rider.rider 0
python3.5 -m distributed_horse_rider.rider 1
Or, for more convenience, execute the launch_distributed_horse_riders.sh.
- The
whip
is shared by all drivers and horses => Shared FIFO queue of capacity 16. - Each whipping of a particular intensity => An integer that is enqueued by a driver
flick_intensity
=> TF placeholderflick_whip
=> TF op to enqueue the flick_intensityfeel_whip
=> TF op to dequeue the flick_intensitysteps_taken
=> TF variable shared by all horses and riders storing total steps taken by all horsestake_step
=> TF op to add the dequeued flick_intensity to the sharedsteps_taken
variablemeasure_distance
=> Just a TF op representing half the number of steps taken
With just a little bit of tweaking, you can play with the number of horses and drivers, remove the input statements to benchmark the performance (spoiler I found it pretty impressive for a master-slave based IPC!), go full distributed - running it beyond your localhost and across multiple machine on the same LAN, or... whatever else is in these days. Enjoy!
Due to the simplicity of this demo, there isn't any graceful shutdown, you just kill the processes when you're done. Make sure to kill these processes. You'll be unable to launch this project until the previous launches have been shut down.
Please post issues if you face any!
sjdifo sdfiojsfiojsd foisjdf poisdjfowiehf wiofkwdfmowifhks ldfnj o asiodj aojoaisjd asdhoiuefhowifa.
There are more characters in this README than code in the project