Giter Site home page Giter Site logo

trick-17 / backends Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 82 KB

Interchangeable backends in C++, OpenMP, CUDA, OpenCL, OpenACC

License: MIT License

Shell 0.13% C++ 98.35% CMake 1.52%
c-plus-plus cuda-backend opencl-backend cross-platform header-only openmp-backend openacc-backend cuda openmp openacc

backends's Introduction

backends

Interchangeable backends:

  • C++
  • CUDA
  • OpenCL
  • OpenACC

Project Health

Service System Compiler Status
Travis-CI Ubuntu 14.04
OSX
GCC 6
Clang
Build Status
AppVeyor Windows MSVC12
MSVC14
MSVC14.1
Build status

Including this library in your code

TODO...

Library usage

Filling a vector with a single value:

auto myVec = backends::vector<double>(2000);
backends::fill(myVec, 12.0);

Typical reductions:

auto myVec = backends::vector<double>{1, 2, 3, 4};
double sum  = backends::sum(myVec);
double mean = backends::mean(myVec);
// The sum should be 12, the mean should be 2.5

backends's People

Contributors

gpmueller avatar nohs avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

backends's Issues

Implement testing for cuda and opencl

Can we somehow do this abstractly (i.e. only once for cpp cu and cl at once) or do we have to write a test for each version?

An idea might be to put a switch in the CMakeLists to cpp ´cudaoropencl, which then changes which version is included with a #define`

Do we add a single file include?

We might do it like Eigen and make it possible to e.g. #include "backends/cpp" by placing files cpp cuda and opencl (note the missing file extensions), which contain the necessary includes, into the backends folder.

Document exact version requirements (OpenMP, CUDA, ...)

  • C++ ? (nvcc only supports 11 or 14 I think... probably we therefore cannot use C++17?)
  • OpenMP 4.5 for GPU offloading (not yet implemented)
  • CUDA 8.0 for unified memory
  • OpenCL ?
  • OpenACC ?

Maybe we should even write down which compilers exactly support each backend due to these requirements?

Do we add Eigen-specific functions?

Since we need modern compilers anyways and Eigen is quite small and header-only, I don't see a particular reason not to.
Examples would be:

  • dot which could take two vector fields and output a scalar field
  • cross
  • mean which would give a mean vector instead of a scalar

@NOhs does the usage of Eigen (e.g. std::vector<Eigen::Vector3f> correspond to your use-case?

Note the mean function could not be applied by using the templated mean, as it requires atomics. Thus it would have to be specialized.

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.