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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
e7777a18
authored
Jul 02, 2024
by
Karsa Zoltán István
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
points cloud init
parent
7e67e85a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
6 deletions
+68
-6
epgpu.cu
+28
-0
gpu.py
+12
-0
measure3.sh
+1
-2
tetrarun.py
+27
-4
No files found.
epgpu.cu
View file @
e7777a18
...
@@ -272,4 +272,31 @@ __global__ void gpu_egyensulyi(int v, int w, const double* Cx_arr, const double
...
@@ -272,4 +272,31 @@ __global__ void gpu_egyensulyi(int v, int w, const double* Cx_arr, const double
BCD_oldal(v, w, C, D, egysulyi_mtx);
BCD_oldal(v, w, C, D, egysulyi_mtx);
CDA_oldal(v, w, C, D, egysulyi_mtx);
CDA_oldal(v, w, C, D, egysulyi_mtx);
DAB_oldal(v, w, C, D, egysulyi_mtx);
DAB_oldal(v, w, C, D, egysulyi_mtx);
}
__global__ void gpu_pontok(int v, int w, double Cx, double Cy, double Dx, double Dy, double Dz, float* points, char* type) {
int pos = blockDim.x * blockIdx.x + threadIdx.x * w + threadIdx.y;
vec3 C(Cx, Cy, 0.0);
vec3 D(Dx, Dy, Dz);
vec3 AB(1.0/v, 0.0, 0.0);
vec3 AC = C/v;
vec3 K = ( (double) blockIdx.x) * AB + ((double) threadIdx.x) * AC;
vec3 L = (D - K)/w;
vec3 Sv = K + L*((double) threadIdx.y);
int S = stabil_ep(Sv, C, D);
int U = instabil_ep(Sv, C, D);
int H = nyereg_ep(Sv, C, D);
if (S > 0 && U > 0 && S + U - H == 2) {
points[3*pos] = Sv.x;
points[3*pos + 1] = Sv.y;
points[3*pos + 2] = Sv.z;
type[pos] = (S-1)*4+(U-1);
}
//ABC_oldal(v, w, C, D, egysulyi_mtx);
//BCD_oldal(v, w, C, D, egysulyi_mtx);
//CDA_oldal(v, w, C, D, egysulyi_mtx);
//DAB_oldal(v, w, C, D, egysulyi_mtx);
}
}
\ No newline at end of file
gpu.py
View file @
e7777a18
...
@@ -9,6 +9,10 @@ kers = ('gpu_egyensulyi', )
...
@@ -9,6 +9,10 @@ kers = ('gpu_egyensulyi', )
ep_pontok_module
=
cp
.
RawModule
(
code
=
code
,
options
=
(
'--std=c++11'
,),
name_expressions
=
kers
)
ep_pontok_module
=
cp
.
RawModule
(
code
=
code
,
options
=
(
'--std=c++11'
,),
name_expressions
=
kers
)
fun
=
ep_pontok_module
.
get_function
(
kers
[
0
])
fun
=
ep_pontok_module
.
get_function
(
kers
[
0
])
kers_pontok
=
(
'gpu_pontok'
,
)
ep_pontok_module_pontok
=
cp
.
RawModule
(
code
=
code
,
options
=
(
'--std=c++11'
,),
name_expressions
=
kers_pontok
)
fun_pontok
=
ep_pontok_module_pontok
.
get_function
(
kers_pontok
[
0
])
def
start_kernel
(
Cx
,
Cy
,
Dx
,
Dy
,
Dz
,
v
,
w
):
def
start_kernel
(
Cx
,
Cy
,
Dx
,
Dy
,
Dz
,
v
,
w
):
print
(
f
"Cnt: {Cx.size}x{Dx.size}={Cx.size*Dx.size}"
)
print
(
f
"Cnt: {Cx.size}x{Dx.size}={Cx.size*Dx.size}"
)
print
(
"Res size (byte): "
,
Cx
.
size
*
Dx
.
size
*
4
*
4
)
print
(
"Res size (byte): "
,
Cx
.
size
*
Dx
.
size
*
4
*
4
)
...
@@ -20,3 +24,10 @@ def start_kernel(Cx, Cy, Dx, Dy, Dz, v, w):
...
@@ -20,3 +24,10 @@ def start_kernel(Cx, Cy, Dx, Dy, Dz, v, w):
fun
((
numBlock
,),
(
fun
.
max_threads_per_block
,),
(
v
,
w
,
Cx
,
Cy
,
Dx
,
Dy
,
Dz
,
Cx
.
size
,
Dx
.
size
,
lcm
,
egyensulyi_mtx
))
fun
((
numBlock
,),
(
fun
.
max_threads_per_block
,),
(
v
,
w
,
Cx
,
Cy
,
Dx
,
Dy
,
Dz
,
Cx
.
size
,
Dx
.
size
,
lcm
,
egyensulyi_mtx
))
return
egyensulyi_mtx
return
egyensulyi_mtx
def
start_kernel_save_points
(
Cx
,
Cy
,
Dx
,
Dy
,
Dz
,
v
,
w
)
points
=
cp
.
zeros
((
v
*
w
,
3
),
dtype
=
cp
.
double
)
points_type
=
cp
.
zeros
((
v
*
w
,
3
),
dtype
=
cp
.
char
)
numBlock
=
int
((
w
*
v
+
fun_pontok
.
max_threads_per_block
-
1
)
/
fun_pontok
.
max_threads_per_block
)
fun_pontok
((
numBlock
),
(
fun_pontok
.
max_threads_per_block
),
(
v
,
w
,
Cx
,
Cy
,
Dx
,
Dy
,
Dz
,
points
,
points_type
))
return
points
,
tipus
\ No newline at end of file
measure3.sh
View file @
e7777a18
...
@@ -11,4 +11,4 @@ module load anaconda3
...
@@ -11,4 +11,4 @@ module load anaconda3
module load cuda11.0
module load cuda11.0
module load mpi-3.1
module load mpi-3.1
mpirun python tetrarun.py
-n
51
-v
50
-w
50
-o
/gv0/karsa/poli_51_50_50.out
mpirun python tetrarun.py
-n
101
-v
51
-w
51
-o
/gv0/karsa/poli_101_51_51
-m
-b
\ No newline at end of file
tetrarun.py
View file @
e7777a18
...
@@ -3,9 +3,10 @@ import numpy as np
...
@@ -3,9 +3,10 @@ import numpy as np
import
cupy
as
cp
import
cupy
as
cp
import
os
import
os
from
genax
import
gen_angels_to_pick
,
angles_alap
,
angles_ratet
from
genax
import
gen_angels_to_pick
,
angles_alap
,
angles_ratet
from
gpu
import
start_kernel
from
gpu
import
start_kernel
,
start_kernel_save_points
from
utils
import
convert
,
printresults
,
search
,
exact_one
,
exact_one_gpu
,
filter_gpu
,
writetofile
,
writetofile2
from
utils
import
convert
,
printresults
,
search
,
exact_one
,
exact_one_gpu
,
filter_gpu
,
writetofile
,
writetofile2
from
mpi
import
size
,
rank
from
mpi
import
size
,
rank
from
pyntcloud
import
PyntCloud
def
main
(
argv
):
def
main
(
argv
):
outputfile
=
None
outputfile
=
None
...
@@ -43,7 +44,7 @@ def main(argv):
...
@@ -43,7 +44,7 @@ def main(argv):
elif
opt
in
(
"-b"
,
"--bin"
):
elif
opt
in
(
"-b"
,
"--bin"
):
binary
=
True
binary
=
True
if
outputfile
and
binary
and
mpi
and
rank
==
0
:
if
outputfile
and
binary
and
rank
==
0
:
os
.
mkdir
(
outputfile
)
os
.
mkdir
(
outputfile
)
space
=
gen_angels_to_pick
(
n
)
space
=
gen_angels_to_pick
(
n
)
...
@@ -92,5 +93,28 @@ def main(argv):
...
@@ -92,5 +93,28 @@ def main(argv):
#print("Filter 2-1")
#print("Filter 2-1")
#filter21 = filter_gpu(res, 2-1, 1-1)
#filter21 = filter_gpu(res, 2-1, 1-1)
lines
=
[
{
"color"
:
"red"
,
"vertices"
:
[[
0
,
0
,
0
],
[
10
,
0
,
0
]]
},
{
"color"
:
"green"
,
"vertices"
:
[[
0
,
0
,
0
],
[
0
,
10
,
0
]]
},
{
"color"
:
"blue"
,
"vertices"
:
[[
0
,
0
,
0
],
[
0
,
0
,
10
]]
}
]
def
save_points
(
Cx
=
1
,
Cy
=
0
,
Dx
=
0
,
Dy
=
0
,
Dz
=
1
,
v
=
4
,
w
=
4
):
points
,
types
=
start_kernel_save_points
(
Cx
,
Cy
,
Dx
,
Dy
,
Dz
,
v
,
w
)
points
=
pd
.
DataFrame
(
points
.
astype
(
np
.
double
),
columns
=
[
'x'
,
'y'
,
'z'
])
cloud
=
PyntCloud
(
points
)
cloud
.
plot
(
polylines
=
lines
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
main
(
sys
.
argv
[
1
:])
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