Skip to content

Commit

Permalink
Fixed bad assumption about null pointer return from cudaFree which ca…
Browse files Browse the repository at this point in the history
…used a segmentation fault. Closes #37.
  • Loading branch information
mikeaclark committed Oct 18, 2011
1 parent 3de6e8f commit 981e1bf
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions lib/blas_quda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,30 @@ void initBlas(void)

void endBlas(void)
{
if (d_reduceFloat) cudaFree(d_reduceFloat);
if (d_reduceComplex) cudaFree(d_reduceComplex);
if (d_reduceFloat3) cudaFree(d_reduceFloat3);
if (h_reduceFloat) cudaFreeHost(h_reduceFloat);
if (h_reduceComplex) cudaFreeHost(h_reduceComplex);
if (h_reduceFloat3) cudaFreeHost(h_reduceFloat3);
if (d_reduceFloat) {
cudaFree(d_reduceFloat);
d_reduceFloat = 0;
}
if (d_reduceComplex) {
cudaFree(d_reduceComplex);
d_reduceComplex = 0;
}
if (d_reduceFloat3) {
cudaFree(d_reduceFloat3);
d_reduceFloat3 = 0;
}
if (h_reduceFloat) {
cudaFreeHost(h_reduceFloat);
h_reduceFloat = 0;
}
if (h_reduceComplex) {
cudaFreeHost(h_reduceComplex);
h_reduceComplex = 0;
}
if (h_reduceFloat3) {
cudaFreeHost(h_reduceFloat3);
h_reduceFloat3 = 0;
}
}

void setBlasTuning(QudaTune tune)
Expand Down

0 comments on commit 981e1bf

Please sign in to comment.