Skip to content

Commit 763ee57

Browse files
committed
black-scholes: add partial gpu support, verification is skipped
1 parent 3928233 commit 763ee57

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

Diff for: examples/black_scholes.py

+17-9
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,23 @@ def eval():
246246
info(f"Median rate: {perf_rate:.5f} Mopts/s")
247247

248248
# verify
249-
call, put = args[-2], args[-1]
250-
expected_call = 16.976097804669887
251-
expected_put = 0.34645174725098116
252-
call_value = float(call[0])
253-
put_value = float(put[0])
254-
assert numpy.allclose(call_value, expected_call)
255-
assert numpy.allclose(put_value, expected_put)
256-
257-
info("SUCCESS")
249+
if device:
250+
# FIXME gpu.memcpy to host requires identity layout
251+
# FIXME reduction on gpu
252+
# call = args[-2].to_device()
253+
# put = args[-1].to_device()
254+
pass
255+
else:
256+
call = args[-2]
257+
put = args[-1]
258+
expected_call = 16.976097804669887
259+
expected_put = 0.34645174725098116
260+
call_value = float(call[0])
261+
put_value = float(put[0])
262+
assert numpy.allclose(call_value, expected_call)
263+
assert numpy.allclose(put_value, expected_put)
264+
info("SUCCESS")
265+
258266
fini()
259267

260268

0 commit comments

Comments
 (0)