Function library

Hi all, I have very basic question: where can I find function database to search a full description of any cuda function, for example, I cannot find description of the function findCudaDevice.
Thanks, Mikhail

All CUDA documentation is conveniently listed in one place: http://docs.nvidia.com/cuda/

Based on naming convention, I do not think that findCudaDevice() is a CUDA API function. This may be a function defined as a helper function in one of the SDK sample programs. If it is not defined locally in the source file you are looking at, check the header file(s) your code includes. [Later:] A quick Google search suggests that helper_cuda.h may be the header file you want.

Thanks! So where can i find information about helper_cuda.h. If it is not CUDA API, where it came from?
And what is SDK?

helper_cuda.h is a header file from the “inc” subdirectory of the CUDA samples that ship with CUDA. I have no way of knowing whether the CUDA samples are installed on your machine. If you installed CUDA yourself, you would probably be aware of this because I seem to recall this part of the installation is optional. You may simply want to search the relevant portion of your directory tree for the file name to see if the file helper_cuda.h is present on your machine. For your reference, below is the findCudaDevice() function as found in the file helper_cuda.h of my local installation of CUDA 6.5.

// Initialization code to find the best CUDA Device
inline int findCudaDevice(int argc, const char **argv)
{
    cudaDeviceProp deviceProp;
    int devID = 0;

    // If the command-line has a device number specified, use it
    if (checkCmdLineFlag(argc, argv, "device"))
    {
        devID = getCmdLineArgumentInt(argc, argv, "device=");

        if (devID < 0)
        {
            printf("Invalid command line parameter\n ");
            exit(EXIT_FAILURE);
        }
        else
        {
            devID = gpuDeviceInit(devID);

            if (devID < 0)
            {
                printf("exiting...\n");
                exit(EXIT_FAILURE);
            }
        }
    }
    else
    {
        // Otherwise pick the device with highest Gflops/s
        devID = gpuGetMaxGflopsDeviceId();
        checkCudaErrors(cudaSetDevice(devID));
        checkCudaErrors(cudaGetDeviceProperties(&deviceProp, devID));
        printf("GPU Device %d: \"%s\" with compute capability %d.%d\n\n", devID, deviceProp.name, deviceProp.major, deviceProp.minor);
    }

    return devID;
}

Thanks for the response. Yes, I know where this file is located. But is there a documentation for the functions defined in helper_cuda.h (and other SDK) files?

helper_functions.h seems to be a collection of relatively simple functions designed to unclutter the source code sample apps by moving boiler-plate code to a separate location. There does not seem to be any formal documentation, and frankly I see little need for that since this is not part of the CUDA API in any sense. The source code and comments should be sufficient to understand what each function does and how it operates: “Use the source, Luke!”

Note that such helper functions are there for the convenience of the sample app authors, and can change or disappear at any time, so CUDA programmers should not rely on this functionality for their own apps.

Got it, great Master!