Skip to content

Commit

Permalink
Merge pull request #2979 from QMCPACK/origin/update_multi_for_clang11…
Browse files Browse the repository at this point in the history
…_second_try

Clang CUDA AFQMC workaround device_allocator by defining uninitialized_copy at the allocator level
  • Loading branch information
ye-luo authored Mar 3, 2021
2 parents f51d115 + d2c607f commit 4d188e8
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/AFQMC/Memory/device_pointers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,17 +420,20 @@ struct device_allocator
bool operator==(device_allocator const& other) const { return true; }
bool operator!=(device_allocator const& other) const { return false; }
template<class U, class... Args>
void construct(U p, Args&&... args)
{}
//{
// ::new((void*)p) U(std::forward<Args>(args)...);
// }
void construct(U p, Args&&... args){
static_assert( std::is_trivially_copy_constructible<value_type>{}, "!"); // ::new((void*)p) U(std::forward<Args>(args)...);
}
template<class U>
void destroy(U p)
{}
// {
// p->~U();
// }
void destroy(U p){
static_assert( std::is_trivially_destructible<value_type>{}, "!"); // p->~U();
}
template<class InputIt, class ForwardIt>
ForwardIt alloc_uninitialized_copy(InputIt first, InputIt last, ForwardIt d_first){
static_assert( std::is_trivially_copy_constructible<value_type>{}, "!");
static_assert( std::is_trivially_destructible<value_type>{}, "!");
std::advance( d_first , std::distance(first, last) );
return d_first;
}
};

struct memory_resource
Expand Down

0 comments on commit 4d188e8

Please sign in to comment.