Git Product home page Git Product logo

mdspan's Introduction

Reference mdspan implementation

The ISO-C++ proposal P0009 will add support for non-owning multi-dimensional array references to the C++ standard library. This repository aims to provide a production-quality implementation of the proposal as written (with a few caveats, see below) in preparation for the addition of mdspan to the standard. Please feel free to use this, file bugs when it breaks, and let us know how it works for you :-)

Try it out on Godbolt{: .btn }

Using mdspan

A tutorial-style introduction to the basic usage of mdspan is provided on the project wiki. More advanced tutorials to come.

Features in Addition To C++ Standard

  • C++17 backport (e.g., concepts not required)
  • C++14 backport (e.g., fold expressions not required)
    • Compile times of this backport will be substantially slower than the C++17 version
  • Macros to enable, e.g., __device__ marking of all functions for CUDA compatibility

Building and Installation

This implementation is header-only, with compiler features detected using feature test macros, so you can just use it directly with no building or installation. If you would like to run the included tests or benchmarks, you'll need CMake.

Running tests

TODO write this

Running benchmarks

TODO write this

Caveats

This implementation is fully conforming with a few exceptions (most of which are extensions):

C++20

  • implements operator() not operator[]
    • note you can control which operator is available with defining MDSPAN_USE_BRACKET_OPERATOR=[0,1] and MDSPAN_USE_PAREN_OPERATOR=[0,1] irrespective of whether multi dimensional subscript support is detected.

C++17 and C++14

  • the conditional explicit markup is missing, making certain constructors implicit
    • most notably you can implicitly convert from dynamic extent to static extent, which you can't in C++20 mode

C++14

  • deduction guides don't exist

Acknowledgements

This work was undertaken as part of the Kokkos project at Sandia National Laboratories. Sandia National Laboratories is a multimission laboratory managed and operated by National Technology & Engineering Solutions of Sandia, LLC, a wholly owned subsidary of Honeywell International Inc., for the U. S. Department of Energy's National Nuclear Security Administration under contract DE-NA0003525.

mdspan's People

Contributors

crtrott avatar nliber avatar brycelelbach avatar dalg24 avatar mhoemmen avatar clausklein avatar tpadioleau avatar jbigot avatar mattja avatar amklinv-nnl avatar amozzhuhin avatar kinetictheory avatar rscohn2 avatar r-burns avatar tobiashienzsch avatar

Stargazers

 avatar Corey J. Nolet avatar

Watchers

James Cloos avatar Corey J. Nolet avatar Jiaming Yuan avatar  avatar

Forkers

mfoerste4

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.