Skip to content

Commit

Permalink
Improved existing 16->32 fallback. Added performance-based fallback.
Browse files Browse the repository at this point in the history
  • Loading branch information
borisfom committed Nov 10, 2016
1 parent d6e0ce5 commit f746b79
Show file tree
Hide file tree
Showing 10 changed files with 174 additions and 145 deletions.
7 changes: 4 additions & 3 deletions SpatialConvolution.lua
Expand Up @@ -127,12 +127,13 @@ function SpatialConvolution:createIODescriptors(input)
self.pad = {self.padH, self.padW}
self.stride = {self.dH, self.dW}

self.convDesc = cudnn.setConvolutionDescriptor(
{ padA = self.pad,
self.convDescData = { padA = self.pad,
filterStrideA = self.stride,
upscaleA = {1,1},
dataType = cudnn.configmap(torch.type(self.weight))
})
}

self.convDesc = cudnn.setConvolutionDescriptor(self.convDescData)

-- get output shape, resize output
local oSize = torch.IntTensor(4)
Expand Down
10 changes: 5 additions & 5 deletions SpatialFullConvolution.lua
Expand Up @@ -47,11 +47,11 @@ function SpatialFullConvolution:createIODescriptors(input)
self.pad = {self.padH, self.padW}
self.stride = {self.dH, self.dW}

self.convDesc = cudnn.setConvolutionDescriptor(
{ padA = self.pad,
filterStrideA = self.stride,
dataType = cudnn.configmap(torch.type(self.weight))
})
self.convDescData = { padA = self.pad,
filterStrideA = self.stride,
dataType = cudnn.configmap(torch.type(self.weight))
}
self.convDesc = cudnn.setConvolutionDescriptor(self.convDescData)

-- get output shape, resize output
local iwidth = input:size(4)
Expand Down
2 changes: 1 addition & 1 deletion TemporalConvolution.lua
Expand Up @@ -37,7 +37,7 @@ function TemporalConvolution:createIODescriptors(input)
end

function TemporalConvolution:fastest(mode)
self = cudnn.SpatialConvolution.fastest(self,mode)
cudnn.SpatialConvolution.fastest(self,mode)
return self
end

Expand Down
7 changes: 3 additions & 4 deletions VolumetricConvolution.lua
Expand Up @@ -43,10 +43,9 @@ function VolumetricConvolution:createIODescriptors(input)
if mathtype == 'CUDNN_DATA_HALF' then
mathtype = 'CUDNN_DATA_FLOAT'
end
self.convDesc = cudnn.setConvolutionDescriptor(
{ padA = self.pad, filterStrideA = self.stride,
dataType = mathtype
})
self.convDescData = { padA = self.pad, filterStrideA = self.stride,
dataType = mathtype }
self.convDesc = cudnn.setConvolutionDescriptor(self.convDescData)

local oSize = torch.IntTensor(5)
errcheck('cudnnGetConvolutionNdForwardOutputDim',
Expand Down
7 changes: 3 additions & 4 deletions VolumetricFullConvolution.lua
Expand Up @@ -45,10 +45,9 @@ function VolumetricFullConvolution:createIODescriptors(input)
-- create conv descriptor
self.pad = {self.padT, self.padH, self.padW}
self.stride = {self.dT, self.dH, self.dW}
self.convDesc = cudnn.setConvolutionDescriptor(
{ padA = self.pad, filterStrideA = self.stride,
dataType = cudnn.configmap(torch.type(self.weight))
})
self.convDescData = { padA = self.pad, filterStrideA = self.stride,
dataType = cudnn.configmap(torch.type(self.weight))}
self.convDesc = cudnn.setConvolutionDescriptor(self.convDescData)

-- get output shape, resize output
local iwidth = input:size(5)
Expand Down
6 changes: 3 additions & 3 deletions ffi.lua
Expand Up @@ -1614,10 +1614,10 @@ end
-- check cuDNN version
cudnn.version = tonumber(cudnn.C.cudnnGetVersion())
if cudnn.version < 5005 then
error('These bindings are for version 5005 or above, '
if cudnn.version < 5005 or cudnn.version >= 6000 then
error('These bindings are for CUDNN 5.x (5005 <= cudnn.version > 6000) , '
.. 'while the loaded CuDNN is version: ' .. cudnn.version
.. ' \nAre you using an older version of CuDNN?')
.. ' \nAre you using an older or newer version of CuDNN?')
end
-- check GPU driver version
Expand Down

0 comments on commit f746b79

Please sign in to comment.