Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Michiel Cottaar
gyral_structure
Commits
dffd0db9
Commit
dffd0db9
authored
May 04, 2020
by
Michiel Cottaar
Browse files
BUG: return different function if sparse multiplication is empty
parent
061c0d6e
Pipeline
#5303
failed with stage
in 7 minutes and 44 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
gyral_structure/cuda.py
View file @
dffd0db9
...
...
@@ -137,10 +137,15 @@ def sparse_mult_prepare(sparse):
"""Returns a function that does the GPU multiplication for the provided sparse matrix.
"""
gpu_sparse
=
_sparse_mult_to_gpu
(
sparse
)
output
=
gpuarray
.
zeros
((
M
,
),
dtype
=
'f4'
if
dtype
==
'float'
else
'f8'
)
if
len
(
gpu_sparse
[
-
1
])
==
0
:
def
empty_sparse_mult
(
vec_in
):
return
output
return
empty_sparse_mult
M
=
sparse
.
shape
[
0
]
gpu_func
=
cached_func
(
_sparse_mult_mod_vector
(
gpu_sparse
[
0
].
size
-
1
),
'sparse_matrix_mult'
)
input
=
gpuarray
.
zeros
((
sparse
.
shape
[
1
],
),
dtype
=
'f4'
if
dtype
==
'float'
else
'f8'
)
output
=
gpuarray
.
zeros
((
M
,
),
dtype
=
'f4'
if
dtype
==
'float'
else
'f8'
)
stream
=
drv
.
Stream
()
def
sparse_mult
(
vec_in
):
"""Does a sparse matrix multiplication.
...
...
Write
Preview
Supports
Markdown
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