Open
Description
The below test code for image resize results in an error:
Specs:
Ubuntu 14.04
CUDA-8
OpenCV 3.2 / OpenCV 3.1 / OpenCV 3.1 (with CUDA 8 support)
Latest Torch-7and related packages
GPU: Titan X Pascal
Code:
require 'cutorch'
local cv = require 'cv'
require 'cv.cudawarping'
require 'cv.highgui'
require 'cv.imgcodecs'
require 'image'
cutorch.setDevice(3)
local img = cv.imread {arg[1] or 'lena.jpg', cv.IMREAD_COLOR}
print("Read image - done")
local imgCUDA = img:float():cuda() / 255
print("Cuda conversion - done")
for i=0,100,1
do
print(i)
local resized = cv.cuda.resize{imgCUDA, {1024, 768}}
print("Resize - done")
print(resized:size())
print(resized:type())
image.save('lenaresized.png',resized:transpose(1,3):transpose(2,3))
end
The output of the above test code is below:
Read image - done
Cuda conversion - done
0
Resize - done
768
1024
3
[torch.LongStorage of size 3]
torch.CudaTensor
.
.
.
15
Resize - done
768
1024
3
[torch.LongStorage of size 3]
torch.CudaTensor
THCudaCheck FAIL file=/tmp/luarocks_cutorch-scm-1-1283/cutorch/lib/THC/generic/THCStorage.c line=182 error=17 : invalid device pointer
/home/user/torch/install/bin/luajit: cuda runtime error (17) : invalid device pointer at /tmp/luarocks_cutorch-scm-1-1283/cutorch/lib/THC/generic/THCStorage.c:182
There is some memory conversion(?) issue after 15 times of looping. The corresponding line in THCStorage.c is
THCudaCheck(
(*self->allocator->free)(self->allocatorContext, self->data));
This code runs in CUDA 6.5/OpenCV 3.1/ Torch 7. Does torch-opencv support CUDA-8?
Could someone look into this issue?