Commit 08d6cac9 by Zoltan Karsa

copy to host

parent ada69672
import sys, getopt
import numpy as np
from genax import gen_angels_to_pick, angles_alap, angles_ratet
from gpu import start_kernel
from utils import convert, printresults, search, exact_one, exact_one_gpu, filter_gpu, writetofile, writetofile2
......@@ -42,8 +42,22 @@ def main(argv):
res = start_kernel(Cx, Cy, Dx, Dy, Dz, v, w)
Cx_cpu = np.zeros(Cx.size, dtype=np.float64)
Cx.get(out=Cx_cpu)
Cy_cpu = np.zeros(Cy.size, dtype=np.float64)
Cy.get(out=Cy_cpu)
Dx_cpu = np.zeros(Dx.size, dtype=np.float64)
Dx.get(out=Dx_cpu)
Dy_cpu = np.zeros(Dy.size, dtype=np.float64)
Dy.get(out=Dy_cpu)
Dz_cpu = np.zeros(Dz.size, dtype=np.float64)
Dz.get(out=Dz_cpu)
mtx_cpu = np.zeros(res.size, dtype=np.int8).reshape(res.shape)
res.get(out=mtx_cpu)
if outputfile:
writetofile(outputfile, Cx, Cy, Dx, Dy, Dz, res)
writetofile(outputfile+'.full', Cx_cpu, Cy_cpu, Dx_cpu, Dy_cpu, Dz_cpu, mtx_cpu)
writetofile2(outputfile, Cx_cpu, Cy_cpu, Dx_cpu, Dy_cpu, Dz_cpu, mtx_cpu)
#printresults(res)
#print("Exact one 3-3")
......
......@@ -56,20 +56,14 @@ def printresults(egyensulyi_mtx):
print(np.resize(parok, (int(N/2), 2)))
print()
def writetofile(filename, Cx, Cy, Dx, Dy, Dz, egyensulyi_mtx):
lcm = compute_lcm(Cx.size, Dx.size)
Cx_cpu = Cx.get()
Cy_cpu = Cy.get()
Dx_cpu = Dx.get()
Dy_cpu = Dy.get()
Dz_cpu = Dz.get()
mtx_cpu = egyensulyi_mtx.get()
pos = Cx.size * Dx.size
def writetofile(filename, Cx_cpu, Cy_cpu, Dx_cpu, Dy_cpu, Dz_cpu, mtx_cpu):
size_C = Cx_cpu.size
size_D = Dx_cpu.size
lcm = compute_lcm(size_C, size_D)
pos = size_C * size_D
f = open(filename, "w")
size_C = Cx.size
size_D = Dx.size
for i in range(0, pos):
#parok = np.empty([0], dtype=np.int8)
#for S in range(0, 4):
......@@ -85,20 +79,13 @@ def writetofile(filename, Cx, Cy, Dx, Dy, Dz, egyensulyi_mtx):
f.close()
def writetofile2(filename, Cx, Cy, Dx, Dy, Dz, egyensulyi_mtx):
lcm = compute_lcm(Cx.size, Dx.size)
Cx_cpu = Cx.get()
Cy_cpu = Cy.get()
Dx_cpu = Dx.get()
Dy_cpu = Dy.get()
Dz_cpu = Dz.get()
mtx_cpu = egyensulyi_mtx.get()
pos = Cx.size * Dx.size
def writetofile2(filename, Cx_cpu, Cy_cpu, Dx_cpu, Dy_cpu, Dz_cpu, mtx_cpu):
size_C = Cx_cpu.size
size_D = Dx_cpu.size
lcm = compute_lcm(size_C, size_D)
pos = size_C * size_D
f = open(filename, "w")
size_C = Cx.size
size_D = Dx.size
for i in range(0, pos):
s = 0
for S in range(0, 4):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment