Parallel Monte Carlo simulation of the 2D Ising model using CPU and mobile GPU
We implement the checkerboard Metropolis algorithm utilizing the multiple threads and cores from the CPU and mobile GPU. The specifications of the computing system include an Intel i5-11400H CPU, 16GB RAM, and Nvidia RTX 3050 Laptop GPU. Python is used as the programming language using Jupyter notebooks. The parallel-CPU implementation can be up to 390× faster than the Python interpreter and 2.61× faster than Python compiler through Numba. The serial Python compiler outperforms the parallel-CPU at N = (20×128) associated with drawbacks of parallel execution. The parallel-CPU outperforms the GPU when underutilized with up to 7.70× speedup, which is particularly advantageous for simulating low lattice sizes. However, the mobile GPU can reach speeds up to 11.97× than the parallel-CPU for high lattice sizes. Simulating for very high lattice sizes requires enough memory for both of the parallel-CPU and GPU implementation. The parallel CPU kernel crashes and the mobile GPU encounters memory error on high lattices. After the equilibration of the system, the average magnetization is computed. We then compare it to the analytical solution derived by Onsager [Phys. Rev. 65, 117 (1944)] to validate the accuracy of our simulation.