-
Notifications
You must be signed in to change notification settings - Fork 1
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
FFT api with custom allocators #9
Conversation
@@ -354,7 +355,7 @@ | |||
// auto _1 = T{1}; | |||
|
|||
int nbits = 0; | |||
std::vector<T> e2{e}; | |||
::boost::container::static_vector<T,32> e2{e}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The quickest way I found to get rid of heap memory here was to introduce the static_vector
. I would have used an std::array
but the class T
doesn't necessarily have a default constructor.
@@ -273,8 +279,7 @@ namespace my_modulo_lib | |||
public: | |||
constexpr mint() : x{0} {} | |||
|
|||
template <typename int_type> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason having this template constructor breaks the compilation.
Clang with gnu++2a is failing with once we added allocators. I will try to find a simple failing case to pinpoint the problem. |
} // namespace detail | ||
|
||
template<class RingType, class Allocator_t = std::allocator<RingType> > | ||
using bsl_dft = detail::dft< detail::bsl_backend<RingType,Allocator_t> >; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notice that in order to accommodate the allocator template I've changed the API. We will come back very soon to review the state of the API to answer the comments on the previous PR.
no memory leaks allowed
test/fft_cpp17_allocator.cpp
Outdated
void test_inverse(int N, int tolerance) | ||
{ | ||
std::array<std::byte,200000> buf; | ||
std::pmr::monotonic_buffer_resource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with the C++17 polymorphic memory resource (pmr) feature, creating custom allocators is very simple. Our custom allocator interface integrates with pmr out-of-the-box.
No description provided.