summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2017-10-17 22:29:52 +0200
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2017-11-01 15:53:26 +0100
commit84e163009c10f6ac5631cf5f29a4923852542eaf (patch)
tree0264de6639f179cad045d30079a023711dc8d2eb
parent3eaebe8827db8ddf029fdb94ccda2b0af1385bec (diff)
downloadastra-84e163009c10f6ac5631cf5f29a4923852542eaf.tar.gz
astra-84e163009c10f6ac5631cf5f29a4923852542eaf.tar.bz2
astra-84e163009c10f6ac5631cf5f29a4923852542eaf.tar.xz
astra-84e163009c10f6ac5631cf5f29a4923852542eaf.zip
Add basic post-install matlab tests
-rw-r--r--README.md10
-rw-r--r--README.txt8
-rw-r--r--matlab/tools/astra_test_CUDA.m59
-rw-r--r--matlab/tools/astra_test_noCUDA.m32
4 files changed, 104 insertions, 5 deletions
diff --git a/README.md b/README.md
index ddc881c..f36bdea 100644
--- a/README.md
+++ b/README.md
@@ -126,8 +126,8 @@ For python 2.7/3.5: Run build_python27.bat or build_python35.bat. Astra will be
## Testing your installation
To perform a (very) basic test of your ASTRA installation in Python, you can
-run the following Python commands. You can choose if you want to skip the test
-of the GPU functionality for systems without a NVIDIA GPU.
+run the following Python commands. You can choose to skip the test of the GPU
+functionality for systems without a NVIDIA GPU.
```
import astra
@@ -135,6 +135,12 @@ astra.test_noCUDA() # To skip GPU tests
astra.test_CUDA() # To also perform GPU tests
```
+To test your ASTRA installation in Matlab, the equivalent commands are:
+
+```
+astra_test_noCUDA % To skip GPU tests
+astra_test_CUDA % To also perform GPU tests
+```
## References
diff --git a/README.txt b/README.txt
index 63c9cf5..69b3b3b 100644
--- a/README.txt
+++ b/README.txt
@@ -155,16 +155,18 @@ Testing your installation:
---------------------------
To perform a (very) basic test of your ASTRA installation in Python, you can
-run the following Python commands. You can choose if you want to skip the test
-of the GPU functionality for systems without a NVIDIA GPU.
+run the following Python commands. You can choose to skip the test of the GPU
+functionality for systems without a NVIDIA GPU.
import astra
astra.test_noCUDA() # To skip GPU tests
astra.test_CUDA() # To also perform GPU tests
+To test your ASTRA installation in Matlab, the equivalent commands are:
-
+astra_test_noCUDA % To skip GPU tests
+astra_test_CUDA % To also perform GPU tests
References:
diff --git a/matlab/tools/astra_test_CUDA.m b/matlab/tools/astra_test_CUDA.m
new file mode 100644
index 0000000..4171f20
--- /dev/null
+++ b/matlab/tools/astra_test_CUDA.m
@@ -0,0 +1,59 @@
+%--------------------------------------------------------------------------
+% Clears and frees memory of all objects (data, projectors, algorithms)
+% currently in the astra-library.
+%--------------------------------------------------------------------------
+%--------------------------------------------------------------------------
+% This file is part of the ASTRA Toolbox
+%
+% Copyright: 2010-2017, iMinds-Vision Lab, University of Antwerp
+% 2014-2017, CWI, Amsterdam
+% License: Open Source under GPLv3
+% Contact: astra@uantwerpen.be
+% Website: http://www.astra-toolbox.com/
+%--------------------------------------------------------------------------
+
+%%
+fprintf('Getting GPU info...')
+astra_get_gpu_info()
+
+%%
+astra_test_noCUDA()
+
+%%
+fprintf('Testing basic CUDA 2D functionality...')
+
+vg = astra_create_vol_geom(2, 32);
+pg = astra_create_proj_geom('parallel', 1, 32, [0]);
+proj_id = astra_create_projector('cuda', pg, vg);
+
+vol = rand(2, 32);
+[sino_id, sino] = astra_create_sino(vol, proj_id);
+astra_mex_data2d('delete', sino_id);
+astra_mex_projector('delete', proj_id);
+
+err = max(abs(sino - sum(vol)));
+
+if err < 1e-6
+ disp('Ok')
+else
+ disp('Error')
+end
+
+%%
+fprintf('Testing basic CUDA 3D functionality...')
+
+vg = astra_create_vol_geom(2, 32, 32);
+pg = astra_create_proj_geom('parallel3d', 1, 1, 32, 32, [0]);
+
+vol = rand(32, 2, 32);
+[sino_id, sino] = astra_create_sino3d_cuda(vol, pg, vg);
+astra_mex_data3d('delete', sino_id);
+
+err = max(max(abs(sino - sum(vol,2))));
+
+if err < 1e-6
+ disp('Ok')
+else
+ disp('Error')
+end
+
diff --git a/matlab/tools/astra_test_noCUDA.m b/matlab/tools/astra_test_noCUDA.m
new file mode 100644
index 0000000..6437661
--- /dev/null
+++ b/matlab/tools/astra_test_noCUDA.m
@@ -0,0 +1,32 @@
+%--------------------------------------------------------------------------
+% Clears and frees memory of all objects (data, projectors, algorithms)
+% currently in the astra-library.
+%--------------------------------------------------------------------------
+%--------------------------------------------------------------------------
+% This file is part of the ASTRA Toolbox
+%
+% Copyright: 2010-2017, iMinds-Vision Lab, University of Antwerp
+% 2014-2017, CWI, Amsterdam
+% License: Open Source under GPLv3
+% Contact: astra@uantwerpen.be
+% Website: http://www.astra-toolbox.com/
+%--------------------------------------------------------------------------
+
+fprintf('Testing basic CPU 2D functionality...')
+
+vg = astra_create_vol_geom(2, 32);
+pg = astra_create_proj_geom('parallel', 1, 32, [0]);
+proj_id = astra_create_projector('line', pg, vg);
+
+vol = rand(2, 32);
+[sino_id, sino] = astra_create_sino(vol, proj_id);
+astra_mex_data2d('delete', sino_id);
+astra_mex_projector('delete', proj_id);
+
+err = max(abs(sino - sum(vol)));
+
+if err < 1e-6
+ disp('Ok')
+else
+ disp('Error')
+end