4 Replies Latest reply on Jul 26, 2011 4:04 AM by spectral

    Load/Save binary kernels



      I'm currently saving/loading binary kernels and have some questions :

      1) Is there a "platform ID" and a "device ID" that I can use to identify my binary file. I would like to be able to save my file "xxxx_PLATFORMID_DEVICE_ID.bin"

      But later, being able to copy theses ".bin" file to another machine. The platform ID and device ID must identify the specific platform and device even on different machines.

      2) Is there a way to save a "library" and not a complete "program". In my application I have 95% of the code in ".cl" files but 5% that is generated at run-time. So, I would like to avoid to recompile 100% and maybe merge a "bin" file with the 5% remainder of the program ?


        • Load/Save binary kernels

          hi viewon01,

          1.AFAIK, we are having a generate binary image function in SDK samples. When we run the sample with --dump option, it creates the kernel binary for all AMD devices and name these files on the devices name. I am not sure if device_id or platform_id are as reliable and friendly as platform_name and device name.

          2. I am not sure if i understand it correctly.But

          As I understand from library, it should be a group of functions capable of doing something useful. And AFAIK, you can have some set of headers and cl[Edited] files having those useful functions/kernels. And It should be possible to call them inside the main kernel

            • Load/Save binary kernels

              Thanks Himanshu,

              - What I have see in the samples (or I don't use the right sample that AMD provide), it names the devices 0,1,2,3,..... !!!

              - What I would like it to pre-compile the cl functions. (I cannot use headers because I do not provide the .cl file in the release version of the software). And so, I would like to compile and save the binaries of theses functions and later, when I compile the remainder of my software I must include theses functions too. But how to do this ?

                • Load/Save binary kernels

                  There's no -l equivalent in OpenCL. So, you can generate multiple binaries but they can't cross reference each other, but as long as you pass your various cl_programs around, you should be able to launch kernels from whichever ones you want.

                    • Load/Save binary kernels

                      Thanks Rick,

                      The problem is that 95% is always the same but another is generated at run-time.

                      So, I would like to find a way to "pre-compile" the "static" part of the code and merge it with the program.

                      I think that today there is no solution, but it is a good idea of "feature" for a next version of OpenCL ?