<div dir="ltr">Hi Chao,<br>Thanks for the detailed report. It was a tough bug but I think I nailed it:<br><a href="https://github.com/SimonRit/RTK/commit/9ff302899f247c10b8ab198df7b2d1aac6bbcad8">https://github.com/SimonRit/RTK/commit/9ff302899f247c10b8ab198df7b2d1aac6bbcad8</a><br>This occured only in the displaced detector situation I think. Let me know if the fix does work for you. Thanks again,<br>Simon</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 2, 2015 at 11:08 PM, Chao Wu <span dir="ltr"><<a href="mailto:wuchao04@gmail.com" target="_blank">wuchao04@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><div dir="ltr"><span style="font-size:14px">Hi Simon,</span><div style="font-size:14px"><br></div><div style="font-size:14px">I found how to reproduce it.</div><div style="font-size:14px">Instead of using proj.mha, if you use separate projection files (e.g. proj_0.tif ~ proj_7.tif), and add the -l flag you will see the problem. The --subsetsize is needed to show the issue (not necessarily =1 but should let the for loop in the FDK filter run several times). The issue is not in the first time the for loop runs, but only in sequential ones.</div><div style="font-size:14px"><br></div><div style="font-size:14px">Here's my output using separate tif files as projections: without -l it runs 8 times, with -l it runs 15 times = 1 + 7*2 (first time in the loop is normal, next ones weight filter run twice).</div><div style="font-size:14px"><br></div><div style="font-size:14px"><div>D:\Chao\RTK>rtkfdk -p . -r proj_ -o fdk.mha -g g --hardware cuda --subsetsize 1</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div><br></div><div>D:\Chao\RTK>rtkfdk -p . -r proj_ -o fdk.mha -g g --hardware cuda --subsetsize 1 -l</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div><div>CudaFDKWeightProjectionFilter::GPUGenerateData()</div></div><div style="font-size:14px"><br></div><div style="font-size:14px">When I print out the GRAM activities by #define VERBOSE in itkCudaDataManager.h and add some other debug info in the code (before and after filter->Update(), and at the beginning and end of GPUGenerateData() of the filters) I have the following log showing the problem with -l flag on (I show below the log of the first 4 projections and hope it is still readable...)</div><div style="font-size:14px">When I focus on the CudaDataManager that updates (copies) the projection data from CPU to GPU for the weight filter, I actually found two: 00000000036B7CC0 and 00000000036B80C0. The latter one only exists for projections other than the first projection and runs during the first weight filter update, and the former one exists for all projections and is the one running during the only weight filter update for the first projection and the one taking action when the weight filter reruns during the ramp filter update for the remaining projections.</div><div style="font-size:14px">(Note that I have a small modification in the GRAM message: when a gpu buffer is freed for a new allocation, I log it as "Deallocate" instead of "Freed" to discriminate it from a pure free operation.)</div><div style="font-size:14px"><br></div><div style="font-size:14px"><div>===Projection 0:</div><div><br></div><div>>>>>>>>> Start Weight Update</div><div>00000000036B78C0::UpdateCPUBuffer GPU->CPU data copy 0000002304620000->0000000009700040 : 4805568</div><div>--------VVVVVVVV CudaFDKWeightProjectionFilter GenerateData--------</div><div>000000000384B3F0::Allocate Create GPU buffer of size 4805568 Bytes : 0000002304AC0000</div><div>00000000036B7CC0::UpdateGPUBuffer CPU->GPU data copy 0000000009BA0040->0000002304AC0000 : 4805568</div><div>--------^^^^^^^^ CudaFDKWeightProjectionFilter GenerateData--------</div><div>End Weight Update <<<<<<<<</div><div><br></div><div>>>>>>>>> Start Ramp Update</div><div>--------VVVVVVVV CudaFFTConvolutionImageFilter GenerateData--------</div><div>000000000391D390::Allocate Create GPU buffer of size 9704448 Bytes : 0000002304F60000</div><div>000000000391C800::Allocate Create GPU buffer of size 31112 Bytes : 00000023058C0000</div><div>00000000036B85C0::UpdateGPUBuffer CPU->GPU data copy 00000000039A5660->00000023058C0000 : 31112</div><div>00000000038B3A40::Allocate Create GPU buffer of size 846660 Bytes : 00000023059C0000</div><div>--------^^^^^^^^ CudaFFTConvolutionImageFilter GenerateData--------</div><div>000000000391C800::Freed GPU buffer of size 31112 Bytes : 00000023058C0000</div><div>000000000391D390::Freed GPU buffer of size 9704448 Bytes : 0000002304F60000</div><div>End Ramp Update <<<<<<<<</div><div><br></div><div>>>>>>>>> Start BP Update</div><div>--------VVVVVVVV CudaFDKBackProjectionImageFilter GenerateData--------</div><div>0000000003832A80::Allocate Create GPU buffer of size 4290772992 Bytes : 0000002306420000</div><div>00000000036B79C0::UpdateGPUBuffer CPU->GPU data copy 00000029FFC10040->0000002306420000 : 4290772992</div><div>--------^^^^^^^^ CudaFDKBackProjectionImageFilter GenerateData--------</div><div>End BP Update <<<<<<<<</div><div><br></div><div>===Projection 1:</div><div><br></div><div>>>>>>>>> Start Weight Update</div><div>000000000380B570::Deallocate GPU buffer of size 2402784 Bytes : 0000002303F20000</div><div>000000000380B570::Allocate Create GPU buffer of size 2418336 Bytes : 0000002303F20000</div><div>00000000036B75C0::UpdateGPUBuffer CPU->GPU data copy 000000000ABF0040->0000002303F20000 : 2418336</div><div>0000000003832530::Deallocate GPU buffer of size 4805568 Bytes : 0000002304180000</div><div>0000000003832530::Allocate Create GPU buffer of size 4836672 Bytes : 0000002304180000</div><div>0000000003832800::Deallocate GPU buffer of size 4805568 Bytes : 0000002304620000</div><div>0000000003832800::Allocate Create GPU buffer of size 4836672 Bytes : 0000002304620000</div><div>00000000036B78C0::UpdateCPUBuffer GPU->CPU data copy 0000002304620000->0000000009010040 : 4836672</div><div>000000000384B3F0::Freed GPU buffer of size 4805568 Bytes : 0000002304AC0000</div><div>--------VVVVVVVV CudaFDKWeightProjectionFilter GenerateData--------</div><div>000000000384B170::Allocate Create GPU buffer of size 4836672 Bytes : 0000002305AC0000</div><div>00000000036B80C0::UpdateGPUBuffer CPU->GPU data copy 00000000094B0040->0000002305AC0000 : 4836672</div><div>--------^^^^^^^^ CudaFDKWeightProjectionFilter GenerateData--------</div><div>End Weight Update <<<<<<<<</div><div><br></div><div>>>>>>>>> Start Ramp Update</div><div>00000000036B78C0::UpdateCPUBuffer GPU->CPU data copy 0000002304620000->0000000009010040 : 4836672</div><div>000000000384B170::Freed GPU buffer of size 4836672 Bytes : 0000002305AC0000</div><div>--------VVVVVVVV CudaFDKWeightProjectionFilter GenerateData--------</div><div>000000000391D110::Allocate Create GPU buffer of size 4836672 Bytes : 0000002305AC0000</div><div>00000000036B7CC0::UpdateGPUBuffer CPU->GPU data copy 0000000009950040->0000002305AC0000 : 4836672</div><div>--------^^^^^^^^ CudaFDKWeightProjectionFilter GenerateData--------</div><div>--------VVVVVVVV CudaFFTConvolutionImageFilter GenerateData--------</div><div>00000000039BFED0::Allocate Create GPU buffer of size 9704448 Bytes : 0000002304AC0000</div><div>00000000039C01A0::Allocate Create GPU buffer of size 31112 Bytes : 0000002305F60000</div><div>00000000036B81C0::UpdateGPUBuffer CPU->GPU data copy 00000000039B8470->0000002305F60000 : 31112</div><div>00000000039C02E0::Allocate Create GPU buffer of size 1097208 Bytes : 0000002306060000</div><div>00000000038B3A40::Freed GPU buffer of size 846660 Bytes : 00000023059C0000</div><div>--------^^^^^^^^ CudaFFTConvolutionImageFilter GenerateData--------</div><div>00000000039C01A0::Freed GPU buffer of size 31112 Bytes : 0000002305F60000</div><div>00000000039BFED0::Freed GPU buffer of size 9704448 Bytes : 0000002304AC0000</div><div>End Ramp Update <<<<<<<<</div><div><br></div><div>>>>>>>>> Start BP Update</div><div>--------VVVVVVVV CudaFDKBackProjectionImageFilter GenerateData--------</div><div>--------^^^^^^^^ CudaFDKBackProjectionImageFilter GenerateData--------</div><div>End BP Update <<<<<<<<</div><div><br></div><div>===Projection 2:</div><div><br></div><div>>>>>>>>> Start Weight Update</div><div>00000000036B75C0::UpdateGPUBuffer CPU->GPU data copy 000000000ABF0040->0000002303F20000 : 2418336</div><div>00000000036B78C0::UpdateCPUBuffer GPU->CPU data copy 0000002304620000->0000000009010040 : 4836672</div><div>000000000391D110::Freed GPU buffer of size 4836672 Bytes : 0000002305AC0000</div><div>--------VVVVVVVV CudaFDKWeightProjectionFilter GenerateData--------</div><div>000000000391CBC0::Allocate Create GPU buffer of size 4836672 Bytes : 0000002304AC0000</div><div>00000000036B80C0::UpdateGPUBuffer CPU->GPU data copy 000000000AF50040->0000002304AC0000 : 4836672</div><div>--------^^^^^^^^ CudaFDKWeightProjectionFilter GenerateData--------</div><div>End Weight Update <<<<<<<<</div><div><br></div><div>>>>>>>>> Start Ramp Update</div><div>00000000036B78C0::UpdateCPUBuffer GPU->CPU data copy 0000002304620000->0000000009010040 : 4836672</div><div>000000000391CBC0::Freed GPU buffer of size 4836672 Bytes : 0000002304AC0000</div><div>--------VVVVVVVV CudaFDKWeightProjectionFilter GenerateData--------</div><div>000000000391D020::Allocate Create GPU buffer of size 4836672 Bytes : 0000002304AC0000</div><div>00000000036B7CC0::UpdateGPUBuffer CPU->GPU data copy 00000000098E0040->0000002304AC0000 : 4836672</div><div>--------^^^^^^^^ CudaFDKWeightProjectionFilter GenerateData--------</div><div>--------VVVVVVVV CudaFFTConvolutionImageFilter GenerateData--------</div><div>00000000039C0420::Allocate Create GPU buffer of size 9704448 Bytes : 0000002304F60000</div><div>00000000039C0100::Allocate Create GPU buffer of size 31112 Bytes : 0000002306180000</div><div>00000000036B81C0::UpdateGPUBuffer CPU->GPU data copy 000000000A408080->0000002306180000 : 31112</div><div>00000000039C0060::Allocate Create GPU buffer of size 1183044 Bytes : 00000023058C0000</div><div>00000000039C02E0::Freed GPU buffer of size 1097208 Bytes : 0000002306060000</div><div>--------^^^^^^^^ CudaFFTConvolutionImageFilter GenerateData--------</div><div>00000000039C0100::Freed GPU buffer of size 31112 Bytes : 0000002306180000</div><div>00000000039C0420::Freed GPU buffer of size 9704448 Bytes : 0000002304F60000</div><div>End Ramp Update <<<<<<<<</div><div><br></div><div>>>>>>>>> Start BP Update</div><div>--------VVVVVVVV CudaFDKBackProjectionImageFilter GenerateData--------</div><div>--------^^^^^^^^ CudaFDKBackProjectionImageFilter GenerateData--------</div><div>End BP Update <<<<<<<<</div><div><br></div><div>===Projection 3:</div><div><br></div><div>>>>>>>>> Start Weight Update</div><div>00000000036B75C0::UpdateGPUBuffer CPU->GPU data copy 000000000ABF0040->0000002303F20000 : 2418336</div><div>00000000036B78C0::UpdateCPUBuffer GPU->CPU data copy 0000002304620000->0000000009010040 : 4836672</div><div>000000000391D020::Freed GPU buffer of size 4836672 Bytes : 0000002304AC0000</div><div>--------VVVVVVVV CudaFDKWeightProjectionFilter GenerateData--------</div><div>000000000391D110::Allocate Create GPU buffer of size 4836672 Bytes : 0000002305A00000</div><div>00000000036B80C0::UpdateGPUBuffer CPU->GPU data copy 0000000013400040->0000002305A00000 : 4836672</div><div>--------^^^^^^^^ CudaFDKWeightProjectionFilter GenerateData--------</div><div>End Weight Update <<<<<<<<</div><div><br></div><div>>>>>>>>> Start Ramp Update</div><div>00000000036B78C0::UpdateCPUBuffer GPU->CPU data copy 0000002304620000->0000000009010040 : 4836672</div><div>000000000391D110::Freed GPU buffer of size 4836672 Bytes : 0000002305A00000</div><div>--------VVVVVVVV CudaFDKWeightProjectionFilter GenerateData--------</div><div>00000000039C0420::Allocate Create GPU buffer of size 4836672 Bytes : 0000002305A00000</div><div>00000000036B7CC0::UpdateGPUBuffer CPU->GPU data copy 00000000098E0040->0000002305A00000 : 4836672</div><div>--------^^^^^^^^ CudaFDKWeightProjectionFilter GenerateData--------</div><div>--------VVVVVVVV CudaFFTConvolutionImageFilter GenerateData--------</div><div>00000000039C0380::Allocate Create GPU buffer of size 9704448 Bytes : 0000002304AC0000</div><div>00000000039C0290::Allocate Create GPU buffer of size 31112 Bytes : 0000002305EA0000</div><div>00000000036B81C0::UpdateGPUBuffer CPU->GPU data copy 000000000A414080->0000002305EA0000 : 31112</div><div>00000000039C0560::Allocate Create GPU buffer of size 1081036 Bytes : 0000002305FA0000</div><div>00000000039C0060::Freed GPU buffer of size 1183044 Bytes : 00000023058C0000</div><div>--------^^^^^^^^ CudaFFTConvolutionImageFilter GenerateData--------</div><div>00000000039C0290::Freed GPU buffer of size 31112 Bytes : 0000002305EA0000</div><div>00000000039C0380::Freed GPU buffer of size 9704448 Bytes : 0000002304AC0000</div><div>End Ramp Update <<<<<<<<</div><div><br></div><div>>>>>>>>> Start BP Update</div><div>--------VVVVVVVV CudaFDKBackProjectionImageFilter GenerateData--------</div><div>--------^^^^^^^^ CudaFDKBackProjectionImageFilter GenerateData--------</div><div>End BP Update <<<<<<<<</div></div><div style="font-size:14px"><br></div><div style="font-size:14px"><br></div><div style="font-size:14px">Regards,</div><div style="font-size:14px">Chao</div><div style="font-size:14px"><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">2015-06-02 17:43 GMT+02:00 Simon Rit <span dir="ltr"><<a href="mailto:simon.rit@creatis.insa-lyon.fr" target="_blank">simon.rit@creatis.insa-lyon.fr</a>></span>:<br></div></div><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Chao,<br>
It looks bad but I couldn't reproduce the problem. What I did is add<br>
messages in the GPUGenerateData and launch a very simple sequence of<br>
command lines:<br>
  rtksimulatedgeometry -n 8 -o g<br>
  rtkprojectshepploganphantom -g g -o proj.mha<br>
  rtkfdk -p . -r proj.mha -o fdk.mha -g g --hardware cuda<br>
