4 Replies Latest reply on Feb 6, 2012 9:38 AM by notyou

    Kernel caching code?

    thesmileman

      Does anyone have code to cache the kernel binaries and source then check for modifications before building them from scratch? I am sure someone has to have done as it takes a very long time to build kernels. It was just a hassle at first but now the time is really starting to add up when I have a chain of kernels and I change one kernel and I have to rebuild them all. Anyway I thought I would ask because I assume someone has done this and I didn't want to reinvent the wheel for such a common task plus I am sure someone has done something more robust than what I am going to write.

       

      Would like to see this as part of the SDK. (wink, wink, wink AMD).

        • Re: Kernel caching code?
          notyou

          I have some basic code that I use to check the binaries. I'll post it in a few hours when I get home.

          • Re: Kernel caching code?
            notyou

            Since this was just something I whipped up for my own use it's not great quality. You'll need to go over things like error checking here since I didn't include the additional files.

             

            Note: I'm OK if anyone uses this exact (or modified) code. If you do, just send me a message since I'd like to know where it's being used (out of curiosity).

              • Re: Kernel caching code?
                thesmileman

                @notyou,

                 

                Thanks for the code! I went through it pretty quicak and it looks great. I was thinking about saving a backup of source file and the binary so I could do a string compare rather than a modified check but I think your way here is easier and most likely the right way to go because it will be faster and that is the goal. I haven't tested it yet because I want to look it over more and see how best to add it to my framework for building and especially my framework for device selecting (getting the correct interop device can get a bit complex especially with multiple GPUs so I have a lot of code for that). .Also I usually build the kernels seperately as I have a framework for stringing together kernels but that is trivial stuff. Thanks for the awesome time saver!

                  • Re: Kernel caching code?
                    notyou

                    Glad I could help. I definitely thought of using strings when I was building it but I realized that if they changed anything in the file the date modified would reflect that so we wouldn't need to look at the actual file. This in turn would handle of 99% of situations aside from any weird editing problems.