muGrid 0.0.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 (206) hide show
  1. mugrid-0.0.0/.clang-format +9 -0
  2. mugrid-0.0.0/.gitattributes +3 -0
  3. mugrid-0.0.0/.github/install_netcdf4.sh +84 -0
  4. mugrid-0.0.0/.github/workflows/documentation.yml +65 -0
  5. mugrid-0.0.0/.github/workflows/publish.yml +49 -0
  6. mugrid-0.0.0/.github/workflows/tests.yml +198 -0
  7. mugrid-0.0.0/.github/workflows/wheels.yml +86 -0
  8. mugrid-0.0.0/.gitignore +28 -0
  9. mugrid-0.0.0/.gitmodules +11 -0
  10. mugrid-0.0.0/.pre-commit-config.yaml +11 -0
  11. mugrid-0.0.0/CHANGELOG.md +363 -0
  12. mugrid-0.0.0/CMakeLists.txt +321 -0
  13. mugrid-0.0.0/CPPLINT.cfg +5 -0
  14. mugrid-0.0.0/LICENSE +165 -0
  15. mugrid-0.0.0/PKG-INFO +228 -0
  16. mugrid-0.0.0/README.md +43 -0
  17. mugrid-0.0.0/SESSION_CONTEXT.md +173 -0
  18. mugrid-0.0.0/cmake/muGridConfig.cmake.in +18 -0
  19. mugrid-0.0.0/discover_version.py +148 -0
  20. mugrid-0.0.0/doc/Doxyfile +25 -0
  21. mugrid-0.0.0/doc/MainSchema.png +0 -0
  22. mugrid-0.0.0/doc/Makefile +20 -0
  23. mugrid-0.0.0/doc/logo_flat.png +0 -0
  24. mugrid-0.0.0/doc/logo_square.png +0 -0
  25. mugrid-0.0.0/doc/requirements.txt +3 -0
  26. mugrid-0.0.0/doc/source/CodingConvention.rst +3077 -0
  27. mugrid-0.0.0/doc/source/Cplusplus.rst +224 -0
  28. mugrid-0.0.0/doc/source/CplusplusAPI.rst +4 -0
  29. mugrid-0.0.0/doc/source/FFT.rst +243 -0
  30. mugrid-0.0.0/doc/source/GPU.rst +217 -0
  31. mugrid-0.0.0/doc/source/GettingStarted.rst +207 -0
  32. mugrid-0.0.0/doc/source/Python.rst +295 -0
  33. mugrid-0.0.0/doc/source/Summary.rst +10 -0
  34. mugrid-0.0.0/doc/source/conf.py +209 -0
  35. mugrid-0.0.0/doc/source/index.rst +43 -0
  36. mugrid-0.0.0/examples/CMakeLists.txt +48 -0
  37. mugrid-0.0.0/examples/components.py +12 -0
  38. mugrid-0.0.0/examples/fft_roundtrip.py +23 -0
  39. mugrid-0.0.0/examples/field_collection.py +25 -0
  40. mugrid-0.0.0/examples/fourier_derivative.py +44 -0
  41. mugrid-0.0.0/examples/gradient.py +63 -0
  42. mugrid-0.0.0/examples/io.py +21 -0
  43. mugrid-0.0.0/examples/poisson.py +139 -0
  44. mugrid-0.0.0/examples/scalar.py +16 -0
  45. mugrid-0.0.0/examples/sub_points.py +15 -0
  46. mugrid-0.0.0/language_bindings/CMakeLists.txt +1 -0
  47. mugrid-0.0.0/language_bindings/python/CMakeLists.txt +61 -0
  48. mugrid-0.0.0/language_bindings/python/__init__.py +1 -0
  49. mugrid-0.0.0/language_bindings/python/bind_py_common_mugrid.cc +269 -0
  50. mugrid-0.0.0/language_bindings/python/bind_py_communicator.cc +161 -0
  51. mugrid-0.0.0/language_bindings/python/bind_py_convolution_operator.cc +250 -0
  52. mugrid-0.0.0/language_bindings/python/bind_py_declarations.hh +53 -0
  53. mugrid-0.0.0/language_bindings/python/bind_py_decomposition.cc +123 -0
  54. mugrid-0.0.0/language_bindings/python/bind_py_fft.cc +406 -0
  55. mugrid-0.0.0/language_bindings/python/bind_py_field.cc +444 -0
  56. mugrid-0.0.0/language_bindings/python/bind_py_field_collection.cc +545 -0
  57. mugrid-0.0.0/language_bindings/python/bind_py_file_io.cc +333 -0
  58. mugrid-0.0.0/language_bindings/python/bind_py_module.cc +54 -0
  59. mugrid-0.0.0/language_bindings/python/bind_py_state_field.cc +101 -0
  60. mugrid-0.0.0/language_bindings/python/muGrid/Field.py +361 -0
  61. mugrid-0.0.0/language_bindings/python/muGrid/Parallel.py +91 -0
  62. mugrid-0.0.0/language_bindings/python/muGrid/Solvers.py +107 -0
  63. mugrid-0.0.0/language_bindings/python/muGrid/Wrappers.py +872 -0
  64. mugrid-0.0.0/language_bindings/python/muGrid/__init__.py +175 -0
  65. mugrid-0.0.0/pyproject.toml +74 -0
  66. mugrid-0.0.0/pytest.ini +3 -0
  67. mugrid-0.0.0/renovate.json +6 -0
  68. mugrid-0.0.0/requirements.txt +44 -0
  69. mugrid-0.0.0/setup.cfg +2 -0
  70. mugrid-0.0.0/src/CMakeLists.txt +1 -0
  71. mugrid-0.0.0/src/libmugrid/CMakeLists.txt +192 -0
  72. mugrid-0.0.0/src/libmugrid/collection/field_collection.cc +681 -0
  73. mugrid-0.0.0/src/libmugrid/collection/field_collection.hh +1133 -0
  74. mugrid-0.0.0/src/libmugrid/collection/field_collection_global.cc +305 -0
  75. mugrid-0.0.0/src/libmugrid/collection/field_collection_global.hh +344 -0
  76. mugrid-0.0.0/src/libmugrid/collection/field_collection_local.cc +129 -0
  77. mugrid-0.0.0/src/libmugrid/collection/field_collection_local.hh +159 -0
  78. mugrid-0.0.0/src/libmugrid/core/coordinates.hh +614 -0
  79. mugrid-0.0.0/src/libmugrid/core/enums.cc +101 -0
  80. mugrid-0.0.0/src/libmugrid/core/enums.hh +137 -0
  81. mugrid-0.0.0/src/libmugrid/core/exception.cc +107 -0
  82. mugrid-0.0.0/src/libmugrid/core/exception.hh +319 -0
  83. mugrid-0.0.0/src/libmugrid/core/types.hh +119 -0
  84. mugrid-0.0.0/src/libmugrid/core/units.cc +485 -0
  85. mugrid-0.0.0/src/libmugrid/core/units.hh +299 -0
  86. mugrid-0.0.0/src/libmugrid/core/version.hh +92 -0
  87. mugrid-0.0.0/src/libmugrid/fft/cufft_backend.cu +236 -0
  88. mugrid-0.0.0/src/libmugrid/fft/cufft_backend.hh +147 -0
  89. mugrid-0.0.0/src/libmugrid/fft/fft_1d_backend.hh +143 -0
  90. mugrid-0.0.0/src/libmugrid/fft/fft_backend_factory.cc +61 -0
  91. mugrid-0.0.0/src/libmugrid/fft/fft_backend_traits.hh +140 -0
  92. mugrid-0.0.0/src/libmugrid/fft/fft_engine.cc +51 -0
  93. mugrid-0.0.0/src/libmugrid/fft/fft_engine.hh +671 -0
  94. mugrid-0.0.0/src/libmugrid/fft/fft_engine_base.cc +401 -0
  95. mugrid-0.0.0/src/libmugrid/fft/fft_engine_base.hh +226 -0
  96. mugrid-0.0.0/src/libmugrid/fft/fft_utils.cc +181 -0
  97. mugrid-0.0.0/src/libmugrid/fft/fft_utils.hh +155 -0
  98. mugrid-0.0.0/src/libmugrid/fft/fft_work_buffer.hh +294 -0
  99. mugrid-0.0.0/src/libmugrid/fft/hipfft_backend.cpp +236 -0
  100. mugrid-0.0.0/src/libmugrid/fft/hipfft_backend.hh +147 -0
  101. mugrid-0.0.0/src/libmugrid/fft/pocketfft/pocketfft_hdronly.h +3653 -0
  102. mugrid-0.0.0/src/libmugrid/fft/pocketfft_backend.cc +131 -0
  103. mugrid-0.0.0/src/libmugrid/fft/pocketfft_backend.hh +77 -0
  104. mugrid-0.0.0/src/libmugrid/fft/transpose.cc +654 -0
  105. mugrid-0.0.0/src/libmugrid/fft/transpose.hh +267 -0
  106. mugrid-0.0.0/src/libmugrid/field/field.cc +392 -0
  107. mugrid-0.0.0/src/libmugrid/field/field.hh +463 -0
  108. mugrid-0.0.0/src/libmugrid/field/field_map.cc +272 -0
  109. mugrid-0.0.0/src/libmugrid/field/field_map.hh +438 -0
  110. mugrid-0.0.0/src/libmugrid/field/field_map_static.hh +800 -0
  111. mugrid-0.0.0/src/libmugrid/field/field_typed.cc +938 -0
  112. mugrid-0.0.0/src/libmugrid/field/field_typed.hh +717 -0
  113. mugrid-0.0.0/src/libmugrid/field/mapped_field.hh +348 -0
  114. mugrid-0.0.0/src/libmugrid/field/mapped_state_field.hh +260 -0
  115. mugrid-0.0.0/src/libmugrid/field/optional_mapped_field.hh +106 -0
  116. mugrid-0.0.0/src/libmugrid/field/state_field.cc +216 -0
  117. mugrid-0.0.0/src/libmugrid/field/state_field.hh +368 -0
  118. mugrid-0.0.0/src/libmugrid/field/state_field_map.cc +177 -0
  119. mugrid-0.0.0/src/libmugrid/field/state_field_map.hh +284 -0
  120. mugrid-0.0.0/src/libmugrid/field/state_field_map_static.hh +518 -0
  121. mugrid-0.0.0/src/libmugrid/grid/index_ops.cc +87 -0
  122. mugrid-0.0.0/src/libmugrid/grid/index_ops.hh +366 -0
  123. mugrid-0.0.0/src/libmugrid/grid/iterators.hh +383 -0
  124. mugrid-0.0.0/src/libmugrid/grid/pixels.cc +182 -0
  125. mugrid-0.0.0/src/libmugrid/grid/pixels.hh +360 -0
  126. mugrid-0.0.0/src/libmugrid/grid/strides.hh +332 -0
  127. mugrid-0.0.0/src/libmugrid/io/file_io_base.cc +112 -0
  128. mugrid-0.0.0/src/libmugrid/io/file_io_base.hh +564 -0
  129. mugrid-0.0.0/src/libmugrid/io/file_io_netcdf.cc +3146 -0
  130. mugrid-0.0.0/src/libmugrid/io/file_io_netcdf.hh +1745 -0
  131. mugrid-0.0.0/src/libmugrid/memory/array.hh +508 -0
  132. mugrid-0.0.0/src/libmugrid/memory/memory_space.hh +183 -0
  133. mugrid-0.0.0/src/libmugrid/mpi/cartesian_communicator.cc +246 -0
  134. mugrid-0.0.0/src/libmugrid/mpi/cartesian_communicator.hh +326 -0
  135. mugrid-0.0.0/src/libmugrid/mpi/cartesian_decomposition.cc +409 -0
  136. mugrid-0.0.0/src/libmugrid/mpi/cartesian_decomposition.hh +134 -0
  137. mugrid-0.0.0/src/libmugrid/mpi/communicator.cc +62 -0
  138. mugrid-0.0.0/src/libmugrid/mpi/communicator.hh +459 -0
  139. mugrid-0.0.0/src/libmugrid/mpi/decomposition.hh +25 -0
  140. mugrid-0.0.0/src/libmugrid/operators/convolution_kernels.hh +184 -0
  141. mugrid-0.0.0/src/libmugrid/operators/convolution_kernels_cpu.hh +193 -0
  142. mugrid-0.0.0/src/libmugrid/operators/convolution_kernels_cuda.cuh +204 -0
  143. mugrid-0.0.0/src/libmugrid/operators/convolution_kernels_hip.hpp +185 -0
  144. mugrid-0.0.0/src/libmugrid/operators/convolution_operator.cc +723 -0
  145. mugrid-0.0.0/src/libmugrid/operators/convolution_operator.hh +607 -0
  146. mugrid-0.0.0/src/libmugrid/operators/convolution_operator_base.hh +229 -0
  147. mugrid-0.0.0/src/libmugrid/operators/convolution_operator_device.cc +133 -0
  148. mugrid-0.0.0/src/libmugrid/util/T4_map_proxy.hh +119 -0
  149. mugrid-0.0.0/src/libmugrid/util/eigen_checks.hh +177 -0
  150. mugrid-0.0.0/src/libmugrid/util/eigen_tools.hh +455 -0
  151. mugrid-0.0.0/src/libmugrid/util/math.hh +88 -0
  152. mugrid-0.0.0/src/libmugrid/util/python_helpers.hh +104 -0
  153. mugrid-0.0.0/src/libmugrid/util/raw_memory_operations.cc +53 -0
  154. mugrid-0.0.0/src/libmugrid/util/raw_memory_operations.hh +160 -0
  155. mugrid-0.0.0/src/libmugrid/util/ref_array.hh +117 -0
  156. mugrid-0.0.0/src/libmugrid/util/ref_vector.hh +119 -0
  157. mugrid-0.0.0/src/libmugrid/util/tensor_algebra.hh +599 -0
  158. mugrid-0.0.0/src/libmugrid/version.cc.skeleton +71 -0
  159. mugrid-0.0.0/tests/CMakeLists.txt +169 -0
  160. mugrid-0.0.0/tests/conftest.py +11 -0
  161. mugrid-0.0.0/tests/field_test_fixtures.cc +47 -0
  162. mugrid-0.0.0/tests/field_test_fixtures.hh +142 -0
  163. mugrid-0.0.0/tests/header_test_ccoord_operations.cc +279 -0
  164. mugrid-0.0.0/tests/header_test_eigen_tools.cc +134 -0
  165. mugrid-0.0.0/tests/header_test_ref_array.cc +54 -0
  166. mugrid-0.0.0/tests/header_test_t4_map.cc +201 -0
  167. mugrid-0.0.0/tests/header_test_tensor_algebra.cc +341 -0
  168. mugrid-0.0.0/tests/io_mpi_test_file_io.hh +143 -0
  169. mugrid-0.0.0/tests/io_mpi_test_file_io_netcdf.cc +593 -0
  170. mugrid-0.0.0/tests/io_test_file_io.hh +165 -0
  171. mugrid-0.0.0/tests/io_test_file_io_base.cc +64 -0
  172. mugrid-0.0.0/tests/io_test_file_io_netcdf.cc +855 -0
  173. mugrid-0.0.0/tests/main_test_suite.cc +43 -0
  174. mugrid-0.0.0/tests/mpi_context.hh +97 -0
  175. mugrid-0.0.0/tests/mpi_field_test_fixtures.hh +146 -0
  176. mugrid-0.0.0/tests/mpi_test_communicator.cc +262 -0
  177. mugrid-0.0.0/tests/mpi_test_decomposition.cc +350 -0
  178. mugrid-0.0.0/tests/mpi_test_field_map.cc +247 -0
  179. mugrid-0.0.0/tests/python_common_tests.py +55 -0
  180. mugrid-0.0.0/tests/python_communicator_tests.py +136 -0
  181. mugrid-0.0.0/tests/python_convolution_operator_tests.py +788 -0
  182. mugrid-0.0.0/tests/python_convolution_performance_tests.py +1359 -0
  183. mugrid-0.0.0/tests/python_decomposition_tests.py +264 -0
  184. mugrid-0.0.0/tests/python_fft_tests.py +300 -0
  185. mugrid-0.0.0/tests/python_field_gpu_tests.py +321 -0
  186. mugrid-0.0.0/tests/python_field_tests.py +242 -0
  187. mugrid-0.0.0/tests/python_file_io_tests.py +430 -0
  188. mugrid-0.0.0/tests/python_mpi_fft_tests.py +518 -0
  189. mugrid-0.0.0/tests/python_poisson_tests.py +204 -0
  190. mugrid-0.0.0/tests/python_solvers_test.py +39 -0
  191. mugrid-0.0.0/tests/test_ccoord_operations.cc +130 -0
  192. mugrid-0.0.0/tests/test_convolution_operator.cc +887 -0
  193. mugrid-0.0.0/tests/test_fft_engine.cc +392 -0
  194. mugrid-0.0.0/tests/test_field.cc +410 -0
  195. mugrid-0.0.0/tests/test_field_collection.cc +364 -0
  196. mugrid-0.0.0/tests/test_field_gpu.cc +277 -0
  197. mugrid-0.0.0/tests/test_field_map.cc +333 -0
  198. mugrid-0.0.0/tests/test_goodies.cc +73 -0
  199. mugrid-0.0.0/tests/test_goodies.hh +277 -0
  200. mugrid-0.0.0/tests/test_mapped_fields.cc +307 -0
  201. mugrid-0.0.0/tests/test_mapped_state_fields.cc +107 -0
  202. mugrid-0.0.0/tests/test_raw_memory_operations.cc +135 -0
  203. mugrid-0.0.0/tests/test_state_field_maps.cc +256 -0
  204. mugrid-0.0.0/tests/test_state_fields.cc +98 -0
  205. mugrid-0.0.0/tests/test_units.cc +209 -0
  206. mugrid-0.0.0/tests/tests.hh +52 -0
