[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Parallella Community • View topic - can e_read,e_write pass a two-dimensional array
Page 1 of 1

can e_read,e_write pass a two-dimensional array

PostPosted: Wed Jun 03, 2015 9:36 am
by Anthony
hi! i just use two dimensional array in my code,but i dont kown whether the e_read ,e_write can be used like this:

int a[M][N];
for(i=0;i<platform.rows;i++)
for(j=0;j<platform.cols;j++)
e_write(&dev,i,j,0x2000,&a,M*N*sizeof(int));
....


can i pass the array to epiphany platform correctly? Or,how to pass a two-dimensional array between host and device platform

Thanks

Re: can e_read,e_write pass a two-dimensional array

PostPosted: Fri Jun 05, 2015 2:25 pm
by skinner
Hi !

From what i see, this will only write the content of you two-dimensional array into each eCore on the chip. I guess it could work since you specifically address eCores but you have to keep in mind that each eCore only can have a maximum amout of 32kB of data in his local memory so you have to be careful about the size of your array.

Regards,

Thomas.

Re: can e_read,e_write pass a two-dimensional array

PostPosted: Sun Jun 07, 2015 9:35 am
by Anthony
Hi,Thomas!

you are right,i just want to write arrays to each ecore,,since i want to use the 16 ecores separately run the code,i use the e_load_group function to load programs into them.But i'm not quite sure if there is any difference between one-dimensional array
and two-dimension array,especially the address ,and how to read/write the two-dimension arrays correctly in device/host side.there isn't any examples about two-dimension arrays tranferring :? :? :?

Regards

Anthony

Re: can e_read,e_write pass a two-dimensional array

PostPosted: Sun Jun 07, 2015 4:34 pm
by sebraa
In C, there are no N-dimensional arrays by default, only one-dimensional arrays. However, if (N-1) dimension sizes are known at compile-time (so that the memory layout is known), then C provides some syntactic sugar. Each element has its own address, and each address is compatible to a void* (and vice versa).

In your example, you copy the whole array into each eCore. But you could also do an e_write of &A[i][j] (one element of the array), with a sizeof(A[0]) for the size, which would only copy one (unique) element to each eCore.

Re: can e_read,e_write pass a two-dimensional array

PostPosted: Mon Jun 08, 2015 3:29 am
by Anthony

Re: can e_read,e_write pass a two-dimensional array

PostPosted: Mon Jun 08, 2015 1:18 pm
by sebraa
I think in this case, &a and &a[0][0] are equivalent: The very first element of a C array has the same address as the array itself. You might want to read up on how (multi-dimensional) C arrays are laid out in memory, because that is the magic you need to know here.

If you do e_write(&dev, i, j, 0x2000, &a[0][0], sizeof(a[0])), then you only copy the first element of your array into each core.
If you do e_write(&dev, i, j, 0x2000, &a, M*N*sizeof(a[0][0])), then you copy the whole array into each core (*)
If you do e_write(&dev, i, j, 0x2000, &a[i][j], sizeof(a[0][0])), then you copy a[0][0] to core (0,0), a[0][1] to core (0,1) and so on.

(*) I think that sizeof(a) should work as well, but I am not sure. I tend to avoid these constructs.

Re: can e_read,e_write pass a two-dimensional array

PostPosted: Mon Jun 08, 2015 1:58 pm
by Anthony

Re: can e_read,e_write pass a two-dimensional array

PostPosted: Tue Jun 09, 2015 5:15 pm
by sebraa
No idea. I always called e_load() in a loop. I don't think all 16 cores will start simultaneously, so you shouldn't count on it.

Re: can e_read,e_write pass a two-dimensional array

PostPosted: Tue Jun 09, 2015 10:03 pm
by skinner
I think that if you defined a workgroup containing the 16 cores, striclty regarding the given API you should be able to run your program on all the cores in the same time by using e_load_group. Or rather, if the API is correct, why wouldn't this work ?

Re: can e_read,e_write pass a two-dimensional array

PostPosted: Wed Jun 10, 2015 1:48 am
by Anthony