[python-arrayfire] 155/250: Adding the ability to switch devices for monte_carlo_pi example

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Mar 28 22:59:44 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/master
in repository python-arrayfire.

commit c7c273f1dfa507cc9bdd5bfd3be27b5531fb3226
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Tue Dec 8 21:13:04 2015 -0500

    Adding the ability to switch devices for monte_carlo_pi example
---
 examples/benchmarks/monte_carlo_pi.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/examples/benchmarks/monte_carlo_pi.py b/examples/benchmarks/monte_carlo_pi.py
index ee25099..fc35b3d 100755
--- a/examples/benchmarks/monte_carlo_pi.py
+++ b/examples/benchmarks/monte_carlo_pi.py
@@ -13,6 +13,7 @@ from random import random
 from time import time
 from arrayfire import (array, randu)
 import arrayfire as af
+import sys
 
 #alias range / xrange because xrange is faster than range in python2
 try:
@@ -47,5 +48,9 @@ def bench(calc_pi, samples=1000000, iters=25):
     print("Average time taken: %f ms" % (1000 * (end - start) / iters))
 
 if __name__ == "__main__":
+    if (len(sys.argv) > 1):
+        af.set_device(int(sys.argv[1]))
+    af.info()
+
     bench(calc_pi_device)
     bench(calc_pi_host)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-arrayfire.git



More information about the debian-science-commits mailing list