def LoadDataRef(db,table) :
    db = MySQLdb.connect("localhost", "root", "", db)
    cursor = db.cursor()
    sql = "SELECT idstr from %s"%table 
    idString = []
    try:
		cursor.execute(sql)
		results = cursor.fetchall()
		for row in results :
			list_ref.append(float64(row[0]))
    except :
		print "Error"
    db.close
Example #2
0
'''
Demonstrate the vectorize API with automatical memory transfer and
manual memory transfer.
'''
from timeit import default_timer as timer
import numpy
from numbapro import vectorize, float64, cuda


@vectorize([float64(float64, float64)], target='gpu')
def vector_mul(a, b):
    return a * b


a = numpy.random.rand(10000000)
b = numpy.random.rand(10000000)

# Let NumbaPro automatically convert host memory to device memory
ts = timer()
for i in xrange(10):
    result = vector_mul(a, b)
te = timer()

print 'auto', te - ts

# Manual conversion between host and device memory
ts = timer()
for i in xrange(10):
    # copy host memory to device
    da = cuda.to_device(a)
    db = cuda.to_device(b)
'''
Demonstrate the vectorize API with automatical memory transfer and
manual memory transfer.
'''
from timeit import default_timer as timer
import numpy
from numbapro import vectorize, float64, cuda

@vectorize([float64(float64, float64)], target='gpu')
def vector_mul(a, b):
    return  a * b

a = numpy.random.rand(10000000)
b = numpy.random.rand(10000000)

# Let NumbaPro automatically convert host memory to device memory
ts = timer()
for i in xrange(10):
    result = vector_mul(a, b)
te = timer()

print 'auto', te - ts


# Manual conversion between host and device memory
ts = timer()
for i in xrange(10):
    # copy host memory to device
    da = cuda.to_device(a)
    db = cuda.to_device(b)
    # execute kernel