Git Product home page Git Product logo

pscan's Introduction

FastPSCAN

This implements 5 different algorithms for the parallel scan problem in pytorch. The algorithms are:

  • Naive: The naive algorithm that uses a for loop to compute the scan.
  • Original: Code written by https://twitter.com/francoisfleuret which motivated this project.
  • Heinsen: The algorithm described in https://arxiv.org/abs/2311.06281
  • CUDA_V1: The (currently fastest) algorithm which uses a custom CUDA kernel + CUB to do the reduction on a block level. This is the recommended algorithm to use.
  • CUDA_V2: This does a device level reduction using CUB, it is slower than CUDA_V1 but works for much larger input size.

Benchmark

Benchmarking was done on a 3090 GPU.

Forward

original_pscan_fn(A, X, Y_init) setup: from main import original_pscan_fn 911.40 us 1 measurement, 1000 runs , 1 thread

heinsen_pscan(A, X, Y_init) setup: from main import heinsen_pscan 783.34 us 1 measurement, 1000 runs , 1 thread

pscan_cuda_fn(A, X, Y_init) setup: from main import pscan_cuda_fn 113.88 us 1 measurement, 1000 runs , 1 thread

pscan_cuda_v2_fn(A, X, Y_init) setup: from main import pscan_cuda_v2_fn 149.98 us 1 measurement, 1000 runs , 1 thread

Forward + Backward

backward_wrapper(pscan_cuda_fn,A, X, Y_init) setup: from main import pscan_cuda_fn, backward_wrapper 394.81 us 1 measurement, 1000 runs , 1 thread

backward_wrapper(heinsen_pscan, A, X, Y_init) setup: from main import heinsen_pscan, backward_wrapper 1.63 ms 1 measurement, 1000 runs , 1 thread

backward_wrapper(original_pscan_fn, A, X, Y_init) setup: from main import original_pscan_fn, backward_wrapper 2.07 ms 1 measurement, 1000 runs , 1 thread

backward_wrapper(pscan_cuda_v2_fn, A, X, Y_init) setup: from main import pscan_cuda_v2_fn, backward_wrapper 453.88 us 1 measurement, 1000 runs , 1 thread

pscan's People

Contributors

johnryan465 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.