Skip to content

Commit

Permalink
Merge pull request #713 from mspronesti/master
Browse files Browse the repository at this point in the history
fix(dev/cuda): memory leaks
  • Loading branch information
karpathy authored Jul 28, 2024
2 parents 362c6a8 + c6e74ea commit 7379cd1
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev/cuda/attention_backward.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,7 @@ int main(int argc, char **argv) {
free(dinp);
free(dpreatt);
free(datt);
free(h_dinp);
cudaCheck(cudaFree(d_inp));
cudaCheck(cudaFree(d_qkvr));
cudaCheck(cudaFree(d_preatt));
Expand Down
1 change: 1 addition & 0 deletions dev/cuda/attention_forward.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1377,6 +1377,7 @@ int main(int argc, char **argv) {
cudaCheck(cudaFree(d_preatt));
cudaCheck(cudaFree(d_att));
cudaCheck(cudaFree(d_inp));
cudaCheck(cudaFree(d_stats));
cublasDestroy(cublas_handle);

#ifdef ENABLE_CUDNN
Expand Down
1 change: 1 addition & 0 deletions dev/cuda/classifier_fused.cu
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@ int main(int argc, char **argv) {
cudaCheck(cudaFree(d_logits));
cudaCheck(cudaFree(d_dlosses));
cudaCheck(cudaFree(d_targets));
cudaCheck(cudaFree(d_dlogits_no_pad));

return 0;
}
1 change: 1 addition & 0 deletions dev/cuda/nccl_all_reduce.cu
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,6 @@ int main(int argc, char **argv) {

free(all_reduce_buffer_host);
cudaCheck(cudaFree(all_reduce_buffer));
cudaCheck(cudaFree(all_reduce_buffer_recv));
multi_gpu_config_free(&multi_gpu_config);
}
1 change: 1 addition & 0 deletions dev/cuda/trimat_forward.cu
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ int main(int argc, char **argv) {
free(inp);
cudaCheck(cudaFree(d_out));
cudaCheck(cudaFree(d_inp));
cudaCheck(cudaFree(d_qkvr));
cublasDestroy(cublas_handle);

return 0;
Expand Down

0 comments on commit 7379cd1

Please sign in to comment.