This is an implementation of the parallel multicanonical Monte Carlo sampling method.
As a benchmark system we have chosen the well studied two-dimensional Ising model on a square lattice.
We provide a CPU version using MPI and a GPU version using CUDA.
CudaMuca can be easily adapted to other systems.
Authors: Jonathan Gross, Johannes Zierenberg, Martin Weigel, Wolfhard Janke
This work is licensed under a Creative Commons Attribution 4.0 International License.
- CUDA capable GPU
- NVIDIA CUDA Toolkit 6.5+
- C++11 compatible compiler (tested with GNU compiler)
- MPI >= 2.2 compiler (tested with GNU compiler and OpenMPI)
- recent version Linux or macOS, (maybe Windows)
make cpu
make gpu
Available command line arguments:
Usage :
./ising2D_cpu [mt] [-s seed] [-p nupdates] -L size
-m turns on modifyWeights, default: false
-p final production run (set number of updates, if selected), default: 0
-L sets the system size, required parameter
-s sets the initial seed, default: 1000
example run:
mpirun -np 24 ising2D_cpu -L 32 -m -s 91564
Usage :
./ising2D_gpu [mt] [-s seed] [-p nupdates] [-i dev] -L size -W workers
-m turns on modifyWeights, default: false
-p final production run (set number of updates, if selected), default: 0
-L sets the system size, required parameter
-s sets the initial seed, default: 1000
-i select device from list of available GPUs, optional parameter, default: automatic
-W sets the number of workers, required parameter
example run:
ising2D_gpu -L 8 -m -W 26624 -i 2
Random123 is a library of "counter-based" random number generators
Can be used with CPUs and CPUs.
from D. E. Shaw Research: https://www.deshawresearch.com/resources_random123.html
Reference implementation of the two-dimensional Ising model on CPUs using C++ and MPI.
Reference implementation of the two-dimensional Ising model on GPUs using NVIDIA's CUDA toolkit.
This file includes all methods for reading and parsing command line arguments as well as output generated by the main program.
All methods and variables defined in here are shared between the CPU and the GPU implementation.
In this header all the functions related to the multicanonical sampling algorithm are implementated.
This file is shared between CPU and GPU implementations.
-
Cuda related code
- Update weights
- modify weights (linear extrapolation on the sides)
-
Histogram methods
- get histogram range
-
Flatness criteria
- Chebychev
- Kullback-Leibler
The subdirectory example/
includes sample outputs generated on a Tesla K20m using the following command:
ising2d_gpu -L 16 -W 26624
This file is used to store all simulational parameters as well as statistics of the simulation.
Information included in this file is:
- system size
- random number seed
- number of workers
- number of updates per workers
- number of iterations until convergence
- total time of simulation
- average spin flip time
- number of thermalization updater per worker
- number of measurement updates per worker
- total number of updates per worker
In this file all iterations until convergence (flat histogram) are accumulated.
The header includes the iteration number, width of the covered energy range, number of measurement updates and the Kullback-Leibler parameter.
A table with energy bins, current MUCA weights and histogram entries follows for each iteration.