diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2016-02-16 17:53:24 +0100 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2016-02-16 17:53:24 +0100 |
commit | 3743fdc534b39958c105f4124ad1130d3e8b042a (patch) | |
tree | 1385761a94fe1abb34291bf5052a3abfe45b5a6a /cuda/3d | |
parent | c041ce4fabcafe263bb93ca481040ed32ed5c5f2 (diff) | |
download | astra-3743fdc534b39958c105f4124ad1130d3e8b042a.tar.gz astra-3743fdc534b39958c105f4124ad1130d3e8b042a.tar.bz2 astra-3743fdc534b39958c105f4124ad1130d3e8b042a.tar.xz astra-3743fdc534b39958c105f4124ad1130d3e8b042a.zip |
Query max texture size instead of hardcoding it
Diffstat (limited to 'cuda/3d')
-rw-r--r-- | cuda/3d/mem3d.cu | 19 | ||||
-rw-r--r-- | cuda/3d/mem3d.h | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/cuda/3d/mem3d.cu b/cuda/3d/mem3d.cu index 6d81dc0..0320117 100644 --- a/cuda/3d/mem3d.cu +++ b/cuda/3d/mem3d.cu @@ -62,6 +62,25 @@ size_t availableGPUMemory() return free; } +int maxBlockDimension() +{ + int dev; + cudaError_t err = cudaGetDevice(&dev); + if (err != cudaSuccess) { + ASTRA_WARN("Error querying device"); + return 0; + } + + cudaDeviceProp props; + err = cudaGetDeviceProperties(&props, dev); + if (err != cudaSuccess) { + ASTRA_WARN("Error querying device %d properties", dev); + return 0; + } + + return std::min(props.maxTexture3D[0], std::min(props.maxTexture3D[1], props.maxTexture3D[2])); +} + MemHandle3D allocateGPUMemory(unsigned int x, unsigned int y, unsigned int z, Mem3DZeroMode zero) { SMemHandle3D_internal hnd; diff --git a/cuda/3d/mem3d.h b/cuda/3d/mem3d.h index acb72cb..6fff80b 100644 --- a/cuda/3d/mem3d.h +++ b/cuda/3d/mem3d.h @@ -78,6 +78,7 @@ enum Mem3DZeroMode { }; size_t availableGPUMemory(); +int maxBlockDimension(); MemHandle3D allocateGPUMemory(unsigned int x, unsigned int y, unsigned int z, Mem3DZeroMode zero); |