GithubHelp home page GithubHelp logo

cuda_bench_memory_space_transfer's Introduction

Benchmark template project

The goal of this project is to be forked to serve as a base for anyone needing to benchmark several Cuda functions quickly.

Requirements

Additional libraries

These libraries are included in the conan file. Do not install them yourself. Conan will do the job for you.

Build

  • To build, execute the following commands :
mkdir build && cd build
conan install ..
cmake ..
make

Run :

cd build
./bin/Bench
  • Additionnaly you can use --build=missing to build missing libraries:
conan install .. --build missing

Additional infos

  • By default the program will run in release when it's inside a build or build_release folder. To build in debug, build the projet inside a build_debug folder.

  • You can specify the "--no-check" option when running the bench binary to disable result checking :

./bin/Bench --no-check

To bench your own code

Compile your code

There are two ways to get your code compiled:

  • Directly copy the function in the file src/to_bench.cu
  • Create a new cmake target

Create a new cmake target

In CMakeLists.txt:

  • Create a new library as follows:
add_library(LIB_NAME
	SOURCE_FILE1
	SOURCE_FILE2
	...
)
  • Link this library to the Bench target (add this library among the others) as follows:
target_link_libraries(Bench LIB_NAME async_memcpy GTest::GTest benchmark::benchmark TestHelpers)
  • Note: be careful not to have the same functions name for exported functions between libraries (avoid multiple definition compilation error)

Create new benches

In bench/main.cc:

  • Include the header file containing the function(s) to bench #include header_file.cuh if not already in the included files
  • Define a new bench as follows
BENCHMARK_DEFINE_F(Fixture, BENCH_NAME)
(benchmark::State &st)
{
    this->bench(st, NAME_OF_THE_FUNCTION_TO_BENCH, BUFFER_SIZE, FUNCTION_ARGS...);
}
  • Register the new bench as follows
BENCHMARK_REGISTER_F(Fixture, BENCH_NAME)
    ->UseRealTime()
    ->Unit(benchmark::kMillisecond);
  • Note: a template of this steps can directly be found in src/main.cc
  • Note: the first function argument must be a cuda_tools::host_shared_ptr<int>

Extra ressources

  • You can use premade host_shared_ptr to allocate data
  • You can use premade test_helper to test your result

cuda_bench_memory_space_transfer's People

Contributors

li0nmo0se avatar kh4ster 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.