Commit 08d6cac9 by Zoltan Karsa

copy to host

parent ada69672
import sys, getopt import sys, getopt
import numpy as np
from genax import gen_angels_to_pick, angles_alap, angles_ratet from genax import gen_angels_to_pick, angles_alap, angles_ratet
from gpu import start_kernel from gpu import start_kernel
from utils import convert, printresults, search, exact_one, exact_one_gpu, filter_gpu, writetofile, writetofile2 from utils import convert, printresults, search, exact_one, exact_one_gpu, filter_gpu, writetofile, writetofile2
...@@ -42,8 +42,22 @@ def main(argv): ...@@ -42,8 +42,22 @@ def main(argv):
res = start_kernel(Cx, Cy, Dx, Dy, Dz, v, w) 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: 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) #printresults(res)
#print("Exact one 3-3") #print("Exact one 3-3")
......
...@@ -56,20 +56,14 @@ def printresults(egyensulyi_mtx): ...@@ -56,20 +56,14 @@ def printresults(egyensulyi_mtx):
print(np.resize(parok, (int(N/2), 2))) print(np.resize(parok, (int(N/2), 2)))
print() print()
def writetofile(filename, Cx, Cy, Dx, Dy, Dz, egyensulyi_mtx): def writetofile(filename, Cx_cpu, Cy_cpu, Dx_cpu, Dy_cpu, Dz_cpu, mtx_cpu):
lcm = compute_lcm(Cx.size, Dx.size) size_C = Cx_cpu.size
Cx_cpu = Cx.get() size_D = Dx_cpu.size
Cy_cpu = Cy.get() lcm = compute_lcm(size_C, size_D)
Dx_cpu = Dx.get() pos = size_C * size_D
Dy_cpu = Dy.get()
Dz_cpu = Dz.get()
mtx_cpu = egyensulyi_mtx.get()
pos = Cx.size * Dx.size
f = open(filename, "w") f = open(filename, "w")
size_C = Cx.size
size_D = Dx.size
for i in range(0, pos): for i in range(0, pos):
#parok = np.empty([0], dtype=np.int8) #parok = np.empty([0], dtype=np.int8)
#for S in range(0, 4): #for S in range(0, 4):
...@@ -85,20 +79,13 @@ def writetofile(filename, Cx, Cy, Dx, Dy, Dz, egyensulyi_mtx): ...@@ -85,20 +79,13 @@ def writetofile(filename, Cx, Cy, Dx, Dy, Dz, egyensulyi_mtx):
f.close() f.close()
def writetofile2(filename, Cx, Cy, Dx, Dy, Dz, egyensulyi_mtx): def writetofile2(filename, Cx_cpu, Cy_cpu, Dx_cpu, Dy_cpu, Dz_cpu, mtx_cpu):
lcm = compute_lcm(Cx.size, Dx.size) size_C = Cx_cpu.size
Cx_cpu = Cx.get() size_D = Dx_cpu.size
Cy_cpu = Cy.get() lcm = compute_lcm(size_C, size_D)
Dx_cpu = Dx.get() pos = size_C * size_D
Dy_cpu = Dy.get()
Dz_cpu = Dz.get()
mtx_cpu = egyensulyi_mtx.get()
pos = Cx.size * Dx.size
f = open(filename, "w") f = open(filename, "w")
size_C = Cx.size
size_D = Dx.size
for i in range(0, pos): for i in range(0, pos):
s = 0 s = 0
for S in range(0, 4): 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