Skip to content

Omp/CUDA Utility Accelerations - #813

Open
jwilso39-uc wants to merge 1 commit into
QuEST-Kit:mainfrom
jwilso39-uc:omp-cuda-utility-checks
Open

Omp/CUDA Utility Accelerations#813
jwilso39-uc wants to merge 1 commit into
QuEST-Kit:mainfrom
jwilso39-uc:omp-cuda-utility-checks

Conversation

@jwilso39-uc

Copy link
Copy Markdown

OpenMP/CUDA Utility Accelerations

This PR implements both OpenMP and CUDA versions of the unitary, hermiticity, and CPTP checks in utilities.cpp (#496):

  1. Added OpenMP parallelizations for both DiagMatr and CompMatr versions of utility checks in utilities.cpp
  2. Added new subroutines in gpu_subroutines.cpp for CUDA accelerations of these utilities.
  3. Added thresholds for calling these new routines in utilities.hpp based on my own benchmarking (see Benchmarks section below)

Note: The multithreading utility checks now require running over the full matrix, rather than exiting early when a failure is found, since these checks need to be aggregated and compared across all threads. Alternatively, I could add back in the early exit when these checks are ran without multithreading, but I thought since the common case should be these checks passing anyways, it was better to keep things simple. Happy to add the early exit for the serial case back in, though.

Benchmarks

I ran benchmarks comparing the timing of the existing serial version of these checks to my new OpenMP and CUDA versions, comparing different numbers of qubits to see at what point an actual speedup was achieved. OpenMP tests were all run across [2, 4, 8, 16, 32] threads as well.

The serial and OpenMP benchmarks were run on a Intel Xeon Silver 4110, and the CUDA benchmarks were run on a NVIDIA L40S (Let me know if there's any other information needed here).

Graphs below show the speedup for each of the accelerations, along with my decision on what to set the threshold at based on these data:

OpenMP Benchmarks

DiagMatr Hermiticity Check - Saw speedup at >= 11 qubits
speedup_cpu_diag_hermiticity.pdf

CompMatr Hermiticity Check - Saw speedup at >= 7 qubits
speedup_cpu_hermiticity.pdf

DiagMatr Unitarity Check - Saw speedup at >= 10 qubits
speedup_cpu_diag_unitarity.pdf

CompMatr Unitarity Check - Saw speedup at >= 4 qubits
speedup_cpu_unitarity.pdf

CPTP Check - Saw speedup at >= 4 qubits
speedup_cpu_cptp.pdf

CUDA Benchmarks

DiagMatr Hermiticity Check - Saw speedup at >= 14 qubits
speedup_gpu_diag_hermitian.pdf

CompMatr Hermiticity Check - Saw speedup at >= 10 qubits
speedup_gpu_dense_hermitian.pdf

DiagMatr Unitarity Check - Saw speedup at >= 12 qubits
speedup_gpu_diag_unitary.pdf

CompMatr Unitarity Check - Saw speedup at >= 7 qubits
speedup_gpu_dense_unitary.pdf

CPTP Check - Saw speedup at >= 7 qubits
speedup_gpu_cptp.pdf

Tests

Ran tests over the [operations],[calculations],[decoherence] filters (Those looked like the ones with tests that would call these utility checks). Ran those tests in serial, with multithreading enabled, and with GPU acceleration enabled, and had all tests pass in all cases:

Serial: 
Filters: [operations],[calculations],[decoherence]
Randomness seeded to: 250026403
===============================================================================
All tests passed (519547 assertions in 142 test cases)

OpenMP:
Filters: [operations],[calculations],[decoherence]
Randomness seeded to: 4268771204
===============================================================================
All tests passed (1038497 assertions in 142 test cases)

CUDA: 
// ran filters seperately since it took a bit longer
Filters: [decoherence]
Randomness seeded to: 1750640480
===============================================================================
All tests passed (8840 assertions in 9 test cases)
Filters: [operations]
Randomness seeded to: 2612553469
===============================================================================
All tests passed (104457 assertions in 115 test cases)
Filters: [calculations]
Randomness seeded to: 1295861675
===============================================================================
All tests passed (62296 assertions in 18 test cases)

Let me know what other information or testing will be needed for this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant