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
a3790eec
authored
Feb 10, 2023
by
Zoltan Karsa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
binary support
parent
e1c5288c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
38 deletions
+24
-38
.gitignore
+2
-0
epgpu.cu
+0
-33
tetrarun.py
+22
-5
No files found.
.gitignore
View file @
a3790eec
...
...
@@ -53,3 +53,4 @@ docs/_build/
*.out
*.full
*.npy
\ No newline at end of file
epgpu.cu
View file @
a3790eec
...
...
@@ -26,39 +26,6 @@ __device__ inline vec3 cross(const vec3& v1, const vec3& v2) {
__device__ inline vec3 operator*(double a, const vec3& v) { return vec3(v.x * a, v.y * a, v.z * a); }
//---------------------------
struct mat3 { // row-major matrix 4x4
//---------------------------
vec3 rows[4];
public:
__device__ mat3() {}
__device__ mat3(double m00, double m01, double m02,
double m10, double m11, double m12,
double m20, double m21, double m22,
double m30, double m31, double m32) {
rows[0][0] = m00; rows[0][1] = m01; rows[0][2] = m02;
rows[1][0] = m10; rows[1][1] = m11; rows[1][2] = m12;
rows[2][0] = m20; rows[2][1] = m21; rows[2][2] = m22;
rows[3][0] = m30; rows[3][1] = m31; rows[3][2] = m32;
}
__device__ mat3(vec3 it, vec3 jt, vec3 kt) {
rows[0] = it; rows[1] = jt; rows[2] = kt;
}
__device__ vec3& operator[](int i) { return rows[i]; }
__device__ vec3 operator[](int i) const { return rows[i]; }
__device__ operator double*() const { return (double*)this; }
};
__device__ inline vec3 operator*(const vec3& v, const mat3& mat) {
return v.x * mat[0] + v.y * mat[1] + v.z * mat[2];
}
__device__ inline mat3 operator*(const mat3& left, const mat3& right) {
mat3 result;
for (int i = 0; i < 4; i++) result.rows[i] = left.rows[i] * right;
return result;
}
__device__ inline double signeddistance(const vec3& planeNN, const vec3& planeP, const vec3& Q) {
vec3 PQ = Q - planeP;
...
...
tetrarun.py
View file @
a3790eec
import
sys
,
getopt
import
numpy
as
np
import
cupy
as
cp
import
os
from
genax
import
gen_angels_to_pick
,
angles_alap
,
angles_ratet
from
gpu
import
start_kernel
from
utils
import
convert
,
printresults
,
search
,
exact_one
,
exact_one_gpu
,
filter_gpu
,
writetofile
,
writetofile2
...
...
@@ -11,9 +13,10 @@ def main(argv):
w
=
3
PLOT
=
False
mpi
=
False
binary
=
False
try
:
opts
,
args
=
getopt
.
getopt
(
argv
,
"hpn:v:w:d:o:m
:
"
)
opts
,
args
=
getopt
.
getopt
(
argv
,
"hpn:v:w:d:o:m
b
"
)
except
getopt
.
GetoptError
as
err
:
print
(
err
)
print
(
'tetrarun.py -n <range division:int> -v <> -w <> -o <outputfile>'
)
...
...
@@ -36,6 +39,8 @@ def main(argv):
PLOT
=
True
elif
opt
in
(
"-m"
,
"--mpi"
):
mpi
=
True
elif
opt
in
(
"-b"
,
"--bin"
):
binary
=
True
space
=
gen_angels_to_pick
(
n
)
...
...
@@ -43,9 +48,7 @@ def main(argv):
Dx
,
Dy
,
Dz
=
angles_ratet
(
space
,
mpi
)
del
space
res
=
start_kernel
(
Cx
,
Cy
,
Dx
,
Dy
,
Dz
,
v
,
w
)
if
outputfile
and
not
binary
:
Cx_cpu
=
np
.
zeros
(
Cx
.
size
,
dtype
=
np
.
float64
)
Cx
.
get
(
out
=
Cx_cpu
)
...
...
@@ -57,13 +60,27 @@ def main(argv):
Dy
.
get
(
out
=
Dy_cpu
)
Dz_cpu
=
np
.
zeros
(
Dz
.
size
,
dtype
=
np
.
float64
)
Dz
.
get
(
out
=
Dz_cpu
)
del
space
res
=
start_kernel
(
Cx
,
Cy
,
Dx
,
Dy
,
Dz
,
v
,
w
)
mtx_cpu
=
np
.
zeros
(
res
.
size
,
dtype
=
np
.
int8
)
.
reshape
(
res
.
shape
)
res
.
get
(
out
=
mtx_cpu
)
if
outputfile
:
writetofile
(
outputfile
+
'.full'
,
Cx_cpu
,
Cy_cpu
,
Dx_cpu
,
Dy_cpu
,
Dz_cpu
,
mtx_cpu
,
mpi
)
writetofile2
(
outputfile
,
Cx_cpu
,
Cy_cpu
,
Dx_cpu
,
Dy_cpu
,
Dz_cpu
,
mtx_cpu
,
mpi
)
if
outputfile
and
binary
:
res
=
start_kernel
(
Cx
,
Cy
,
Dx
,
Dy
,
Dz
,
v
,
w
)
os
.
mkdir
(
outputfile
)
cp
.
save
(
outputfile
+
'/Cx.npy'
,
Cx
)
cp
.
save
(
outputfile
+
'/Cy.npy'
,
Cy
)
cp
.
save
(
outputfile
+
'/Dx.npy'
,
Dx
)
cp
.
save
(
outputfile
+
'/Dy.npy'
,
Dy
)
cp
.
save
(
outputfile
+
'/Dz.npy'
,
Dz
)
cp
.
save
(
outputfile
+
'/mtx.npy'
,
res
)
#printresults(res)
#print("Exact one 3-3")
#exact_one_gpu(res, 3-1, 3-1)
...
...
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