cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

escapeclause
Adept I

Cannot find video card

calGetDeviceCount and calDeviceGetAttribs problem

Code quoted below... card is an MSI R4890 T2DIG in a DFI LanParty JR P45 board, everything running at stock clocks.

Fedora 8 x86_64, KDE 3.5, CAL v 1.4.283, GCC 4.1.2, ATI driver 9.5

I have found two problems, the first perhaps not a big deal, the second quite worrying.

1) calDeviceGetAttribs() reports zero for GPU device clock rate and GPU memory clock rate. It's a new chip, is CAL just not aware of it?

2) Code quoted below initially found the 4890 card and reported results from calGetDeviceAttribs(). Now, two days later, same code cannot find the card, calGetDeviceCount() says zero devices. All the functions return CAL_RESULT_OK. If I change the code so calGetDeviceAttribs() gets called regardless, it returns junk values in the CALdeviceattribs struct.

Does anyone have a suggestion how I can get CAL to see the video card?


#include <stdio.h>
#include <cal.h>

/** Device Kernel ISA */
/* from cal.h CALtargetEnum */
char *isa_targets[] = {"R600 GPU ISA", "RV610 GPU ISA",
                                     "RV630 GPU ISA", "RV670 GPU ISA",
                                     "R700 class GPU ISA", "RV770 GPU ISA",
                                     "RV710 GPU ISA", "RV730 GPU ISA"};

/* #define RETURNS 1
*/

void print_info(CALdeviceattribs a);
void print_status(CALdevicestatus s, int ordinal);
void print_return(int rtn, char *msg);

int main(int argc, char **argv) {
   int ii = 0;
   CALresult rtn = CAL_RESULT_OK;
   CALuint v_major, v_minor, v_imp;
   CALuint nDevice = 0;
   CALdeviceattribs attribs;
   CALdevice device;
   CALdevicestatus status;

   rtn = calInit();
   print_return(rtn, "calInit ");

   rtn = calGetVersion(&v_major, &v_minor, &v_imp);
   print_return(rtn, "calGetVersion ");
   printf("CAL version %d.%d.%d\n", v_major, v_minor, v_imp);

   rtn = calDeviceGetCount(&nDevice);
   print_return(rtn, "calGetCount ");
   printf("Found %d devices.\n", nDevice);

   for (ii=0; ii < nDevice; ii++) {
     attribs.struct_size = sizeof(CALdeviceattribs);
      rtn = calDeviceGetAttribs(&attribs, ii);
      printf("Device %d info:\n", ii);
      print_info(attribs);

      rtn = calDeviceOpen(&device, ii);
      status.struct_size = sizeof(CALdevicestatus);
      rtn = calDeviceGetStatus(&status, device);
      print_status(status, ii);
      calDeviceClose(ii);
   }

   rtn = calShutdown();
}

void print_info(CALdeviceattribs a) {
printf("\
\t%s\tAsic identifier \n\
\t%d\tAmount of local GPU RAM in megabytes \n\
\t%d\tAmount of uncached remote GPU memory in megabytes \n\
\t%d\tAmount of cached remote GPU memory in megabytes \n\
\t%d\tGPU device clock rate in megahertz \n\
\t%d\tGPU memory clock rate in megahertz \n\
\t%d\tWavefront size \n\
\t%d\tNumber of SIMDs \n\
\t%d\tdouble precision supported \n\
\t%d\tlocal data share supported \n\
\t%d\tglobal data share supported \n\
\t%d\tglobal GPR supported \n\
\t%d\tcompute shader supported \n\
\t%d\tmemexport supported \n\
\t%d\tRequired alignment for calCreateRes allocations (in data elements)\n\
\t%d\tRequired start address alignment for calCreateRes allocations (in bytes)\n",
isa_targets[a.target],
a.localRAM,
a.uncachedRemoteRAM,
a.cachedRemoteRAM,
a.engineClock,
a.memoryClock,
a.wavefrontSize,
a.numberOfSIMD,
a.doublePrecision,
a.localDataShare,
a.globalDataShare,
a.globalGPR,
a.computeShader,
a.memExport,
a.pitch_alignment,
a.surface_alignment
);
}

void print_status(CALdevicestatus s, int ordinal) {
   printf("Device %d status:\n", ordinal);
   printf("\t%d\tavailable local RAM\n", s.availLocalRAM);
   printf("\t%d\tavailable uncached remote RAM\n", s.availUncachedRemoteRAM);
   printf("\t%d\tavalable cached remote RAM\n", s.availCachedRemoteRAM);
}

void print_return(int rtn, char *msg) {
#ifdef RETURNS
   printf("%s\t", msg);
   switch (rtn) {
      case CAL_RESULT_ERROR:
         printf("CAL_RESULT_ERROR\n");
         break;
      case CAL_RESULT_ALREADY:
         printf("CAL_RESULT_ALREADY\n");
         break;
      case CAL_RESULT_OK:
         printf("CAL_RESULT_OK\n");
         break;
      case CAL_RESULT_NOT_INITIALIZED:
         printf("CAL_RESULT_INITIALIZED\n");
         break;
      case CAL_RESULT_INVALID_PARAMETER:
         printf("CAL_RESULT_INVALID_PARAMETER\n");
         break;
      default:
         printf("Unknown return value.\n");
         break;
   }
#endif
}


Output originally was:

CAL version 1.4.283
Found 1 devices.
Device 0 info:
        RV770 GPU ISA   Asic identifier
        1024    Amount of local GPU RAM in megabytes
        0       Amount of uncached remote GPU memory in megabytes
        1979    Amount of cached remote GPU memory in megabytes
        0       GPU device clock rate in megahertz
        0       GPU memory clock rate in megahertz
        64      Wavefront size
        10      Number of SIMDs
        1 (b)   double precision supported
        1 (b)   local data share supported
        0 (b)   global data share supported
        1 (b)   global GPR supported
        1 (b)   compute shader supported
        1 (b)   memexport supported
        64      Required alignment for calCreateRes allocations (in data elements)
        256     Required start address alignment for calCreateRes allocations (in bytes)
Device 0 status:
        1001    available local RAM
        0       available uncached remote RAM
        1962    avalable cached remote RAM



...but now it is just:

CAL version 1.4.283
Found 0 devices.



0 Likes
1 Reply
escapeclause
Adept I

note to self: always read the KB.

I found the knowledgebase, and in it I found this: http://developer.amd.com/support/KnowledgeBase/Lists/KnowledgeBase/DispForm.aspx?ID=19

This solved the problem - I was logging in via SSH when my card not found problem occured and had been logged in at the console when the code ran properly.

0 Likes