3 Replies Latest reply on Jan 13, 2015 4:21 PM by wpetchang

    Running the CODEXL teapot example

    wpetchang

      I am trying to get the teapot example to run in Microsoft Visual Studio 2013 Professional as the first step to learn CODEXL debugging environment inside VS2013. So far, the example built without errors. But when I tried to run it, all I got is a static teapot. The teapot is neither smoking or rotating. The same result is also observed with stand-alone AMD CODEXL  I also noticed while the program was running in debug mode, it produced the the following error message continuously.

       

      First-chance exception at 0x0130A7EA in AMDTTeaPot.exe: 0xC0000005: Access violation reading location 0xBAADF00D.

      First-chance exception at 0x0130A7EA in AMDTTeaPot.exe: 0xC0000005: Access violation reading location 0xBAADF00D.

      First-chance exception at 0x0130A7EA in AMDTTeaPot.exe: 0xC0000005: Access violation reading location 0xBAADF00D.

      First-chance exception at 0x0130A7EA in AMDTTeaPot.exe: 0xC0000005: Access violation reading location 0xBAADF00D.

       

      Any help will be appreciated.

       

      Regards,

      Peter Chang

        • Re: Running the CODEXL teapot example
          wpetchang

          I found a bug in the code.  In

           

          bool AMDTTeapotOCLSmokeSystem::chooseBestDevices()

          Near the end of the implementation of the method, comment the 'else" statement out. The original logic breaks when both Intel CPU  and AMD GPU OpenCL platforms and devices are presented in the system. The block of statements following "else" never get executed so

          _changeSmokeSimDevice
          _changeVolSliceDevice

           

          pointers contain NULL.

           

           

          // Comment the next line out

          //   else
          {
          // Set the best GPU and CPU device that will be used by the programs.
          // If there is no GPU device, use the CPU.
          _changeSmokeSimDevice = firstGPUDevice ? firstGPUDevice : bestCPUDevice;
          _changeVolSliceDevice = firstGPUDevice ? firstGPUDevice : bestCPUDevice;
          _dirtyFlags |= DIRTY_DEVICES;
          }
          }

           

          return retVal;

          }

            • Re: Re: Running the CODEXL teapot example
              urishomroni

              Hi wpetchang!

               

              First of all, nice catch! Thanks for updating the forum thread with your solution.

              You are now immortalized in the sample's source code !

               

              In fact, looking at the code, it seems all instances of "else if" in that block should be just "if"-s: The function is supposed to prefer AMD CPU > Intel CPU > any other CPU > no CPU.

              It also decides the function return value based solely on the presence of a CPU device (instead of considering the GPU device as well). The *real* correct code is:

               

                      // Thanks wpetchang from the AMD Dev Gurus forum for finding the issue here =)
                      if (firstIntelCPUDevice)
                      {
                          bestCPUDevice = firstIntelCPUDevice;
                      }
              
              
                      if (firstAMDCPUDevice)
                      {
                          bestCPUDevice = firstAMDCPUDevice;
                      }
              
                      if (!firstGPUDevice && !bestCPUDevice)
                      {
                          // No suitable devices!
                          retVal = false;
                      }
                      else
                      {
                          // Set the best GPU and CPU device that will be used by the programs.
                          // If there is no GPU device, use the CPU.
                          _changeSmokeSimDevice = firstGPUDevice ? firstGPUDevice : bestCPUDevice;
                          _changeVolSliceDevice = firstGPUDevice ? firstGPUDevice : bestCPUDevice;
                          _dirtyFlags |= DIRTY_DEVICES;
                      }
              

               

              This fix will be included in upcoming versions of CodeXL.

               

              Best regards,

              1 of 1 people found this helpful