Sample Projects including data folder don't work, but those without data folder are working.

I installed the CUDA 5.0 on Mac OSX 10.8.2 with GeForce GT 650M.

All the samples are compiled successfully.

But the samples including data folder don’t work, like oceanFFT, FunctionPointers, matrixMulDrv, etc.

Other samples without data folder are working, like matrixMul, nobody, etc.

For example, when running oceanFFT, the Error is

Error unable to find GLSL vertex and fragment shaders!

which came from oceanFFT.cpp

bool initGL(int *argc, char **argv)
      {
         ...
         vertShaderPath = sdkFindFilePath("ocean.vert", argv[0]);
         fragShaderPath = sdkFindFilePath("ocean.frag", argv[0]);

          if (vertShaderPath == NULL || fragShaderPath == NULL)
           {
              fprintf(stderr, "Error unable to find GLSL vertex and fragment shaders!\n");
              exit(EXIT_FAILURE);
           }
          ...
      }

When running FunctionPointers, the error is

Failed to read image file: <lena.pgm>

which is from FunctionPointers.cpp

void loadDefaultImage(char *loc_exec)
     {
        ...
        const char *image_filename = "lena.pgm";
        char *image_path = sdkFindFilePath(image_filename, loc_exec);

        if (image_path == NULL)
        {
             printf("Failed to read image file: <%s>\n", image_filename);
             exit(EXIT_FAILURE);
        }
        ...
     }

I guess that sdkFindFilePath() may be wrong or something is missing. Does anyone knows how to solve it?

Thanks!!!

I’ve met same error now.
According to the source code, it searches in the data directory which is specified by the relative path from the current directory.
To enable relative path properly, run the sample at the original directory such as /usr/local/cuda/samples/bin/MACHINE/linux/release/XXXXX/

I have been struggling with this too albeit several years later having just managed to get my GeForce GT 750M working on Mac OS X High Sierra 10.13.3 build 17D102, and finally getting rid of the boot warning that CUDA needs updating even though the same screen says it is using the latest update … , so apologies if the ship has sailed.
My mistake was to be trying to run the binaries by double-clicking on them in Finder, which works for things like particles which don’t load external files, but not in any of the cases where additional files are needed, as in oceanFFT and others that can’t find “Bucky.raw” in the /data/ folder.
The solution is to run them from terminal by navigating to wherever the compiled binary has been written and then using $ ./oceanFFT , because then the argv[0] optional parameter in the sdkFindFilePath (see above) knows what to look for in which of the sample subdirectories. That also obviously allows the command-line parameters to be used, where provided, which double-clicking doesn’t.
I may be the only person on the planet to whom this isn’t obvious, but just in case …