Sample delivered in the middle of new region/task initialization process. #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The following commits should emphasize the problem of delivering the sample in the middle of the region/task initialization process.
Since, this process is not done atomically, it is possible that the tool receive the sample in the middle of it (process) and calls the ompt_get_task_info function in order to get information about active tasks/regions.
The proposal is to always initialize the task/region's descriptor before setting it to thread's descriptor as currently valid. Since the initialization process is scattered across multiple functions and even multiple threads, it is possible that these changes won't handle all edge cases. However, they should point out to the problems that should be consider in future.
The best way to handle this problem is to introduce some variable that should show whether thread is initializing the region/task. If so, the ompt_get_task_info could return the value 1, which should indicate that there'a a task/region at this level, but the information about it are incomplete (this should satisfies the OMPT 5.0 standard specification). However, this approach would require memoizing some information about the old task/region during the process of setting the new one, so it may introduce additional memory footprint.