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

Autodetect if a GPU can be used with CMSSW #33561

Merged
merged 1 commit into from Apr 29, 2021

Conversation

fwyzard
Copy link
Contributor

@fwyzard fwyzard commented Apr 28, 2021

PR description:

Autodetect if a GPU can be used with CMSSW.
A GPU is deemed usable if

  • it is visible to cudaGetDeviceCount();
  • it can be selected by cudaSetDevice();
  • it can allocate a small amount of GPU memory;
  • it can run a kernel.

The last point in particular ensures that CMSSW has been built to support the GPUs "compute capability" (e.g. 7.0 for a Tesla v100, etc.).

cudaComputeCapabilities now prints (unsupported) after a GPU name if it cannot be used by CMSSW.

PR validation:

With a version of CMSSW built to support only compute capability 7.5:

$ cudaComputeCapabilities 
   0     7.0    NVIDIA Tesla V100-PCIE-32GB (unsupported)
   1     7.5    NVIDIA Tesla T4

$ cudaIsEnabled && echo true || echo false
true

After hiding the usable GPU:

$ export CUDA_VISIBLE_DEVICES=0

$ cudaComputeCapabilities 
   0     7.0    NVIDIA Tesla V100-PCIE-32GB (unsupported)

$ cudaIsEnabled && echo true || echo false
false

After hiding the unusable GPU:

$ export CUDA_VISIBLE_DEVICES=1

$ cudaComputeCapabilities 
   0     7.5    NVIDIA Tesla T4

$ cudaIsEnabled && echo true || echo false
true

After hiding all GPUs (or on a machine without GPUs):

$ export CUDA_VISIBLE_DEVICES= 

$ cudaComputeCapabilities 
cudaComputeCapabilities: no CUDA-capable device is detected

$ cudaIsEnabled && echo true || echo false
false

@fwyzard
Copy link
Contributor Author

fwyzard commented Apr 28, 2021

enable gpu

@fwyzard
Copy link
Contributor Author

fwyzard commented Apr 28, 2021

please test

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-33561/22347

  • This PR adds an extra 12KB to repository

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @fwyzard (Andrea Bocci) for master.

It involves the following packages:

HeterogeneousCore/CUDAServices

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

cms-bot commands are listed here

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-d26ea3/14664/summary.html
COMMIT: cc325b9
CMSSW: CMSSW_12_0_X_2021-04-27-2300/slc7_amd64_gcc900
Additional Tests: GPU
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/33561/14664/install.sh to create a dev area with all the needed externals and cmssw changes.

GPU Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 0 differences found in the comparisons
  • DQMHistoTests: Total files compared: 4
  • DQMHistoTests: Total histograms compared: 9559
  • DQMHistoTests: Total failures: 0
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 9559
  • DQMHistoTests: Total skipped: 0
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 3 files compared)
  • Checked 12 log files, 9 edm output root files, 4 DQM output files
  • TriggerResults: no differences found

Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 7 differences found in the comparisons
  • DQMHistoTests: Total files compared: 38
  • DQMHistoTests: Total histograms compared: 2877605
  • DQMHistoTests: Total failures: 15
  • DQMHistoTests: Total nulls: 1
  • DQMHistoTests: Total successes: 2877567
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.004 KiB( 37 files compared)
  • DQMHistoSizes: changed ( 312.0 ): 0.004 KiB MessageLogger/Warnings
  • Checked 160 log files, 37 edm output root files, 38 DQM output files
  • TriggerResults: no differences found

@makortel
Copy link
Contributor

+1

Significant improvement for cudaIsEnabled, thanks!

Comparison differences are in MessageLogger and non-repeatibility in one histogram in EgammaV (#33554).

@cmsbuild
Copy link
Contributor

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, @qliphy (and backports should be raised in the release meeting by the corresponding L2)

@qliphy
Copy link
Contributor

qliphy commented Apr 28, 2021

+1

@cmsbuild cmsbuild merged commit 8de209a into cms-sw:master Apr 29, 2021
@fwyzard fwyzard deleted the rework_cudaIsEnabled branch August 18, 2021 13:35
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

4 participants