So I've read through the C++ AMP tutorials and I've started rewriting a neural net algorithm to attempt to analyse the networks (called "Brain" instances in my code) on an accelerator device using AMP.
The problem I'm having is that each "Brain" class has a vector of "Neuron" and "Synapse" types (these are compound types with primitive members that are compatible with C++ AMP), so how can I offload these to the accelerator, when each "Brain" has a different length of each of these vectors? (They are not known at compile time). Here is what I've got:
// (This obviously won't work as vectors aren't permissible; alternatives?)
void AMPAnalyse(std::vector<Brain> const& brain_sequence)
// build the view of the brain sequence
concurrency::array_view<Brain,1> brain_sequence_view(brain_sequence_extent, brain_sequence);
// store the performance of each brain in this array (the indices match with those of brain_sequence)
array_view<unsigned, 1> error_result(size, error_result);
error_result.discard_data(); // we don't need to transfer the data as it's created on the device
// Define the compute domain, which is the set of threads that are created.
// Define the code to run on each thread on the accelerator.
[=](index<1> idx) restrict(amp)
// analyse the performance of each brain in brain_sequence_view and dump the result to the error_result view
Basically I need to use something to replace those vectors in the "Brain" struct, presumably I need to use a concurrency::Array or something like that but I don't really know how I would implement that in a struct given that the size isn't known at compile time!?