Commit 435dd35f by Zoltan Karsa

print res

parent c274dad0
......@@ -10,7 +10,7 @@ fun = ep_pontok_module.get_function(kers[0])
def start_kernel(Cx, Cy, Dx, Dy, Dz, v, w):
print("Res size (byte): ", Cx.size*Dx.size*4*4)
print(Cx.size, ",", Cy.size, ",", Dx.size, ",", Dy.size, ",", Dz.size)
#print(Cx.size, ",", Cy.size, ",", Dx.size, ",", Dy.size, ",", Dz.size)
egyensulyi_mtx = cp.zeros((Cx.size*Dx.size, 4, 4), dtype=cp.int8)
numBlock = int((Cx.size*Dx.size + 256 - 1) / 256)
fun((numBlock,), (256,), (v, w, Cx, Cy, Dx, Dy, Dz, Cx.size, Dx.size, egyensulyi_mtx))
......
......@@ -2,6 +2,7 @@ import sys, getopt
from genax import gen_angels_to_pick, angles_alap, angles_ratet
from gpu import start_kernel
from utils import convert, printresults
def main(argv):
outputfile = 'out.txt'
......@@ -39,8 +40,7 @@ def main(argv):
Dx, Dy, Dz = angles_ratet(space)
res = start_kernel(Cx, Cy, Dx, Dy, Dz, v, w)
#print(res)
printresults(res)
if __name__ == "__main__":
main(sys.argv[1:])
\ No newline at end of file
import cupy as cp
import numpy as np
def expSpace(min, max, N, exponentialliness = 20.0):
LinVec = cp.linspace(0, cp.log10(exponentialliness+1, dtype=cp.float64),N, dtype=cp.float64)
return (max-min)/exponentialliness * (10.0**LinVec - 1) + min
\ No newline at end of file
return (max-min)/exponentialliness * (10.0**LinVec - 1) + min
def convert(egyensulyi_mtx):
parok = np.empty([0], dtype=np.int8)
for i in egyensulyi_mtx:
for S in range(0, 4):
for U in range(0, 4):
if i[S][U] == 1:
parok = np.append(parok, S+1)
parok = np.append(parok, U+1)
parok = np.append(parok, 0)
parok = np.append(parok, 0)
N = parok.size
return np.resize(parok, (int(N/2), 2))
def printresults(egyensulyi_mtx):
print(egyensulyi_mtx.size / 4 / 4)
for i in egyensulyi_mtx:
parok = np.empty([0], dtype=np.int8)
for S in range(0, 4):
for U in range(0, 4):
if i[S][U] == 1:
parok = np.append(parok, S+1)
parok = np.append(parok, U+1)
N = parok.size
print(f"{int(N/2)}x2")
print(np.resize(parok, (int(N/2), 2)))
print()
\ No newline at end of file
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