Code Monkey home page Code Monkey logo

gpu_vs_cpu's Introduction

This is a demo to compare the computation ability of single thread CPU, multi thread CPU and GPU.
The task is to extract the an image's local high gradient point. A local pixel block has size 7 * 7. We'll find the point that has the maximum image gradient of each 7 * 7 pixel block. An image with size 739 * 458 is provided

Requirement

OpenCV > 3.0
CUDA > 7

Install

git clone https://github.com/zhaozhongch/GPU_vs_CPU.git
mkdir build
cd build
cmake ..
make

Use

Single CPU example

cd build
./find_gradient

Multi CPU example

cd build
./find_gradient_multi_thread

GPU example

cd build
./find_gradient_cuda

Result Example

They'll all get similar image output like demo_result Those circles just show the where the local high gradient point is in every 7 by 7 pixel block.
On my ThinkPad-X1-Extreme laptop with CPU Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz and GPU GTX 1050, the single CPU computation time is about 100ms, multi CPU computation time is about 50ms, GPU computation time is about 400us.

gpu_vs_cpu's People

Contributors

zhaozhongch avatar

Watchers

 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.