cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

wpetchang
Adept I

Running the CODEXL teapot example

Jump to solution

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

0 Likes
1 Solution

Accepted Solutions
wpetchang
Adept I

Re: Running the CODEXL teapot example

Jump to solution

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;

}

View solution in original post

0 Likes
3 Replies
wpetchang
Adept I

Re: Running the CODEXL teapot example

Jump to solution

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;

}

View solution in original post

0 Likes
urishomroni
Staff
Staff

Re: Re: Running the CODEXL teapot example

Jump to solution

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,

wpetchang
Adept I

Re: Re: Running the CODEXL teapot example

Jump to solution

Thanks for the correct solution.

It will be my pleasure to continue to participate in the forum.

Peter

0 Likes