Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
bitsandbytes
Commits
64bb1ae8
"git@developer.sourcefind.cn:OpenDAS/bitsandbytes.git" did not exist on "e4a9a94c75255af1f066f364a5641c5fe152065e"
Commit
64bb1ae8
authored
Mar 09, 2023
by
Phil Wang
Browse files
add a sign function, for lion
parent
8de29fc3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
csrc/kernels.cu
csrc/kernels.cu
+8
-0
No files found.
csrc/kernels.cu
View file @
64bb1ae8
...
@@ -217,6 +217,14 @@ __device__ __forceinline__ unsigned char quantize_quadrant(int QUADRANT, float *
...
@@ -217,6 +217,14 @@ __device__ __forceinline__ unsigned char quantize_quadrant(int QUADRANT, float *
}
}
}
}
// sign function for lion
// taken from https://stackoverflow.com/a/4609795, but not sure if there's a proper way to do this in CUDA
template
<
typename
T
>
__device__
int
sgn
(
T
val
)
{
return
(
T
(
0
)
<
val
)
-
(
val
<
T
(
0
));
}
__global__
void
kHistogramScatterAdd2D
(
float
*
histogram
,
int
*
index1
,
int
*
index2
,
float
*
src
,
const
int
maxidx1
,
const
int
n
)
__global__
void
kHistogramScatterAdd2D
(
float
*
histogram
,
int
*
index1
,
int
*
index2
,
float
*
src
,
const
int
maxidx1
,
const
int
n
)
{
{
const
int
tid
=
threadIdx
.
x
+
(
blockDim
.
x
*
blockIdx
.
x
);
const
int
tid
=
threadIdx
.
x
+
(
blockDim
.
x
*
blockIdx
.
x
);
...
...
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