Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding HPX backend #235

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Adding HPX backend #235

wants to merge 4 commits into from

Conversation

hkaiser
Copy link

@hkaiser hkaiser commented Jun 15, 2022

This is a very rudimentary implementation of an HPX backend, essentially mostly a proof of concept.

Implemented functions:

  • scale
  • add

The HPX backend will be triggered if one of the HPX execution policies is passed to one of the API functions, e.g.

        std::vector<double> data(N);

        // Requires CTAD working, GCC 11.1 works but some others are buggy
        // std::experimental::mdspan a(data.data(),N);
        std::experimental::mdspan<double,
            std::experimental::extents<std::experimental::dynamic_extent>>
            a(data.data(), N);
        for (std::size_t i = 0; i < a.extent(0); i++)
            a(i) = double(i);

        // This forwards to HPXKernels
        std::experimental::linalg::scale(HPXKernelsSTD::hpx_exec<>(), 2.0, a);
        // This forwards to HPXKernels if LINALG_ENABLE_HPX_DEFAULT is ON
        std::experimental::linalg::scale(std::execution::par, 2.0, a);
        // This always forwards to HPXKernels
        std::experimental::linalg::scale(hpx::execution::par, 2.0, a);
        // This goes to the base implementation
        std::experimental::linalg::scale(std::execution::seq, 2.0, a);
        // This also goes to the base implementation
        std::experimental::linalg::scale(hpx::execution::seq, 2.0, a);

This also contains the necessary build system and testing infrastructure. I'm creating this PR mainly to be able to set up a github action that would run the tests using the HPX backend.

@@ -0,0 +1,108 @@
# Copyright (c) 2016 Thomas Heller
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR includes a .clang-format file. Are you suggesting this as a code formatting standard for the project?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't suggest using this formatting style. I guess I suggest using any .clang-format to simplify contributions. The file I used was simply taken from HPX (with minor changes). Do you have any coding guidelines for this project? I'd be happy to adapt everything.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hkaiser An excellent idea! Ideally I would like the code to be formatted like the C++ Standard document. I don't think clang-format has a standard preset for that. I'll ask around for how to do this.

include/experimental/linalg Show resolved Hide resolved
tests/hpx-based/gtest_fixtures.hpp Show resolved Hide resolved
tests/kokkos-based/CMakeLists.txt Show resolved Hide resolved
tests/native/CMakeLists.txt Outdated Show resolved Hide resolved
tests/native/CMakeLists.txt Show resolved Hide resolved
@hkaiser
Copy link
Author

hkaiser commented Jun 16, 2022

@mhoemmen could you possibly approve the GitHub action execution for this PR? This would enable me to set up the HPX testing environment.

- added build system support and test infrastructure
- added .clang-format configuration file
- added BLAS1 add (1d and 2d)
- added BLAS1 scale (1d and 2d)
- added GitHub action
- flyby: minor tweak to CMakeLists.txt (detect KokkosKernels quietly)
- flyby: adding workaround for MSVC to transposed.hpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants