From 2895e27613dab0815e9f0f2f0ed7853d31f856b4 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 2 Apr 2014 14:21:59 +0000 Subject: Add global astra_set_gpu_index function --- src/CudaBackProjectionAlgorithm3D.cpp | 4 ++-- src/CudaCglsAlgorithm3D.cpp | 4 ++-- src/CudaDartMaskAlgorithm.cpp | 2 +- src/CudaDartMaskAlgorithm3D.cpp | 2 +- src/CudaDartSmoothingAlgorithm.cpp | 2 +- src/CudaDartSmoothingAlgorithm3D.cpp | 2 +- src/CudaDataOperationAlgorithm.cpp | 2 +- src/CudaFDKAlgorithm3D.cpp | 4 ++-- src/CudaFilteredBackProjectionAlgorithm.cpp | 4 ++-- src/CudaForwardProjectionAlgorithm.cpp | 4 ++-- src/CudaForwardProjectionAlgorithm3D.cpp | 6 +++--- src/CudaReconstructionAlgorithm2D.cpp | 6 +++--- src/CudaRoiSelectAlgorithm.cpp | 2 +- src/CudaSirtAlgorithm3D.cpp | 4 ++-- 14 files changed, 24 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/CudaBackProjectionAlgorithm3D.cpp b/src/CudaBackProjectionAlgorithm3D.cpp index b60adf1..b096756 100644 --- a/src/CudaBackProjectionAlgorithm3D.cpp +++ b/src/CudaBackProjectionAlgorithm3D.cpp @@ -51,7 +51,7 @@ std::string CCudaBackProjectionAlgorithm3D::type = "BP3D_CUDA"; CCudaBackProjectionAlgorithm3D::CCudaBackProjectionAlgorithm3D() { m_bIsInitialized = false; - m_iGPUIndex = 0; + m_iGPUIndex = -1; m_iVoxelSuperSampling = 1; } @@ -101,7 +101,7 @@ bool CCudaBackProjectionAlgorithm3D::initialize(const Config& _cfg) return false; } - m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", 0); + m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", -1); CC.markOptionParsed("GPUindex"); m_iVoxelSuperSampling = (int)_cfg.self->getOptionNumerical("VoxelSuperSampling", 1); CC.markOptionParsed("VoxelSuperSampling"); diff --git a/src/CudaCglsAlgorithm3D.cpp b/src/CudaCglsAlgorithm3D.cpp index 07569a2..37d3592 100644 --- a/src/CudaCglsAlgorithm3D.cpp +++ b/src/CudaCglsAlgorithm3D.cpp @@ -51,7 +51,7 @@ CCudaCglsAlgorithm3D::CCudaCglsAlgorithm3D() { m_bIsInitialized = false; m_pCgls = 0; - m_iGPUIndex = 0; + m_iGPUIndex = -1; m_iVoxelSuperSampling = 1; m_iDetectorSuperSampling = 1; } @@ -106,7 +106,7 @@ bool CCudaCglsAlgorithm3D::initialize(const Config& _cfg) return false; } - m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", 0); + m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", -1); CC.markOptionParsed("GPUindex"); m_iDetectorSuperSampling = (int)_cfg.self->getOptionNumerical("DetectorSuperSampling", 1); CC.markOptionParsed("DetectorSuperSampling"); diff --git a/src/CudaDartMaskAlgorithm.cpp b/src/CudaDartMaskAlgorithm.cpp index 9c9b83f..911e448 100644 --- a/src/CudaDartMaskAlgorithm.cpp +++ b/src/CudaDartMaskAlgorithm.cpp @@ -81,7 +81,7 @@ bool CCudaDartMaskAlgorithm::initialize(const Config& _cfg) CC.markNodeParsed("MaskDataId"); // Option: GPU number - m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", 0); + m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", -1); m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUIndex", m_iGPUIndex); CC.markOptionParsed("GPUindex"); if (!_cfg.self->hasOption("GPUindex")) diff --git a/src/CudaDartMaskAlgorithm3D.cpp b/src/CudaDartMaskAlgorithm3D.cpp index 7965587..f5d5d82 100644 --- a/src/CudaDartMaskAlgorithm3D.cpp +++ b/src/CudaDartMaskAlgorithm3D.cpp @@ -81,7 +81,7 @@ bool CCudaDartMaskAlgorithm3D::initialize(const Config& _cfg) CC.markNodeParsed("MaskDataId"); // Option: GPU number - m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", 0); + m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", -1); m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUIndex", m_iGPUIndex); CC.markOptionParsed("GPUindex"); if (!_cfg.self->hasOption("GPUindex")) diff --git a/src/CudaDartSmoothingAlgorithm.cpp b/src/CudaDartSmoothingAlgorithm.cpp index 91cde6d..e77606b 100644 --- a/src/CudaDartSmoothingAlgorithm.cpp +++ b/src/CudaDartSmoothingAlgorithm.cpp @@ -81,7 +81,7 @@ bool CCudaDartSmoothingAlgorithm::initialize(const Config& _cfg) CC.markNodeParsed("OutDataId"); // Option: GPU number - m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", 0); + m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", -1); m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUIndex", m_iGPUIndex); CC.markOptionParsed("GPUindex"); if (!_cfg.self->hasOption("GPUindex")) diff --git a/src/CudaDartSmoothingAlgorithm3D.cpp b/src/CudaDartSmoothingAlgorithm3D.cpp index 50ef847..e44970f 100644 --- a/src/CudaDartSmoothingAlgorithm3D.cpp +++ b/src/CudaDartSmoothingAlgorithm3D.cpp @@ -81,7 +81,7 @@ bool CCudaDartSmoothingAlgorithm3D::initialize(const Config& _cfg) CC.markNodeParsed("OutDataId"); // Option: GPU number - m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", 0); + m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", -1); m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUIndex", m_iGPUIndex); CC.markOptionParsed("GPUindex"); if (!_cfg.self->hasOption("GPUindex")) diff --git a/src/CudaDataOperationAlgorithm.cpp b/src/CudaDataOperationAlgorithm.cpp index ed2ac94..f27cab8 100644 --- a/src/CudaDataOperationAlgorithm.cpp +++ b/src/CudaDataOperationAlgorithm.cpp @@ -94,7 +94,7 @@ bool CCudaDataOperationAlgorithm::initialize(const Config& _cfg) CC.markNodeParsed("Scalar"); // Option: GPU number - m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", 0); + m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", -1); m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUIndex", m_iGPUIndex); CC.markOptionParsed("GPUindex"); if (!_cfg.self->hasOption("GPUindex")) diff --git a/src/CudaFDKAlgorithm3D.cpp b/src/CudaFDKAlgorithm3D.cpp index 8f9e7b8..6b65641 100644 --- a/src/CudaFDKAlgorithm3D.cpp +++ b/src/CudaFDKAlgorithm3D.cpp @@ -48,7 +48,7 @@ std::string CCudaFDKAlgorithm3D::type = "FDK_CUDA"; CCudaFDKAlgorithm3D::CCudaFDKAlgorithm3D() { m_bIsInitialized = false; - m_iGPUIndex = 0; + m_iGPUIndex = -1; m_iVoxelSuperSampling = 1; } @@ -100,7 +100,7 @@ bool CCudaFDKAlgorithm3D::initialize(const Config& _cfg) return false; } - m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", 0); + m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", -1); CC.markOptionParsed("GPUindex"); m_iVoxelSuperSampling = (int)_cfg.self->getOptionNumerical("VoxelSuperSampling", 1); CC.markOptionParsed("VoxelSuperSampling"); diff --git a/src/CudaFilteredBackProjectionAlgorithm.cpp b/src/CudaFilteredBackProjectionAlgorithm.cpp index 75a1534..3656f3f 100644 --- a/src/CudaFilteredBackProjectionAlgorithm.cpp +++ b/src/CudaFilteredBackProjectionAlgorithm.cpp @@ -153,7 +153,7 @@ bool CCudaFilteredBackProjectionAlgorithm::initialize(const Config& _cfg) ASTRA_DELETE(node); // GPU number - m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", 0); + m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", -1); CC.markOptionParsed("GPUindex"); // Pixel supersampling factor @@ -286,7 +286,7 @@ bool CCudaFilteredBackProjectionAlgorithm::check() ASTRA_CONFIG_CHECK(m_pReconstruction->isInitialized(), "FBP_CUDA", "Reconstruction Data Object Not Initialized."); // check gpu index - ASTRA_CONFIG_CHECK(m_iGPUIndex >= 0, "FBP_CUDA", "GPUIndex must be a non-negative integer."); + ASTRA_CONFIG_CHECK(m_iGPUIndex >= -1, "FBP_CUDA", "GPUIndex must be a non-negative integer."); // check pixel supersampling ASTRA_CONFIG_CHECK(m_iPixelSuperSampling >= 0, "FBP_CUDA", "PixelSuperSampling must be a non-negative integer."); diff --git a/src/CudaForwardProjectionAlgorithm.cpp b/src/CudaForwardProjectionAlgorithm.cpp index 965c4af..bd9cffb 100644 --- a/src/CudaForwardProjectionAlgorithm.cpp +++ b/src/CudaForwardProjectionAlgorithm.cpp @@ -87,7 +87,7 @@ bool CCudaForwardProjectionAlgorithm::initialize(const Config& _cfg) CC.markNodeParsed("VolumeDataId"); // GPU number - m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", 0); + m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", -1); m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUIndex", m_iGPUIndex); CC.markOptionParsed("GPUindex"); if (!_cfg.self->hasOption("GPUindex")) @@ -153,7 +153,7 @@ bool CCudaForwardProjectionAlgorithm::check() //ASTRA_CONFIG_CHECK((iImageSideBlocks * G_BLOCKIMAGESIZE) == m_pVolume->getHeight(), "FP_CUDA", "Volume Height must be a multiple of G_BLOCKIMAGESIZE"); //ASTRA_CONFIG_CHECK(m_pProjectionGeometry->getDetectorCount() == (m_pVolume->getWidth() * 3 / 2), "SIRT_CUDA", "Number of detectors must be 1.5 times the width of the image"); - ASTRA_CONFIG_CHECK(m_iGPUIndex >= 0, "FP_CUDA", "GPUIndex must be a non-negative integer."); + ASTRA_CONFIG_CHECK(m_iGPUIndex >= -1, "FP_CUDA", "GPUIndex must be a non-negative integer."); // success m_bIsInitialized = true; diff --git a/src/CudaForwardProjectionAlgorithm3D.cpp b/src/CudaForwardProjectionAlgorithm3D.cpp index e9289f1..f64620f 100644 --- a/src/CudaForwardProjectionAlgorithm3D.cpp +++ b/src/CudaForwardProjectionAlgorithm3D.cpp @@ -54,7 +54,7 @@ std::string CCudaForwardProjectionAlgorithm3D::type = "FP3D_CUDA"; CCudaForwardProjectionAlgorithm3D::CCudaForwardProjectionAlgorithm3D() { m_bIsInitialized = false; - m_iGPUIndex = 0; + m_iGPUIndex = -1; m_iDetectorSuperSampling = 1; m_pProjector = 0; m_pProjections = 0; @@ -107,7 +107,7 @@ bool CCudaForwardProjectionAlgorithm3D::initialize(const Config& _cfg) CC.markNodeParsed("ProjectorId"); // GPU number - m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", 0); + m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", -1); CC.markOptionParsed("GPUindex"); m_iDetectorSuperSampling = (int)_cfg.self->getOptionNumerical("DetectorSuperSampling", 1); CC.markOptionParsed("DetectorSuperSampling"); @@ -160,7 +160,7 @@ bool CCudaForwardProjectionAlgorithm3D::check() ASTRA_CONFIG_CHECK(m_pVolume->isInitialized(), "FP3D_CUDA", "Volume Data Object Not Initialized."); ASTRA_CONFIG_CHECK(m_iDetectorSuperSampling >= 1, "FP3D_CUDA", "DetectorSuperSampling must be a positive integer."); - ASTRA_CONFIG_CHECK(m_iGPUIndex >= 0, "FP3D_CUDA", "GPUIndex must be a non-negative integer."); + ASTRA_CONFIG_CHECK(m_iGPUIndex >= -1, "FP3D_CUDA", "GPUIndex must be a non-negative integer."); // check compatibility between projector and data classes // ASTRA_CONFIG_CHECK(m_pSinogram->getGeometry()->isEqual(m_pProjector->getProjectionGeometry()), "SIRT_CUDA", "Projection Data not compatible with the specified Projector."); diff --git a/src/CudaReconstructionAlgorithm2D.cpp b/src/CudaReconstructionAlgorithm2D.cpp index d567158..385cef1 100644 --- a/src/CudaReconstructionAlgorithm2D.cpp +++ b/src/CudaReconstructionAlgorithm2D.cpp @@ -76,7 +76,7 @@ void CCudaReconstructionAlgorithm2D::_clear() m_bAlgoInit = false; CReconstructionAlgorithm2D::_clear(); - m_iGPUIndex = 0; + m_iGPUIndex = -1; m_iDetectorSuperSampling = 1; m_iPixelSuperSampling = 1; } @@ -153,7 +153,7 @@ bool CCudaReconstructionAlgorithm2D::initialize(const Config& _cfg) } // GPU number - m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", 0); + m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", -1); m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUIndex", m_iGPUIndex); CC.markOptionParsed("GPUindex"); if (!_cfg.self->hasOption("GPUindex")) @@ -240,7 +240,7 @@ bool CCudaReconstructionAlgorithm2D::_check() ASTRA_CONFIG_CHECK(m_iDetectorSuperSampling >= 1, "SIRT_CUDA", "DetectorSuperSampling must be a positive integer."); ASTRA_CONFIG_CHECK(m_iPixelSuperSampling >= 1, "SIRT_CUDA", "PixelSuperSampling must be a positive integer."); - ASTRA_CONFIG_CHECK(m_iGPUIndex >= 0, "SIRT_CUDA", "GPUIndex must be a non-negative integer."); + ASTRA_CONFIG_CHECK(m_iGPUIndex >= -1, "SIRT_CUDA", "GPUIndex must be a non-negative integer."); // check compatibility between projector and data classes // ASTRA_CONFIG_CHECK(m_pSinogram->getGeometry()->isEqual(m_pProjector->getProjectionGeometry()), "SIRT_CUDA", "Projection Data not compatible with the specified Projector."); diff --git a/src/CudaRoiSelectAlgorithm.cpp b/src/CudaRoiSelectAlgorithm.cpp index f835c59..bbe2235 100644 --- a/src/CudaRoiSelectAlgorithm.cpp +++ b/src/CudaRoiSelectAlgorithm.cpp @@ -74,7 +74,7 @@ bool CCudaRoiSelectAlgorithm::initialize(const Config& _cfg) CC.markNodeParsed("DataId"); // Option: GPU number - m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", 0); + m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", -1); m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUIndex", m_iGPUIndex); CC.markOptionParsed("GPUindex"); if (!_cfg.self->hasOption("GPUindex")) diff --git a/src/CudaSirtAlgorithm3D.cpp b/src/CudaSirtAlgorithm3D.cpp index f23d0f6..179ded8 100644 --- a/src/CudaSirtAlgorithm3D.cpp +++ b/src/CudaSirtAlgorithm3D.cpp @@ -52,7 +52,7 @@ CCudaSirtAlgorithm3D::CCudaSirtAlgorithm3D() { m_bIsInitialized = false; m_pSirt = 0; - m_iGPUIndex = 0; + m_iGPUIndex = -1; m_iVoxelSuperSampling = 1; m_iDetectorSuperSampling = 1; } @@ -107,7 +107,7 @@ bool CCudaSirtAlgorithm3D::initialize(const Config& _cfg) return false; } - m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", 0); + m_iGPUIndex = (int)_cfg.self->getOptionNumerical("GPUindex", -1); CC.markOptionParsed("GPUindex"); m_iDetectorSuperSampling = (int)_cfg.self->getOptionNumerical("DetectorSuperSampling", 1); CC.markOptionParsed("DetectorSuperSampling"); -- cgit v1.2.3