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

GPU vs CPU results #280

Open
vannarho-fas opened this issue Jan 27, 2025 · 0 comments
Open

GPU vs CPU results #280

vannarho-fas opened this issue Jan 27, 2025 · 0 comments

Comments

@vannarho-fas
Copy link

Hi Team,

We’ve observed discrepancies between XVA results generated using GPU (OpenCL) and CPU configurations, despite identical input parameters and model settings. The differences are non-trivial in certain metrics.

Key Observations - Example 24 XVA Results

  • GPU results differ systematically from CPU results across metrics like CVA, DVA, FCA, and BaselEPE/EEPE.
  • Larger variances appear in columns involving collateral adjustments (DVA, FBAexAllSP) and exposure aggregation (BaselEPE).
  • Full diff report and files (xva_o.csv [GPU] and xva_e.csv [CPU]) are attached for reference.

Possible Factors to Investigate:

  • Precision Settings: Are GPU kernels using single-precision (float32) while CPU uses double-precision (float64)?
  • Non-Determinism: Do parallel GPU executions (e.g., OpenCL workgroups) introduce order-of-operations variability in summations or Monte Carlo paths?
  • Algorithmic Approximations: Are there GPU-specific optimizations (e.g., reduced convergence thresholds, simplified math ops) that differ from CPU logic?
  • RNG Seeds: Are stochastic components (e.g., Monte Carlo simulations) using identical seeds across GPU/CPU runs?
  • Math Libraries: Could differences between GPU (e.g., OpenCL) and CPU (e.g., MKL) math libraries explain the variances?
  • Error Handling: How are #N/A values or edge cases handled differently between configurations?

Request:

Could you review the attached results and share your insights on:

  • Likely root causes for the discrepancies (e.g., precision, parallelism, or RNG issues).
  • Whether these differences fall within expected tolerances for GPU vs. CPU implementations.
  • Recommendations to align results (e.g., enforcing double-precision on GPU, locking RNG seeds).

We’re particularly keen to understand if the larger variances (e.g., 30% in DVA) indicate a potential bug or are an artifact of hardware-driven approximations.

Differences in column: FCAexOwnSP
File1 File2 Difference % Difference
0 -13203.64 -13525.63 True 2.438646
1 -132.72 -122.25 True 7.888788
2 -8497.15 -8595.22 True 1.154152
3 -12165.43 -11334.98 True 6.826310
4 -326.87 -328.68 True 0.553737
5 -588.97 -596.16 True 1.220775

Differences in column: BaselEPE
File1 File2 Difference % Difference
0 2398705.37 2405735.10 True 0.293064
1 23192.67 22987.52 True 0.884547
2 532423.01 501898.61 True 5.733111
3 2112582.71 2095955.48 True 0.787057
4 55258.92 52011.90 True 5.876011
5 162012.20 162361.74 True 0.215749

Differences in column: DVA
File1 File2 Difference % Difference
0 1231.88 861.91 True 30.032958
2 78857.98 68649.12 True 12.945881
4 6422.02 5808.41 True 9.554782

Differences in column: FBAexAllSP
File1 File2 Difference % Difference
0 644.09 451.90 True 29.838998
2 41312.52 35992.05 True 12.878590
4 3312.53 2997.22 True 9.518706

Differences in column: CVA
File1 File2 Difference % Difference
0 79153.01 81082.78 True 2.438025
1 795.61 732.83 True 7.890801
2 50928.33 51515.37 True 1.152679
3 72927.54 67949.86 True 6.825515
4 1959.95 1970.80 True 0.553586
5 3532.20 3575.31 True 1.220486

Differences in column: AllocatedDVA
File1 File2 Difference % Difference
0 1231.88 861.91 True 30.032958

Differences in column: FBAexOwnSP
File1 File2 Difference % Difference
0 623.77 436.95 True 29.950142
2 39960.93 34799.29 True 12.916716
4 3232.25 2923.92 True 9.539175

Differences in column: AllocatedCVA
File1 File2 Difference % Difference
0 79153.01 81082.78 True 2.438025

Differences in column: FCAexAllSP
File1 File2 Difference % Difference
0 -13566.43 -13900.11 True 2.459601
1 -136.47 -125.64 True 7.935810
2 -8779.92 -8885.08 True 1.197733
3 -12506.21 -11648.12 True 6.861311
4 -334.17 -336.32 True 0.643385
5 -599.26 -606.64 True 1.231519

Differences in column: FBA
File1 File2 Difference % Difference
0 591.03 412.92 True 30.135526
2 37798.29 32891.76 True 12.980825
4 3102.36 2805.35 True 9.573679

Differences in column: FCA
File1 File2 Difference % Difference
0 -12620.64 -12923.89 True 2.402810
1 -126.71 -116.80 True 7.821009
2 -8044.48 -8131.27 True 1.078876
3 -11618.17 -10832.03 True 6.766470
4 -315.02 -316.32 True 0.412672
5 -572.14 -579.01 True 1.200755

Differences in column: BaselEEPE
File1 File2 Difference % Difference
0 2411948.36 2414412.91 True 0.102181
1 23260.81 23165.26 True 0.410777
2 532423.01 501898.61 True 5.733111
3 2112582.71 2099129.86 True 0.636796
4 55258.92 52696.95 True 4.636301
5 162030.68 162426.68 True 0.244398

xva_24_o.csv
xva_24_e.csv

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

No branches or pull requests

1 participant