Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cluster task example #116

Open
SaraNassef opened this issue Feb 10, 2022 · 4 comments
Open

Cluster task example #116

SaraNassef opened this issue Feb 10, 2022 · 4 comments

Comments

@SaraNassef
Copy link

Hi,
I want to ask if there is a cluster task example like the one available in pulp-rt-examples https://github.com/pulp-platform/pulp-rt-examples/blob/master/cluster/task/test.c as I can't find one in those examples https://github.com/GreenWaves-Technologies/pmsis_tests.
If not, can someone help me with what are the functions available in the SDK to perform such functionality or where I can find them.
Thanks in advance

@NBruschi
Copy link
Collaborator

NBruschi commented Feb 14, 2022

Hi @SaraNassef,

The test you have referred to is part of legacy software support, which is no longer maintained and supported by the PULP team. You can now find the last commit and all the previous history of those runtime functions in the v1(https://github.com/pulp-platform/pulp-sdk/tree/v1) branch of the current pulp-sdk(https://github.com/pulp-platform/pulp-sdk) repository.
What you can find in the main(https://github.com/pulp-platform/pulp-sdk/tree/main) branch is an upgraded and maintained version of the pulp-runtime based on PMSIS, which is not compatible with the previous one based on PULP-RT. My suggestion is to use the main branch if you want to develop new applications and test them on GVSoC simulator. Porting the code to the PMSIS APIs should not be a demanding job, especially if you are using standard cluster's tasking. You can use examples like these(https://github.com/pulp-platform/pulp-sdk/tree/main/tests/cluster) to port your code.
Otherwise, if you want to use the old PULP-RT APIs and runtime based on those you can checkout to v1 branch.

Best regards,

Nazareno

@SaraNassef
Copy link
Author

Thanks @NBruschi for your reply and clarifying things,

Upon your suggestion, I am using the main branch and have checked the examples you referred to, what I want to do is to send different tasks to different cluster cores to be executed simultaneously, I thought at first that the example I mentioned does so.
To be clear, my question is if there is an example or certain functions that send different tasks to different cluster cores to be executed simultaneously.

@NBruschi
Copy link
Collaborator

Dear @SaraNassef,

the test notation that you are referring to uses "task" to define a cluster job. So, there could be different simultaneous cluster tasks and the cores could do different jobs but they can not execute different tasks.
What you should do is write a cluster task where the program flow is different between cores using control flow statements such as if-else or switch-case and where the control variable is the core id, which you can easily extract using pi_core_id() API. To do so you should firstly open a "parallel section" using pi_cl_team_fork() API. At the end of your control flow statement, you should put a barrier using pi_cl_team_barrier() in order to synchronize the cores.
The examples to something similar are the ones that I pointed you in the previous message.

Best regards,

Nazareno

@SaraNassef
Copy link
Author

Thanks @NBruschi for your suggestion, I tried something similar and it worked.

I have another question, I'm trying to use a semaphore but when using the struct pi_sem_t, it gives an error that the storage size is not known, also using the semaphore functions such as pi_sem_init gives an error that it's not defined, so am I missing certain defines or flags or what should I do to be able too use these semaphore functions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants