<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() = [ 0x1ImageRegion (]0x7f45f0229328)<br><br>  Dimension:  ]<br>img->GetLargestPossibleRegion() = [ 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::InvalidRequestedRegionError (itk::InvalidRequestedRegionError (0x7f45d048a100)<br>0x7f45d85a9ee0)<br>Location: "unknown" <br>Location: "unknown" <br>File: /home/koza/thirdparty/InsightToolkit-4.8.0/Modules/Core/Common/src/itkDataObject.cxx<br>Line: File: /home/koza/thirdparty/InsightToolkit-4.8.0/Modules/Core/Common/src/itkDataObject.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>