You are here: Blog
Menu
Categories
.NET
DotNetNuke
ECO
General
UI
Archive
August, 2014 (1)
September, 2013 (1)
February, 2010 (2)
October, 2008 (2)
September, 2008 (1)
July, 2008 (2)
June, 2008 (1)
April, 2008 (3)
February, 2008 (1)
December, 2007 (1)
October, 2007 (2)
June, 2007 (2)
March, 2007 (1)
January, 2007 (1)
December, 2006 (3)
Search
Software development matters
Aug 31

Written by: Oleg Zhukov
8/31/2013 5:39 PM

Recently I studied the percolation threshold problem and the computational apprach to solving this problem with the Monte Carlo method. The paper covering the topic can be found here. However I decided to go a little bit further by parallelizing the algorithm.

The main idea of the Monte Carlo approach is to simulate a series of experiments with random input data and then to analyze the outcome. What's important is that each experiment is independent. This allows us to run experiments in parallel.

The C# demo application runs the Monte Carlo simulation first in a single thread and then in multiple threads by using the Parallel.For(...) call from .NET 4.0 . The results were surprisingly good:

Performing SINGLE-threaded percolation threshold calculation

grid size: 1000, attempt count: 100

Time elapsed (seconds): 48,5539215

Mean: 0,59256566

StdDev: 0,00294317195969352

95% confidence interval: (0,5919887982959, 0,5931425217041)

========================================================

Performing MULTI-threaded percolation threshold calculation

grid size: 1000, attempt count: 100

Time elapsed (seconds): 13,3781846

Mean: 0,59257617

StdDev: 0,00268350124296981

95% confidence interval: (0,592050203756378, 0,593102136243622)

========================================================

The multi-threaded approach runs 4 times faster (on 4-cored CPU) ! So I strongly encourage everybody to utilize their multi-core processors by using multi-threaded calculations.

Tags:

Copyright 2007-2016 by Oleg Zhukov Terms Of UsePrivacy Statement