diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2017-11-09 20:57:31 +0100 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2018-01-09 14:23:54 +0100 |
commit | 0ad6cb01b9176e99c3e4bb5643ac6a5dd477aad6 (patch) | |
tree | 69b27fa6406cf318d785c827e1fd05b786da2876 /cuda/2d | |
parent | de27e439a0c59fade175fba4e0b4a1e0c84b933d (diff) | |
download | astra-0ad6cb01b9176e99c3e4bb5643ac6a5dd477aad6.tar.gz astra-0ad6cb01b9176e99c3e4bb5643ac6a5dd477aad6.tar.bz2 astra-0ad6cb01b9176e99c3e4bb5643ac6a5dd477aad6.tar.xz astra-0ad6cb01b9176e99c3e4bb5643ac6a5dd477aad6.zip |
Check for CUDA support at run-time in use_cuda()
Diffstat (limited to 'cuda/2d')
-rw-r--r-- | cuda/2d/astra.cu | 11 | ||||
-rw-r--r-- | cuda/2d/astra.h | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/cuda/2d/astra.cu b/cuda/2d/astra.cu index 81459de..69a4e86 100644 --- a/cuda/2d/astra.cu +++ b/cuda/2d/astra.cu @@ -529,5 +529,16 @@ _AstraExport bool setGPUIndex(int iGPUIndex) return true; } +_AstraExport size_t availableGPUMemory() +{ + size_t free, total; + cudaError_t err = cudaMemGetInfo(&free, &total); + if (err != cudaSuccess) + return 0; + return free; +} + + + } diff --git a/cuda/2d/astra.h b/cuda/2d/astra.h index 9355cb4..119d172 100644 --- a/cuda/2d/astra.h +++ b/cuda/2d/astra.h @@ -121,5 +121,7 @@ _AstraExport std::string getCudaDeviceString(int device); _AstraExport bool setGPUIndex(int index); +_AstraExport size_t availableGPUMemory(); + } #endif |