Skip to content

Commit 5708995

Browse files
author
Thanh Chung
committed
add pi example with ray
1 parent 1397e1b commit 5708995

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tutorial/pi_ray/pi_calc.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
import math, statistics, random, time, sys, locale
33
import ray
44
import numpy as np
5-
5+
import argparse
66

77
############################### Main ##############################################
88
repeat=10 # We'll do this many calculations for a given N and average the results.
99

1010
def main():
1111
global repeat
1212

13-
import argparse
13+
Ns = [500, 1000, 5000, 10000, 50000, 100000]
14+
1415
parser = argparse.ArgumentParser(description="Monte Carlo Pi Calculator")
1516
parser.add_argument('Ns', metavar='N', type=int, default=Ns, nargs='*', help='Runs with the specified number of samples')
1617
parser.add_argument('-r', '--repeat', metavar='M', type=int, default=repeat, nargs='?', help='Repeat for each N, then compute average, stdev, etc')

0 commit comments

Comments
 (0)