xsuite 0.45.8__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 (172) hide show
  1. xsuite-0.45.8/.github/scripts/generate_summary.sh +52 -0
  2. xsuite-0.45.8/.github/scripts/install_branches.sh +45 -0
  3. xsuite-0.45.8/.github/scripts/run_tests.sh +52 -0
  4. xsuite-0.45.8/.github/workflows/cron_test_gh.yaml +20 -0
  5. xsuite-0.45.8/.github/workflows/cron_test_gh_omp.yaml +15 -0
  6. xsuite-0.45.8/.github/workflows/cron_test_gpu_cl.yaml +19 -0
  7. xsuite-0.45.8/.github/workflows/cron_test_gpu_cuda.yaml +19 -0
  8. xsuite-0.45.8/.github/workflows/cron_test_sh_cpu.yaml +32 -0
  9. xsuite-0.45.8/.github/workflows/cron_test_sh_xwakes_mpi.yaml +20 -0
  10. xsuite-0.45.8/.github/workflows/manual_test_gh.yaml +43 -0
  11. xsuite-0.45.8/.github/workflows/manual_test_sh.yaml +55 -0
  12. xsuite-0.45.8/.github/workflows/release.yaml +84 -0
  13. xsuite-0.45.8/.github/workflows/test_gh.yaml +105 -0
  14. xsuite-0.45.8/.github/workflows/test_sh.yaml +155 -0
  15. xsuite-0.45.8/.gitignore +150 -0
  16. xsuite-0.45.8/.readthedocs.yaml +34 -0
  17. xsuite-0.45.8/Dockerfile +88 -0
  18. xsuite-0.45.8/LICENSE +201 -0
  19. xsuite-0.45.8/MANIFEST.in +7 -0
  20. xsuite-0.45.8/PKG-INFO +43 -0
  21. xsuite-0.45.8/README.md +9 -0
  22. xsuite-0.45.8/contributors.txt +21 -0
  23. xsuite-0.45.8/docs/.gitignore +2 -0
  24. xsuite-0.45.8/docs/Makefile +184 -0
  25. xsuite-0.45.8/docs/acceleration.rst +15 -0
  26. xsuite-0.45.8/docs/apireference.rst +620 -0
  27. xsuite-0.45.8/docs/autogeneration.rst +93 -0
  28. xsuite-0.45.8/docs/beambeam.rst +151 -0
  29. xsuite-0.45.8/docs/citing.rst +6 -0
  30. xsuite-0.45.8/docs/collective.rst +18 -0
  31. xsuite-0.45.8/docs/collective_intro.rst +107 -0
  32. xsuite-0.45.8/docs/collimation.rst +585 -0
  33. xsuite-0.45.8/docs/combined_cpu_gpu.rst +21 -0
  34. xsuite-0.45.8/docs/community.rst +21 -0
  35. xsuite-0.45.8/docs/conf.py +631 -0
  36. xsuite-0.45.8/docs/contexts.rst +53 -0
  37. xsuite-0.45.8/docs/contributors_acknowledgements.rst +81 -0
  38. xsuite-0.45.8/docs/dev_guide_xtbe_data_structure.rst +147 -0
  39. xsuite-0.45.8/docs/dev_guide_xtbe_internal_record.rst +32 -0
  40. xsuite-0.45.8/docs/dev_guide_xtbe_lost_part_codes.rst +40 -0
  41. xsuite-0.45.8/docs/dev_guide_xtbe_tracking_code.rst +95 -0
  42. xsuite-0.45.8/docs/dev_guide_xtrack_beam_elements.rst +11 -0
  43. xsuite-0.45.8/docs/developer.rst +12 -0
  44. xsuite-0.45.8/docs/dynamic_aperture.rst +15 -0
  45. xsuite-0.45.8/docs/environment.rst +996 -0
  46. xsuite-0.45.8/docs/exciter.rst +76 -0
  47. xsuite-0.45.8/docs/fast_lattice_changes.rst +18 -0
  48. xsuite-0.45.8/docs/figures/acceleration.png +0 -0
  49. xsuite-0.45.8/docs/figures/beambeam_sigmapi.png +0 -0
  50. xsuite-0.45.8/docs/figures/beambeamkick.png +0 -0
  51. xsuite-0.45.8/docs/figures/cern_and_chart.png +0 -0
  52. xsuite-0.45.8/docs/figures/collimator_jaws_front_view.png +0 -0
  53. xsuite-0.45.8/docs/figures/collimator_jaws_top_view.png +0 -0
  54. xsuite-0.45.8/docs/figures/crossing_bump.png +0 -0
  55. xsuite-0.45.8/docs/figures/dynamic_aperture.png +0 -0
  56. xsuite-0.45.8/docs/figures/elena_w_chrom.png +0 -0
  57. xsuite-0.45.8/docs/figures/exciter_signals.png +0 -0
  58. xsuite-0.45.8/docs/figures/footprint_HO2D.png +0 -0
  59. xsuite-0.45.8/docs/figures/footprint_bb_no_rescale.png +0 -0
  60. xsuite-0.45.8/docs/figures/footprint_bb_with_rescale.png +0 -0
  61. xsuite-0.45.8/docs/figures/footprint_polar.png +0 -0
  62. xsuite-0.45.8/docs/figures/footprint_unif_action.png +0 -0
  63. xsuite-0.45.8/docs/figures/gaussian.png +0 -0
  64. xsuite-0.45.8/docs/figures/halfcell.png +0 -0
  65. xsuite-0.45.8/docs/figures/halo.png +0 -0
  66. xsuite-0.45.8/docs/figures/ibs_sr_steadystate_coupling.png +0 -0
  67. xsuite-0.45.8/docs/figures/ibs_sr_steadystate_excitation.png +0 -0
  68. xsuite-0.45.8/docs/figures/loss_location_refinement.png +0 -0
  69. xsuite-0.45.8/docs/figures/orbit_bump.png +0 -0
  70. xsuite-0.45.8/docs/figures/orbit_correction_basic.png +0 -0
  71. xsuite-0.45.8/docs/figures/orbit_correction_custom.png +0 -0
  72. xsuite-0.45.8/docs/figures/orbit_correction_micado.png +0 -0
  73. xsuite-0.45.8/docs/figures/orbit_correction_svalues.png +0 -0
  74. xsuite-0.45.8/docs/figures/orbit_correction_thread.png +0 -0
  75. xsuite-0.45.8/docs/figures/orbit_correction_ti2.png +0 -0
  76. xsuite-0.45.8/docs/figures/pencil.png +0 -0
  77. xsuite-0.45.8/docs/figures/phasespacedistortion.png +0 -0
  78. xsuite-0.45.8/docs/figures/radial_steering.png +0 -0
  79. xsuite-0.45.8/docs/figures/spin_lep_depolarization_time.png +0 -0
  80. xsuite-0.45.8/docs/figures/spin_lep_with_bumps.png +0 -0
  81. xsuite-0.45.8/docs/figures/stabilitydiagram.png +0 -0
  82. xsuite-0.45.8/docs/figures/time_dep_knob_pwlin_tracking.png +0 -0
  83. xsuite-0.45.8/docs/figures/time_dep_knob_pwlin_twiss.png +0 -0
  84. xsuite-0.45.8/docs/figures/time_dep_knob_sin_pulse_tracking.png +0 -0
  85. xsuite-0.45.8/docs/figures/time_dep_knob_sin_tracking.png +0 -0
  86. xsuite-0.45.8/docs/figures/time_dep_knob_sin_twiss.png +0 -0
  87. xsuite-0.45.8/docs/figures/twiss.png +0 -0
  88. xsuite-0.45.8/docs/figures/twiss_beam_sizes.png +0 -0
  89. xsuite-0.45.8/docs/figures/twiss_periodic.png +0 -0
  90. xsuite-0.45.8/docs/figures/twiss_range.png +0 -0
  91. xsuite-0.45.8/docs/figures/twiss_reverse.png +0 -0
  92. xsuite-0.45.8/docs/figures/twiss_vs_delta.png +0 -0
  93. xsuite-0.45.8/docs/figures/xcoll_external.png +0 -0
  94. xsuite-0.45.8/docs/figures/xsuite_logo_alpha.png +0 -0
  95. xsuite-0.45.8/docs/footprint.rst +76 -0
  96. xsuite-0.45.8/docs/freeze_longitudinal.rst +43 -0
  97. xsuite-0.45.8/docs/full_table_of_contents.rst +45 -0
  98. xsuite-0.45.8/docs/generated_code_snippets/.gitkeep +0 -0
  99. xsuite-0.45.8/docs/gettingstarted.rst +281 -0
  100. xsuite-0.45.8/docs/index.rst +61 -0
  101. xsuite-0.45.8/docs/installation.rst +434 -0
  102. xsuite-0.45.8/docs/intrabeam_scattering.rst +77 -0
  103. xsuite-0.45.8/docs/jupyter_tutorials.rst +18 -0
  104. xsuite-0.45.8/docs/lattice_model.rst +102 -0
  105. xsuite-0.45.8/docs/make.bat +242 -0
  106. xsuite-0.45.8/docs/make_package_links.sh +6 -0
  107. xsuite-0.45.8/docs/match.rst +159 -0
  108. xsuite-0.45.8/docs/method_4d.rst +13 -0
  109. xsuite-0.45.8/docs/numericalreproducibility.rst +91 -0
  110. xsuite-0.45.8/docs/optimize_for_tracking.rst +11 -0
  111. xsuite-0.45.8/docs/particles_monitor.rst +253 -0
  112. xsuite-0.45.8/docs/particlesmanip.rst +279 -0
  113. xsuite-0.45.8/docs/physics_manual/bb6d.tex +0 -0
  114. xsuite-0.45.8/docs/physics_manual/bbconfig.tex +0 -0
  115. xsuite-0.45.8/docs/physics_manual/bibliography.bib +623 -0
  116. xsuite-0.45.8/docs/physics_manual/compile.sh +4 -0
  117. xsuite-0.45.8/docs/physics_manual/figures/b1ip1.png +0 -0
  118. xsuite-0.45.8/docs/physics_manual/figures/b1ip5.png +0 -0
  119. xsuite-0.45.8/docs/physics_manual/figures/b4ip1.png +0 -0
  120. xsuite-0.45.8/docs/physics_manual/figures/b4ip5.png +0 -0
  121. xsuite-0.45.8/docs/physics_manual/figures/bend-roll.pdf +0 -0
  122. xsuite-0.45.8/docs/physics_manual/figures/bhabha_1.png +0 -0
  123. xsuite-0.45.8/docs/physics_manual/figures/bs_1.png +0 -0
  124. xsuite-0.45.8/docs/physics_manual/figures/rbend.png +0 -0
  125. xsuite-0.45.8/docs/physics_manual/figures/xang_xplane.png +0 -0
  126. xsuite-0.45.8/docs/physics_manual/physics_man.pdf +0 -0
  127. xsuite-0.45.8/docs/physics_manual/physics_man.tex +129 -0
  128. xsuite-0.45.8/docs/physics_manual/xfields.tex +4061 -0
  129. xsuite-0.45.8/docs/physics_manual/xtrack.tex +4640 -0
  130. xsuite-0.45.8/docs/physicsguide.rst +12 -0
  131. xsuite-0.45.8/docs/pipeline.rst +32 -0
  132. xsuite-0.45.8/docs/pyhtinterface.rst +86 -0
  133. xsuite-0.45.8/docs/spacechargeauto.rst +27 -0
  134. xsuite-0.45.8/docs/spin_polarization.rst +42 -0
  135. xsuite-0.45.8/docs/synchrotron_radiation.rst +23 -0
  136. xsuite-0.45.8/docs/tapering.rst +12 -0
  137. xsuite-0.45.8/docs/testing.rst +349 -0
  138. xsuite-0.45.8/docs/time_dependent_knobs.rst +73 -0
  139. xsuite-0.45.8/docs/track.rst +85 -0
  140. xsuite-0.45.8/docs/trajectory_correction.rst +128 -0
  141. xsuite-0.45.8/docs/twiss.rst +155 -0
  142. xsuite-0.45.8/docs/twiss_match_symm.rst +0 -0
  143. xsuite-0.45.8/docs/usersguide.rst +25 -0
  144. xsuite-0.45.8/docs/v020changes.rst +36 -0
  145. xsuite-0.45.8/docs/xmask.rst +30 -0
  146. xsuite-0.45.8/docs/xobjexample.rst +254 -0
  147. xsuite-0.45.8/docs/xsuite_data_management.rst +479 -0
  148. xsuite-0.45.8/logos/xsuite_logo.png +0 -0
  149. xsuite-0.45.8/logos/xsuite_logo.svg +28 -0
  150. xsuite-0.45.8/logos/xsuite_logo_square.png +0 -0
  151. xsuite-0.45.8/logos/xsuite_logo_square.svg +26 -0
  152. xsuite-0.45.8/make_changelog.py +97 -0
  153. xsuite-0.45.8/pyproject.toml +69 -0
  154. xsuite-0.45.8/release.sh +66 -0
  155. xsuite-0.45.8/requirements.txt +8 -0
  156. xsuite-0.45.8/run_on_gh.py +142 -0
  157. xsuite-0.45.8/run_release_tests.sh +29 -0
  158. xsuite-0.45.8/run_specific_tests.sh +15 -0
  159. xsuite-0.45.8/scripts/ipac_count_papers.py +93 -0
  160. xsuite-0.45.8/setup.cfg +4 -0
  161. xsuite-0.45.8/setup.py +69 -0
  162. xsuite-0.45.8/xsuite/__init__.py +9 -0
  163. xsuite-0.45.8/xsuite/cli.py +77 -0
  164. xsuite-0.45.8/xsuite/kernel_definitions.py +43 -0
  165. xsuite-0.45.8/xsuite/lib/__init__.py +0 -0
  166. xsuite-0.45.8/xsuite/prebuild_kernels.py +291 -0
  167. xsuite-0.45.8/xsuite.egg-info/PKG-INFO +43 -0
  168. xsuite-0.45.8/xsuite.egg-info/SOURCES.txt +170 -0
  169. xsuite-0.45.8/xsuite.egg-info/dependency_links.txt +1 -0
  170. xsuite-0.45.8/xsuite.egg-info/entry_points.txt +2 -0
  171. xsuite-0.45.8/xsuite.egg-info/requires.txt +21 -0
  172. xsuite-0.45.8/xsuite.egg-info/top_level.txt +1 -0
