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

Refactor test classes #2156

Merged

Conversation

j-stephan
Copy link
Member

This PR refactors some of our test classes. It also silences the following wrong g++-11 warning uncovered by #2107:

/builds/hzdr/crp/alpaka/include/alpaka/test/KernelExecutionFixture.hpp:47:15: error: 'fixture' may be used uninitialized [-Werror=maybe-uninitialized]
   47 |             : m_devHost{getDevByIdx(m_platformHost, 0)}
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /builds/hzdr/crp/alpaka/include/alpaka/acc/Traits.hpp:15,
                 from /builds/hzdr/crp/alpaka/include/alpaka/acc/AccCpuOmp2Blocks.hpp:27,
                 from /builds/hzdr/crp/alpaka/include/alpaka/alpaka.hpp:13,
                 from /builds/hzdr/crp/alpaka/include/alpaka/test/KernelExecutionFixture.hpp:7,
                 from /builds/hzdr/crp/alpaka/test/unit/intrinsic/src/Popcount.cpp:6:
/builds/hzdr/crp/alpaka/include/alpaka/platform/Traits.hpp: In function 'void CATCH2_INTERNAL_TEMPLATE_TEST_0() [with TestType = alpaka::AccCpuSerial<std::integral_constant<long unsigned int, 1>, long unsigned int>]':
/builds/hzdr/crp/alpaka/include/alpaka/platform/Traits.hpp:62:25: note: by argument 1 of type 'const alpaka::PlatformCpu&' to 'alpaka::Dev<TPlatform> alpaka::getDevByIdx(const TPlatform&, const size_t&) [with TPlatform = alpaka::PlatformCpu]' declared here
   62 |     ALPAKA_FN_HOST auto getDevByIdx(TPlatform const& platform, std::size_t const& devIdx) -> Dev<TPlatform>
      |                         ^~~~~~~~~~~
/builds/hzdr/crp/alpaka/test/unit/intrinsic/src/Popcount.cpp:60:47: note: 'fixture' declared here
   60 |     alpaka::test::KernelExecutionFixture<Acc> fixture(alpaka::Vec<Dim, Idx>::ones());
      |                                               ^~~~~~~

QueueTestFixture() : m_dev(getDevByIdx(m_platform, 0)), m_queue(m_dev)
{
}
QueueTestFixture() = default;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
QueueTestFixture() = default;

At this point you can just follow the rule of zero :)

DevHost devHost{alpaka::getDevByIdx(platformHost, 0u)};
DevQueue devQueue{devAcc};

TestContainer() = default;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
TestContainer() = default;

@bernhardmgruber bernhardmgruber merged commit bf976cb into alpaka-group:develop Sep 12, 2023
@j-stephan j-stephan deleted the Wmaybe-uninitialized branch September 12, 2023 12:02
@j-stephan j-stephan mentioned this pull request Sep 12, 2023
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.

2 participants