8 Replies Latest reply on May 5, 2014 11:34 AM by endoerner

    cannot open source file on .cl file only with AMD APP SDK under VS2012


      Hi to everyone,


      I have a very weird problem with an OpenCL project under VS2012 only when a use a PC with the AMD APP SDK.


      It is a main .cl file that includes some source .cl files (specifically a RNG for GPU), the console message is as follows:


      Platform[0]: AMD Accelerated Parallel Processing

      Chosen Platform:0

      Device[0]: Tahiti

      Device[1]: Tahiti

      Device[2]: AMD Phenom(tm) II X6 1100T Processor

      Chosen Device:0

      clBuildProgram: Error code -11

      Build log: "C:\Users\EDGARD~1\AppData\Local\Temp\OCLB474.tmp.cl", line 1: catast

      rophic error:

                cannot open source file "mwc64x_rng.cl"

        #include "mwc64x_rng.cl"



      1 catastrophic error detected in the compilation of "C:\Users\EDGARD~1\AppData\L


      Compilation terminated.

      Frontend phase failed compilation.

      clCreateKernel: Error code -46

      Press any key to continue . . .


      The strange thing is that under a second PC with the Intel OpenCL SDK, under VS2012, the error does not appear and the

      Kernel compiles and executes without problems. I attached the codes. Thanks for your help!

        • Re: cannot open source file on .cl file only with AMD APP SDK under VS2012



          Try changing the compiler option with -I when calling clBuildProgram() function.

          clBuildProgram() allows you to specify compiler options which include the include file directories. In your case, for cl files directory, it will be something like the string:

          -I myKernelSourceDir1 -I myKernelSourceDir2 ...


          Please update us back, if you still see the same behavior.


          The other alternative is to use clLinkProgram from OpenCL 1.2.

          1. First create separate program objects from separate source files using clCreateProgramWithSource.

          2. Then build the program separately using clBuildProgram.

          3. After building, link these program objects using clLinkProgram.

          4. Now this final Program object could be used to create OpenCL kernels.