How can I make a struct containing vectors ready for AMP?

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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
struct Brain
{
	std::vector<Neuron> neuron_sequence;
	std::vector<Synapse> synapse_sequence;

// (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::extent<1> brain_sequence_extent(brain_sequence.size());
	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)
	unsigned error_result[brain_sequence.size()];
	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

	parallel_for_each( 
		// Define the compute domain, which is the set of threads that are created.
		error_result.extent, 
		// 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!?
Topic archived. No new replies allowed.