@@ -0,0 +1,9 @@
1
+ AccessModifierOffset: -1
2
+ IndentWidth: 4
3
+ UseTab: Never
4
+ SpacesBeforeTrailingComments: 2
5
+ NamespaceIndentation: All
6
+ SortIncludes: false
7
+ SortUsingDeclarations: false
8
+ PointerAlignment: Middle
9
+ AlwaysBreakTemplateDeclarations: true
@@ -0,0 +1,3 @@
1
+ # Tags in this file will be replaced during git archive. git archive is used
2
+ # by meson to create source packages.
3
+ discover_version.py export-subst
@@ -0,0 +1,84 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo "uname -a is:"
5
+ uname -a
6
+ echo "============"
7
+
8
+ echo "Environment variables are:"
9
+ printenv
10
+ echo "=========================="
11
+
12
+ # Determine install prefix based on platform
13
+ OS_TYPE=$(uname -s)
14
+ echo "Detected OS: ${OS_TYPE}"
15
+
16
+ if [ -z "$INSTALL_PREFIX" ]; then
17
+ if [ "$OS_TYPE" = "Darwin" ]; then
18
+ # macOS - use Homebrew prefix
19
+ brew install pkg-config cmake
20
+ INSTALL_PREFIX=$(brew --prefix)
21
+ else
22
+ # Linux - use /usr/local
23
+ INSTALL_PREFIX=/usr/local
24
+ fi
25
+ fi
26
+
27
+ export PATH=${INSTALL_PREFIX}/bin:${PATH}
28
+ export PKG_CONFIG_PATH=${INSTALL_PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH}
29
+
30
+ echo "Installing into prefix ${INSTALL_PREFIX}..."
31
+ echo "PATH is ${PATH}"
32
+ echo "PKG_CONFIG_PATH is ${PKG_CONFIG_PATH}"
33
+
34
+ # Build libxml2 from source (required for NetCDF on some platforms)
35
+ XML2_VERSION="2.15.1"
36
+ echo "Installing libxml2-${XML2_VERSION}"
37
+ curl -L https://download.gnome.org/sources/libxml2/2.15/libxml2-${XML2_VERSION}.tar.xz | tar -Jx
38
+ mkdir -p build-libxml2
39
+ cd build-libxml2
40
+ cmake \
41
+ -DCMAKE_BUILD_TYPE=Release \
42
+ -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
43
+ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
44
+ -DBUILD_SHARED_LIBS=OFF \
45
+ -DLIBXML2_WITH_PYTHON=OFF \
46
+ -DLIBXML2_WITH_TESTS=OFF \
47
+ -DLIBXML2_WITH_PROGRAMS=OFF \
48
+ ../libxml2-${XML2_VERSION}
49
+ cmake --build . --parallel
50
+ cmake --install .
51
+ cd ..
52
+ rm -rf build-libxml2 libxml2-${XML2_VERSION}
53
+
54
+ # Build NetCDF from source using CMake
55
+ NETCDF_VERSION="4.9.3"
56
+ echo "Installing netcdf-c-${NETCDF_VERSION}"
57
+ curl -L https://github.com/Unidata/netcdf-c/archive/refs/tags/v${NETCDF_VERSION}.tar.gz | tar -zx
58
+ mkdir -p build-netcdf
59
+ cd build-netcdf
60
+ cmake \
61
+ -DCMAKE_BUILD_TYPE=Release \
62
+ -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
63
+ -DCMAKE_VERBOSE_MAKEFILE=ON \
64
+ -DBUILD_SHARED_LIBS=OFF \
65
+ -DBUILD_TESTING=OFF \
66
+ -DBUILD_TESTSETS=OFF \
67
+ -DNETCDF_BUILD_UTILITIES=OFF \
68
+ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
69
+ -DNETCDF_ENABLE_CDF5=ON \
70
+ -DNETCDF_ENABLE_DAP=OFF \
71
+ -DNETCDF_ENABLE_DAP2=OFF \
72
+ -DNETCDF_ENABLE_DAP4=OFF \
73
+ -DNETCDF_ENABLE_HDF5=OFF \
74
+ -DNETCDF_ENABLE_PLUGINS=OFF \
75
+ ../netcdf-c-${NETCDF_VERSION}
76
+ cmake --build . --parallel
77
+ cmake --install .
78
+ cd ..
79
+ rm -rf build-netcdf netcdf-c-${NETCDF_VERSION}
80
+
81
+ echo "NetCDF installation complete!"
82
+ echo "Checking pkg-config:"
83
+ pkg-config --modversion netcdf || echo "Warning: pkg-config netcdf not found"
84
+ pkg-config --libs netcdf || echo "Warning: pkg-config netcdf libs not found"
@@ -0,0 +1,65 @@
1
+ name: Documentation
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ tags:
8
+ - '*'
9
+
10
+ concurrency:
11
+ group: documentation-${{ github.ref }}
12
+ cancel-in-progress: true
13
+
14
+ jobs:
15
+ build:
16
+ runs-on: ubuntu-24.04
17
+ permissions:
18
+ contents: write
19
+
20
+ steps:
21
+ - uses: actions/checkout@v6
22
+ with:
23
+ fetch-depth: 0
24
+ submodules: recursive
25
+
26
+ - name: Install dependencies
27
+ run: |
28
+ sudo apt-get update -qy
29
+ sudo apt-get install -y \
30
+ python3-dev \
31
+ python3-pip \
32
+ python3-venv \
33
+ doxygen \
34
+ meson \
35
+ ninja-build
36
+ python3 -m venv ../venv
37
+ source ../venv/bin/activate
38
+ pip install -r doc/requirements.txt
39
+
40
+ - name: Build documentation
41
+ run: |
42
+ source ../venv/bin/activate
43
+ cd doc
44
+ doxygen
45
+ make html
46
+ cd ..
47
+
48
+ - name: Commit documentation changes
49
+ run: |
50
+ git clone https://github.com/muSpectre/muGrid.git --branch gh-pages --single-branch gh-pages
51
+ cp -r doc/build/html/* gh-pages/
52
+ cd gh-pages
53
+ git config --local user.email "action@github.com"
54
+ git config --local user.name "GitHub Action"
55
+ git add .
56
+ git commit -m "Update documentation" -a || true
57
+ # The above command will fail if no changes were present, so we ignore
58
+ # that.
59
+
60
+ - name: Push documentation changes
61
+ uses: ad-m/github-push-action@master
62
+ with:
63
+ branch: gh-pages
64
+ directory: gh-pages
65
+ github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,49 @@
1
+ name: Publish
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ tags:
8
+ - '*'
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-24.04
13
+
14
+ steps:
15
+ - uses: actions/checkout@v6
16
+ with:
17
+ fetch-depth: 0
18
+ submodules: recursive
19
+
20
+ - name: Installing Python
21
+ run: |
22
+ sudo apt-get update -qy
23
+ sudo apt-get install -y \
24
+ python3-dev \
25
+ python3-pip \
26
+ python3-venv \
27
+ meson \
28
+ ninja-build
29
+ python3 -m venv ../venv
30
+ source ../venv/bin/activate
31
+ pip install build
32
+
33
+ - name: Build source package
34
+ run: |
35
+ source ../venv/bin/activate
36
+ python3 -m build . -s
37
+
38
+ - name: Test installation of source package
39
+ run: |
40
+ source ../venv/bin/activate
41
+ pip install dist/*.tar.gz
42
+
43
+ - name: Publish package on PyPI
44
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
45
+ uses: pypa/gh-action-pypi-publish@master
46
+ with:
47
+ user: __token__
48
+ password: ${{ secrets.PYPI_TOKEN }}
49
+
@@ -0,0 +1,198 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - '**'
7
+ tags:
8
+ - '**'
9
+ pull_request:
10
+ branches:
11
+ - '**'
12
+ schedule:
13
+ - cron: "0 2 * * 5"
14
+ jobs:
15
+ tests:
16
+ runs-on: ubuntu-24.04
17
+ timeout-minutes: 45
18
+
19
+ strategy:
20
+ matrix:
21
+ mpi: [ 'no', 'yes' ]
22
+ compiler: [ 'gcc', 'clang' ]
23
+ python-version: [ '3.10', '3.14' ]
24
+ numpy-version: [ '>=2.1.0' ]
25
+ mpi4py-version: [ '==4.0.3' ]
26
+ exclude:
27
+ - mpi: 'yes'
28
+ compiler: 'clang'
29
+
30
+ steps:
31
+ - uses: actions/checkout@v6
32
+ with:
33
+ fetch-depth: 0
34
+ submodules: recursive
35
+
36
+ - name: Set up Python ${{ matrix.python-version }}
37
+ uses: actions/setup-python@v6
38
+ with:
39
+ python-version: ${{ matrix.python-version }}
40
+
41
+ - name: Install dependencies
42
+ run: |
43
+ sudo apt-get update -qy
44
+ if [ "${{ matrix.compiler }}" == "clang" ]; then
45
+ sudo apt-get install -y clang
46
+ fi
47
+ python3 -m venv venv
48
+ source venv/bin/activate
49
+ python3 -m pip install --upgrade pip
50
+ # Install numpy
51
+ pip install -v "numpy${{ matrix.numpy-version }}"
52
+ if [ "${{ matrix.mpi }}" == "yes" ]; then
53
+ sudo apt-get install -y \
54
+ cmake \
55
+ ninja-build \
56
+ libboost-test-dev \
57
+ openmpi-bin \
58
+ libopenmpi-dev \
59
+ libpnetcdf-dev \
60
+ libnetcdf-dev
61
+ # Install mpi4py
62
+ echo "Installing mpi4py${{ matrix.mpi4py-version }}"
63
+ CC=mpicc python3 -m pip install -v \
64
+ --no-binary mpi4py \
65
+ "mpi4py${{ matrix.mpi4py-version }}"
66
+ else
67
+ sudo apt-get install -y \
68
+ cmake \
69
+ ninja-build \
70
+ libboost-test-dev \
71
+ libnetcdf-dev
72
+ fi
73
+ python3 -m pip install build pytest numpy NuMPI[test] netCDF4
74
+ python3 -m pip list
75
+
76
+ - name: Compile with CMake
77
+ run: |
78
+ if [ "${{ matrix.compiler }}" == "clang" ]; then
79
+ export CC=clang
80
+ export CXX=clang++
81
+ fi
82
+ source venv/bin/activate
83
+ # Explicitly tell CMake to use the venv Python so pytest is found
84
+ cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DPython_EXECUTABLE=$(which python3)
85
+ cd build
86
+ cmake --build .
87
+
88
+ - name: Run tests
89
+ run: |
90
+ source venv/bin/activate
91
+ cd build
92
+ ctest --output-on-failure
93
+
94
+ - name: Test installation of Python extension module
95
+ run: |
96
+ source venv/bin/activate
97
+ python3 -m pip install .
98
+
99
+ # CUDA compile-only test (no GPU required)
100
+ cuda-compile:
101
+ runs-on: ubuntu-24.04
102
+ timeout-minutes: 30
103
+
104
+ steps:
105
+ - uses: actions/checkout@v6
106
+ with:
107
+ fetch-depth: 0
108
+ submodules: recursive
109
+
110
+ - name: Install CUDA Toolkit
111
+ uses: Jimver/cuda-toolkit@v0.2.29
112
+ id: cuda-toolkit
113
+ with:
114
+ cuda: '12.6.3'
115
+ method: 'network'
116
+ sub-packages: '["nvcc", "cudart-dev"]'
117
+ non-cuda-sub-packages: '["libcufft-dev"]'
118
+
119
+ - name: Install dependencies
120
+ run: |
121
+ sudo apt-get update -qy
122
+ sudo apt-get install -y \
123
+ cmake \
124
+ ninja-build \
125
+ libboost-test-dev
126
+
127
+ - name: Compile with CUDA enabled
128
+ run: |
129
+ echo "CUDA Toolkit installed at: ${{ steps.cuda-toolkit.outputs.CUDA_PATH }}"
130
+ nvcc --version
131
+ cmake -B build -G Ninja \
132
+ -DCMAKE_BUILD_TYPE=Release \
133
+ -DMUGRID_ENABLE_CUDA=ON \
134
+ -DMUGRID_ENABLE_PYTHON=OFF \
135
+ -DMUGRID_ENABLE_MPI=OFF \
136
+ -DMUGRID_ENABLE_NETCDF=OFF \
137
+ -DMUGRID_ENABLE_TESTS=ON \
138
+ -DMUGRID_ENABLE_EXAMPLES=OFF \
139
+ -DCMAKE_CUDA_ARCHITECTURES="70;80;90"
140
+ cmake --build build
141
+
142
+ # HIP/ROCm compile-only test (no GPU required)
143
+ hip-compile:
144
+ runs-on: ubuntu-24.04 # ROCm has better support on 22.04
145
+ timeout-minutes: 30
146
+
147
+ steps:
148
+ - uses: actions/checkout@v6
149
+ with:
150
+ fetch-depth: 0
151
+ submodules: recursive
152
+
153
+ - name: Install ROCm/HIP
154
+ run: |
155
+ # Add ROCm repository
156
+ sudo mkdir -p --mode=0755 /etc/apt/keyrings
157
+ curl -fsSL https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/rocm.gpg > /dev/null
158
+ echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/6.2.4 jammy main" | sudo tee /etc/apt/sources.list.d/rocm.list > /dev/null
159
+ # Set package priority to prefer ROCm repo over Ubuntu's packages
160
+ echo -e 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' | sudo tee /etc/apt/preferences.d/rocm-pin-600
161
+ sudo apt-get update -qy
162
+ # Install HIP development packages (no runtime/driver needed for compile-only)
163
+ # hipcc: HIP compiler, hip-dev: headers, hipfft: FFT library
164
+ # rocm-device-libs: device libraries needed by clang for GPU code generation
165
+ # rocm-cmake: CMake support
166
+ sudo apt-get install -y \
167
+ hipcc \
168
+ hip-dev \
169
+ hipfft \
170
+ rocm-device-libs \
171
+ rocm-cmake
172
+
173
+ - name: Install dependencies
174
+ run: |
175
+ sudo apt-get install -y \
176
+ cmake \
177
+ ninja-build \
178
+ libboost-test-dev
179
+
180
+ - name: Compile with HIP enabled
181
+ run: |
182
+ # Set up HIP environment
183
+ export HIP_PATH=/opt/rocm
184
+ export PATH=$HIP_PATH/bin:$PATH
185
+ export CMAKE_PREFIX_PATH=$HIP_PATH:$CMAKE_PREFIX_PATH
186
+ hipcc --version || echo "hipcc not in PATH, checking /opt/rocm/bin"
187
+ /opt/rocm/bin/hipcc --version
188
+ cmake -B build -G Ninja \
189
+ -DCMAKE_BUILD_TYPE=Release \
190
+ -DMUGRID_ENABLE_HIP=ON \
191
+ -DMUGRID_ENABLE_PYTHON=OFF \
192
+ -DMUGRID_ENABLE_MPI=OFF \
193
+ -DMUGRID_ENABLE_NETCDF=OFF \
194
+ -DMUGRID_ENABLE_TESTS=ON \
195
+ -DMUGRID_ENABLE_EXAMPLES=OFF \
196
+ -DCMAKE_HIP_ARCHITECTURES="gfx906;gfx908;gfx90a" \
197
+ -DCMAKE_PREFIX_PATH=/opt/rocm
198
+ cmake --build build
@@ -0,0 +1,86 @@
1
+ name: Wheels
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - '**'
7
+ tags:
8
+ - '**'
9
+ pull_request:
10
+ branches:
11
+ - '**'
12
+
13
+ concurrency:
14
+ group: wheels-${{ github.ref }}
15
+ cancel-in-progress: true
16
+
17
+ jobs:
18
+ build_wheels:
19
+ name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }} ${{ matrix.buildplat[2] }}
20
+ runs-on: ${{ matrix.buildplat[0] }}
21
+ strategy:
22
+ matrix:
23
+ buildplat:
24
+ - [ubuntu-22.04, manylinux, x86_64]
25
+ - [ubuntu-22.04, manylinux, aarch64]
26
+ - [macos-14, macosx, arm64]
27
+ # - [windows-2019, win, AMD64]
28
+ python: ["cp310", "cp311", "cp312", "cp313", "cp314"]
29
+ fail-fast: false
30
+
31
+ env:
32
+ IS_32_BIT: ${{ matrix.buildplat[2] == 'x86' }}
33
+ MACOSX_DEPLOYMENT_TARGET: "${{ matrix.buildplat[0] == 'macos-13' && '13.0' || '14.0' }}"
34
+
35
+ steps:
36
+ - if: matrix.buildplat[2] == 'aarch64'
37
+ uses: docker/setup-qemu-action@v3
38
+ with:
39
+ platforms: all
40
+
41
+ - uses: actions/checkout@v6
42
+ with:
43
+ fetch-depth: 0
44
+ submodules: recursive
45
+
46
+ - uses: actions/setup-python@v6
47
+ with:
48
+ python-version: '3.14'
49
+
50
+ - name: Build wheels
51
+ uses: pypa/cibuildwheel@v3.3.0
52
+ env:
53
+ CIBW_BUILD_VERBOSITY: 3
54
+ CIBW_BEFORE_BUILD: bash .github/install_netcdf4.sh
55
+ CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}*
56
+ CIBW_ARCHS: ${{ matrix.buildplat[2] }}
57
+ CIBW_ENVIRONMENT_PASS_LINUX: RUNNER_OS
58
+ # Ensure pkg-config can find NetCDF (installed by before-all or before-build)
59
+ CIBW_ENVIRONMENT_LINUX: PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/local/lib/pkgconfig
60
+ CIBW_ENVIRONMENT_MACOS: >-
61
+ PKG_CONFIG_PATH=/opt/homebrew/lib/pkgconfig:/usr/local/lib/pkgconfig
62
+ PATH=/opt/homebrew/bin:/usr/local/bin:$PATH
63
+ CIBW_TEST_COMMAND: python3 -c "import muGrid; print(muGrid.__version__); from muGrid._muGrid import FileIONetCDF"
64
+
65
+ - uses: actions/upload-artifact@v6
66
+ with:
67
+ path: ./wheelhouse/*.whl
68
+ name: ${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }}
69
+
70
+ - name: Check tag
71
+ id: check-tag
72
+ run: |
73
+ if [[ ${{ github.ref }} =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
74
+ echo ::set-output name=match::true
75
+ fi
76
+ shell: bash
77
+
78
+ - name: Deploy to PyPI
79
+ if: steps.check-tag.outputs.match == 'true'
80
+ run: |
81
+ pip install twine
82
+ twine upload wheelhouse/*.whl
83
+ env:
84
+ TWINE_USERNAME: __token__
85
+ TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
86
+ shell: bash
@@ -0,0 +1,28 @@
1
+ /build/CMake*
2
+ *~
3
+ /build/*
4
+ /build-o3/
5
+ /build*
6
+ /cmake-build-*
7
+
8
+ /doc/build
9
+ /doc/html
10
+ /doc/xml
11
+ /doc/doxygenxml
12
+ /doc/source/doxygenxml
13
+ /doc/source/html
14
+
15
+ /venv
16
+ /.venv*/
17
+
18
+ *.pyc
19
+
20
+ .fleet
21
+ .vscode
22
+ .idea
23
+ .ccls-cache
24
+ .cache
25
+
26
+ /subprojects/packagecache/*
27
+ /subprojects/eigen-*/*
28
+ /subprojects/pybind11-*/*
@@ -0,0 +1,11 @@
1
+ [submodule "external/pybind11"]
2
+ path = external/pybind11
3
+ url = https://github.com/pybind/pybind11.git
4
+ branch = stable
5
+ [submodule "external/eigen3"]
6
+ path = external/eigen3
7
+ url = https://gitlab.com/libeigen/eigen.git
8
+ branch = 3.4
9
+ [submodule "external/cork"]
10
+ path = external/cork
11
+ url = https://github.com/pastewka/cork
@@ -0,0 +1,11 @@
1
+ repos:
2
+ - repo: https://github.com/pycqa/flake8
3
+ rev: '7.0.0'
4
+ hooks:
5
+ - id: flake8
6
+ name: flake8 (check python code style)
7
+ - repo: https://github.com/pycqa/isort
8
+ rev: '5.13.2'
9
+ hooks:
10
+ - id: isort
11
+ name: isort (check imports)