System: MacPro with OSX10.5.4 and an NVIDIA GeForce8800GT.
cuInit() in the test file below returns CUDA_ERROR_NO_DEVICE. Any ideas?
System specifics:
Chipset Model: NVIDIA GeForce 8800 GT
Type: Display
Bus: PCIe
Slot: Slot-1
PCIe Lane Width: x16
VRAM (Total): 512 MB
Vendor: NVIDIA (0x10de)
Device ID: 0x0602
Revision ID: 0x00a2
ROM Revision: 3233
Modifed from code posted by Mass Fatica (NVIDIA)
/*
suggested:
g++ -o gpumeminfo gpumeminfo.c -I /usr/local/cuda/include/ -L /usr/local/cuda/lib/ -lcuda
worked:
nvcc gpumeminfo.c -lcuda
*/
#include <cuda.h>
#include <stdio.h>
static unsigned long inKB(unsigned long bytes)
{ return bytes/1024; }
static unsigned long inMB(unsigned long bytes)
{ return bytes/(1024*1024); }
static void printStats(unsigned long free, unsigned long total)
{
printf("^^^^ Free : %lu bytes (%lu KB) (%lu MB)\n", free, inKB(free), inMB(free));
printf("^^^^ Total: %lu bytes (%lu KB) (%lu MB)\n", total, inKB(total), inMB(total));
printf("^^^^ %f%% free, %f%% used\n", 100.0*free/(double)total, 100.0*(total - free)/(double)total);
}
int main(int argc, char **argv)
{
unsigned int free, total;
int gpuCount, i;
CUresult res;
CUdevice dev;
CUcontext ctx;
CUresult e = cuInit(0);
printf("error %d\n", e); /* prints: "error 100" */
cuDeviceGetCount(&gpuCount);
printf("Detected %d GPU\n",gpuCount);
for (i=0; i<gpuCount; i++)
{
cuDeviceGet(&dev,i);
cuCtxCreate(&ctx, 0, dev);
res = cuMemGetInfo(&free, &total);
if(res != CUDA_SUCCESS)
printf("!!!! cuMemGetInfo failed! (status = %x)", res);
printf("^^^^ Device: %d\n",i);
printStats(free, total);
cuCtxDetach(ctx);
}
return 0;
}