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
f9b951c8
authored
Feb 02, 2023
by
Zoltan Karsa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
o
parent
d96ae1d3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
tetrarun.py
+4
-3
utils.py
+8
-3
No files found.
tetrarun.py
View file @
f9b951c8
...
@@ -43,9 +43,9 @@ def main(argv):
...
@@ -43,9 +43,9 @@ def main(argv):
res
=
start_kernel
(
Cx
,
Cy
,
Dx
,
Dy
,
Dz
,
v
,
w
)
res
=
start_kernel
(
Cx
,
Cy
,
Dx
,
Dy
,
Dz
,
v
,
w
)
#printresults(res)
#printresults(res)
print
(
"Exact one 3-3"
)
print
(
"Exact one 3-3"
)
exact_one
33
=
exact_one
_gpu
(
res
,
3
-
1
,
3
-
1
)
exact_one_gpu
(
res
,
3
-
1
,
3
-
1
)
print
(
"Filter 2-1"
)
#
print("Filter 2-1")
filter21
=
filter_gpu
(
res
,
2
-
1
,
1
-
1
)
#
filter21 = filter_gpu(res, 2-1, 1-1)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
main
(
sys
.
argv
[
1
:])
main
(
sys
.
argv
[
1
:])
\ No newline at end of file
utils.py
View file @
f9b951c8
import
cupy
as
cp
import
cupy
as
cp
import
numpy
as
np
from
functools
import
wraps
from
functools
import
wraps
import
time
import
time
import
torch
with
open
(
'filtering.cu'
)
as
f
:
with
open
(
'filtering.cu'
)
as
f
:
code
=
f
.
read
()
code
=
f
.
read
()
...
@@ -79,10 +79,15 @@ def exact_one(egyensulyi_mtx, S, U):
...
@@ -79,10 +79,15 @@ def exact_one(egyensulyi_mtx, S, U):
def
exact_one_gpu
(
egyensulyi_mtx
,
S
,
U
):
def
exact_one_gpu
(
egyensulyi_mtx
,
S
,
U
):
size
=
int
(
egyensulyi_mtx
.
size
/
16
)
size
=
int
(
egyensulyi_mtx
.
size
/
16
)
indexes
=
cp
.
zeros
((
size
,),
dtype
=
cp
.
bool
)
indexes
=
cp
.
zeros
((
size
,),
dtype
=
bool
)
numBlock
=
int
((
size
+
256
-
1
)
/
256
)
numBlock
=
int
((
size
+
256
-
1
)
/
256
)
exact_one_cuda
((
numBlock
,),
(
256
,),
(
egyensulyi_mtx
,
size
,
indexes
,
S
,
U
))
exact_one_cuda
((
numBlock
,),
(
256
,),
(
egyensulyi_mtx
,
size
,
indexes
,
S
,
U
))
return
egyensulyi_mtx
[
indexes
]
t_emtx
=
torch
.
as_tensor
(
egyensulyi_mtx
,
device
=
torch
.
device
(
'cuda'
),
dtype
=
torch
.
int8
)
assert
t_emtx
.
__cuda_array_interface__
[
'data'
][
0
]
==
egyensulyi_mtx
.
__cuda_array_interface__
[
'data'
][
0
]
t_ind
=
torch
.
as_tensor
(
indexes
,
device
=
torch
.
device
(
'cuda'
),
dtype
=
torch
.
bool
)
t_ind
=
t_ind
.
unsqueeze
(
-
1
)
.
unsqueeze
(
-
1
)
.
expand
(
-
1
,
4
,
4
)
res
=
torch
.
masked_select
(
t_emtx
,
t_ind
)
return
res
def
filter_gpu
(
egyensulyi_mtx
,
S
,
U
):
def
filter_gpu
(
egyensulyi_mtx
,
S
,
U
):
size
=
int
(
egyensulyi_mtx
.
size
/
16
)
size
=
int
(
egyensulyi_mtx
.
size
/
16
)
...
...
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