예제 #1
0
pool = genome.Pool(db)

data = numpy.array(data).astype(numpy.float32)
data_gpu = cuda.mem_alloc(data.nbytes)
cuda.memcpy_htod(data_gpu, data)

validData = numpy.array(validData).astype(numpy.float32)
validData_gpu = cuda.mem_alloc(validData.nbytes)
cuda.memcpy_htod(validData_gpu, validData)

#### transfer data array and winner table to GPU
while True:

    trees = []
    for x in range(poolSize):
        trees.append(genome.randomTree(treeLength))

    ### Main Loop
    generations = 0

    while True:

        winnerTable = numpy.zeros(len(data) * poolSize, dtype=numpy.bool)
        winnerTable_gpu = cuda.mem_alloc(winnerTable.nbytes)
        cuda.memcpy_htod(winnerTable_gpu, winnerTable)

        trees = numpy.array(trees).astype(numpy.float32)
        trees_gpu = cuda.mem_alloc(trees.nbytes)
        cuda.memcpy_htod(trees_gpu, trees)

        winCounter = numpy.zeros(12 * poolSize, dtype=numpy.int32)
예제 #2
0

data = numpy.array(data).astype(numpy.float32)
data_gpu = cuda.mem_alloc(data.nbytes)
cuda.memcpy_htod(data_gpu, data)

#validData = numpy.array(validData).astype(numpy.float32)
#validData_gpu = cuda.mem_alloc(validData.nbytes)
#cuda.memcpy_htod(validData_gpu, validData)

#### transfer data array and winner table to GPU
while True:

	trees = []
	for x in range(poolSize):
		trees.append( genome.randomTree(treeLength) )
	
	### Main Loop
	generations = 0
	dataDim = math.floor(len(data)/64.0)

	evalArray = None
	lastTrees = None
	winCount = None
	lossCount = None
	winTradeCount = None
	lossTradeCount = None
	drawdownCount = None

	while True:
		winnerTable = numpy.zeros(len(data) * poolSize, dtype=numpy.bool)