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
torch-sparse
Commits
e661481d
Commit
e661481d
authored
Jan 13, 2020
by
rusty1s
Browse files
gpu implementation rowptr
parent
e5e3985d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
cuda/rowptr_kernel.cu
cuda/rowptr_kernel.cu
+7
-7
No files found.
cuda/rowptr_kernel.cu
View file @
e661481d
...
@@ -11,18 +11,18 @@ __global__ void rowptr_kernel(const int64_t *row_data, int64_t *out_data,
...
@@ -11,18 +11,18 @@ __global__ void rowptr_kernel(const int64_t *row_data, int64_t *out_data,
int64_t
thread_idx
=
blockDim
.
x
*
blockIdx
.
x
+
threadIdx
.
x
;
int64_t
thread_idx
=
blockDim
.
x
*
blockIdx
.
x
+
threadIdx
.
x
;
if
(
thread_idx
==
0
)
{
if
(
thread_idx
==
0
)
{
for
(
int64_t
i
=
0
;
i
<
row_data
[
0
];
i
++
)
for
(
int64_t
i
=
0
;
i
<
=
row_data
[
0
];
i
++
)
out_data
[
i
]
=
0
;
out_data
[
i
]
=
0
;
}
else
if
(
thread_idx
==
numel
)
{
}
else
if
(
thread_idx
<
numel
)
{
for
(
int64_t
i
=
row_data
[
numel
-
1
];
i
<
size
+
1
;
i
++
)
out_data
[
i
]
=
size
;
}
else
{
for
(
int64_t
i
=
row_data
[
thread_idx
-
1
];
i
<
row_data
[
thread_idx
];
i
++
)
for
(
int64_t
i
=
row_data
[
thread_idx
-
1
];
i
<
row_data
[
thread_idx
];
i
++
)
out_data
[
i
]
=
thread_idx
-
1
;
out_data
[
i
+
1
]
=
thread_idx
;
}
else
if
(
thread_idx
==
numel
)
{
for
(
int64_t
i
=
row_data
[
numel
-
1
]
+
1
;
i
<
size
+
1
;
i
++
)
out_data
[
i
]
=
numel
;
}
}
}
}
at
::
Tensor
rowptr_cuda
(
at
::
Tensor
row
,
size
_t
size
)
{
at
::
Tensor
rowptr_cuda
(
at
::
Tensor
row
,
int64
_t
size
)
{
AT_ASSERTM
(
row
.
dim
()
==
1
,
"Row needs to be one-dimensional"
);
AT_ASSERTM
(
row
.
dim
()
==
1
,
"Row needs to be one-dimensional"
);
auto
out
=
at
::
empty
(
size
+
1
,
row
.
options
());
auto
out
=
at
::
empty
(
size
+
1
,
row
.
options
());
...
...
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