Coder Social home page Coder Social logo

bruce-lee-ly / cuda_hgemv Goto Github PK

View Code? Open in Web Editor NEW
24.0 2.0 4.0 469 KB

Several optimization methods of half-precision general matrix vector multiplication (HGEMV) using CUDA core.

License: MIT License

CMake 3.51% Shell 6.20% C 13.27% C++ 17.50% Cuda 52.78% Python 6.75%
cublas cuda gemm gemv gpu hgemm matrix-multiply nvidia tensor-core cuda-core

cuda_hgemv's Introduction

CUDA HGEMV

Several optimization methods of half-precision general matrix vector multiplication (HGEMV) using CUDA core. The calculation expression is as follows, where the precision of matrix A (1 * K), B (K * N) and C (1 * N) is FP16. Through exploring various parallel task design, the current performance between 1 to 4096 dimensions is not less than 150% of the performance of cublas.

C (1 * N) = A (1 * K) * B (K * N)

hgemv

Optimization Method

  • Thread Naive: each thread computes 1 result of C
  • Thread Smem: each thread computes 1 result of C using shared memory
  • Warp1 Naive: each warp computes 1 result of C
  • Warp1 Smem: each warp computes 1 result of C using shared memory
  • Warp2 Naive: each warp computes 2 results of C
  • Warp2 Smem: each warp computes 2 results of C using shared memory
  • Warp4 Naive: each warp computes 4 results of C
  • Warp4 Smem: each warp computes 4 results of C using shared memory
  • Warp8 Naive: each warp computes 8 results of C
  • Warp8 Smem: each warp computes 8 results of C using shared memory
  • Warp16 Naive: each warp computes 16 results of C
  • Warp16 Smem: each warp computes 16 results of C using shared memory

Compile

Environment

  • OS: Linux
  • Cmake Version: >= 3.12
  • GCC Version: >= 4.8
  • CUDA Version: >= 11.0
  • Gflags: install on ubuntu as follows
sudo apt-get install libgflags-dev

Clone

git clone https://github.com/Bruce-Lee-LY/cuda_hgemv.git

Build

NVIDIA A100

cd cuda_hgemv
./build.sh -a 80 -t Release -b OFF
./build.sh -a 80 -t Debug -b OFF

RTX3080Ti / RTX3090 / RTX A6000

cd cuda_hgemv
./build.sh -a 86 -t Release -b OFF
./build.sh -a 86 -t Debug -b OFF

Run Sample

./run_sample.sh

Performance

Process the data in the log and plot it as a line chart.

cd tools/performance
./performance.sh

RTX3090

  • CUDA Version: 11.8
  • K: 128

Performance achieved by current optimization methods.

throughput

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.