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-cluster
Commits
eb413124
Commit
eb413124
authored
Apr 07, 2018
by
rusty1s
Browse files
fixed gpu tests
parent
c7f73ca2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
3 deletions
+4
-3
aten/THC/THCGrid.cu
aten/THC/THCGrid.cu
+1
-1
aten/THC/generic/THCGrid.cu
aten/THC/generic/THCGrid.cu
+2
-1
test/test_grid.py
test/test_grid.py
+1
-1
No files found.
aten/THC/THCGrid.cu
View file @
eb413124
...
@@ -9,7 +9,7 @@ __global__ void gridKernel(int64_t *self, TensorInfo<T> posInfo, T *size,
...
@@ -9,7 +9,7 @@ __global__ void gridKernel(int64_t *self, TensorInfo<T> posInfo, T *size,
KERNEL_LOOP
(
i
,
nNodes
)
{
KERNEL_LOOP
(
i
,
nNodes
)
{
T
*
pos
=
posInfo
.
data
+
i
*
posInfo
.
stride
[
0
];
T
*
pos
=
posInfo
.
data
+
i
*
posInfo
.
stride
[
0
];
int64_t
coef
=
1
,
value
=
0
;
int64_t
coef
=
1
,
value
=
0
;
for
(
ptrdiff_t
d
=
0
;
d
<
posInfo
.
dims
*
posInfo
.
strid
e
[
1
];
d
+=
posInfo
.
stride
[
1
])
{
for
(
ptrdiff_t
d
=
0
;
d
<
posInfo
.
siz
e
[
1
];
d
+=
posInfo
.
stride
[
1
])
{
value
+=
coef
*
THCNumerics
<
T
>::
floor
(
THCNumerics
<
T
>::
div
(
pos
[
d
],
size
[
d
]));
value
+=
coef
*
THCNumerics
<
T
>::
floor
(
THCNumerics
<
T
>::
div
(
pos
[
d
],
size
[
d
]));
coef
*=
count
[
d
];
coef
*=
count
[
d
];
}
}
...
...
aten/THC/generic/THCGrid.cu
View file @
eb413124
...
@@ -6,12 +6,13 @@ void THCTensor_(grid)(THCState *state, THCudaLongTensor *self, THCTensor *pos, T
...
@@ -6,12 +6,13 @@ void THCTensor_(grid)(THCState *state, THCudaLongTensor *self, THCTensor *pos, T
THCudaLongTensor
*
count
)
{
THCudaLongTensor
*
count
)
{
THCAssertSameGPU
(
THCTensor_
(
checkGPU
)(
state
,
4
,
self
,
pos
,
size
,
count
));
THCAssertSameGPU
(
THCTensor_
(
checkGPU
)(
state
,
4
,
self
,
pos
,
size
,
count
));
ptrdiff_t
nNodes
=
THCudaLongTensor_nElement
(
state
,
self
);
int64_t
*
selfData
=
THCudaLongTensor_data
(
state
,
self
);
int64_t
*
selfData
=
THCudaLongTensor_data
(
state
,
self
);
TensorInfo
<
real
>
posInfo
=
THCTensor_
(
getTensorInfo
)(
state
,
pos
);
TensorInfo
<
real
>
posInfo
=
THCTensor_
(
getTensorInfo
)(
state
,
pos
);
real
*
sizeData
=
THCTensor_
(
data
)(
state
,
size
);
real
*
sizeData
=
THCTensor_
(
data
)(
state
,
size
);
int64_t
*
countData
=
THCudaLongTensor_data
(
state
,
count
);
int64_t
*
countData
=
THCudaLongTensor_data
(
state
,
count
);
ptrdiff_t
nNodes
=
THCudaLongTensor_nElement
(
state
,
self
);
KERNEL_REAL_RUN
(
gridKernel
,
nNodes
,
selfData
,
posInfo
,
sizeData
,
countData
);
KERNEL_REAL_RUN
(
gridKernel
,
nNodes
,
selfData
,
posInfo
,
sizeData
,
countData
);
}
}
...
...
test/test_grid.py
View file @
eb413124
...
@@ -46,7 +46,7 @@ def test_grid_cluster_cpu(tensor, i):
...
@@ -46,7 +46,7 @@ def test_grid_cluster_cpu(tensor, i):
@
pytest
.
mark
.
skipif
(
not
torch
.
cuda
.
is_available
(),
reason
=
'no CUDA'
)
@
pytest
.
mark
.
skipif
(
not
torch
.
cuda
.
is_available
(),
reason
=
'no CUDA'
)
@
pytest
.
mark
.
parametrize
(
'tensor,i'
,
product
(
tensors
,
range
(
len
(
tests
))))
@
pytest
.
mark
.
parametrize
(
'tensor,i'
,
product
(
tensors
,
range
(
len
(
tests
))))
def
test_grid_cluster_gpu
(
tensor
,
i
):
def
test_grid_cluster_gpu
(
tensor
,
i
):
# pragma: no cover
data
=
tests
[
i
]
data
=
tests
[
i
]
pos
=
getattr
(
torch
.
cuda
,
tensor
)(
data
[
'pos'
])
pos
=
getattr
(
torch
.
cuda
,
tensor
)(
data
[
'pos'
])
...
...
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