-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
21 changed files
with
1,190 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,7 @@ | |
#define MAXTHREADS 1024 | ||
#define MAX_BUFFER 60 | ||
|
||
#include "POCS_TV.hpp" | ||
#include "GD_AwTV.hpp" | ||
|
||
|
||
|
||
|
@@ -65,7 +65,7 @@ do { \ | |
if (__err != cudaSuccess) { \ | ||
mexPrintf("%s \n",msg);\ | ||
cudaDeviceReset();\ | ||
mexErrMsgIdAndTxt("CBCT:CUDA:POCS_TV",cudaGetErrorString(__err));\ | ||
mexErrMsgIdAndTxt("CBCT:CUDA:GD_TV",cudaGetErrorString(__err));\ | ||
} \ | ||
} while (0) | ||
|
||
|
@@ -278,15 +278,15 @@ void aw_pocs_tv(float* img,float* dst,float alpha,const long* image_size, int ma | |
int deviceCount = gpuids.GetLength(); | ||
cudaCheckErrors("Device query fail"); | ||
if (deviceCount == 0) { | ||
mexErrMsgIdAndTxt("minimizeAwTV:POCS_TV2:GPUselect","There are no available device(s) that support CUDA\n"); | ||
mexErrMsgIdAndTxt("minimizeAwTV:GD_AwTV:GPUselect","There are no available device(s) that support CUDA\n"); | ||
} | ||
// | ||
// CODE assumes | ||
// 1.-All available devices are usable by this code | ||
// 2.-All available devices are equal, they are the same machine (warning thrown) | ||
// Check the available devices, and if they are the same | ||
if (!gpuids.AreEqualDevices()) { | ||
mexWarnMsgIdAndTxt("minimizeAwTV:POCS_TV2:GPUselect","Detected one (or more) different GPUs.\n This code is not smart enough to separate the memory GPU wise if they have different computational times or memory limits.\n First GPU parameters used. If the code errors you might need to change the way GPU selection is performed."); | ||
mexWarnMsgIdAndTxt("minimizeAwTV:GD_AwTV:GPUselect","Detected one (or more) different GPUs.\n This code is not smart enough to separate the memory GPU wise if they have different computational times or memory limits.\n First GPU parameters used. If the code errors you might need to change the way GPU selection is performed."); | ||
} | ||
int dev; | ||
|
||
|
@@ -355,15 +355,15 @@ void aw_pocs_tv(float* img,float* dst,float alpha,const long* image_size, int ma | |
|
||
// Assert | ||
if (mem_GPU_global< 3*mem_img_each_GPU+mem_auxiliary){ | ||
mexErrMsgIdAndTxt("minimizeAwTV:POCS_TV2:GPU","Assertion Failed. Logic behind splitting flawed! Please tell: [email protected]\n"); | ||
mexErrMsgIdAndTxt("minimizeAwTV:GD_AwTV:GPU","Assertion Failed. Logic behind splitting flawed! Please tell: [email protected]\n"); | ||
} | ||
} | ||
|
||
|
||
// Assert | ||
|
||
if ((slices_per_split+buffer_length*2)*image_size[0]*image_size[1]* sizeof(float)!= mem_img_each_GPU){ | ||
mexErrMsgIdAndTxt("minimizeAwTV:POCS_TV2:GPU","Assertion Failed. Memory needed calculation broken! Please tell: [email protected]\n"); | ||
mexErrMsgIdAndTxt("minimizeAwTV:GD_AwTV:GPU","Assertion Failed. Memory needed calculation broken! Please tell: [email protected]\n"); | ||
} | ||
|
||
|
||
|
@@ -395,7 +395,7 @@ void aw_pocs_tv(float* img,float* dst,float alpha,const long* image_size, int ma | |
unsigned long long buffer_pixels=buffer_length*image_size[0]*image_size[1]; | ||
float* buffer; | ||
if(splits>1){ | ||
mexWarnMsgIdAndTxt("minimizeAwTV:POCS_TV2:Image_split","Your image can not be fully split between the available GPUs. The computation of minTV will be significantly slowed due to the image size.\nApproximated mathematics turned on for computational speed."); | ||
mexWarnMsgIdAndTxt("minimizeAwTV:GD_AwTV:Image_split","Your image can not be fully split between the available GPUs. The computation of minTV will be significantly slowed due to the image size.\nApproximated mathematics turned on for computational speed."); | ||
}else{ | ||
cudaMallocHost((void**)&buffer,buffer_length*image_size[0]*image_size[1]*sizeof(float)); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,7 @@ | |
#define MAXTHREADS 1024 | ||
#define MAX_BUFFER 60 | ||
|
||
#include "POCS_TV.hpp" | ||
#include "GD_TV.hpp" | ||
#include "gpuUtils.hpp" | ||
|
||
|
||
|
@@ -65,7 +65,7 @@ do { \ | |
if (__err != cudaSuccess) { \ | ||
mexPrintf("%s \n",msg);\ | ||
cudaDeviceReset();\ | ||
mexErrMsgIdAndTxt("POCS_TV:GPU",cudaGetErrorString(__err));\ | ||
mexErrMsgIdAndTxt("GD_TV:GPU",cudaGetErrorString(__err));\ | ||
} \ | ||
} while (0) | ||
|
||
|
@@ -261,15 +261,15 @@ do { \ | |
int deviceCount = gpuids.GetLength(); | ||
cudaCheckErrors("Device query fail"); | ||
if (deviceCount == 0) { | ||
mexErrMsgIdAndTxt("POCS_TV:GPU","There are no available device(s) that support CUDA\n"); | ||
mexErrMsgIdAndTxt("GD_TV:GPU","There are no available device(s) that support CUDA\n"); | ||
} | ||
// | ||
// CODE assumes | ||
// 1.-All available devices are usable by this code | ||
// 2.-All available devices are equal, they are the same machine (warning thrown) | ||
// Check the available devices, and if they are the same | ||
if (!gpuids.AreEqualDevices()) { | ||
mexWarnMsgIdAndTxt("minimizeTV:POCS_TV:GPUselect","Detected one (or more) different GPUs.\n This code is not smart enough to separate the memory GPU wise if they have different computational times or memory limits.\n First GPU parameters used. If the code errors you might need to change the way GPU selection is performed."); | ||
mexWarnMsgIdAndTxt("minimizeTV:GD_TV:GPUselect","Detected one (or more) different GPUs.\n This code is not smart enough to separate the memory GPU wise if they have different computational times or memory limits.\n First GPU parameters used. If the code errors you might need to change the way GPU selection is performed."); | ||
} | ||
|
||
int dev; | ||
|
@@ -339,15 +339,15 @@ do { \ | |
|
||
// Assert | ||
if (mem_GPU_global< 3*mem_img_each_GPU+mem_auxiliary){ | ||
mexErrMsgIdAndTxt("POCS_TV:GPU","Assertion Failed. Logic behind splitting flawed! Please tell: [email protected]\n"); | ||
mexErrMsgIdAndTxt("GD_TV:GPU","Assertion Failed. Logic behind splitting flawed! Please tell: [email protected]\n"); | ||
} | ||
} | ||
|
||
|
||
// Assert | ||
|
||
if ((slices_per_split+buffer_length*2)*image_size[0]*image_size[1]* sizeof(float)!= mem_img_each_GPU){ | ||
mexErrMsgIdAndTxt("POCS_TV:GPU","Assertion Failed. Memory needed calculation broken! Please tell: [email protected]\n"); | ||
mexErrMsgIdAndTxt("GD_TV:GPU","Assertion Failed. Memory needed calculation broken! Please tell: [email protected]\n"); | ||
} | ||
|
||
|
||
|
@@ -379,7 +379,7 @@ do { \ | |
unsigned long long buffer_pixels=buffer_length*image_size[0]*image_size[1]; | ||
float* buffer; | ||
if(splits>1){ | ||
mexWarnMsgIdAndTxt("minimizeTV:POCS_TV:Image_split","Your image can not be fully split between the available GPUs. The computation of minTV will be significantly slowed due to the image size.\nApproximated mathematics turned on for computational speed."); | ||
mexWarnMsgIdAndTxt("minimizeTV:GD_TV:Image_split","Your image can not be fully split between the available GPUs. The computation of minTV will be significantly slowed due to the image size.\nApproximated mathematics turned on for computational speed."); | ||
}else{ | ||
cudaMallocHost((void**)&buffer,buffer_length*image_size[0]*image_size[1]*sizeof(float)); | ||
} | ||
|
@@ -690,7 +690,7 @@ void checkFreeMemory(const GpuIds& gpuids,size_t *mem_GPU_global){ | |
cudaMemGetInfo(&memfree,&memtotal); | ||
if(dev==0) *mem_GPU_global=memfree; | ||
if(memfree<memtotal/2){ | ||
mexErrMsgIdAndTxt("POCS_TV:GPU","One (or more) of your GPUs is being heavily used by another program (possibly graphics-based).\n Free the GPU to run TIGRE\n"); | ||
mexErrMsgIdAndTxt("GD_TV:GPU","One (or more) of your GPUs is being heavily used by another program (possibly graphics-based).\n Free the GPU to run TIGRE\n"); | ||
} | ||
cudaCheckErrors("Check mem error"); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,61 @@ | ||
/*------------------------------------------------------------------------- | ||
* | ||
* Header for CUDA functions for Steepest descend in POCS-type algorithms. | ||
* | ||
* This file has the required headers for POCS_TV.cu | ||
* | ||
* CODE by Ander Biguri | ||
* | ||
--------------------------------------------------------------------------- | ||
--------------------------------------------------------------------------- | ||
Copyright (c) 2015, University of Bath and CERN- European Organization for | ||
Nuclear Research | ||
All rights reserved. | ||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
1. Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
3. Neither the name of the copyright holder nor the names of its contributors | ||
may be used to endorse or promote products derived from this software without | ||
specific prior written permission. | ||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGE. | ||
--------------------------------------------------------------------------- | ||
Contact: [email protected] | ||
Codes : https://github.com/CERN/TIGRE | ||
--------------------------------------------------------------------------- | ||
*/ | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
#ifndef POCS_TV_HPP | ||
#define POCS_TV_HPP | ||
#include "TIGRE_common.hpp" | ||
#include "GpuIds.hpp" | ||
|
||
void pocs_tv(float* img,float* dst,float alpha,const long* image_size, int maxIter, const GpuIds& gpuids); | ||
|
||
void checkFreeMemory(const GpuIds& gpuids, size_t *mem_GPU_global); | ||
/*------------------------------------------------------------------------- | ||
* | ||
* Header for CUDA functions for Steepest descend in POCS-type algorithms. | ||
* | ||
* This file has the required headers for POCS_TV.cu | ||
* | ||
* CODE by Ander Biguri | ||
* | ||
--------------------------------------------------------------------------- | ||
--------------------------------------------------------------------------- | ||
Copyright (c) 2015, University of Bath and CERN- European Organization for | ||
Nuclear Research | ||
All rights reserved. | ||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
1. Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
3. Neither the name of the copyright holder nor the names of its contributors | ||
may be used to endorse or promote products derived from this software without | ||
specific prior written permission. | ||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGE. | ||
--------------------------------------------------------------------------- | ||
Contact: [email protected] | ||
Codes : https://github.com/CERN/TIGRE | ||
--------------------------------------------------------------------------- | ||
*/ | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
#ifndef GD_TV_HPP | ||
#define GD_TV_HPP | ||
#include "TIGRE_common.hpp" | ||
#include "GpuIds.hpp" | ||
|
||
void pocs_tv(float* img,float* dst,float alpha,const long* image_size, int maxIter, const GpuIds& gpuids); | ||
|
||
void checkFreeMemory(const GpuIds& gpuids, size_t *mem_GPU_global); | ||
#endif |
Oops, something went wrong.