Changes

Jump to: navigation, search

DPS921/Halt and Catch Fire

20 bytes added, 20:40, 1 December 2016
Pi -Serial
*We just need to multiply by 4 to get π.
==== Programming implementation ====
===== Pi -Serial =====
<syntaxhighlight lang="go">
func PISerialPI(samples int) float64 {
var inside int = 0
}
</syntaxhighlight>
 
===== Serial execution CPU profile =====
As you can see only one core is work to compute the value of Pi - '''CPU8 @ 100%'''<br/>
[[Image:Cpu.PNG|alt=Monte Carlo Simulations]]
===== Pi - Parallel =====
<syntaxhighlight lang="go">
func MultiPIParallelPI(samples int) float64 {
runtime.GOMAXPROCS(runtime.NumCPU())
}
</syntaxhighlight>
 
===== Parallel execution CPU profile =====
As you can see all cores are working to compute the value of Pi - '''CPU1-8 @ 100%'''<br/>
147
edits

Navigation menu