<div dir="ltr">Hi,<div><br></div><div>Now I fix the problem. It seems like before this I have issues with loading the rtkcuda libraries. My runtime argument failed to tell the program to load them.</div><div>Thanks a lot for your help.</div><div>Tao</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Simon Rit <<a href="mailto:simon.rit@creatis.insa-lyon.fr">simon.rit@creatis.insa-lyon.fr</a>> 於 2019年1月30日 週三 下午4:22寫道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I don't see what has changed since this commit...</div><div>For Tao, I would suggest to try a minimal example in one separate main just to be sure that this is indeed this line that causes the problem and not some bad memory management before. I really don't see what is the issue here since you are using CUDA code from the same RTK version.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 30, 2019 at 6:17 PM Chao Wu <<a href="mailto:wuchao04@gmail.com" target="_blank">wuchao04@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">L.S.,</div><div dir="ltr"><br></div><div dir="ltr">I encouter recently the "Cuda Error # 3" with a Quadro P4000 when running rtkfdk, but I am not sure if the cause is the same as Tao's problem. </div><div dir="ltr"><div>CUDA_CHECK() marks Driver API error with a "#" whereas Runtime API error with a ":", so it is CUresult 3 (CUDA_ERROR_NOT_INITIALIZED).</div><div>Indeed when I add CUDA_CHECK to cuInit(0) in itkCudaContextManager.cxx I already got an CUresult 100 (CUDA_ERROR_NO_DEVICE) here.</div><div>In the same itkCudaContextManager.cxx file, itk::CudaGetAvailableDevices (which calls Runtime API) works well, so only Driver API doesn't work properly.</div><div>The same build works fine with a Tesla P40.<br class="gmail-m_3202034422025105212gmail-m_-2874964985804874761gmail-Apple-interchange-newline"></div><div><br></div><div>I don't have time to investigate further but I found on my computer a previous build based on commit 5717b6d02675ee10f03200038566f06dfcc2ad19 in May 2018 doesn't have this issue with the Quadro card.</div><div>So I guess it shouldn't be the problem of the card or the driver, but a problem induced by a later commit.</div><div><br></div><div>Best regards,</div><div>Chao</div></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Andreas Andersen <<a href="mailto:andreasga22@gmail.com" target="_blank">andreasga22@gmail.com</a>> 于2019年1月30日周三 下午5:33写道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">I've encountered the "Cuda Error # 3" issue two times.<br>As far as I remember, both were caused by the GPU being unreachable at runtime:<br>* A missing or outdated (relative to CUDA version) nVidia driver<div>* The code running within a non-native environment.</div><div>The second point can also be triggered if the binary is located on remote storage.</div><div><br></div><div>However, both of these cases were on Windows, and by the path "/home/tsun/bin/" I would guess you're on some Linux distro.</div><div><br></div><div>/Andreas</div><div><div dir="ltr" class="gmail-m_3202034422025105212gmail-m_-2874964985804874761gmail-m_2917829920075002930gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><p style="margin-bottom:0.0001pt"><span style="color:rgb(31,73,125)" lang="EN-US"><span style="font-size:11pt;line-height:16.8667px;font-family:Calibri,sans-serif" lang="EN-US">__________________________________</span></span></p><p style="margin-bottom:0.0001pt"><span style="color:rgb(31,73,125)" lang="EN-US"><span style="font-size:11pt;line-height:16.8667px;font-family:Calibri,sans-serif" lang="EN-US">Andreas Gravgaard Andersen</span></span></p><div><p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;color:black"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Department of Oncology, </span></p><p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;color:black"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Aarhus University Hospital<u></u><u></u></span></p><p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;color:black"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)" lang="DA">Nørrebrogade 44,</span></p><p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;color:black"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)" lang="DA">8000, Aarhus C<u></u></span></p><p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;color:black"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)" lang="DA">Mail:     <a href="mailto:agravgaard@protonmail.com" target="_blank">agravgaard@protonmail.com</a></span></p><p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;color:black"><span style="color:rgb(31,73,125);font-family:Calibri,sans-serif;font-size:11pt">Cell:     </span><span style="color:rgb(31,73,125);font-family:Calibri,sans-serif;font-size:11pt"> </span><a value="+4523382411" style="font-family:Calibri,sans-serif;font-size:11pt;color:rgb(17,85,204)">+45 3165 8140</a></p></div></div></div></div></div></div></div></div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 30 Jan 2019 at 17:29, Simon Rit <<a href="mailto:simon.rit@creatis.insa-lyon.fr" target="_blank">simon.rit@creatis.insa-lyon.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Can you send the code if you want us to help? <br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 30, 2019 at 5:21 PM tao sun <<a href="mailto:colddiesun@gmail.com" target="_blank">colddiesun@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">No I am not using that. But the error was thrown before GRAFT() function was called. It happens when I initialized the backprojector:<div> bp = rtk::CudaRayCastBackProjectionImageFilter::New(). <br><div> </div></div><div>Tao</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Simon Rit <<a href="mailto:simon.rit@creatis.insa-lyon.fr" target="_blank">simon.rit@creatis.insa-lyon.fr</a>> 於 2019年1月30日 週三 上午11:13寫道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Are you using the HEAD version of the git ? Because I recently corrected a bug in the Graft function (commit b2d73642ce171ba9890af2c107a1a31f923454b5).</div><div>Simon<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 30, 2019 at 5:05 PM tao sun <<a href="mailto:colddiesun@gmail.com" target="_blank">colddiesun@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi Simon,<div><br></div><div>CUDA_HAVE_GPU is on. So is CUDA_FOUND. I can run examples like rtkfdk with gpu on without any problem though,</div><div>By the way I am using CUDA 9.2.88.</div><div><br></div><div>Tao</div><div><br></div><div><br></div><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Simon Rit <<a href="mailto:simon.rit@creatis.insa-lyon.fr" target="_blank">simon.rit@creatis.insa-lyon.fr</a>> 於 2019年1月30日 週三 上午1:25寫道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Hi,</div><div>No, not really. In my experience, this occurs mainly when you don't have a GPU properly configured for CUDA. Can you check the value of CUDA_HAVE_GPU in cmake ? If it's OFF, then this is indeed the problem.<br></div><div>Simon<br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 30, 2019 at 1:23 AM tao sun <<a href="mailto:colddiesun@gmail.com" target="_blank">colddiesun@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi again,<div><br></div><div>Finally I got time to work on this. I was able to compile the program this time using the Graft() function. However, there's a runtime error when I run the program:</div><div><br></div><div><div>    /home/tsun/bin/RTK-1.4.0/utilities/ITKCudaCommon/src/itkCudaDataManager.cxx:38 @ unknown : Cuda Error #3</div><div>    terminate called after throwing an instance of 'itk::ExceptionObject'</div><div>    what():  /home/tsun/bin/RTK-1.4.0/utilities/ITKCudaCommon/src/itkCudaDataManager.cxx:38:</div><div>    Cuda Error # 3</div><div>    Aborted</div></div><div><br></div><div>It happens when a new gpu backprojector is created:</div><div>    bp = rtk::CudaRayCastBackProjectionImageFilter::New();<br></div><div><br></div><div>Any insights for this?</div><div><br></div><div>Thanks,</div><div>Tao</div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">tao sun <<a href="mailto:colddiesun@gmail.com" target="_blank">colddiesun@gmail.com</a>> 於 2019年1月19日 週六 下午8:51寫道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thank you all! I will give a try using your solutions.<div>Tao</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Simon Rit <<a href="mailto:simon.rit@creatis.insa-lyon.fr" target="_blank">simon.rit@creatis.insa-lyon.fr</a>> 於 2019年1月17日 週四 上午12:26寫道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div>That's one solution. Two other:</div><div>- graft the output to a Cuda image</div><div>itk::CudaImage<float, 3>::Pointer cuImg = itk::CudaImage<float, 3>::New();</div><div>cuImg->Graft(projectionReader->GetOutput())</div><div>- use the rtk::ImportImageFilter which is templated over image type to allow precisely this (I used it in Gate <a href="https://github.com/OpenGATE/Gate/blob/develop/source/digits_hits/src/GateFixedForcedDetectionActor.cc#L1583" target="_blank">here</a>).</div><div>Best regards,</div><div>Simon<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail-m_3202034422025105212gmail-m_-2874964985804874761gmail-m_2917829920075002930gmail-m_-7205459150592597102gmail-m_-5682795666777629372gmail-m_-6928066469225963281gmail-m_2083612832876678240gmail-m_1585271949393647574gmail-m_-485280682349819555gmail-m_6672558738276974937gmail-m_5619079691586473791gmail_attr">On Wed, Jan 16, 2019 at 11:06 PM Andreas Andersen <<a href="mailto:andreasga22@gmail.com" target="_blank">andreasga22@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Tao,<br><br>I think you want the <a href="https://itk.org/Doxygen/html/classitk_1_1CastImageFilter.html" target="_blank">CastImageFilter</a> from ITK.<br><br></div><div dir="ltr">Something like this:<br><div dir="ltr">using castToImageType = itk::CastImageFilter<<span style="color:rgb(0,0,0)">itk:::Image<float,3></span>, <span style="color:rgb(0,0,0)">itk::CudaImage<float,3></span>>;</div><div dir="ltr">typename castToImageType::Pointer castfilter = castToImageType::New();</div><div dir="ltr">castfilter->SetInput(projectionReader->GetOutput());</div><div dir="ltr">castfilter->Update();</div><div dir="ltr">auto cuda_image = castfilter->GetOutput();</div><div><br></div><div>Best regards Andreas</div><div><div dir="ltr" class="gmail-m_3202034422025105212gmail-m_-2874964985804874761gmail-m_2917829920075002930gmail-m_-7205459150592597102gmail-m_-5682795666777629372gmail-m_-6928066469225963281gmail-m_2083612832876678240gmail-m_1585271949393647574gmail-m_-485280682349819555gmail-m_6672558738276974937gmail-m_5619079691586473791gmail-m_8518759442569938gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><p style="margin-bottom:0.0001pt"><span style="color:rgb(31,73,125)" lang="EN-US"><span style="font-size:11pt;line-height:16.8667px;font-family:Calibri,sans-serif" lang="EN-US">__________________________________</span></span></p><p style="margin-bottom:0.0001pt"><span style="color:rgb(31,73,125)" lang="EN-US"><span style="font-size:11pt;line-height:16.8667px;font-family:Calibri,sans-serif" lang="EN-US">Andreas Gravgaard Andersen</span></span></p><div><p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;color:black"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Department of Oncology, </span></p><p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;color:black"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Aarhus University Hospital<u></u><u></u></span></p><p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;color:black"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)" lang="DA">Nørrebrogade 44,</span></p><p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;color:black"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)" lang="DA">8000, Aarhus C<u></u></span></p><p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;color:black"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)" lang="DA">Mail:     <a href="mailto:agravgaard@protonmail.com" target="_blank">agravgaard@protonmail.com</a></span></p><p style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;color:black"><span style="color:rgb(31,73,125);font-family:Calibri,sans-serif;font-size:11pt">Cell:     </span><span style="color:rgb(31,73,125);font-family:Calibri,sans-serif;font-size:11pt"> </span><a value="+4523382411" style="font-family:Calibri,sans-serif;font-size:11pt;color:rgb(17,85,204)">+45 3165 8140</a></p></div></div></div></div></div></div></div></div><br></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, 16 Jan 2019 at 22:59, tao sun <<a href="mailto:colddiesun@gmail.com" target="_blank">colddiesun@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><span style="color:rgb(0,0,0)">Hi,</span><div style="color:rgb(0,0,0)"><br></div><div style="color:rgb(0,0,0)">I have read in some image using  itk::ImportImageFilter. </div><div style="color:rgb(0,0,0)"> ImportFilterType::Pointer projectionReader = ImportFilterType::New();<br></div><div style="color:rgb(0,0,0)">...</div><div style="color:rgb(0,0,0)"> projectionReader->Update();<br></div><div style="color:rgb(0,0,0)"><br></div><div style="color:rgb(0,0,0)">The type of the image is itk:::Image<float,3>. I wonder if there is any way I can cast it to itk::CudaImage<float,3>? </div><div style="color:rgb(0,0,0)">In rtkforwardprojections.cxx the imageReaderType is defined as CudaImageType so there is no such problem.</div><div style="color:rgb(0,0,0)"><br></div><div style="color:rgb(0,0,0)">Thanks,</div><div style="color:rgb(0,0,0)">Tao</div></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="https://public.kitware.com/mailman/listinfo/rtk-users" rel="noreferrer" target="_blank">https://public.kitware.com/mailman/listinfo/rtk-users</a><br>
</blockquote></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="https://public.kitware.com/mailman/listinfo/rtk-users" rel="noreferrer" target="_blank">https://public.kitware.com/mailman/listinfo/rtk-users</a><br>
</blockquote></div>
</blockquote></div>
</blockquote></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="https://public.kitware.com/mailman/listinfo/rtk-users" rel="noreferrer" target="_blank">https://public.kitware.com/mailman/listinfo/rtk-users</a><br>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></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="https://public.kitware.com/mailman/listinfo/rtk-users" rel="noreferrer" target="_blank">https://public.kitware.com/mailman/listinfo/rtk-users</a><br>
</blockquote></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="https://public.kitware.com/mailman/listinfo/rtk-users" rel="noreferrer" target="_blank">https://public.kitware.com/mailman/listinfo/rtk-users</a><br>
</blockquote></div>
</blockquote></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="https://public.kitware.com/mailman/listinfo/rtk-users" rel="noreferrer" target="_blank">https://public.kitware.com/mailman/listinfo/rtk-users</a><br>
</blockquote></div>