<div dir="ltr"><div><div><div><div><div>Hi,<br></div>Interesting! I have never worked on that so... good luck! I have no idea why you get this error, maybe one of the filter is not threadsafe? But in my experience, ITK filters can be used like this. Maybe there is one issue in our CUDA framework which has never been tested in such a manner.<br></div>I think you don't have to do your grep but replace the line<br>    m_DeviceIdx = itk::CudaGetMaxFlopsDev();<br></div>with the device of your choice in utilities/ITKCudaCommon/src/itkCudaContextManager.cxx. All the other cuCtxSetCurrent depend on that choice. What I would have done is changed this via an (optional) env variable and run rtkfdk twice to create each subvolume, each with a different thread.<br></div>Good luck and keep us posted if you have a working solution.<br></div>Simon<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Oct 15, 2016 at 9:30 AM, Boris Lahmadulin <span dir="ltr"><<a href="mailto:zagahulik@gmail.com" target="_blank">zagahulik@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 dir="ltr"><div><div><div><div><div><div><div>       Hello. I work with high resolution projections (32 mp) and reconstuction takes some longstanding time. At the same time there are two video cards in my computer, but uses only one. I wonder if i can use two video cards to reduce reconstruction time.<br></div>What i tried to do in short:<br><br></div>- execute this script on newest rtk revisiion<br>for ($i in $(grep -nrl "cuCtxSetCurrent" utilities/ITKCudaCommon/*))<br>    echo "!$i"<br>    p="_"<br>    grep -vE "(cuCtxSetCurrent)" $i > $i$p<br>    mv $i$p $i<br>done<br></div><div>i.e. remove all lines where happens setting of video card context<br></div><div><br></div>- in rtkfdk.cxx by using posix threads create two threads, where i set contexts through cuCtxSetCurrent(0) and cuCtxSetCurrentset(1) correspondingly and wait for signals;<br></div>- in main thread for each working thread it created separated graphs, with reader, ddf, pssf, constant   (which is splitted by two, i.e. dimension[1] /= 2; origin+= ), fdk. <br>- then fdk pointers put to shared data, so working threads can use them. After all signal is emmited  and fdk->update() is called at working threads<br></div>- since job is done, i copy two resulted subvolumes to one and save.<br><br></div>it works and reconstuction time is reduced for about 1.5 times! However, if i run it a lot of times, finally it crashes with<br><br>img->GetRequestedRegion() = [ img->GetRequestedRegion() = [ ImageRegionImageRegion ( (0x7f45f02293600x7f45f0229360)<br>)<br>  Dimension:   Dimension: 0x30x3<br>  Index: <br>  Index: [[00, , 0x14d0x14d, , 0xcf0xcf]]<br>  Size: <br>  Size: [[0x3e8, 0x14f, 0x3e8, 0x1]0x14f, <br> ]<br>img->GetLargestPossibleRegion(<wbr>) = [ 0x1ImageRegion (]0x7f45f0229328)<br><br>  Dimension:  ]<br>img->GetLargestPossibleRegion(<wbr>) = [ ImageRegion (0x30x7f45f0229328<br>)<br>  Index: [0, 0, 0]<br>  Size: [0x3e8, 0x29a, 0x1bc]<br> ]<br>  Dimension: 0x3<br>  Index: [0, 0, 0]<br>  Size: [0x3e8, 0x29a, 0x1bc]<br> ]<br>ExceptionObject caught with arg->fdk->Update() in file rtkfdk.cxx line ExceptionObject caught with arg->fdk->Update() in file 242<br>rtkfdk.cxx line 242<br><br><br>itk::<wbr>InvalidRequestedRegionError (itk::<wbr>InvalidRequestedRegionError (0x7f45d048a100)<br>0x7f45d85a9ee0)<br>Location: "unknown" <br>Location: "unknown" <br>File: /home/koza/thirdparty/<wbr>InsightToolkit-4.8.0/Modules/<wbr>Core/Common/src/itkDataObject.<wbr>cxx<br>Line: File: /home/koza/thirdparty/<wbr>InsightToolkit-4.8.0/Modules/<wbr>Core/Common/src/itkDataObject.<wbr>cxx<br>Line: 393<br>Description: Requested region is (at least partially) outside the largest possible region.<br><br>393<br>Description: Requested region is (at least partially) outside the largest possible region.<br><br><br></div><div>It seems that itk classes are not reenterable, Is there way to fix it ? Or is there another way to make several video cards using for reconstuction in parallel ?<br><br></div><div>Thanks.<br></div></div>
<br>______________________________<wbr>_________________<br>
Rtk-users mailing list<br>
<a href="mailto:Rtk-users@public.kitware.com">Rtk-users@public.kitware.com</a><br>
<a href="http://public.kitware.com/mailman/listinfo/rtk-users" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/rtk-users</a><br>
<br></blockquote></div><br></div>