NamGyuKang / CosineSampler

Triple backward custom CUDA kernel for interpolation supporting third order gradients
Other
7 stars 1 forks source link

CosineSampler

We implemented the 2D, and 3D customized CUDA kernel of the triple backward grid sampler that supports cosine, linear, and smoothstep kernel (Thomas Müller) and third-order gradients $u{xxc}, u{yyc}$ with second-order gradients (Tymoteusz Bleja). As a result, the runtime and the memory requirement were significantly reduced. It is used in https://github.com/NamGyuKang/PIXEL

Installation

The code is tested with Python3 environment (3.8, 3.9) and PyTorch (1.11, 11.2) with CUDA (>=11.3).

pip install git+https://github.com/NamGyuKang/CosineSampler.git

Usage

You can choose the kernel (cosine, linear, smoothstep), and the multicell (True, False). The multicell is used in PIXEL (Physics-Informed Cell Representation), and if you set the multicell False, and linear kernel, it is the same with Pytorch grid_sample and our CosineSampler support triple backpropagation of kernel.

Compare CUDA with Pytorch

Second-order PDE (Helmholtz equation)

Citation

If you use this code for research, please consider citing:

@article{kang2023pixel,
title={PIXEL: Physics-Informed Cell Representations for Fast and Accurate PDE Solvers},
author={Kang, Namgyu and Lee, Byeonghyeon and Hong, Youngjoon and Yun, Seok-Bae and Park, Eunbyung},
journal={Proceedings of the AAAI Conference on Artificial Intelligence}, 
year={2023}}