I would never want to see such error again…

In main, I have

x = (float *)  malloc(ncols * sizeof(float));
randomizeFloatVector(x, ncols * sizeof(float) );

The function randomFloatVector is defined as

void randomizeFloatVector(float * vec, int size){
    for(int i = 0; i < size; i++){
        float r = ((float) rand()) /  (RAND_MAX);
        *(vec+i) = r;
    }
}

It kept (randomly) showing “segment fault” for hours, until I found the very subtle size issue.

In order to excuse myself, I have to say… malloc is evil!

BTW, is Tesla 2075 that legacy? Even cuda 6.5 cannot produce legit code for it (had to switch to cude 5.5’s nvcc). Stranded by “cudaErrorInvalidDeviceFunction” for another couple of hours.

 

Leave a Reply

Your email address will not be published. Required fields are marked *