in which case I go only once in each GPUGenerateData. Can you give us<br>
a command line example where you can see the problem?<br>
Thanks,<br>
Simon<br>
<div><div><br>
On Mon, Jun 1, 2015 at 6:53 PM, Chao Wu <<a href="mailto:wuchao04@gmail.com" target="_blank">wuchao04@gmail.com</a>> wrote:<br>
> Hi all,<br>
><br>
> When testing CUDA-based FDK I found the CudaFDKWeightProjectionFilter seems<br>
> to rerun unnecessarily. Details below:<br>
><br>
> In FDKConeBeamReconstructionFilter<TInputImage, TOutputImage,<br>
> TFFTPrecision>::GenerateData() the three sub-filters run separately for<br>
> timing:<br>
><br>
>     m_PreFilterProbe.Start();<br>
>     m_WeightFilter->Update();<br>
>     m_PreFilterProbe.Stop();<br>
><br>
>     m_FilterProbe.Start();<br>
>   m_RampFilter->Update();<br>
> m_FilterProbe.Stop();<br>
><br>
>     m_BackProjectionProbe.Start();<br>
>     m_BackProjectionFilter->Update();<br>
>     m_BackProjectionProbe.Stop();<br>
><br>
> However with some debug procedure I found when executing<br>
> m_RampFilter->Update() the m_WeightFilter is updated again. Maybe there's<br>
> something wrong with filter modified time or flags of CPU/GPU buffer?<br>
><br>
> Furthermore, if I remove m_WeightFilter->Update() then both m_WeightFilter<br>
> and m_RampFilter will rerun during update of m_BackProjectionFilter. Only if<br>
> I remove both m_WeightFilter->Update() and m_RampFilter->Update() and let<br>
> m_BackProjectionFilter execute the whole minipipeline, all filters will run<br>
> nicely only once for each projection subset.<br>
><br>
> The results are identical for all cases I tested.<br>
><br>
> I did not check whether the same issue applies to the CPU or OpenCL version.<br>
><br>
> Regards,<br>
> Chao<br>
><br>
</div></div>> _______________________________________________<br>
> Rtk-users mailing list<br>
> <a href="mailto:Rtk-users@public.kitware.com" target="_blank">Rtk-users@public.kitware.com</a><br>
> <a href="http://public.kitware.com/mailman/listinfo/rtk-users" target="_blank">http://public.kitware.com/mailman/listinfo/rtk-users</a><br>
><br>
</blockquote></div></div></div><br></div>
</blockquote></div><br></div>