Giter VIP home page Giter VIP logo

example_cuda_benchmark's Introduction

CUDA Google Benchmark

A starting point for writing and building Google Benchmarks of both CUDA and CPU code.

How to Use

An example CPU benchmark is located in benchmarks/example/example_benchmark.cpp.

To build this benchmark:

mkdir -p build
cd build
cmake .. && make

To run this benchmark:

./gbenchmarks/EXAMPLE_BENCH

Example output:

~/example_cuda_benchmark/build$ ./gbenchmarks/EXAMPLE_BENCH 
2020-06-25T09:38:23-05:00
Running ./gbenchmarks/EXAMPLE_BENCH
Run on (20 X 4500 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x10)
  L1 Instruction 32 KiB (x10)
  L2 Unified 1024 KiB (x10)
  L3 Unified 14080 KiB (x1)
Load Average: 1.14, 0.79, 0.67
***WARNING*** CPU scaling is enabled, the benchmark real time measurements may be noisy and will incur extra overhead.
-------------------------------------------------------------------------------
Benchmark                                     Time             CPU   Iterations
-------------------------------------------------------------------------------
BM_test                                   0.000 ns        0.000 ns   1000000000
BM_StringCopy                              4.23 ns         4.23 ns    139185384
BM_StringCompare/1024                      21.5 ns         21.5 ns     32624809
BM_StringCompare/2048                      39.3 ns         39.3 ns     17823169
BM_StringCompare/4096                      73.4 ns         73.4 ns      9546744
BM_StringCompare/8192                       147 ns          147 ns      4754180
BM_StringCompare/16384                      308 ns          308 ns      2282049
BM_StringCompare/32768                      865 ns          865 ns       845382
BM_StringCompare/65536                     1542 ns         1541 ns       447876
BM_StringCompare/131072                    3136 ns         3136 ns       215387
BM_StringCompare/262144                    6005 ns         6005 ns       115466
BM_StringCompare_BigO                      0.02 N          0.02 N    
BM_StringCompare_RMS                          5 %             5 %    
BM_Sequential<std::vector<int>>/1          5.36 ns         5.36 ns    109825554 bytes_per_second=177.79M/s
BM_Sequential<std::vector<int>>/8          50.8 ns         50.8 ns     10000000 bytes_per_second=150.11M/s
BM_Sequential<std::vector<int>>/64          420 ns          420 ns      2283232 bytes_per_second=145.212M/s
BM_Sequential<std::vector<int>>/512        2504 ns         2504 ns       252367 bytes_per_second=194.988M/s
BM_Sequential<std::vector<int>>/1024       5119 ns         5119 ns       115397 bytes_per_second=190.757M/s

Adding New Benchmark

To add a new benchmark:

  1. Add a new *.cpp or *.cu file to the benchmarks/ directory.

  2. Update the benchmarks/CMakeLists.txt to point to the new benchmark, e.g.,

set(MY_NEW_BENCH_SRC
  "${CMAKE_CURRENT_SOURCE_DIR}/*my_new_bench_dir*/*my_new_bench.cpp/.cu*")

ConfigureBench(*MY_NEW_BENCH* "${*MY_NEW_BENCH_SRC*}"
  1. Follow the above build instructions and your new benchmark executable *MY_NEW_BENCH* will be built into the build/gbenchmarks directory.

example_cuda_benchmark's People

Contributors

jrhemstad avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ykkan rommeldb

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.