gqis 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. gqis-0.1.0/BENCHMARKS.md +122 -0
  2. gqis-0.1.0/Benchmark_01_full_benchmark.csv +53 -0
  3. gqis-0.1.0/Benchmark_01_full_benchmark.png +0 -0
  4. gqis-0.1.0/Benchmark_01_two_level.py +1325 -0
  5. gqis-0.1.0/Benchmark_01_two_level_basic_julia_gpu.jl +96 -0
  6. gqis-0.1.0/Benchmark_02_four_level_Interferometry.py +1122 -0
  7. gqis-0.1.0/Benchmark_02_full_benchmark.csv +53 -0
  8. gqis-0.1.0/Benchmark_02_full_benchmark.png +0 -0
  9. gqis-0.1.0/Benchmark_full_tools.py +370 -0
  10. gqis-0.1.0/CHANGELOG.md +34 -0
  11. gqis-0.1.0/CITATION.cff +18 -0
  12. gqis-0.1.0/CONTRIBUTING.md +66 -0
  13. gqis-0.1.0/Example_01_two_level_basic.png +0 -0
  14. gqis-0.1.0/Example_01_two_level_basic.py +119 -0
  15. gqis-0.1.0/Example_02_four_level_interferogram.png +0 -0
  16. gqis-0.1.0/Example_02_four_level_interferogram.py +192 -0
  17. gqis-0.1.0/Example_03_two_level_animation.py +274 -0
  18. gqis-0.1.0/Example_04_four_level_animation.py +389 -0
  19. gqis-0.1.0/Example_05_initial_condition_sweep_gate_fidelity.py +407 -0
  20. gqis-0.1.0/GQIS_API.md +299 -0
  21. gqis-0.1.0/INSTALLATION_TEST.md +258 -0
  22. gqis-0.1.0/LICENSE +21 -0
  23. gqis-0.1.0/MANIFEST.in +25 -0
  24. gqis-0.1.0/PKG-INFO +363 -0
  25. gqis-0.1.0/README.md +313 -0
  26. gqis-0.1.0/check_environment.py +6 -0
  27. gqis-0.1.0/gqis/N_Level_Kernel.cu +173 -0
  28. gqis-0.1.0/gqis/__init__.py +27 -0
  29. gqis-0.1.0/gqis/check_environment.py +362 -0
  30. gqis-0.1.0/gqis/solver.py +1375 -0
  31. gqis-0.1.0/gqis.egg-info/PKG-INFO +363 -0
  32. gqis-0.1.0/gqis.egg-info/SOURCES.txt +42 -0
  33. gqis-0.1.0/gqis.egg-info/dependency_links.txt +1 -0
  34. gqis-0.1.0/gqis.egg-info/entry_points.txt +2 -0
  35. gqis-0.1.0/gqis.egg-info/requires.txt +36 -0
  36. gqis-0.1.0/gqis.egg-info/top_level.txt +1 -0
  37. gqis-0.1.0/pyproject.toml +83 -0
  38. gqis-0.1.0/requirements.txt +30 -0
  39. gqis-0.1.0/setup.cfg +4 -0
  40. gqis-0.1.0/tests/test_animation_settings.py +55 -0
  41. gqis-0.1.0/tests/test_benchmark_interfaces.py +162 -0
  42. gqis-0.1.0/tests/test_gpu_solver.py +28 -0
  43. gqis-0.1.0/tests/test_package.py +102 -0
  44. gqis-0.1.0/tests/test_time_grids.py +21 -0
