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

implement AccIsEnabled #2267

Merged
merged 1 commit into from May 13, 2024

Conversation

SimeonEhrig
Copy link
Member

The value of AccIsEnabled indicates whether an accelerator is enabled for a specific tag.

include/alpaka/acc/Tag.hpp Outdated Show resolved Hide resolved
@SimeonEhrig SimeonEhrig force-pushed the isAccIsEnabled branch 2 times, most recently from 7ef2c29 to e41ddc4 Compare May 6, 2024 15:28
@mehmetyusufoglu
Copy link
Contributor

The value of AccIsEnabled indicates whether an accelerator is enabled for a specific tag.

[question] Where will this be used?

@SimeonEhrig
Copy link
Member Author

SimeonEhrig commented May 7, 2024

The value of AccIsEnabled indicates whether an accelerator is enabled for a specific tag.

[question] Where will this be used?

To make it easier to write tests. An example from PR #2180

using TagList = std::tuple<
    alpaka::TagCpuSerial,
    alpaka::TagCpuThreads,
    alpaka::TagCpuTbbBlocks,
    alpaka::TagCpuOmp2Blocks,
    alpaka::TagCpuOmp2Threads,
    alpaka::TagGpuCudaRt,
    alpaka::TagGpuHipRt,
    alpaka::TagCpuSycl,
    alpaka::TagFpgaSyclIntel,
    alpaka::TagGpuSyclIntel>;

using TagTagList = alpaka::meta::CartesianProduct<std::tuple, TagList, TagList>;

TEMPLATE_LIST_TEST_CASE("printDefines", "[mem][visibility]", TagTagList)
{
    using Tag1 = std::tuple_element_t<0, TestType>;
    using Tag2 = std::tuple_element_t<1, TestType>;

    if constexpr(alpaka::AccIsEnabled<Tag1>::value && alpaka::AccIsEnabled<Tag2>::value)
    {
        SUCCEED(Tag1::get_name() << " + " << Tag2::get_name());

        using Acc1 = alpaka::TagToAcc<Tag1, Dim, Idx>;
        using Acc2 = alpaka::TagToAcc<Tag2, Dim, Idx>;
        // ...

        if constexpr((isCPUTag<Tag1>() && isCPUTag<Tag2>()) || std::is_same_v<Tag1, Tag2>)
        {
            STATIC_REQUIRE(alpaka::hasSameMemView(dev1, bufDev2));
            STATIC_REQUIRE(alpaka::hasSameMemView(dev2, bufDev1));
        }
        else
        {
            STATIC_REQUIRE_FALSE(alpaka::hasSameMemView(dev1, bufDev2));
            STATIC_REQUIRE_FALSE(alpaka::hasSameMemView(dev2, bufDev1));
        }
}

@SimeonEhrig
Copy link
Member Author

SimeonEhrig commented May 7, 2024

During the VC today, @psychocoderHPC gave some improvements for this PR:

  • add the TagList to the official API and rename it to AccTags
  • add function, which returns list of tags, where the acc is enabled
  • add trait, which return list of tags, which are bonded to Acc's which uses the cpuplatform
  • change all tests to use tags instead the EnabledAccsElseInt list (extra PR)

include/alpaka/acc/Tag.hpp Outdated Show resolved Hide resolved
include/alpaka/acc/TagAccIsEnabled.hpp Outdated Show resolved Hide resolved
include/alpaka/acc/Tag.hpp Outdated Show resolved Hide resolved
@psychocoderHPC
Copy link
Member

short doxygen introduction: https://www.doxygen.nl/manual/docblocks.html

@SimeonEhrig SimeonEhrig force-pushed the isAccIsEnabled branch 7 times, most recently from c405d2d to 21c090a Compare May 9, 2024 06:08
@SimeonEhrig
Copy link
Member Author

@psychocoderHPC ready to merge

Copy link
Member

@psychocoderHPC psychocoderHPC left a comment

Choose a reason for hiding this comment

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

one open point we need to discuss.

include/alpaka/acc/Tag.hpp Outdated Show resolved Hide resolved
- the value of AccIsEnabled indicates whether an accelerator is enabled for a specific tag
- AccTags list which contains all tags
- EnabledAccTags contains all tags, where the related Acc is enabled
- isCpuTag returns true, if the related Acc is bounded the cpuplatform
- enable relaxed template template argument matching for Clang base compiler
@psychocoderHPC psychocoderHPC merged commit f3664a1 into alpaka-group:develop May 13, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants