Giter Site home page Giter Site logo

psteinb / compass Goto Github PK

View Code? Open in Web Editor NEW
17.0 2.0 0.0 193 KB

drop-in header-only C++ library to detect hardware capabilities at runtime and at compiletime

License: BSD 3-Clause "New" or "Revised" License

CMake 40.47% C++ 59.53%
c-plus-plus hardware-architectures hardware-libraries header-only cpp-library

compass's Issues

Node and Device Properties

We run into the issue of a standardization process for hardware topologies and I think HSA can help us with names and layers.

What is the current state of compass. The current compass usage usually looks like this:

auto vendor = compass::runtime::vendor();
auto device_name = compass::runtime::device_name();
auto value = compass::runtime::has(compass::feature::sse());
...

The instantiation of the corresponding wrappers happens at compile-time through the detection of

  • OS (linux, mac, windows)
  • platform (x86, x86_64, power)
  • compiler architecture (clang, intel, gcc, msvc),

mostly retrieved by macros coming from header includes and compilers.

So, the code above always refer to CPU device (keep in mind, nvcc does not compile host code). So first thing coming up here is:

How to name device layer?

There is a need for a layer for the devices within a node. C++AMP just calls them accelerator, which does not seem sufficient for our library. What about HSA, what's their convention:

HSA nomenclature

1x compass instance only sees 1x node, but n devices (HSA refers to as agents).

// possible compass API
auto node = compass::node();
auto node_compiletime = compass::compiletime::node(); // for compile-time structure
auto vendor = compass::vendor(node);
  • So, how about using compass::node and compass::devices to get [compile-time] properties encapsulated in structures?

How to select or iterate through devices?

// possible compass API
...
auto devices = compass::devices();
auto value_node = compass::has(node, compass::feature::sse());
auto value_dev  = compass::has(devices[0], compass::feature::sse());
auto devices_gpu = compass::devices(compass::device_type::gpu);
...
  • maybe the runtime namespace can be neglected. A user should not start guessing "is this in runtime or in compiletime". However, compiletime could be a reasonable namespace to ensure compile-time features
  • does compile-time feature still work when using cross-compiler?
  • accessing device- or node-specific properties can be done via structures/methods, see issue #4

Encapsulation of properties?

... coming from issue #3
Instead of:

auto node = compass::node();
auto devices = compass::devices();

auto value_node = compass::has(node, compass::feature::sse());
auto value_dev  = compass::has(devices[0], compass::feature::sse());
...

what about:

auto node = compass::node();
auto devices = compass::devices();

auto value_node = node.has(compass::feature::sse());
auto value_dev  = devices[0].has(compass::feature::sse());
...

read /proc/cpuinfo only once

in include/detail/rt/linux_os_impl.hpp, /proc/cpuinfo is opened multiple times and read in, it would be nice if this could only be done once in a thread-safe manner

Other "compass"-like libraries

There are other libraries around which try to provide a generic hardware discovering.
What is done there and what can be re-used in compass?
The ideal case would be to gather the authors and merge the work into compass.
I will try to list them in this issue...

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.