torch.utils.cpp_extension

Created
Created
2024 May 9 17:27
Editor
Creator
Creator
Seonglae ChoSeonglae Cho
Edited
Edited
2024 May 9 17:30
Refs
Refs
CUDA

Write and Use Custom CUDA Extensions for Critical Operations
llm.c
karpathyUpdated 2024 Jul 4 12:51

You can start by using profiling tools to identify specific operations in your model that are potential bottlenecks and could benefit from a custom CUDA implementation.
cpp_extension module to create a bridge between your CUDA kernels and your PyTorch code.
 
Once compiled and loaded, the custom operation can be used directly in your PyTorch models like any other function.
 
 
 
 
 

Recommendations