Automatically selecting NVIDIA / AMD GPU on a Laptop

NVIDIA and AMD produce fast GPUs. However with laptops you will probably out of the box automatically be using an Intel GPU rather than the rather expensive NVIDIA/AMD GPU that you bought with your high end gaming/business laptop.

The following tweak on Windows will select the NVIDIA / AMD GPU in preference to the Intel GPU:

extern "C" {
  __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
  __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
} 

If your application crashes after enabling the above either look at why the application crashes or don't use this tweak.

References:

Comments