torch/cunn

nn.SpatialSoftMax breaking

shubhamjain0594 opened this issue · 9 comments

require 'nn'
require 'cunn'

softOutCalc = nn.Sequential():add(nn.SpatialSoftMax())
softOutCalc = softOutCalc:cuda()
ips = torch.rand(8,2,80,80)
ips = ips:cuda()
softOutCalc:forward(ips)

This code gives the error

THCudaCheck FAIL file=/tmp/user/1012/luarocks_cutorch-scm-1-199/cutorch/lib/THC/generic/THCTensorCopy.c line=81 error=77 : an illegal memory access was encountered
/home/users/shubhamj/torch/install/bin/luajit: cuda runtime error (77) : an illegal memory access was encountered at /tmp/user/1012/luarocks_cutorch-scm-1-199/cutorch/lib/THC/generic/THCStorage.c:158

It used to work fine on earlier installations.

I just tried the snippet using most recent installations of cutorch and cunn and it works fine for me.

I have updated to the latest version. Still getting same errors. Any help is appreciated.
I am working with cuda7.5 and latest released installs of torch, cutorch, nn, cunn and cudnn.

Meanwhile I also found that it works if I use

ips = torch.rand(1,2,80,80)

Shubham, is this still a blocker? if so i can have a look.

Give me info on your GPU model (of all GPUs on system) and NVIDIA driver.

Its working fine. Thanks

I have the exact same issue.

System config:
Updated torch using '$ ./update.sh' and '$ ./install.sh'
Titan X, Ubuntu 14.04, cuda7.5, cudnnv5

@shubhamjain0594 : can you reopen the issue

Let me give more cases with cudnn:

require 'nn'
require 'cunn'
require 'cudnn'

softOutCalc = nn.Sequential():add(nn.SpatialSoftMax())
softOutCalc = softOutCalc:cuda()
softOutCalc = cudnn.convert(softOutCalc, cudnn)  
ips = torch.rand(8,2,80,80)
ips = ips:cuda()
softOutCalc:forward(ips)

Gives

THCudaCheck FAIL file=/home/users/sasank/torch/extra/cutorch/lib/THC/generic/THCStorage.c line=147 error=77 : an illegal memory access was encountered

While,

require 'nn'
require 'cunn'
require 'cudnn'

softOutCalc = nn.Sequential():add(cudnn.SpatialSoftMax())
softOutCalc = softOutCalc:cuda()
ips = torch.rand(8,2,80,80)
ips = ips:cuda()
softOutCalc:forward(ips)

Works

oh cool. so cudnn.convert is screwing something up. that's very helpful to figure out a fix. thanks.

ok nevermind, it's not even cudnn.convert. the code has a bug.

pushed a fix. reinstalling cunn fixes it.