@@ -0,0 +1,122 @@
1
+ # Benchmark Validation And Performance
2
+
3
+ The benchmark scripts validate the GPU Quantum Interferometry Solver (GQIS) against independent numerical solvers and
4
+ show how calculation time changes with parameter-grid size. They are supporting evidence for the solver, not the
5
+ primary GQIS interface. The runnable examples and [`mesolve_2D` application programming interface
6
+ (API)](./GQIS_API.md) describe normal use.
7
+
8
+ ## Models
9
+
10
+ - `Benchmark_01_two_level.py` evaluates a driven two-level system.
11
+ - `Benchmark_02_four_level_Interferometry.py` evaluates a coupled qubit-resonator model represented by four basis
12
+ states.
13
+
14
+ Both benchmarks offer the same solver choices. Central processing unit (CPU) solvers run on the computer processor;
15
+ graphics processing unit (GPU) solvers run on the NVIDIA GPU.
16
+
17
+ | Solver | Method |
18
+ | --- | --- |
19
+ | `gpu` | GQIS fixed-step fourth-order Runge-Kutta (RK4) solver on CUDA. |
20
+ | `python_cpu` | Transparent fixed-step Python RK4 reference. |
21
+ | `python_ode_cpu` | Adaptive SciPy `solve_ivp` embedded fourth/fifth-order Runge-Kutta (RK45) method on CPU. |
22
+ | `qutip_cpu` | Adaptive QuTiP `mesolve` reference on CPU. |
23
+ | `julia_gpu` | Julia DifferentialEquations/DiffEqGPU solver using the same reduced density-matrix ordinary differential equation (ODE) system as GQIS. |
24
+
25
+ ## Running Benchmarks
26
+
27
+ The user-editable block near the bottom of each script documents the model, grid, solver, and output settings. Run the
28
+ default configuration with:
29
+
30
+ ```bash
31
+ python Benchmark_01_two_level.py
32
+ python Benchmark_02_four_level_Interferometry.py
33
+ ```
34
+
35
+ The available modes are:
36
+
37
+ | Mode | Purpose |
38
+ | --- | --- |
39
+ | `single` | Run one selected solver. |
40
+ | `diff` | Run any two solvers and report map differences and timings. |
41
+ | `all` | Attempt every available solver. |
42
+ | `full_benchmark` | Measure calculation time over powers-of-two square-grid sizes and save comma-separated values (CSV) data and a Portable Network Graphics (PNG) figure. |
43
+
44
+ For example, compare GQIS with QuTiP using the settings selected in the benchmark file:
45
+
46
+ ```bash
47
+ python Benchmark_02_four_level_Interferometry.py --mode diff --solver gpu --solver-b qutip_cpu
48
+ ```
49
+
50
+ `diff` mode prints mean-square deviation (MSE), root-mean-square deviation (RMS), maximum absolute deviation, and both
51
+ solver times. Increase `solver_steps_per_period` until the GQIS result is converged. Use divider `1` for QuTiP or SciPy
52
+ when validating every solver on the same requested time grid for evaluating time-dependent coefficients and recording
53
+ output.
54
+
55
+ Run either script with `--help` for its complete command-line options. Those options override `user_settings()`.
56
+
57
+ > Running `all` or `full_benchmark` can take considerable time, especially with adaptive CPU solvers. Full benchmark
58
+ > mode terminates measurements that exceed its configured limit and extrapolates larger grids instead of leaving a
59
+ > timed-out process running.
60
+
61
+ ## Numerical Comparison Notes
62
+
63
+ - GQIS and `python_cpu` use fixed-step RK4. The `python_cpu` divider defaults to `1`, matching the GQIS step density.
64
+ - `python_ode_cpu` and `qutip_cpu` choose adaptive internal steps. Their default divider of `10` reduces the requested
65
+ number of time samples used to evaluate time-dependent coefficients and record output; it does not change the internal
66
+ adaptive accuracy target. Set the divider to `1` when all solvers must receive the same requested time grid.
67
+ - If a time list contains `M` samples, it defines `M - 1` integration intervals. `N` always denotes the number of
68
+ simulated quantum levels, not the time-grid length.
69
+ - The Julia solver solves the same trace- and Hermiticity-reduced physical ODE system as GQIS. Its scaling value is the
70
+ synchronized Julia solve time; symbolic and Julia-side single-threaded CPU preparation are excluded. Consequently,
71
+ the plotted value does not represent Julia's complete model-preparation workflow or its peak video random-access
72
+ memory (VRAM) requirement.
73
+ - The reference timings are hardware- and model-specific. Compare numerical output first, then interpret speed.
74
+
75
+ ## Full Scaling Benchmark
76
+
77
+ Full benchmark mode measures powers-of-two square grids. Measured plot points use circles. Once a solver exceeds or is
78
+ predicted to exceed the time limit, larger values are extrapolated on a graph with logarithmic scales on both axes and
79
+ plotted as squares using the same solver color. Extrapolation is intended to show scaling estimates, not substitute for
80
+ measured data.
81
+
82
+ Each generated CSV stores the equipment and software versions, physical and numerical configuration, grid dimensions,
83
+ number of simulations, solver, timing components, and measured/extrapolated status. The benchmark also saves its PNG
84
+ figure automatically so a long run can be compared with the reference results later.
85
+
86
+ ## Reference Results
87
+
88
+ Reference workstation:
89
+
90
+ - CPU: 11th Gen Intel Core i9-11900K at 3.50 gigahertz (GHz)
91
+ - GPU: NVIDIA GeForce RTX 3080 with 10 gigabytes (GB) VRAM
92
+ - precision: 32-bit floating point (FP32) for the GQIS scaling runs
93
+ - workload: 10,240 fixed RK4 steps per GQIS simulation
94
+
95
+ The largest measured `32768 x 32768` grids contain 1.07 billion independent simulations. GQIS completed them in
96
+ about 1 minute 44 seconds for the two-level model and 7 minutes 1 second for the four-level model. Direct QuTiP runs at
97
+ this resolution were not practical; extrapolation from measured smaller grids estimates about 69 days and 108 days,
98
+ respectively.
99
+
100
+ Across the linear scaling region from `4096 x 4096` through `32768 x 32768`, where calculation time increases in
101
+ proportion to the number of simulations, average point-by-point speedups were about 69,000 times over QuTiP and 22 times
102
+ over Julia for the two-level model, and 24,000 times over QuTiP and 38 times over Julia for the four-level model. The
103
+ QuTiP and Julia values in this region include extrapolated timings after each reference solver reaches the configured
104
+ practical limit.
105
+
106
+ ### Two-Level Reference
107
+
108
+ [Timing data (CSV)](./Benchmark_01_full_benchmark.csv) | [Figure file (PNG)](./Benchmark_01_full_benchmark.png)
109
+
110
+ ![Two-level full benchmark](./Benchmark_01_full_benchmark.png)
111
+
112
+ ### Four-Level Reference
113
+
114
+ [Timing data (CSV)](./Benchmark_02_full_benchmark.csv) | [Figure file (PNG)](./Benchmark_02_full_benchmark.png)
115
+
116
+ ![Four-level full benchmark](./Benchmark_02_full_benchmark.png)
117
+
118
+ ## Reporting New Results
119
+
120
+ Keep the automatically generated CSV and PNG together. The CSV is the authoritative record of hardware, software,
121
+ model, time-grid, precision, CPU-divider, sweep-limit, preparation, calculation, and measured/extrapolated metadata.
122
+ Regenerate both files after solver or benchmark changes before citing performance.
@@ -0,0 +1,53 @@
1
+ # timestamp_local,2026-08-20T17:18:37
2
+ # cpu,11th Gen Intel(R) Core(TM) i9-11900K @ 3.50GHz
3
+ # gpu,NVIDIA GeForce RTX 3080
4
+ # os,"Windows 11 Home (25H2, build 26200.9168)"
5
+ # python,3.11.7
6
+ # numpy,2.4.6
7
+ # gqis,0.1.0
8
+ # sympy,1.14.0
9
+ # matplotlib,3.11.1
10
+ # scipy,1.16.1
11
+ # qutip,5.2.0
12
+ # cupy,14.1.1
13
+ # gpu_vram_gb,10.00
14
+ # cuda_runtime,12.9
15
+ # gpu_first_rhs_stage_s,0.246771812
16
+
17
+ side_dimension,number_of_simulations,solver,time_s,prep_s,calc_s,status
18
+ 16,256,gpu,0.00410747528,,,measured
19
+ 32,1024,gpu,0.00399899483,,,measured
20
+ 64,4096,gpu,0.00399947166,,,measured
21
+ 128,16384,gpu,0.00599980354,,,measured
22
+ 256,65536,gpu,0.0100018978,,,measured
23
+ 512,262144,gpu,0.0289971828,,,measured
24
+ 1024,1048576,gpu,0.101011753,,,measured
25
+ 2048,4194304,gpu,0.367999792,,,measured
26
+ 4096,16777216,gpu,1.45735574,,,measured
27
+ 8192,67108864,gpu,5.82352161,,,measured
28
+ 16384,268435456,gpu,22.8693056,,,measured
29
+ 32768,1073741824,gpu,104.29636,,,measured
30
+ 16,256,qutip_cpu,6.78204679,,,measured
31
+ 32,1024,qutip_cpu,13.4935064,,,measured
32
+ 64,4096,qutip_cpu,38.5976455,,,measured
33
+ 128,16384,qutip_cpu,145.669281,,,measured
34
+ 256,65536,qutip_cpu,549.762531,,,extrapolated
35
+ 512,262144,qutip_cpu,2074.82895,,,extrapolated
36
+ 1024,1048576,qutip_cpu,7830.49941,,,extrapolated
37
+ 2048,4194304,qutip_cpu,29552.6631,,,extrapolated
38
+ 4096,16777216,qutip_cpu,111533.103,,,extrapolated
39
+ 8192,67108864,qutip_cpu,420931.035,,,extrapolated
40
+ 16384,268435456,qutip_cpu,1588612.99,,,extrapolated
41
+ 32768,1073741824,qutip_cpu,5995498.12,,,extrapolated
42
+ 16,256,julia_gpu,8.75585461,,,measured
43
+ 32,1024,julia_gpu,8.42992091,,,measured
44
+ 64,4096,julia_gpu,7.72865081,,,measured
45
+ 128,16384,julia_gpu,8.11102223,,,measured
46
+ 256,65536,julia_gpu,7.68946171,,,measured
47
+ 512,262144,julia_gpu,9.45999002,,,measured
48
+ 1024,1048576,julia_gpu,12.4441938,,,measured
49
+ 2048,4194304,julia_gpu,14.8668585,,,measured
50
+ 4096,16777216,julia_gpu,26.8419883,,,measured
51
+ 8192,67108864,julia_gpu,121.175427,,,measured
52
+ 16384,268435456,julia_gpu,547.034146,,,extrapolated
53
+ 32768,1073741824,julia_gpu,2469.53003,,,extrapolated