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

Fix synchronization mistake in CUDAScopedContext #327

Conversation

makortel
Copy link

PR description:

This PR fixes a synchronization mistake in CUDAScopedContext reported by @VinInn e.g. here #318 (comment). The problem was restricted to cases where the producer

  • is not an ExternalWork
  • inserts the CUDA product to the event via CUDAScopedContext::emplace()
  • queued more asynchronous work in the constructor of the CUDA product

(all of these are fulfilled by the BeamSpot PR #318)

The problem was that CUDASCopedContext checked whether the CUDA stream is idle or not before calling the CUDA product constructor (for the CUDA event optimization of #292). If the stream is idle, the CUDAProduct is marked immediately to be available to avoid inspecting the state of the CUDA event (well, even creation of the event). But if the constructor queues more work, the state of the CUDAProduct is incorrect.

The proposed fix is to check for the CUDA stream status after calling the constructor.

PR validation:

Profiling workflow runs, unit tests run. Verified with printouts that now the product status information in the consumer of BeamSpot is consistent with the stream status information.

…called

Otherwise, if the stream was idle before, and the constructor queues
work to it, the event is not created and downstream will assume that
the product is always there (even if it isn't yet).
@fwyzard fwyzard merged commit b96b789 into cms-patatrack:CMSSW_10_6_X_Patatrack Apr 23, 2019
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