Parallel Computing with

MATLAB

Gambling Process Simulation Using MATLAB's SPMD

Using MATLAB 2020a SPMD (single program multiple data) to execute code in parallel on workers of a parallel pool, a gambling process simulation is demonstrated. In this example, there are four workers (four cores) being used, one each for each of the three players and the dealer. The dealer has an arbitrary significantly larger amount than the three players. Each player has a 50/50 chance of winning. If multiple players win, the winning players split the payout, and the losing player(s) pay the dealer. If a player wins they bet half of their winnings in the next bet. If a player loses, they bet a fourth of their remaining funds. If the dealer goes bankrupt, or all three players go bankrupt, the game stops. This simulation is favorable for the players, as the dealer always bets a random amount total funds. Simultaneously, SPMD allows each worker to operate on a different data set and communicate with other workers while performing the parallel computations.