Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Karsa Zoltán István
/
politopok
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
435dd35f
authored
Jan 25, 2023
by
Zoltan Karsa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
print res
parent
c274dad0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
5 deletions
+37
-5
gpu.py
+1
-1
tetrarun.py
+3
-2
utils.py
+33
-2
No files found.
gpu.py
View file @
435dd35f
...
...
@@ -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
))
...
...
tetrarun.py
View file @
435dd35f
...
...
@@ -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
utils.py
View file @
435dd35f
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment