[Insight-developers] Patching a patch : Multithreader / Tread ID Type

David Doria daviddoria at gmail.com
Tue May 31 16:35:12 EDT 2011


On Sun, May 29, 2011 at 7:23 AM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
> Hi David,
>
> Here is how your patch:
> http://review.source.kitware.com/#change,1649
>
> has been modified in order to replace "unsigned int"
> with the typedefed "ThreadIdType".
>
> ----------------------------------------------------------------------
>
> 1) Recover your patch from Gerrit:
>
> git fetch ssh://ibanez@review.source.kitware.com:29418/ITK
> refs/changes/49/1649/2 && git checkout FETCH_HEAD -b Threads
>
> 2) Generate a patch file with respect to the previous commit:
>
> git    format-patch   -1
>
> This resulted in the file:
>
> 0001-ENH-Changed-number-of-threads-to-unsigned-int-throug.patch
>
> 3) Then we edit that file with sed:
>
> sed 's/^+.*unsigned int/&ThreadIdType/g'
> 0001-ENH-Changed-number-of-threads-to-unsigned-int-throug.patch >
> 0001-ENH-Changed-number-of-threads-to-unsigned-int-throug2.patch
>
>
> sed 's/unsigned intThreadIdType/ThreadIdType/g'
> 0001-ENH-Changed-number-of-threads-to-unsigned-int-throug2.patch >
> 0001-ENH-Changed-number-of-threads-to-unsigned-int-throug3.patch
>
>
>
> 4) Then go back to the previous commit
>
>  git checkout HEAD^
>
>
>
> 5) create a branch out of it:
>
>  git checkout -b Threads2
>
>
>
> 6) check the patch for potential issues:
>
> git apply --check
> 0001-ENH-Changed-number-of-threads-to-unsigned-int-throug3.patch
>
>
>
> 7) then apply the patch:
>
>  git am < 0001-ENH-Changed-number-of-threads-to-unsigned-int-throug3.patch
>
>
>
> 8) Then modify the int types file:
>
> gvim Modules/Core/Common/include/itkIntTypes.h
>
> add the lines
>
> @@ -153,6 +153,9 @@ typedef signed long   OffsetValueType;
>
>  #endif
>
> +/** Type to count and reference number of threads */
> +typedef unsigned int  ThreadIdType;
> +
>  }
>
>
> 9)  Start compiling....
>
> Discover that now the itkMultiTheader.h file must include
> the itkIntTypes.h.
>
> index 34788ad..2be8251 100644
> --- a/Modules/Core/Common/include/itkMultiThreader.h
> +++ b/Modules/Core/Common/include/itkMultiThreader.h
> @@ -30,6 +30,7 @@
>
>  #include "itkMutexLock.h"
>  #include "itkThreadSupport.h"
> +#include "itkIntTypes.h"
>
>  namespace itk
>  {
>
>
> 10) Continue compiling...
>
> 11) added a couple more modifications (FFTW file...)
>
> 12) Send the modified patch back to Gerrit:
>
> So, now we have Patch #3 in:
> http://review.source.kitware.com/#change,1649
>
>
>
> -------------------------
>
> The patch is now missing the XML file that describes
> the API change.
>
> You can generate this file by running:
>
> cd      ~/src/ITK
>
> ./Documentation/Migration/InitializeXMLGuide.py
>
> then enter a unique filename such as
>
> ChangeMultiThreaderAPI-ThreadIdType.xml
>
> The file will be put the directory:
>
> ./Documentation/Migration/
>
> and then you can "git add" it and make it
> part of the patch at the moment of doing
> "git merge".
>
>
>
>     Thanks
>
>
>          Luis
>

Thank you for the detailed procedure.

Just a follow up with the status - before I add the migration guide, I
am waiting on the cdash at home builds to finish. There only seems to be
one OS so far (Mac):

http://www.cdash.org/CDash/index.php?project=Insight&filtercount=2&field1=buildname/string&compare1=63&value1=Threads2&field2=buildstarttime/date&compare2=83&value2=2011-5-29

Cory mentioned that there were warnings after these changes so I am
waiting to see if they show up on the other builds.

David


More information about the Insight-developers mailing list