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
d96ae1d3
authored
Feb 01, 2023
by
Zoltan Karsa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ok
parent
5fb0d82c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
tetrarun.py
+3
-2
utils.py
+13
-1
No files found.
tetrarun.py
View file @
d96ae1d3
...
...
@@ -43,9 +43,9 @@ def main(argv):
res
=
start_kernel
(
Cx
,
Cy
,
Dx
,
Dy
,
Dz
,
v
,
w
)
#printresults(res)
print
(
"Exact one 3-3"
)
print
(
exact_one_gpu
(
res
,
3
-
1
,
3
-
1
)
)
exact_one33
=
exact_one_gpu
(
res
,
3
-
1
,
3
-
1
)
print
(
"Filter 2-1"
)
print
(
filter_gpu
(
res
,
2
-
1
,
1
-
1
)
)
filter21
=
filter_gpu
(
res
,
2
-
1
,
1
-
1
)
if
__name__
==
"__main__"
:
main
(
sys
.
argv
[
1
:])
\ No newline at end of file
utils.py
View file @
d96ae1d3
import
cupy
as
cp
import
numpy
as
np
from
functools
import
wraps
import
time
with
open
(
'filtering.cu'
)
as
f
:
code
=
f
.
read
()
...
...
@@ -9,6 +11,17 @@ ep_pontok_module = cp.RawModule(code=code, options=('--std=c++11',), name_expres
exact_one_cuda
=
ep_pontok_module
.
get_function
(
kers
[
0
])
filter_cuda
=
ep_pontok_module
.
get_function
(
kers
[
1
])
def
timeit
(
func
):
@wraps
(
func
)
def
timeit_wrapper
(
*
args
,
**
kwargs
):
start_time
=
time
.
perf_counter
()
result
=
func
(
*
args
,
**
kwargs
)
end_time
=
time
.
perf_counter
()
total_time
=
end_time
-
start_time
print
(
f
'Function {func.__name__}{args} {kwargs} Took {total_time:.4f} seconds'
)
return
result
return
timeit_wrapper
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
...
...
@@ -71,7 +84,6 @@ def exact_one_gpu(egyensulyi_mtx, S, U):
exact_one_cuda
((
numBlock
,),
(
256
,),
(
egyensulyi_mtx
,
size
,
indexes
,
S
,
U
))
return
egyensulyi_mtx
[
indexes
]
def
filter_gpu
(
egyensulyi_mtx
,
S
,
U
):
size
=
int
(
egyensulyi_mtx
.
size
/
16
)
indexes
=
cp
.
zeros
((
size
,),
dtype
=
cp
.
bool
)
...
...
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