Repository navigation
madspace: run the unit test suite on CUDA and HIP - #265
Merged
Merged
Conversation
…UDA and HIP in the GPU CI - tests converted from numpy to torch; conftest sets the default torch device from MADSPACE_TEST_DEVICE (cpu, cuda or hip) and fails if a GPU is requested but missing - random numbers drawn on the CPU and moved to the device: same inputs on every device - host-side tests (LHE, systematics, event histograms, survey jobs, yaml signatures) marked cpu_only, skipped on a GPU - the GPU checks of .github/gpu_ci/madspace_checks.py (histogram, rank-4 kernels) are now regular tests - GPU CI: job madspace_ops replaced by madspace_tests (pytest on the GPU)
…t instructions A Cuts function whose only cut has nothing to act on (no SFOS pair) has no instructions; with zero streams GpuRuntime::run indexed an empty stream vector.
- t_channel momentum conservation: absolute tolerance relative to CM_ENERGY - composite round trip: the single worst point may lose 1e-4
… a CPU build (manneback)
…be reverted)" This reverts commit 473f1f2.
… ends of the t range pt = sqrt(pp^2 - p1_z^2) cancelled near an end of the t range, where the t sampling puts most points: an O(eps) difference in the rounding, e.g. FMA contraction by nvcc, became O(eps / (pt/pp)^2) in pt and in the s23 range of the 2->3 blocks, and broke the CUDA round trip of ColorOrderedMapping with cuts.
oliviermattelaer
temporarily deployed
to
ceci-gpu
October 12, 2026 21:42 — with
GitHub Actions
Inactive
theoheimel
marked this pull request as ready for review
October 13, 2026 09:28
Contributor
|
Relevant findings by claude (I dropped many other I can post them if you want):
|
oliviermattelaer
approved these changes
Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Runs the full madspace unit test suite on CUDA and HIP in the CECI GPU CI, in addition to the existing CPU tests.
Changes
madspace/testsis converted from numpy to torch. Inputs are torch tensors, so madspace runs each function on the device of its inputs, and the assertions usetorch.testing.assert_close. numpy remains only in host-side code.MADSPACE_TEST_DEVICE=cpu|cuda|hip(defaultcpu).conftest.pysets the default torch device and dtype. If a GPU is requested but torch has none, the run fails rather than skipping silently. The helpers inmadspace_testing.pyareDEVICE,default_context(),new_context(), andgenerator/rand/randn/randint.cpu_onlymarker for host-side tests, which are skipped on a GPU:test_lhe,test_systematics,test_event_histograms,test_survey_job_failure, and the yaml signature check intest_cut_kernels..github/gpu_ci/madspace_checks.pyare now regular tests. The large histogram against the CPU runtime is intest_histogram_op.py, and the rank-4 kernel check is intest_rank4_kernels.py.madspace_checks.pyandmadspace_ops_gpu.share removed.gpu_runner_ci.yml, themadspace_opsjob is replaced bymadspace_tests. It runsMADSPACE_TEST_DEVICE=$BACKEND pytest madspace/testswith the python3 of the modules, through.github/gpu_ci/madspace_tests_gpu.sh. If the modules lack pytest or scipy, they are installed into the cluster cache. The log andjunit.xmlare uploaded as an artifact.madspace.ymlsetsMADSPACE_TEST_DEVICE=cpuexplicitly.madspace_tests_gpu.shinstalls atorch==2.8.0cu128 wheel into the cluster cache and puts it ahead of the module's torch.madspace fixes found by the GPU runs
src/gpu/runtime.cu). Such a function got 0 streams, sorun()indexed an empty stream vector. This happens with aCutswhose only cut has nothing to act on, for example an SFOS-pair cut without an SFOS pair. A function now always has at least the main stream.p1com_from_tabs_cs,src/kernels/kinematics.hpp).sqrt(pp² − p1z²). Near the ends of the t range, where the t sampling puts most points, this cancels, so an O(eps) rounding difference grew to O(eps/(pt/pp)²).pt² = (|t|−t_lo)(t_hi−|t|)/(4|pa|²), witht_lofactorized so that it is exactly 0 for massless particles.--fmad=falsepassed everything, which confirmed contraction as the cause.center − half_width) still differs between CUDA and CPU by about 3e-7 at q999. This is within the test tolerances and could be a follow-up.test_t_channelmomentum conservation: the absolute tolerance now scales withCM_ENERGY.test_composite_round_trip: the bound on the single worst point is now 1e-3.Status
madspace.yml, Linux x86 + macOS)The 31 skips are made up of 20
cpu_onlytests and 11 PDF/LHAPDF tests that the clusters cannot run because they lack LHAPDF or the PDF set.Seed changes. These statistical tests were marginal and failed with the new torch random stream:
test_t_channel(1234→43).test_decay_topology(+1).test_pair_mass_floor_subtree(SEED+1→SEED+2). The any-mode W-channel weights are very heavy-tailed: the mapping mean ranges from 1.4e8 to 7e8 across seeds. This deserves a separate look.The GPU workflows were run from this branch through a temporary
ceci-gpudeployment-branch rule.