summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2018-01-09 14:37:20 +0100
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2018-01-09 15:17:44 +0100
commitf757ae3a98b49b34bbf08ab53e5724d17000e7c9 (patch)
treebad6252ec1af8ab3c9df109c8accf0ec2afbe077
parent0ad6cb01b9176e99c3e4bb5643ac6a5dd477aad6 (diff)
downloadastra-f757ae3a98b49b34bbf08ab53e5724d17000e7c9.tar.gz
astra-f757ae3a98b49b34bbf08ab53e5724d17000e7c9.tar.bz2
astra-f757ae3a98b49b34bbf08ab53e5724d17000e7c9.tar.xz
astra-f757ae3a98b49b34bbf08ab53e5724d17000e7c9.zip
Add astra.test/astra_test function
-rw-r--r--README.md11
-rw-r--r--README.txt11
-rw-r--r--matlab/tools/astra_test.m19
-rw-r--r--matlab/tools/astra_test_CUDA.m3
-rw-r--r--matlab/tools/astra_test_noCUDA.m3
-rw-r--r--python/astra/__init__.py4
-rw-r--r--python/astra/tests.py10
7 files changed, 41 insertions, 20 deletions
diff --git a/README.md b/README.md
index f36bdea..c5c38b7 100644
--- a/README.md
+++ b/README.md
@@ -126,20 +126,17 @@ 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 to skip the test of the GPU
-functionality for systems without a NVIDIA GPU.
+run the following Python command.
```
import astra
-astra.test_noCUDA() # To skip GPU tests
-astra.test_CUDA() # To also perform GPU tests
+astra.test()
```
-To test your ASTRA installation in Matlab, the equivalent commands are:
+To test your ASTRA installation in Matlab, the equivalent command is:
```
-astra_test_noCUDA % To skip GPU tests
-astra_test_CUDA % To also perform GPU tests
+astra_test
```
## References
diff --git a/README.txt b/README.txt
index 69b3b3b..5ff8a56 100644
--- a/README.txt
+++ b/README.txt
@@ -155,18 +155,15 @@ 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 to skip the test of the GPU
-functionality for systems without a NVIDIA GPU.
+run the following Python command.
import astra
-astra.test_noCUDA() # To skip GPU tests
-astra.test_CUDA() # To also perform GPU tests
+astra.test()
-To test your ASTRA installation in Matlab, the equivalent commands are:
+To test your ASTRA installation in Matlab, the equivalent command is:
-astra_test_noCUDA % To skip GPU tests
-astra_test_CUDA % To also perform GPU tests
+astra_test
References:
diff --git a/matlab/tools/astra_test.m b/matlab/tools/astra_test.m
new file mode 100644
index 0000000..907443c
--- /dev/null
+++ b/matlab/tools/astra_test.m
@@ -0,0 +1,19 @@
+%--------------------------------------------------------------------------
+% Perform a basic test of ASTRA functionality.
+%--------------------------------------------------------------------------
+%--------------------------------------------------------------------------
+% This file is part of the ASTRA Toolbox
+%
+% Copyright: 2010-2018, iMinds-Vision Lab, University of Antwerp
+% 2014-2018, CWI, Amsterdam
+% License: Open Source under GPLv3
+% Contact: astra@uantwerpen.be
+% Website: http://www.astra-toolbox.com/
+%--------------------------------------------------------------------------
+
+if astra_mex('use_cuda')
+ astra_test_CUDA;
+else
+ fprintf('No GPU support available')
+ astra_test_noCUDA;
+end
diff --git a/matlab/tools/astra_test_CUDA.m b/matlab/tools/astra_test_CUDA.m
index 4171f20..28de3f1 100644
--- a/matlab/tools/astra_test_CUDA.m
+++ b/matlab/tools/astra_test_CUDA.m
@@ -1,6 +1,5 @@
%--------------------------------------------------------------------------
-% Clears and frees memory of all objects (data, projectors, algorithms)
-% currently in the astra-library.
+% Perform a basic test of ASTRA CUDA functionality.
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
% This file is part of the ASTRA Toolbox
diff --git a/matlab/tools/astra_test_noCUDA.m b/matlab/tools/astra_test_noCUDA.m
index 6437661..42a6931 100644
--- a/matlab/tools/astra_test_noCUDA.m
+++ b/matlab/tools/astra_test_noCUDA.m
@@ -1,6 +1,5 @@
%--------------------------------------------------------------------------
-% Clears and frees memory of all objects (data, projectors, algorithms)
-% currently in the astra-library.
+% Perform a basic test of ASTRA CPU functionality.
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
% This file is part of the ASTRA Toolbox
diff --git a/python/astra/__init__.py b/python/astra/__init__.py
index 4675229..e813194 100644
--- a/python/astra/__init__.py
+++ b/python/astra/__init__.py
@@ -27,7 +27,7 @@ from . import matlab as m
from .creators import astra_dict,create_vol_geom, create_proj_geom, create_backprojection, create_sino, create_reconstruction, create_projector,create_sino3d_gpu, create_backprojection3d_gpu
from .functions import data_op, add_noise_to_sino, clear, move_vol_geom
from .extrautils import clipCircle
-from .astra import set_gpu_index, get_gpu_info
+from .astra import set_gpu_index, get_gpu_info, use_cuda
from . import data2d
from . import astra
from . import data3d
@@ -39,7 +39,7 @@ from . import plugin
from . import plugins
from . import log
from .optomo import OpTomo
-from .tests import test_noCUDA, test_CUDA
+from .tests import test, test_noCUDA, test_CUDA
__version__ = '1.9.0dev'
diff --git a/python/astra/tests.py b/python/astra/tests.py
index 32afd36..f7c2c04 100644
--- a/python/astra/tests.py
+++ b/python/astra/tests.py
@@ -95,3 +95,13 @@ def test_CUDA():
ok3 = _basic_par3d_cuda()
if not (ok1 and ok2 and ok3):
raise RuntimeError("Test failed")
+
+def test():
+ """Perform a very basic functionality test"""
+
+ import astra
+ if astra.use_cuda():
+ test_CUDA()
+ else:
+ print("No GPU support available")
+ test_noCUDA()