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

Protected mutex locking with RAII. #30501

Merged
merged 3 commits into from Jul 4, 2020

Conversation

ericcano
Copy link
Contributor

@ericcano ericcano commented Jul 2, 2020

In case some of the cudaCheck() calls threw (line 596), the mutex would have been left locked.

PR description:

This PR fixes a possible leftover locked mutex in case of exception.

PR validation:

if this PR is a backport please specify the original PR and why you need to backport that PR:

In case some of the cudaCheck() calls threw (line 596), the mutex would have been left locked.
@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 2, 2020

The code-checks are being triggered in jenkins.

@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 2, 2020

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-30501/16690

@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 2, 2020

A new Pull Request was created by @ericcano (Eric Cano) for master.

It involves the following packages:

HeterogeneousCore/CUDAUtilities

@makortel, @cmsbuild, @fwyzard can you please review it and eventually sign? Thanks.
@makortel, @rovere this is something you requested to watch as well.
@silviodonato, @dpiparo you are the release manager for this.

cms-bot commands are listed here

@fwyzard
Copy link
Contributor

fwyzard commented Jul 2, 2020

@makortel what do you think ?

In general I prefer to use std::lock_guard which should be slightly more lightweight; here that approach would require adding a couple of extra scopes.

@makortel
Copy link
Contributor

makortel commented Jul 2, 2020

In general I agree on std::lock_guard, on the other hand with std::unique_lock here I like that the changes are minimal. The caching allocator code anyway has much more profound performance issues than the lock type. So if there no strong opinions otherwise I'd go with unique_lock.

Copy link
Contributor

@makortel makortel left a comment

Choose a reason for hiding this comment

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

Thanks, I never really liked the explicit locking of the mutex anyway. For CachingDeviceAllocator we try to document inline the changes CMS has done to the CachingDeviceAllocator from cub.

Could you do similar changes to CachingHostAllocator as well (comment decoration are not needed there because it is all CMS code, even if cloned from the CachingDeviceAllocator).

Co-authored-by: Matti Kortelainen <matti.kortelainen@cern.ch>
@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 2, 2020

The code-checks are being triggered in jenkins.

@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 2, 2020

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-30501/16708

@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 2, 2020

Pull request #30501 was updated. @makortel, @cmsbuild, @fwyzard can you please check and sign again.

@ericcano
Copy link
Contributor Author

ericcano commented Jul 2, 2020

Could you do similar changes to CachingHostAllocator as well (comment decoration are not needed there because it is all CMS code, even if cloned from the CachingDeviceAllocator).

Sure, I will add that to the PR.

In case some of the cudaCheck() calls threw (line 596), the mutex would have been left locked. (Ported from CachingDeviceAllocator).
Also merged instanciation and locking where they appeared bach-to-back in CachingDeviceAllocator.
@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 2, 2020

The code-checks are being triggered in jenkins.

@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 2, 2020

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-30501/16713

@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 2, 2020

Pull request #30501 was updated. @makortel, @cmsbuild, @fwyzard can you please check and sign again.

@makortel
Copy link
Contributor

makortel commented Jul 2, 2020

@cmsbuild, please test

Thanks!

@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 2, 2020

The tests are being triggered in jenkins.

@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 2, 2020

+1
Tested at: 2a042ca
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-0ff47d/7622/summary.html
CMSSW: CMSSW_11_2_X_2020-07-02-1100
SCRAM_ARCH: slc7_amd64_gcc820

@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 2, 2020

Comparison job queued.

@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 2, 2020

Comparison is ready
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-0ff47d/7622/summary.html

Comparison Summary:

  • No significant changes to the logs found
  • Reco comparison results: 0 differences found in the comparisons
  • DQMHistoTests: Total files compared: 37
  • DQMHistoTests: Total histograms compared: 2784120
  • DQMHistoTests: Total failures: 1
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 2784069
  • DQMHistoTests: Total skipped: 50
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 36 files compared)
  • Checked 154 log files, 17 edm output root files, 37 DQM output files

@makortel
Copy link
Contributor

makortel commented Jul 3, 2020

+1

@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 3, 2020

This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @silviodonato, @dpiparo (and backports should be raised in the release meeting by the corresponding L2)

@silviodonato
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit fa0cea0 into cms-sw:master Jul 4, 2020
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.

None yet

5 participants