For debuging and logging, I would like to add a system that logs errors (basically just error codes and associated strings that may be printed when needed). Errors may occur on any core/tile in any thread, so all threads need access to the error log. Connecting each thread to the error log using a channel/interface will have the ressource usage explode and is not a good idea.
From what I understand, chanends are part of a tile and allow a connection to/from any core on the respective tile. This should allow a single chanend to be used for each tile to connect to the error log.
I was thinking about using a distributable task, that accesses the chanend, but I'd still need a connection to this task. There is no data exchange between tiles/cores when a distributable task/function is called, so I wonder if the interface connections to a distributable task are just written similar to an interface connection but are not used like an interface on hardware basis (meaning: no use of channels for communication)? In that case, I could add an error "interface" to all tasks and connect them to the distributable task on the specific tile, that will then connect to the error log itself.
If that is not possible, do you have an idea on how to set up communication of n to 1 tasks without using a lot of ressources?
Access chanend from multiple threads / distributable tasks Topic is solved
-
- XCore Addict
- Posts: 191
- Joined: Tue Jul 05, 2016 2:19 pm
-
Verified
- Experienced Member
- Posts: 117
- Joined: Fri Dec 11, 2009 10:22 am
Do you want the log to be on the host or kept on the device? If you are happy to log errors to the host then you could use scope for this? It is implemented in a very light weight manner that won't use up all your resources.
-
- XCore Addict
- Posts: 191
- Joined: Tue Jul 05, 2016 2:19 pm
ou, good question, forgot to mention this. I would like to log the errors on the device, not on a host system.
And now that you mentioned xscope: Is there any documentation on the underlying software architecture? Cause the system does pretty much what I want (function call to trigger an action on some core) just that I'd want to store the error instead of sending out data over a link.
And now that you mentioned xscope: Is there any documentation on the underlying software architecture? Cause the system does pretty much what I want (function call to trigger an action on some core) just that I'd want to store the error instead of sending out data over a link.
-
Verified
- Experienced Member
- Posts: 117
- Joined: Fri Dec 11, 2009 10:22 am
You could use a shared memory. Depending on the frequency of the errors this might not be appropriate. Each core could have a block of memory it writes the error to then sets a flag for its error block in use. If the flag is set then the error logging core would put the error into a list and clear the flag for that core, the original core is the free to log another error.
Would that work for you?
Would that work for you?
-
- XCore Addict
- Posts: 191
- Joined: Tue Jul 05, 2016 2:19 pm
I like the approach. I dont expect any errors to occure at all and if errors occure there might only be a few per second. A bunch of memory with sections having an offset of n*core_number would allow to use a function that simply writes some memory without the need of any prior initialization in any of the tasks (just need to use mem locks or some other mechanism to prevent parallel memory access).
For this approach, some memory needs to be allocated/reserved beofrehand. I cannot do that in the multi-tile main function. Is there another way to reserve memory (e.g. by adjusting xn/link files)?
For this approach, some memory needs to be allocated/reserved beofrehand. I cannot do that in the multi-tile main function. Is there another way to reserve memory (e.g. by adjusting xn/link files)?
Last edited by DemoniacMilk on Thu Jan 05, 2017 3:29 pm, edited 1 time in total.
-
Verified
- Experienced Member
- Posts: 117
- Joined: Fri Dec 11, 2009 10:22 am
You could just declare it globally. You will need to access it in unsafe mode. Also this will only work on a single tile, if you want to do multi-tile you will need to use channels
-
- XCore Addict
- Posts: 191
- Joined: Tue Jul 05, 2016 2:19 pm
ye its meant to be for multiple tiles. I am aware I need to use channels to cummunicate between tiles, but it should be possible to get the channel usage down to 1 per tile with something like this:
For that, some memory accessible from anywhere is needed (global declaration per tile or memory reserved during linking). Declaring a global variable/array in my main file does compile fine so declaring something like unsigned globalArray[10] reserves the same amount of memory on each individual tile?You do not have the required permissions to view the files attached to this post.
-
Verified
- Experienced Member
- Posts: 117
- Joined: Fri Dec 11, 2009 10:22 am
When you declare a global is appears on every tile and is eliminated on that tile if not used. Hope that helps
-
- XCore Addict
- Posts: 191
- Joined: Tue Jul 05, 2016 2:19 pm
Thanks for the quick responses, you helped me a lot.