I don't think writing CUDA is a good way to do this tbh