-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
I think it would be useful to give the user access to the task id (i.e. 1:ntasks:). My motivation for this is code that have this pattern (which is pretty common):
for i in 1:N
@tasks for j in 1:N
@local cache = computation_with_heavy_allocs()
end
endwhere there currently isn't a great way to hoist the task local cache allocation out of the outer loop. If I can observe the task id I can do something like
caches = [computation_with_heavy_allocs() for _ in 1:ntasks]
for i in 1:N
@tasks for j in 1:N
@local cache = caches[OhMyThreads.taskid()] # or @taskid
end
endIs there a better way to achieve this?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels