diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2016-03-01 14:47:43 +0100 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2016-03-01 14:47:43 +0100 |
commit | 0db21a84dd3cb0f6a78bd462a4a60a4b4a3c6fae (patch) | |
tree | a833d4787504e8612282a82c60d3984be51bdffe /cuda | |
parent | da11f9e7c7559eb01cc422ac55c9f7a1cd4bb803 (diff) | |
parent | b74e64aef7845666d27cbf7e876a6a360eefed7f (diff) | |
download | astra-0db21a84dd3cb0f6a78bd462a4a60a4b4a3c6fae.tar.gz astra-0db21a84dd3cb0f6a78bd462a4a60a4b4a3c6fae.tar.bz2 astra-0db21a84dd3cb0f6a78bd462a4a60a4b4a3c6fae.tar.xz astra-0db21a84dd3cb0f6a78bd462a4a60a4b4a3c6fae.zip |
Merge branch 'master' into indexmanager
Diffstat (limited to 'cuda')
-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); |