Parallel processing pi计算中的并行度

Parallel processing pi计算中的并行度,parallel-processing,pi,Parallel Processing,Pi,我一直在检查代码 npoints = 10000 circle_count = 0 p = number of tasks num = npoints/p find out if I am MASTER or WORKER do j = 1,num generate 2 random numbers between 0 and 1 xcoordinate = random1 ycoordinate = random2 if (xcoordinate, ycoordina

我一直在检查代码

npoints = 10000
circle_count = 0

p = number of tasks
num = npoints/p

find out if I am MASTER or WORKER 

do j = 1,num 
  generate 2 random numbers between 0 and 1
  xcoordinate = random1
  ycoordinate = random2
  if (xcoordinate, ycoordinate) inside circle
  then circle_count = circle_count + 1
end do

if I am MASTER

  receive from WORKERS their circle_counts
  compute PI (use MASTER and WORKER calculations)

else if I am WORKER

  send to MASTER circle_count

endif
有人能告诉我们这个算法使用了什么级别的并行性吗??? 我问的是,这些人的平等程度如何 1工作或计划级别 2任务或程序级别 3指令间级别
4指令内级别

这是蒙特卡罗方法,运行次数越多,检索结果越准确

  do j = 1,num 
  generate 2 random numbers between 0 and 1
  xcoordinate = random1
  ycoordinate = random2
  if (xcoordinate, ycoordinate) inside circle
  then circle_count = circle_count + 1
  end do
上面的代码是一个monte carlo步骤,只要线程之间共享circle_count变量,它就可以在独立运行的num线程中并行。
创建所有点后,您可以返回单线程来计算pi值。

谢谢。但我问的是并行性的水平,即1作业或程序级别2任务或程序级别3指令间级别4指令内级别