jbinski

5970 allocate 2 GB of ram in 5970

Discussion created by jbinski on Mar 9, 2010

I am trying to allocate 1 GB of ram for each GPU on my 5970.  I am using the following code:

    calDeviceGetCount(&numDevices);
    printf("Nb devices: %i\n",numDevices);

    CALdevice device1 = 0;
    if(calDeviceOpen(&device1, 0) != CAL_RESULT_OK) {
                fprintf(stderr, "\tThere was an error opening device.\n");
    }

    CALdevice device2 = 0;
    if(calDeviceOpen(&device2, 1) != CAL_RESULT_OK) {
                fprintf(stderr, "\tThere was an error opening device.\n");
    }

    printf("Device 0 %li Device 1 %li\n",device1,device2);

    CALuint nb = 800;
    CALresource resLocal[nb];
    for(int i=0; i<nb; i++) {
        resLocal=0;
        if(calResAllocLocal2D(&resLocal
,device1,256,256,CAL_FORMAT_FLOAT32_4,0)!=CAL_RESULT_OK) {
                printf("Error in calResAllocaLocal2D:%u\n",nb);
        }
    }

    CALresource resLocal2[nb];
    for(int i=0; i<nb; i++) {
        resLocal2=0;
        if(calResAllocLocal2D(&resLocal2
,device2,256,256,CAL_FORMAT_FLOAT32_4,0)!=CAL_RESULT_OK) {
                printf("Error in calResAllocaLocal2D:%u\n",nb);
        }
    }
But for some reason I am over allocating, and not letting me take the second GPU's ram.  Can someone please give me a hand.

 

Thanks

Outcomes