Skip to content

Commit 6f133f3

Browse files
sakchalsyurkevi
authored andcommitted
removed sync() parameter
1 parent 83edc8d commit 6f133f3

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

examples/financial/black_scholes_options.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import sys
1414
from time import time
1515

16-
# TODO: Remove -1 from sync() after default value has been put in
1716
import arrayfire as af
1817

1918
sqrt2 = math.sqrt(2.0)
@@ -61,7 +60,7 @@ def black_scholes(S, X, R, V, T):
6160
(C, P) = black_scholes(S, X, R, V, T)
6261
af.eval(C)
6362
af.eval(P)
64-
af.sync(-1)
63+
af.sync()
6564

6665
num_iter = 100
6766
for N in range(50, 501, 50):
@@ -70,7 +69,7 @@ def black_scholes(S, X, R, V, T):
7069
R = af.randu((M, N))
7170
V = af.randu((M, N))
7271
T = af.randu((M, N))
73-
af.sync(-1)
72+
af.sync()
7473

7574
print("Input data size: %d elements" % (M * N))
7675

@@ -79,7 +78,7 @@ def black_scholes(S, X, R, V, T):
7978
(C, P) = black_scholes(S, X, R, V, T)
8079
af.eval(C)
8180
af.eval(P)
82-
af.sync(-1)
81+
af.sync()
8382
sec = (time() - start) / num_iter
8483

8584
print("Mean GPU Time: %0.6f ms\n\n" % (1000.0 * sec))

examples/financial/heston_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def main():
8888
# Price plain vanilla call option
8989
tic = time.time()
9090
(x, v) = simulateHestonModel(T, nT, R, r, kappa, vBar, sigmaV, rho, x0, v0)
91-
af.sync(-1)
91+
af.sync()
9292
toc = time.time() - tic
9393
K = math.exp(k)
9494
zeroConstant = af.constant(0, (R,))

examples/financial/monte_carlo_options.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def monte_carlo_options(N, K, t, vol, r, strike, steps, use_barrier=True, B=None
2525
randmat = af.randn((N, steps - 1), dtype=ty)
2626
randmat = af.exp((r - (vol * vol * 0.5)) * dt + vol * math.sqrt(dt) * randmat)
2727

28-
S = af.product(af.join(1, s, randmat), 1)
28+
S = af.product(af.join(1, s, randmat), axis=1)
2929

3030
if use_barrier:
3131
S = S * af.all_true(S < B, 1)
@@ -57,7 +57,7 @@ def monte_carlo_simulate(N, use_barrier, num_iter=10):
5757

5858
monte_carlo_simulate(1000, use_barrier=False)
5959
monte_carlo_simulate(1000, use_barrier=True)
60-
af.sync(-1)
60+
af.sync()
6161

6262
for n in range(10000, 100001, 10000):
6363
print(

0 commit comments

Comments
 (0)