Hi,
I have question/problem - when program run, first time are very big than the others. Is this problem with the allocate memory on device?
#include <stdio.h>
#include <stdlib.h>
#include <cutil_inline.h>
void test(int i)
{
unsigned int timer = 0;
bool *a;
cutCreateTimer(&timer);
cutStartTimer(timer);
cudaMalloc( (void**)&a , 1);
cudaThreadSynchronize();
cudaFree(a);
cutStopTimer( timer);
printf("Time %i: %f (ms)\n", i, cutGetTimerValue( timer));
cutDeleteTimer( timer);
}
int main()
{
for(int x=0;x<10;x++)
test(x);
return 1;
}
Results:
Time 0: 93.683044 (ms)
Time 1: 0.423039 (ms)
Time 2: 0.411558 (ms)
Time 3: 0.390508 (ms)
Time 4: 0.394750 (ms)
Time 5: 0.385538 (ms)
Time 6: 0.385568 (ms)
Time 7: 0.437777 (ms)
Time 8: 0.390998 (ms)
Time 9: 0.404124 (ms)
How can i resove this problem? Suggestions? Please help!