9 return (size + localSize) / localSize;
16 hostArray.
resize(input.size(), input.data());
19 deviceArray.
resize(input.size());
34 unsigned int localSize = 256;
35 auto globalSize = input.
size();
37 std::vector<VkDeviceArray<T>> buffers;
38 buffers.push_back(input);
53 for (std::size_t i = 0; i < buffers.size() - 1; i++)
57 mReduceKernel->enqueue(groupSize, &buffers[i], &buffers[i + 1], &num);
65 std::vector<T> ret(1);
72 for (std::size_t i = 1; i < buffers.size(); i++)
void setValue(const T val)
VkResizeType resize(uint32_t num, VkBufferUsageFlags usageFlags=0)
void resize(uint32_t num, const T *data=nullptr)
std::shared_ptr< VkProgram > mReduceKernel
T reduce(const std::vector< T > &input)
This is an implementation of AdditiveCCD based on peridyno.
static dim3 vkDispatchSize(uint totalSize, uint blockSize)
int SizeOfNextLevel(int size, int localSize)
bool vkTransfer(VkHostArray< T > &dst, const VkDeviceArray< T > &src)