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
aaf31c54
authored
Jan 19, 2023
by
Zoltan Karsa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix kernel pr
parent
301a5e9c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
14 deletions
+35
-14
genax.py
+29
-13
tetrarun.py
+6
-1
No files found.
genax.py
View file @
aaf31c54
...
...
@@ -24,10 +24,10 @@ def gen_angels_to_pick(n, plot = False):
parosit
=
cp
.
RawKernel
(
r'''
extern "C"
__global__
void
my_add(const double* x1, const double* x2, double* a, double* b, const size_
t m, const float PI) {
void
parosit(const double* x1, const double* x2, double* a, double* b, const in
t m, const float PI) {
int tid = blockDim.x * blockIdx.x + threadIdx.x;
float alpha = x1[tid];
for (
size_
t i = 0; i < m; i++) {
for (
in
t i = 0; i < m; i++) {
float betha = x2[i];
if ((alpha + betha) < PI && betha > alpha && alpha > 0.0) {
a[tid*m+i] = alpha;
...
...
@@ -40,6 +40,25 @@ void my_add(const double* x1, const double* x2, double* a, double* b, const size
}
'''
,
'parosit'
)
parosit2
=
cp
.
RawKernel
(
r'''
extern "C"
__global__
void parosit2(const double* x1, const double* x2, double* a, double* b, const int m, const float PI) {
int tid = blockDim.x * blockIdx.x + threadIdx.x;
float alpha = x1[tid];
for (int i = 0; i < m; i++) {
float betha = x2[i];
if ((alpha + betha) < PI && alpha > 0.0) {
a[tid*m+i] = alpha;
b[tid*m+i] = betha;
} else {
a[tid*m+i] = -1.0;
b[tid*m+i] = -1.0;
}
}
}
'''
,
'parosit2'
)
def
angles_alap
(
anglestopick
,
plot
=
False
):
m
=
anglestopick
.
size
alpha_arr
=
cp
.
zeros
((
m
,
m
),
dtype
=
cp
.
float64
)
...
...
@@ -49,9 +68,9 @@ def angles_alap(anglestopick, plot = False):
tompa_beta_arr
=
beta_arr
[
beta_arr
>
cp
.
pi
]
tompa_beta_mpi_arr
=
tompa_beta_arr
-
cp
.
pi
/
2
hegyes_beta_arr
=
beta_arr
[
beta_arr
<=
cp
.
pi
]
hegyes_beta_arr
=
beta_arr
[
(
beta_arr
<=
cp
.
pi
)
&
(
beta_arr
>
0.0
)
]
tompa_alpha_arr
=
alpha_arr
[
beta_arr
>
cp
.
pi
]
hegyes_alpha_arr
=
alpha_arr
[
alpha_arr
<=
cp
.
pi
]
hegyes_alpha_arr
=
alpha_arr
[
(
beta_arr
<=
cp
.
pi
)
&
(
beta_arr
>
0.0
)
]
tghB
=
cp
.
tan
(
hegyes_beta_arr
)
tghA
=
cp
.
tan
(
hegyes_alpha_arr
)
...
...
@@ -77,20 +96,17 @@ def angles_alap(anglestopick, plot = False):
def
angles_ratet
(
anglestopick
,
plot
=
False
):
alpha_arr
=
cp
.
array
([])
beta_arr
=
cp
.
array
([])
m
=
anglestopick
.
size
alpha_arr
=
cp
.
zeros
((
m
,
m
),
dtype
=
cp
.
float64
)
beta_arr
=
cp
.
zeros
((
m
,
m
),
dtype
=
cp
.
float64
)
for
alpha
in
anglestopick
:
for
beta
in
anglestopick
:
if
alpha
+
beta
<
cp
.
pi
and
alpha
!=
0.0
:
# vigyázni
alpha_arr
=
cp
.
put
(
alpha_arr
,
0
,
alpha
)
beta_arr
=
cp
.
put
(
beta_arr
,
0
,
beta
)
parosit2
((
1
,),
(
m
,),
(
anglestopick
,
anglestopick
,
alpha_arr
,
beta_arr
,
m
,
cp
.
pi
))
tompa_beta_arr
=
beta_arr
[
beta_arr
>
cp
.
pi
]
tompa_beta_mpi_arr
=
tompa_beta_arr
-
cp
.
pi
/
2
hegyes_beta_arr
=
beta_arr
[
beta_arr
<=
cp
.
pi
]
hegyes_beta_arr
=
beta_arr
[
(
beta_arr
<=
cp
.
pi
)
&
(
beta_arr
>
0.0
)
]
tompa_alpha_arr
=
alpha_arr
[
beta_arr
>
cp
.
pi
]
hegyes_alpha_arr
=
alpha_arr
[
alpha_arr
<=
cp
.
pi
]
hegyes_alpha_arr
=
alpha_arr
[
(
beta_arr
<=
cp
.
pi
)
&
(
beta_arr
>
0.0
)
]
tghB
=
cp
.
tan
(
hegyes_beta_arr
)
tghA
=
cp
.
tan
(
hegyes_alpha_arr
)
...
...
tetrarun.py
View file @
aaf31c54
...
...
@@ -37,11 +37,15 @@ def main(argv):
space
=
gen_angels_to_pick
(
n
,
PLOT
)
Cx
,
Cy
=
angles_alap
(
space
,
PLOT
)
print
(
Cx
)
print
(
Cy
)
Dx
,
Dy
,
Dz
=
angles_ratet
(
space
)
res
=
start_kernel
(
Cx
,
Cy
,
Dx
,
Dy
,
Dz
,
v
,
w
)
print
(
res
)
#
print(res)
if
__name__
==
"__main__"
:
main
(
sys
.
argv
[
1
:])
\ 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