@@ -0,0 +1,52 @@
1
+ #!/bin/bash
2
+ # copyright ############################### #
3
+ # This file is part of the Xsuite project. #
4
+ # Copyright (c) CERN, 2024. #
5
+ # ######################################### #
6
+ set -xe
7
+
8
+ echo "## Test Summary $1"
9
+
10
+ results_file="reports/$1/results.txt"
11
+
12
+ if [ -f "$results_file" ]; then
13
+ # Results file found, processing...
14
+ sed -i -e 's/\x1b\[[0-9;]*m//g' -e 's/^> /\\> /g' $results_file
15
+
16
+ passed=$(grep -c PASSED $results_file || true)
17
+ failed=$(grep "FAILED.*xsuite" $results_file | grep -P 'FAILED.* - ' | sed -E 's/.*\] (.*::[^ ]+).* - .*/\1/' | sort | uniq | wc -l)
18
+ skipped=$(grep -c SKIPPED $results_file || true)
19
+
20
+ echo "| Result | Number |"
21
+ echo "|------------|----------|"
22
+ echo "| Passed ✅ | $passed |"
23
+ echo "| Failed ❌ | $failed |"
24
+ echo "| Skipped ⏭️ | $skipped |"
25
+
26
+ if [ $failed -ne 0 ]; then
27
+ echo "### 🔴 Failed Tests"
28
+ grep "FAILED.*xsuite" $results_file | grep -P 'FAILED.* - ' | sed -E 's/.*\] (.*::[^ ]+).* - (.*)/\1 - \2/' | sort | uniq | while read -r failure; do
29
+ echo "- $failure"
30
+
31
+ echo "<details><summary>Click here to view the error details</summary><code>"
32
+ # Extract the failure name
33
+ test_name=$(echo "$failure" | sed -E 's/.*::([^\-]+).* - .*/\1/' | sed -E 's/\x1b\[[0-9;]*m//g' )
34
+ test_name=$(echo "$test_name" | sed 's/[][]/\\&/g')
35
+ # Find the start of the error block
36
+ error_start_line=$(grep -n "____________________ ${test_name} ____________________" $results_file | cut -d: -f1)
37
+ # Debug: Start line found at $error_start_line
38
+ error_end_line=$(tail -n +$((error_start_line + 1)) $results_file | grep -nm 1 "^-.*Captured stdout call.*-$" | cut -d: -f1)
39
+ if [[ ! -z "$error_start_line" ]]; then
40
+ error_end_line=$(tail -n +$((error_start_line + 1)) $results_file | grep -nm 1 "^-.*Captured stdout call.*-$" | cut -d: -f1)
41
+ if [[ ! -z "$error_end_line" ]]; then
42
+ # Find the end of the error block
43
+ absolute_error_end_line=$((error_start_line + error_end_line - 1))
44
+ sed -n "${error_start_line},${absolute_error_end_line}p" $results_file | sed 's/^>/\\>/'
45
+ fi
46
+ fi
47
+ echo "</code></details>"
48
+ done
49
+ fi
50
+ else
51
+ echo "No test results found."
52
+ fi
@@ -0,0 +1,45 @@
1
+ #!/bin/bash
2
+ # copyright ############################### #
3
+ # This file is part of the Xsuite project. #
4
+ # Copyright (c) CERN, 2024. #
5
+ # ######################################### #
6
+ set -xe
7
+
8
+ repos=(xobjects xdeps xpart xtrack xfields xmask xcoll xwakes)
9
+ xsuite_prefix="${xsuite_prefix:-.}"
10
+
11
+ # Expects the following environment variables:
12
+ # - $prefix, where to clone the packages
13
+ # - ${repo}_branch, where $repo is one of the repos above (replace - with _)
14
+ # - $precompile_kernels set to "true" or "false"
15
+ # - $install_mpi set to "true" or "false"
16
+
17
+ # Expect Xsuite already cloned by the main workflow
18
+ if [ "${precompile_kernels:-false}" == "false" ]; then
19
+ export SKIP_KERNEL_BUILD=1
20
+ fi
21
+
22
+ if [ "${install_mpi:-false}" == "true" ]; then
23
+ mamba install -y openmpi
24
+ pip install mpi4py
25
+ fi
26
+
27
+ pip install --no-deps -v -e "${xsuite_prefix}/xsuite"
28
+
29
+ # Clone the repos and install them in the correct branch
30
+ for project in "${repos[@]}"; do
31
+ branch_varname="${project//-/_}_branch"
32
+ project_branch=${!branch_varname} # get value of the variable [project]_branch
33
+
34
+ IFS=':' read -r -a parts <<< "$project_branch"
35
+ user="${parts[0]}"
36
+ branch="${parts[1]}"
37
+
38
+ cd "$xsuite_prefix"
39
+ git clone \
40
+ --recursive \
41
+ --single-branch -b "$branch" \
42
+ "https://github.com/${user}/${project}.git"
43
+
44
+ pip install -e "${xsuite_prefix}/${project}[tests]"
45
+ done
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/bash
2
+ # copyright ############################### #
3
+ # This file is part of the Xsuite project. #
4
+ # Copyright (c) CERN, 2024. #
5
+ # ######################################### #
6
+ set -xe
7
+
8
+ # Expects the path to tests folder as the first argument
9
+ if [ $# -eq 0 ]; then
10
+ echo "No arguments provided. Please provide the path to the tests folder."
11
+ exit 1
12
+ fi
13
+
14
+ # We want the tests to be terminated (quickly!) when this script is terminated
15
+ # GitHub gives us 7.5s before sending a SIGKILL to all child processes
16
+ _term() {
17
+ echo "Received a SIGINT/SIGKILL signal. Terminating."
18
+ kill -TERM "$PYTEST_PID"
19
+ }
20
+ trap _term SIGINT SIGTERM
21
+
22
+ # Pytest options
23
+ PYTEST_OPTS="--durations=0 --durations-min=1 --color=yes --verbose $PYTEST_ADDOPTS"
24
+
25
+ # Keep track of failures
26
+ PYTEST_STATUS=0
27
+ STATUS=0
28
+
29
+ # Make nice annotations in the GitHub Actions logs
30
+ pip install pytest-github-actions-annotate-failures
31
+ export GITHUB_ACTIONS=true
32
+
33
+ run_pytest() {
34
+ pytest $PYTEST_OPTS "$1" &
35
+ PYTEST_PID=$!
36
+ wait $PYTEST_PID || PYTEST_STATUS=$?
37
+ }
38
+
39
+ # Use multithreading if on cpu context and not xmask
40
+ if [[ $XOBJECTS_TEST_CONTEXTS =~ "ContextCpu" ]] && [[ ! $* =~ xsuite/(xmask|xcoll) ]]; then
41
+ pip install pytest-xdist
42
+ PYTEST_OPTS="$PYTEST_OPTS -nauto"
43
+ fi
44
+
45
+ run_pytest "$@"
46
+
47
+ # If the tests failed, set the status to 1 (5 is for no tests collected)
48
+ if [ $PYTEST_STATUS -ne 0 ] && [ $PYTEST_STATUS -ne 5 ]; then
49
+ STATUS=1
50
+ fi
51
+
52
+ exit $STATUS
@@ -0,0 +1,20 @@
1
+ # This is a workflow that should run daily
2
+ name: Daily test (GitHub, CPU)
3
+
4
+ # Controls when the action will run.
5
+ on:
6
+ schedule:
7
+ - cron: '00 19 * * *' # run at 19:00 UTC daily
8
+
9
+ # This workflow calls the test_gh.yaml workflow passing the default
10
+ # branches as inputs
11
+ jobs:
12
+ run-tests-cron-gh:
13
+ uses: ./.github/workflows/test_gh.yaml
14
+ with:
15
+ xobjects_test_contexts: "ContextCpu"
16
+ run-tests-cron-gh-precompiled:
17
+ uses: ./.github/workflows/test_gh.yaml
18
+ with:
19
+ precompile_kernels: true
20
+ xobjects_test_contexts: "ContextCpu"
@@ -0,0 +1,15 @@
1
+ # This is a workflow that should run daily
2
+ name: Daily test (GitHub, OpenMP)
3
+
4
+ # Controls when the action will run.
5
+ on:
6
+ schedule:
7
+ - cron: '00 19 * * *' # run at 19:00 UTC daily
8
+
9
+ # This workflow calls the test_gh.yaml workflow passing the default
10
+ # branches as inputs
11
+ jobs:
12
+ run-tests-cron-gh-omp:
13
+ uses: ./.github/workflows/test_gh.yaml
14
+ with:
15
+ xobjects_test_contexts: "ContextCpu:auto"
@@ -0,0 +1,19 @@
1
+ # This is a workflow that should run daily
2
+ name: Daily test (self-hosted, OpenCL)
3
+
4
+ # Controls when the action will run.
5
+ on:
6
+ schedule:
7
+ - cron: '00 19 * * *' # run at 19:00 UTC daily
8
+
9
+ # This workflow calls the test_gpu.yaml workflow passing the default
10
+ # branches as inputs. The cron workflow will not run on forks.
11
+ jobs:
12
+ run-tests-cron-gpu:
13
+ if: github.repository == 'xsuite/xsuite'
14
+ uses: ./.github/workflows/test_sh.yaml
15
+ with:
16
+ test_contexts: 'ContextPyopencl'
17
+ platform: 'alma'
18
+ suites: '["xobjects", "xdeps", "xpart", "xtrack", "xfields", "xcoll"]'
19
+ pytest_options: '-m context_dependent'
@@ -0,0 +1,19 @@
1
+ # This is a workflow that should run daily
2
+ name: Daily test (self-hosted, CUDA)
3
+
4
+ # Controls when the action will run.
5
+ on:
6
+ schedule:
7
+ - cron: '00 19 * * *' # run at 19:00 UTC daily
8
+
9
+ # This workflow calls the test_gpu.yaml workflow passing the default
10
+ # branches as inputs. The cron workflow will not run on forks.
11
+ jobs:
12
+ run-tests-cron-gpu:
13
+ if: github.repository == 'xsuite/xsuite'
14
+ uses: ./.github/workflows/test_sh.yaml
15
+ with:
16
+ test_contexts: 'ContextCupy'
17
+ platform: 'ubuntu'
18
+ suites: '["xobjects", "xdeps", "xpart", "xtrack", "xfields", "xcoll"]'
19
+ pytest_options: '-m context_dependent'
@@ -0,0 +1,32 @@
1
+ # This is a workflow that should run daily
2
+ name: Daily test (self-hosted, CPU)
3
+
4
+ # Controls when the action will run.
5
+ on:
6
+ schedule:
7
+ - cron: '00 19 * * *' # run at 19:00 UTC daily
8
+
9
+ # This workflow calls the test_gpu.yaml workflow passing the default
10
+ # branches as inputs. The cron workflow will not run on forks.
11
+ jobs:
12
+ run-tests-cron-sh-cpu-no-xmask-serial:
13
+ if: github.repository == 'xsuite/xsuite'
14
+ uses: ./.github/workflows/test_sh.yaml
15
+ with:
16
+ test_contexts: 'ContextCpu'
17
+ platform: 'alma-cpu-1'
18
+ suites: '["xobjects", "xdeps", "xpart", "xtrack", "xfields", "xcoll", "xwakes"]'
19
+ run-tests-cron-sh-cpu-no-xmask-openmp:
20
+ if: github.repository == 'xsuite/xsuite'
21
+ uses: ./.github/workflows/test_sh.yaml
22
+ with:
23
+ test_contexts: 'ContextCpu:auto'
24
+ platform: 'alma-cpu-2'
25
+ suites: '["xobjects", "xdeps", "xpart", "xtrack", "xfields", "xcoll", "xwakes"]'
26
+ run-tests-cron-sh-cpu-xmask:
27
+ if: github.repository == 'xsuite/xsuite'
28
+ uses: ./.github/workflows/test_sh.yaml
29
+ with:
30
+ test_contexts: 'ContextCpu;ContextCpu:auto'
31
+ platform: 'alma-cpu-smaller'
32
+ suites: '["xmask"]'
@@ -0,0 +1,20 @@
1
+ # This is a workflow that should run daily
2
+ name: Daily test (Xwakes, MPI)
3
+
4
+ # Controls when the action will run.
5
+ on:
6
+ schedule:
7
+ - cron: '00 19 * * *' # run at 19:00 UTC daily
8
+ workflow_dispatch:
9
+
10
+ # This workflow calls the test_gpu.yaml workflow passing the default
11
+ # branches as inputs. The cron workflow will not run on forks.
12
+ jobs:
13
+ run-tests-cron-sh-cpu-no-xmask-serial:
14
+ if: github.repository == 'xsuite/xsuite'
15
+ uses: ./.github/workflows/test_sh.yaml
16
+ with:
17
+ test_contexts: 'ContextCpu'
18
+ with_mpi: true
19
+ platform: 'alma-cpu-small-1'
20
+ suites: '["xwakes"]'
@@ -0,0 +1,43 @@
1
+ # This is a test workflow that is manually triggered
2
+ name: Manual test (GitHub, CPU)
3
+
4
+ # Controls when the action will run. Workflow runs when manually triggered using the UI
5
+ # or API.
6
+ on:
7
+ workflow_dispatch:
8
+ # Inputs the workflow accepts.
9
+ # Specify branches using the refspec-like syntax: <user>:<branch>
10
+ inputs:
11
+ locations:
12
+ description: 'Branch locations (JSON array string)'
13
+ default: '{
14
+ "xobjects_location":"xsuite:main",
15
+ "xdeps_location":"xsuite:main",
16
+ "xpart_location":"xsuite:main",
17
+ "xtrack_location":"xsuite:main",
18
+ "xfields_location":"xsuite:main",
19
+ "xmask_location":"xsuite:main",
20
+ "xcoll_location":"xsuite:main",
21
+ "xwakes_location":"xsuite:main"
22
+ }'
23
+ required: true
24
+ type: string
25
+ precompile_kernels:
26
+ description: 'precompile kernels?'
27
+ type: boolean
28
+ default: false
29
+ required: true
30
+ xobjects_test_contexts:
31
+ description: xobjects test contexts
32
+ default: "ContextCpu;ContextCpu:auto"
33
+ required: true
34
+
35
+ # This workflow calls the test_gh.yaml workflow passing the specified
36
+ # branches as inputs
37
+ jobs:
38
+ run-tests-manual-gh:
39
+ uses: ./.github/workflows/test_gh.yaml
40
+ with:
41
+ locations: ${{ inputs.locations }}
42
+ precompile_kernels: ${{ inputs.precompile_kernels }}
43
+ xobjects_test_contexts: ${{ inputs.xobjects_test_contexts }}
@@ -0,0 +1,55 @@
1
+ # This is a test workflow that is manually triggered
2
+ name: Manual test (self-hosted)
3
+ run-name: Manual test (${{ inputs.platform }}, ${{ inputs.test_contexts }})
4
+
5
+ # Controls when the action will run. Workflow runs when manually triggered using the UI
6
+ # or API.
7
+ on:
8
+ workflow_dispatch:
9
+ # Inputs the workflow accepts.
10
+ # Specify branches using the refspec-like syntax: <user>:<branch>
11
+ inputs:
12
+ locations:
13
+ description: 'Branch locations (JSON array string)'
14
+ default: '{
15
+ "xobjects_location":"xsuite:main",
16
+ "xdeps_location":"xsuite:main",
17
+ "xpart_location":"xsuite:main",
18
+ "xtrack_location":"xsuite:main",
19
+ "xfields_location":"xsuite:main",
20
+ "xmask_location":"xsuite:main",
21
+ "xcoll_location":"xsuite:main",
22
+ "xwakes_location":"xsuite:main"
23
+ }'
24
+ required: true
25
+ type: string
26
+ pytest_options:
27
+ description: Command to run tests
28
+ required: false
29
+ type: string
30
+ test_contexts:
31
+ description: test contexts
32
+ default: 'ContextCpu;ContextCpu:auto;ContextCupy;ContextPyopencl'
33
+ required: false
34
+ platform:
35
+ description: platform
36
+ default: 'ubuntu'
37
+ required: true
38
+ suites:
39
+ description: test suites (JSON array string)
40
+ required: true
41
+ type: string
42
+ default: '["xobjects", "xdeps", "xpart", "xtrack", "xfields", "xmask", "xcoll", "xwakes"]'
43
+
44
+ # This workflow calls the test_sh.yaml workflow passing the specified
45
+ # branches as inputs
46
+ jobs:
47
+ run-tests-manual-sh:
48
+ uses: ./.github/workflows/test_sh.yaml
49
+ secrets: inherit
50
+ with:
51
+ locations: ${{ inputs.locations }}
52
+ pytest_options: ${{ inputs.pytest_options }}
53
+ test_contexts: ${{ inputs.test_contexts }}
54
+ platform: ${{ inputs.platform }}
55
+ suites: ${{ inputs.suites }}
@@ -0,0 +1,84 @@
1
+ name: Release
2
+ run-name: Release ${{ github.ref_name }}
3
+
4
+ on:
5
+ push:
6
+ tags:
7
+ - v*
8
+
9
+ jobs:
10
+ build-wheels:
11
+ name: Build wheels for ${{ matrix.pyver }} on ${{ matrix.os }}
12
+ runs-on: ${{ matrix.os }}
13
+ strategy:
14
+ matrix:
15
+ os: [
16
+ ubuntu-latest,
17
+ macos-15-intel, # x86_64 runners for building x86 wheels
18
+ macos-latest, # arm64 runners
19
+ ]
20
+ pyver: [cp310, cp311, cp312, cp313, cp314]
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+
24
+ - uses: actions/setup-python@v5
25
+
26
+ - name: Install cibuildwheel
27
+ run: python -m pip install cibuildwheel
28
+
29
+ - name: Build wheels
30
+ run: python -m cibuildwheel --output-dir wheelhouse
31
+ env:
32
+ CIBW_BUILD: ${{ matrix.pyver }}-*
33
+ CIBW_ENVIRONMENT_PASS_LINUX: LDFLAGS
34
+ LDFLAGS: "-Wl,-S" # Strip debug symbols: otherwise added by manylinux
35
+
36
+ - uses: actions/upload-artifact@v4
37
+ with:
38
+ name: dist-wheels-${{ matrix.os }}-${{ strategy.job-index }}
39
+ path: ./wheelhouse/*.whl
40
+
41
+ build-sdist:
42
+ name: Build source distribution
43
+ runs-on: ubuntu-latest
44
+ steps:
45
+ - uses: actions/checkout@v4
46
+
47
+ - name: Build sdist
48
+ run: pipx run build --sdist
49
+
50
+ - uses: actions/upload-artifact@v4
51
+ with:
52
+ name: dist-sdist
53
+ path: dist/*.tar.gz
54
+
55
+ publish-to-pypi:
56
+ name: Publish to PyPI
57
+ runs-on: ubuntu-latest
58
+ needs: [build-wheels, build-sdist]
59
+ environment:
60
+ name: pypi
61
+ url: https://pypi.org/p/xsuite
62
+ permissions:
63
+ id-token: write
64
+
65
+ steps:
66
+ - name: Check tag is a public release
67
+ id: check-tag
68
+ run: |
69
+ # Only if a tag matches the pattern vX.Y.Z, upload to PyPI
70
+ if [[ ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
71
+ echo "match=true" >> $GITHUB_OUTPUT
72
+ fi
73
+
74
+ - name: Download all the dists
75
+ if: steps.check-tag.outputs.match == 'true'
76
+ uses: actions/download-artifact@v4
77
+ with:
78
+ pattern: dist-*
79
+ path: dist
80
+ merge-multiple: true
81
+
82
+ - name: Publish to PyPI
83
+ if: steps.check-tag.outputs.match == 'true'
84
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,105 @@
1
+ # This is a test workflow the other (GitHub runner based) workflows rely on
2
+ name: Test workflow (GitHub, CPU)
3
+
4
+ # Controls when the action will run. This is a reusable workflow.
5
+ on:
6
+ workflow_call:
7
+ # Inputs the workflow accepts.
8
+ inputs:
9
+ locations:
10
+ description: 'Branch locations (JSON array string)'
11
+ default: '{
12
+ "xobjects_location":"xsuite:main",
13
+ "xdeps_location":"xsuite:main",
14
+ "xpart_location":"xsuite:main",
15
+ "xtrack_location":"xsuite:main",
16
+ "xfields_location":"xsuite:main",
17
+ "xmask_location":"xsuite:main",
18
+ "xcoll_location":"xsuite:main",
19
+ "xwakes_location":"xsuite:main"
20
+ }'
21
+ required: false
22
+ type: string
23
+ precompile_kernels:
24
+ required: false
25
+ default: false
26
+ type: boolean
27
+ xobjects_test_contexts:
28
+ required: false
29
+ default: "ContextCpu;ContextCpu:auto"
30
+ type: string
31
+
32
+ # A workflow run is made up of one or more jobs that can run sequentially or in parallel
33
+ # The jobs are all run in independent environments. Here we will run a separate job
34
+ # for each of the test suites specified in the matrix below.
35
+ jobs:
36
+ run-tests:
37
+ # The type of runner that the job will run on: this one is provided by GitHub
38
+ runs-on: ubuntu-latest
39
+
40
+ # Run tests for all the xsuite packages in separate jobs in parallel
41
+ strategy:
42
+ fail-fast: false
43
+ matrix:
44
+ test-suite:
45
+ - xobjects
46
+ - xdeps
47
+ - xpart
48
+ - xtrack
49
+ - xfields
50
+ - xmask
51
+ - xcoll
52
+ - xwakes
53
+
54
+ # Make the default shell a login shell, so that conda is initialised properly
55
+ defaults:
56
+ run:
57
+ shell: bash -el {0}
58
+
59
+ # Steps represent a sequence of tasks that will be executed as part of the job
60
+ steps:
61
+ - name: Set up dynamic swapping
62
+ run: |
63
+ sudo swapoff -a
64
+ sudo apt-get install -y swapspace
65
+ sudo systemctl start swapspace.service
66
+ df -h
67
+ - name: Setup Miniforge
68
+ uses: conda-incubator/setup-miniconda@v2
69
+ with:
70
+ miniforge-version: latest
71
+ python-version: "3.10"
72
+ - name: Install dependencies
73
+ run: |
74
+ conda install openmp
75
+ pip install cython
76
+ - name: Checkout xsuite
77
+ uses: actions/checkout@v4
78
+ with:
79
+ path: xsuite
80
+ - name: Check out xsuite repos & pip install
81
+ env:
82
+ precompile_kernels: ${{ inputs.precompile_kernels }}
83
+ run: |
84
+ export xobjects_branch=${{ fromJson(inputs.locations).xobjects_location }}
85
+ export xdeps_branch=${{ fromJson(inputs.locations).xdeps_location }}
86
+ export xpart_branch=${{ fromJson(inputs.locations).xpart_location }}
87
+ export xtrack_branch=${{ fromJson(inputs.locations).xtrack_location }}
88
+ export xfields_branch=${{ fromJson(inputs.locations).xfields_location }}
89
+ export xmask_branch=${{ fromJson(inputs.locations).xmask_location }}
90
+ export xcoll_branch=${{ fromJson(inputs.locations).xcoll_location }}
91
+ export xwakes_branch=${{ fromJson(inputs.locations).xwakes_location }}
92
+ export xsuite_prefix="$GITHUB_WORKSPACE"
93
+ bash $GITHUB_WORKSPACE/xsuite/.github/scripts/install_branches.sh
94
+ - name: Precompile kernels
95
+ if: ${{ inputs.precompile_kernels == true }}
96
+ run: |
97
+ xsuite-prebuild r
98
+ - name: Print versions
99
+ run: conda list
100
+ - name: Run tests (${{ matrix.test-suite }})
101
+ env:
102
+ XOBJECTS_TEST_CONTEXTS: ${{ inputs.xobjects_test_contexts }}
103
+ run: |
104
+ cd $GITHUB_WORKSPACE/${{ matrix.test-suite }}
105
+ python -m pytest --color=yes -v tests