summaryrefslogtreecommitdiffstats
path: root/cuda
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2019-08-14 11:45:34 +0200
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2019-08-14 11:45:34 +0200
commitd9261bdb05cd0863a2c3747c812871dbb851646e (patch)
treed1a81110e3fe213747a58f236e021a085417f663 /cuda
parent9a58b7451179ed512f975bc4c90fb71f172250b9 (diff)
downloadastra-d9261bdb05cd0863a2c3747c812871dbb851646e.tar.gz
astra-d9261bdb05cd0863a2c3747c812871dbb851646e.tar.bz2
astra-d9261bdb05cd0863a2c3747c812871dbb851646e.tar.xz
astra-d9261bdb05cd0863a2c3747c812871dbb851646e.zip
Replace signal-based abort handling by query-based handling
The abort handling is currently only used to process Ctrl-C from Matlab. Since Matlab R2019a, it appears that calling utIsInterruptPending() from a thread other than the main thread will crash. The previous approach of checking utIsInterruptPending() in a thread, and then signalling the running algorithm was therefore broken.
Diffstat (limited to 'cuda')
-rw-r--r--cuda/2d/algo.cu2
-rw-r--r--cuda/2d/cgls.cu4
-rw-r--r--cuda/2d/em.cu4
-rw-r--r--cuda/2d/sart.cu4
-rw-r--r--cuda/2d/sirt.cu4
-rw-r--r--cuda/3d/algo3d.cu2
-rw-r--r--cuda/3d/astra3d.cu16
-rw-r--r--cuda/3d/cgls3d.cu4
-rw-r--r--cuda/3d/sirt3d.cu4
9 files changed, 6 insertions, 38 deletions
diff --git a/cuda/2d/algo.cu b/cuda/2d/algo.cu
index f809c23..b4c2864 100644
--- a/cuda/2d/algo.cu
+++ b/cuda/2d/algo.cu
@@ -42,7 +42,6 @@ ReconAlgo::ReconAlgo()
{
parProjs = 0;
fanProjs = 0;
- shouldAbort = false;
useVolumeMask = false;
useSinogramMask = false;
@@ -77,7 +76,6 @@ void ReconAlgo::reset()
parProjs = 0;
fanProjs = 0;
- shouldAbort = false;
useVolumeMask = false;
useSinogramMask = false;
diff --git a/cuda/2d/cgls.cu b/cuda/2d/cgls.cu
index 696a0c1..b6a9fae 100644
--- a/cuda/2d/cgls.cu
+++ b/cuda/2d/cgls.cu
@@ -114,8 +114,6 @@ bool CGLS::copyDataToGPU(const float* pfSinogram, unsigned int iSinogramPitch, f
bool CGLS::iterate(unsigned int iterations)
{
- shouldAbort = false;
-
if (!sliceInitialized) {
// copy sinogram
@@ -146,7 +144,7 @@ bool CGLS::iterate(unsigned int iterations)
// iteration
- for (unsigned int iter = 0; iter < iterations && !shouldAbort; ++iter) {
+ for (unsigned int iter = 0; iter < iterations && !astra::shouldAbort(); ++iter) {
// w = A*p
zeroProjectionData(D_w, wPitch, dims);
diff --git a/cuda/2d/em.cu b/cuda/2d/em.cu
index ca09d31..aa272d8 100644
--- a/cuda/2d/em.cu
+++ b/cuda/2d/em.cu
@@ -117,15 +117,13 @@ bool EM::precomputeWeights()
bool EM::iterate(unsigned int iterations)
{
- shouldAbort = false;
-
#if 0
if (useVolumeMask)
precomputeWeights();
#endif
// iteration
- for (unsigned int iter = 0; iter < iterations && !shouldAbort; ++iter) {
+ for (unsigned int iter = 0; iter < iterations && !astra::shouldAbort(); ++iter) {
// Do FP of volumeData
zeroProjectionData(D_projData, projPitch, dims);
diff --git a/cuda/2d/sart.cu b/cuda/2d/sart.cu
index cf9babc..64973ba 100644
--- a/cuda/2d/sart.cu
+++ b/cuda/2d/sart.cu
@@ -166,13 +166,11 @@ bool SART::precomputeWeights()
bool SART::iterate(unsigned int iterations)
{
- shouldAbort = false;
-
if (useVolumeMask)
precomputeWeights();
// iteration
- for (unsigned int iter = 0; iter < iterations && !shouldAbort; ++iter) {
+ for (unsigned int iter = 0; iter < iterations && !astra::shouldAbort(); ++iter) {
int angle;
if (customOrder) {
diff --git a/cuda/2d/sirt.cu b/cuda/2d/sirt.cu
index 7ec377c..2621490 100644
--- a/cuda/2d/sirt.cu
+++ b/cuda/2d/sirt.cu
@@ -238,13 +238,11 @@ bool SIRT::uploadMinMaxMasks(const float* pfMinMaskData, const float* pfMaxMaskD
bool SIRT::iterate(unsigned int iterations)
{
- shouldAbort = false;
-
if (useVolumeMask || useSinogramMask)
precomputeWeights();
// iteration
- for (unsigned int iter = 0; iter < iterations && !shouldAbort; ++iter) {
+ for (unsigned int iter = 0; iter < iterations && !astra::shouldAbort(); ++iter) {
// copy sinogram to projection data
duplicateProjectionData(D_projData, D_sinoData, projPitch, dims);
diff --git a/cuda/3d/algo3d.cu b/cuda/3d/algo3d.cu
index b4a435b..3a83194 100644
--- a/cuda/3d/algo3d.cu
+++ b/cuda/3d/algo3d.cu
@@ -39,7 +39,6 @@ ReconAlgo3D::ReconAlgo3D()
{
coneProjs = 0;
par3DProjs = 0;
- shouldAbort = false;
}
ReconAlgo3D::~ReconAlgo3D()
@@ -53,7 +52,6 @@ void ReconAlgo3D::reset()
coneProjs = 0;
delete[] par3DProjs;
par3DProjs = 0;
- shouldAbort = false;
}
bool ReconAlgo3D::setConeGeometry(const SDimensions3D& _dims, const SConeProjection* _angles, const SProjectorParams3D& _params)
diff --git a/cuda/3d/astra3d.cu b/cuda/3d/astra3d.cu
index be258be..51e76cd 100644
--- a/cuda/3d/astra3d.cu
+++ b/cuda/3d/astra3d.cu
@@ -625,14 +625,6 @@ bool AstraSIRT3d::getReconstruction(float* pfReconstruction,
return true;
}
-void AstraSIRT3d::signalAbort()
-{
- if (!pData->initialized)
- return;
-
- pData->sirt.signalAbort();
-}
-
float AstraSIRT3d::computeDiffNorm()
{
if (!pData->initialized)
@@ -1006,14 +998,6 @@ bool AstraCGLS3d::getReconstruction(float* pfReconstruction,
return true;
}
-void AstraCGLS3d::signalAbort()
-{
- if (!pData->initialized)
- return;
-
- pData->cgls.signalAbort();
-}
-
float AstraCGLS3d::computeDiffNorm()
{
if (!pData->initialized)
diff --git a/cuda/3d/cgls3d.cu b/cuda/3d/cgls3d.cu
index 0df10f0..10c5f1e 100644
--- a/cuda/3d/cgls3d.cu
+++ b/cuda/3d/cgls3d.cu
@@ -146,8 +146,6 @@ bool CGLS::setBuffers(cudaPitchedPtr& _D_volumeData,
bool CGLS::iterate(unsigned int iterations)
{
- shouldAbort = false;
-
if (!sliceInitialized) {
// copy sinogram
@@ -176,7 +174,7 @@ bool CGLS::iterate(unsigned int iterations)
// iteration
- for (unsigned int iter = 0; iter < iterations && !shouldAbort; ++iter) {
+ for (unsigned int iter = 0; iter < iterations && !astra::shouldAbort(); ++iter) {
// w = A*p
zeroProjectionData(D_w, dims);
diff --git a/cuda/3d/sirt3d.cu b/cuda/3d/sirt3d.cu
index 332589e..869b2fd 100644
--- a/cuda/3d/sirt3d.cu
+++ b/cuda/3d/sirt3d.cu
@@ -235,8 +235,6 @@ bool SIRT::setBuffers(cudaPitchedPtr& _D_volumeData,
bool SIRT::iterate(unsigned int iterations)
{
- shouldAbort = false;
-
if (useVolumeMask || useSinogramMask)
precomputeWeights();
@@ -267,7 +265,7 @@ bool SIRT::iterate(unsigned int iterations)
// iteration
- for (unsigned int iter = 0; iter < iterations && !shouldAbort; ++iter) {
+ for (unsigned int iter = 0; iter < iterations && !astra::shouldAbort(); ++iter) {
// copy sinogram to projection data
duplicateProjectionData(D_projData, D_sinoData, dims);