Can I use this algorithm with GPU coding?

조회 수: 9 (최근 30일)
jaehyun yu
jaehyun yu 2021년 3월 8일
I want to create code about picture and want to do monte carlo simulation with gpu
Is it possible to code with gpu?
1st pseudo code
Function EvaluateTopEventProbability (T)
//for number of samples n
For number of samples n
//determine the state of events
For each Ei which is a basic event
//a random number r between 0 and 1
r = rand()
//State of Ei
if r ≤ Pi then Si = True else Si = False
//Calculate the state of top event
ST = GetState (T)//f(S)
if ST ≡ True then m = m + 1
//Evaluate the top event probability PT
PT = m/n
Return PT
2nd pseudo code
Function GetState (g)
//return Sg for basic event
if g is a basic event then
return Sg
//for Gate
//if already processed
if Sg is already determined then
return Sg
//calculate the state for each input
For each Ci ∈ g
//recursively for each input
Si = GetState (Ci)
//Determine the State of g
Sg = DetermineState (g)
Return Sg
3rd pseudo code
Function DetermineState (g)
if g is a OR Gate then
u = False
For each Ci ∈ g
u = u∪Si
else if g is a AND Gate then
u = True
For each Ci ∈ g
u = u∩Si
else if g is a NOT Gate then
For Ci ∈g
u = not Si
Sg = u
return Sg

답변 (0개)

카테고리

Help CenterFile Exchange에서 Parallel Computing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by