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

TimespanLogging: Remove worker Id Nesting #387

Closed

Conversation

Madhupatel08
Copy link
Contributor

Removed the extra level of nesting by worker ID (#379)
Output when only_local is true: logs are fetched only from the current process.
Logs can be directly fetched from consumer_logs since there is only one worker.
image

Output when only only_local is false: logs are fetched from all the workers
image

Copy link
Member

@jpsamaroo jpsamaroo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good so far! Just two changes needed here, and then you'll also need to update the tests to ensure we test both only_local=true and only_local=false.

lib/TimespanLogging/src/core.jl Outdated Show resolved Hide resolved
if only_local
# Only return logs from current process
mls = get_state(ml)
return mls.consumer_logs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to make a copy of these logs and then empty each vector contained in mls.consumer_logs, as the API of get_logs! is to remove the old logs from mls.consumer_logs so that future calls only include new logs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay will fix it

# Only return logs from the current process
logs = Dict{Int, Dict{Symbol,Vector}}()
pid = myid()
logs[pid] = remotecall_fetch(pid, ml) do ml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you remotecall_fetch-ing here? The worker calling get_logs! with only_local=true is by definition the same worker that you need to fetch logs from, so you don't need that level of indirection.

sublogs
end
end
return logs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong, it's now returning logs with an extra layer of nesting.

Comment on lines +78 to +79
A = rand(Blocks(4, 4), 16, 16)
collect(ctx, A*A)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines need to go inside the loop, to ensure we're generating logs for each of only_local=true and only_local=false.

for c in keys(logs[w])
@test isempty(logs[w][c])
end
@testset "Get logs for only_local = true and only_local = false" begin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This extra level of testset nesting isn't necessary.

@jpsamaroo jpsamaroo closed this Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants