Skip to content

Commit 28881a9

Browse files
committed
fix #699
allow 2d reconstruction for algorithms using `tv_proximal` (FISTA, SART_TV, OS_SART_TV)
1 parent b282e0b commit 28881a9

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Common/CUDA/tv_proximal.cu

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,12 @@ void cpy_from_host(float* device_array,float* host_array,
229229
size_t mem_free=mem_GPU_global;
230230

231231
splits=(unsigned int)(ceil(((float)(5*mem_size_image)/(float)(deviceCount))/mem_free));
232-
// Now, there is an overhead here, as each splits should have 2 slices more, to accoutn for overlap of images.
232+
// Now, there is an overhead here, as each splits should have 2 slices more, to account for overlap of images.
233233
// lets make sure these 2 slices fit, if they do not, add 1 to splits.
234234
slices_per_split=(image_size[2]+deviceCount*splits-1)/(deviceCount*splits);
235235
mem_img_each_GPU=(mem_slice_image*(slices_per_split+buffer_length*2));
236236

237-
// if the new stuff does not fit in the GPU, it measn we are in the edge case where adding that extra slice will overflow memory
237+
// if the new stuff does not fit in the GPU, it means we are in the edge case where adding that extra slice will overflow memory
238238
if (mem_GPU_global< 5*mem_img_each_GPU){
239239
// one more split should do the job, as its an edge case.
240240
splits++;
@@ -677,12 +677,12 @@ void cpy_from_host(float* device_array,float* host_array,
677677

678678
// Initial and last cases are special. These define the boundary condition. In our case, we are using Neumann boundary condition
679679
// so we need to copy the edge slice into the buffer
680-
if(is_first_chunk){
680+
if(is_first_chunk && image_size[2] > 1){
681681
for (unsigned int j=0;j<buffer_length;j++){
682-
cudaMemcpyAsync(device_array+pixels_per_slice*j, host_array+pixels_per_slice*(buffer_length-j), pixels_per_slice*sizeof(float), cudaMemcpyHostToDevice,stream);
683-
}
682+
cudaMemcpyAsync(device_array+pixels_per_slice*j, host_array+pixels_per_slice*(buffer_length-j), pixels_per_slice*sizeof(float), cudaMemcpyHostToDevice,stream);
683+
}
684684
}
685-
if(is_last_chunk){
685+
if(is_last_chunk && image_size[2] > 1){
686686

687687
for (unsigned int j=0;j<buffer_length;j++){
688688
cudaMemcpyAsync(device_array+bytes_device+pixels_per_slice*j, host_array+pixels_per_slice*(image_size[2]-j-2), pixels_per_slice*sizeof(float), cudaMemcpyHostToDevice,stream);

0 commit comments

Comments
 (0)