nuTens 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 (62) hide show
  1. nutens-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  2. nutens-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  3. nutens-0.1.0/.github/workflows/CI-build-and-test.yml +108 -0
  4. nutens-0.1.0/.github/workflows/benchmarking-track-main.yaml +56 -0
  5. nutens-0.1.0/.github/workflows/benchmarking.yaml +78 -0
  6. nutens-0.1.0/.github/workflows/cpp-linter.yaml +59 -0
  7. nutens-0.1.0/.github/workflows/doxygen-deployment.yml +29 -0
  8. nutens-0.1.0/.github/workflows/pip.yaml +39 -0
  9. nutens-0.1.0/.github/workflows/pypi-distribution-reusable.yaml +179 -0
  10. nutens-0.1.0/.github/workflows/pypi-distribution.yaml +101 -0
  11. nutens-0.1.0/.pre-commit-config.yaml +7 -0
  12. nutens-0.1.0/CMakeLists.txt +94 -0
  13. nutens-0.1.0/LICENSE +674 -0
  14. nutens-0.1.0/PKG-INFO +795 -0
  15. nutens-0.1.0/PyTorch_requirements.txt +22 -0
  16. nutens-0.1.0/README.md +99 -0
  17. nutens-0.1.0/_version.py +16 -0
  18. nutens-0.1.0/benchmarks/CMakeLists.txt +8 -0
  19. nutens-0.1.0/benchmarks/benchmarks.cpp +147 -0
  20. nutens-0.1.0/cmake/CPM.cmake +24 -0
  21. nutens-0.1.0/cmake/nuTens-dependencies.cmake +40 -0
  22. nutens-0.1.0/doc/bibliography.bib +10 -0
  23. nutens-0.1.0/doc/doxygen.config +2538 -0
  24. nutens-0.1.0/doc/html/.nojekyll +1 -0
  25. nutens-0.1.0/doc/logo-generator.py +80 -0
  26. nutens-0.1.0/doc/nuTens-logo-small.png +0 -0
  27. nutens-0.1.0/doc/tweaks.css +1 -0
  28. nutens-0.1.0/nuTens/CMakeLists.txt +7 -0
  29. nutens-0.1.0/nuTens/propagator/CMakeLists.txt +24 -0
  30. nutens-0.1.0/nuTens/propagator/base-matter-solver.hpp +23 -0
  31. nutens-0.1.0/nuTens/propagator/const-density-solver.cpp +19 -0
  32. nutens-0.1.0/nuTens/propagator/const-density-solver.hpp +92 -0
  33. nutens-0.1.0/nuTens/propagator/constants.hpp +11 -0
  34. nutens-0.1.0/nuTens/propagator/propagator.cpp +55 -0
  35. nutens-0.1.0/nuTens/propagator/propagator.hpp +117 -0
  36. nutens-0.1.0/nuTens/tensors/CMakeLists.txt +14 -0
  37. nutens-0.1.0/nuTens/tensors/README.md +7 -0
  38. nutens-0.1.0/nuTens/tensors/dtypes.hpp +53 -0
  39. nutens-0.1.0/nuTens/tensors/tensor.hpp +446 -0
  40. nutens-0.1.0/nuTens/tensors/tf-tensor.cpp +0 -0
  41. nutens-0.1.0/nuTens/tensors/torch-tensor.cpp +558 -0
  42. nutens-0.1.0/nuTens/utils/CMakeLists.txt +81 -0
  43. nutens-0.1.0/nuTens/utils/instrumentation.hpp +249 -0
  44. nutens-0.1.0/nuTens/utils/logging.hpp +132 -0
  45. nutens-0.1.0/nuTens/utils/nuTens-pch.hpp +16 -0
  46. nutens-0.1.0/nuTens-logo.png +0 -0
  47. nutens-0.1.0/pyproject.toml +50 -0
  48. nutens-0.1.0/python/CMakeLists.txt +15 -0
  49. nutens-0.1.0/python/README.md +5 -0
  50. nutens-0.1.0/python/binding.cpp +164 -0
  51. nutens-0.1.0/python/nuTens/__init__.py +3 -0
  52. nutens-0.1.0/python/nuTens/dtype.py +2 -0
  53. nutens-0.1.0/python/nuTens/propagator.py +2 -0
  54. nutens-0.1.0/python/nuTens/tensor.py +2 -0
  55. nutens-0.1.0/tests/CMakeLists.txt +20 -0
  56. nutens-0.1.0/tests/barger-propagator.hpp +184 -0
  57. nutens-0.1.0/tests/barger.cpp +110 -0
  58. nutens-0.1.0/tests/pyNuTens-test.py +134 -0
  59. nutens-0.1.0/tests/tensor-basic.cpp +139 -0
  60. nutens-0.1.0/tests/test-utils.hpp +40 -0
  61. nutens-0.1.0/tests/two-flavour-const-matter.cpp +90 -0
  62. nutens-0.1.0/tests/two-flavour-vacuum.cpp +65 -0
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Desktop (please complete the following information):**
27
+ - OS: [e.g. iOS]
28
+ - Browser [e.g. chrome, safari]
29
+ - Version [e.g. 22]
30
+
31
+ **Smartphone (please complete the following information):**
32
+ - Device: [e.g. iPhone6]
33
+ - OS: [e.g. iOS8.1]
34
+ - Browser [e.g. stock browser, safari]
35
+ - Version [e.g. 22]
36
+
37
+ **Additional context**
38
+ Add any other context about the problem here.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,108 @@
1
+ # This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
2
+ # See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
3
+ name: CI Build & Test
4
+
5
+ on:
6
+ push:
7
+ branches: [ "main" ]
8
+ pull_request:
9
+ branches: [ "main" ]
10
+ workflow_dispatch:
11
+
12
+ env:
13
+ # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
14
+ BUILD_TYPE: Release
15
+
16
+ jobs:
17
+ build:
18
+ # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
19
+ # You can convert this to a matrix build if you need cross-platform coverage.
20
+ # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
21
+
22
+ strategy:
23
+ fail-fast: false
24
+ matrix:
25
+ include:
26
+ - OS: ubuntu-latest
27
+ cpp_compiler: g++
28
+ c_compiler: gcc
29
+
30
+ - OS: ubuntu-latest
31
+ cpp_compiler: clang++
32
+ c_compiler: clang
33
+
34
+ - OS: windows-latest
35
+ cpp_compiler: cl
36
+ c_compiler: cl
37
+
38
+ name: Build & Test ${{ matrix.os }} ${{ matrix.c_compiler }}
39
+
40
+ runs-on: ${{ matrix.os }}
41
+
42
+ env:
43
+ CC: ${{ matrix.c_compiler }}
44
+ CXX: ${{ matrix.cpp_compiler }}
45
+
46
+ steps:
47
+ # this Action should follow steps to set up Python build environment
48
+ - uses: actions/checkout@v4
49
+
50
+ - name: Install Protoc Windows
51
+ if: ${{ startsWith(matrix.OS, 'windows') }}
52
+ uses: arduino/setup-protoc@v3
53
+
54
+ - name: Install Protoc Ubuntu
55
+ if: ${{ startsWith(matrix.OS, 'ubuntu') }}
56
+ run: sudo apt install protobuf-compiler
57
+
58
+ - name: Install Python dependencies
59
+ uses: py-actions/py-dependency-install@v4
60
+ with:
61
+ path: "PyTorch_requirements.txt"
62
+
63
+ - name: Configure CMake ubuntu
64
+ if: ${{ startsWith(matrix.OS, 'ubuntu') }}
65
+ # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
66
+ # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
67
+ run: |
68
+ cmake \
69
+ -DNT_TEST_COVERAGE=ON \
70
+ -DCMAKE_PREFIX_PATH=`python3 -c "import torch;print(torch.utils.cmake_prefix_path)"` \
71
+ -B ${{github.workspace}}/build \
72
+ -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
73
+
74
+ - name: Configure CMake windows
75
+ if: ${{ startsWith(matrix.OS, 'windows') }}
76
+ # on windows to get the pytorch config we have to
77
+ # run the same python command as before but now save it
78
+ # to a file then read from the file into a variable to pass to cmake
79
+ run: |
80
+ $Torch_DIR = python3 -c "import torch;print(torch.utils.cmake_prefix_path)"
81
+ echo "torch location: $Torch_DIR"
82
+ cmake -DNT_TEST_COVERAGE=ON -DCMAKE_PREFIX_PATH="$Torch_DIR" -B ${{github.workspace}}\build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
83
+
84
+ - name: Build
85
+ # Build your program with the given configuration
86
+ run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel 2
87
+
88
+ - name: Test
89
+ working-directory: ${{github.workspace}}/build
90
+ # Execute tests defined by the CMake configuration.
91
+ # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
92
+ run: ctest -C ${{env.BUILD_TYPE}}
93
+
94
+ - name: Generate Coverage Report
95
+ # only need to do this for one combination of OS and compiler
96
+ if: ${{ matrix.OS == 'ubuntu-latest' && matrix.c_compiler == 'gcc' }}
97
+ working-directory: ${{github.workspace}}/build
98
+ run: gcovr --json -o nuTens_coverage.json -r .. -f "../nuTens/*"
99
+
100
+ - name: Upload coverage reports to Codecov
101
+ # only need to do this for one combination of OS and compiler
102
+ if: ${{ matrix.OS == 'ubuntu-latest' && matrix.c_compiler == 'gcc' }}
103
+ uses: codecov/codecov-action@v4.0.1
104
+ with:
105
+ verbose: true
106
+ files: nuTens_coverage.json
107
+ env:
108
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1,56 @@
1
+ name: Main Branch Benchmarking
2
+
3
+ on:
4
+ push:
5
+ branches: main
6
+
7
+ workflow_dispatch:
8
+
9
+ env:
10
+ # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
11
+ BUILD_TYPE: Release
12
+
13
+ jobs:
14
+ benchmark_base_branch:
15
+ name: Continuous Benchmarking with Bencher
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: bencherdev/bencher@main
20
+
21
+ - name: Set Flags
22
+ run: export USE_CUDA=0
23
+
24
+ - name: Install Protobuf
25
+ run: sudo apt install protobuf-compiler
26
+
27
+ - name: Install Python dependencies
28
+ uses: py-actions/py-dependency-install@v4
29
+ with:
30
+ path: "PyTorch_requirements.txt"
31
+
32
+ - name: Make Build Directory
33
+ run: mkdir build
34
+
35
+ - name: Configure CMake
36
+ working-directory: ${{github.workspace}}/build
37
+ # Configure CMake with benchmarking option on
38
+ run: |
39
+ cmake --debug-output -DNT_USE_PCH=ON -DNT_ENABLE_BENCHMARKING=ON -DCMAKE_PREFIX_PATH=`python3 -c 'import torch;print(torch.utils.cmake_prefix_path)'` -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ..
40
+
41
+ - name: Build
42
+ working-directory: ${{github.workspace}}/build
43
+ # Build your program with the given configuration
44
+ run: make
45
+
46
+ - name: Track base branch benchmarks with Bencher
47
+ working-directory: ${{github.workspace}}/build
48
+ run: |
49
+ bencher run \
50
+ --project nutens \
51
+ --token '${{ secrets.BENCHER_API_TOKEN }}' \
52
+ --branch main \
53
+ --testbed ubuntu-latest \
54
+ --adapter cpp_google \
55
+ --err \
56
+ "./benchmarks/benchmarks --benchmark_format=json --benchmark_repetitions=16 --benchmark_min_warmup_time=60" \
@@ -0,0 +1,78 @@
1
+ name: Continuous Benchmarking
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+
7
+ pull_request:
8
+ branches: [ "main" ]
9
+ types: [opened, reopened, edited, synchronize]
10
+
11
+ workflow_dispatch:
12
+
13
+ env:
14
+ # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
15
+ BUILD_TYPE: Release
16
+
17
+ jobs:
18
+ benchmark_pr_branch:
19
+ name: Continuous Benchmarking PRs with Bencher
20
+ # DO NOT REMOVE: For handling Fork PRs see Pull Requests from Forks
21
+ if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
22
+
23
+ permissions:
24
+ pull-requests: write
25
+
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ - uses: bencherdev/bencher@main
30
+
31
+ - name: Set Flags
32
+ run: export USE_CUDA=0
33
+
34
+ - name: Install Protobuf
35
+ run: sudo apt install protobuf-compiler
36
+
37
+ - name: Install Python dependencies
38
+ uses: py-actions/py-dependency-install@v4
39
+ with:
40
+ path: "PyTorch_requirements.txt"
41
+
42
+ - name: Make Build Directory
43
+ run: mkdir build
44
+
45
+ - name: Configure CMake
46
+ working-directory: ${{github.workspace}}/build
47
+ # Configure CMake with benchmarking option on
48
+ run: |
49
+ cmake --debug-output -DNT_USE_PCH=ON -DNT_ENABLE_BENCHMARKING=ON -DCMAKE_PREFIX_PATH=`python3 -c 'import torch;print(torch.utils.cmake_prefix_path)'` -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ..
50
+ echo :::: Build directory post-CMake:
51
+ ls
52
+ echo
53
+ echo :::: _deps directory:
54
+ ls _deps
55
+ echo
56
+ echo :::: benchmark link file:
57
+ cat benchmarks/CMakeFiles/benchmarks.dir/link.txt
58
+
59
+ - name: Build
60
+ working-directory: ${{github.workspace}}/build
61
+ # Build your program with the given configuration
62
+ run: make --trace #cmake --build ${{github.workspace}}/build
63
+
64
+ - name: Track PR Benchmarks with Bencher
65
+ working-directory: ${{github.workspace}}/build
66
+ run: |
67
+ ls
68
+ bencher run \
69
+ --project nutens \
70
+ --token '${{ secrets.BENCHER_API_TOKEN }}' \
71
+ --branch '${{ github.head_ref }}' \
72
+ --branch-start-point '${{ github.base_ref }}' \
73
+ --branch-start-point-hash '${{ github.event.pull_request.base.sha }}' \
74
+ --testbed ubuntu-latest \
75
+ --adapter cpp_google \
76
+ --err \
77
+ --github-actions '${{ secrets.GITHUB_TOKEN }}' \
78
+ "./benchmarks/benchmarks --benchmark_format=json --benchmark_repetitions=16 --benchmark_min_warmup_time=60" \
@@ -0,0 +1,59 @@
1
+ name: cpp-linter
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [ "main" ]
6
+ workflow_dispatch:
7
+
8
+
9
+ jobs:
10
+ cpp-linter:
11
+ permissions: write-all
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - name: Set Flags
17
+ run: export USE_CUDA=0
18
+
19
+ - name: Install Protobuf
20
+ run: sudo apt install protobuf-compiler
21
+
22
+ - name: Install Python dependencies
23
+ uses: py-actions/py-dependency-install@v4
24
+ with:
25
+ path: "PyTorch_requirements.txt"
26
+
27
+ - name: Configure CMake
28
+ # Configure CMake so we can get a compile_commands.json so that clang-tidy won't be angry about missing headers any more
29
+ run: cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DNT_ENABLE_BENCHMARKING=ON -DCMAKE_PREFIX_PATH=`python3 -c 'import torch;print(torch.utils.cmake_prefix_path)'` -B ${{github.workspace}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
30
+
31
+ ## horrible little hack to put spdlog include files somewhere that clang-tidy can find them
32
+ ## it doesn't seem to like headers included by cpm
33
+ - name: Move spdlog
34
+ run: |
35
+ cp -r _deps/spdlog-src/include/spdlog .
36
+ cp spdlog/spdlog* .
37
+
38
+ - uses: cpp-linter/cpp-linter-action@main
39
+ id: linter
40
+ continue-on-error: true
41
+ env:
42
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43
+ with:
44
+ style: "Microsoft"
45
+ ignore: '.github|_deps|CMakeFiles|spdlog*'
46
+ tidy-review: true
47
+ step-summary: true
48
+ files-changed-only: true
49
+
50
+ thread-comments: false
51
+ file-annotations: false
52
+ tidy-checks: 'boost-*,bugprone-*,performance-*,readability-*,portability-*,modernize-*,clang-analyzer-*,cppcoreguidelines-*,-modernize-use-trailing-return-type,-modernize-use-emplace,-readability-redundant-access-specifiers'
53
+
54
+ - name: Fail fast?!
55
+ if: steps.linter.outputs.checks-failed != 0
56
+ #run: |
57
+ # echo "some linter checks failed. ${{ steps.linter.outputs.checks-failed }}"
58
+ # for actual deployment
59
+ run: exit 1
@@ -0,0 +1,29 @@
1
+ name: Doxygen GitHub Pages Deploy Action
2
+
3
+ permissions:
4
+ contents: write
5
+
6
+ on:
7
+ push:
8
+ branches:
9
+ - main
10
+ workflow_dispatch:
11
+
12
+ jobs:
13
+ deploy:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - run: sudo apt-get update
17
+
18
+ - run: sudo apt-get install -y texlive
19
+
20
+ - run: sudo apt-get install -y libjs-mathjax
21
+
22
+ - uses: DenverCoder1/doxygen-github-pages-action@v1.3.0
23
+ with:
24
+ github_token: ${{ secrets.GITHUB_TOKEN }}
25
+ folder: doc/html
26
+ config_file: doc/doxygen.config
27
+
28
+ - run: ls
29
+ - run: ls doc/html
@@ -0,0 +1,39 @@
1
+ name: "Pip"
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ pull_request:
6
+ push:
7
+ branches:
8
+ - main
9
+
10
+ jobs:
11
+ build:
12
+ name: Build with Pip
13
+ runs-on: ${{ matrix.platform }}
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ platform: [ubuntu-latest]
18
+ python-version: ["3.9", "3.10", "3.11"]
19
+
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+
23
+ - uses: actions/setup-python@v5
24
+ with:
25
+ python-version: ${{ matrix.python-version }}
26
+
27
+ - name: Install Protoc Ubuntu
28
+ run: sudo apt install protobuf-compiler
29
+
30
+ - name: Install Python dependencies
31
+ uses: py-actions/py-dependency-install@v4
32
+ with:
33
+ path: "PyTorch_requirements.txt"
34
+
35
+ - name: Build and install
36
+ run: pip install --verbose .
37
+
38
+ #- name: Test
39
+ # run: pytest
@@ -0,0 +1,179 @@
1
+ on:
2
+ workflow_call:
3
+ inputs:
4
+ build_type:
5
+ required: true
6
+ type: string
7
+ platform:
8
+ required: true
9
+ type: string
10
+
11
+ jobs:
12
+ build:
13
+
14
+ name: Build ${{ inputs.platform }} ${{ inputs.build_type }} distribution 📦
15
+ runs-on: ${{ inputs.platform }}
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ ## runner will run out of space if we don't clear some up by removing some unused tools
21
+ - name: Clear space
22
+ run: >-
23
+ sudo rm -rf /usr/share/dotnet
24
+ sudo rm -rf /opt/ghc
25
+ sudo rm -rf "/usr/local/share/boost"
26
+ sudo rm -rf "$AGENT_TOOLSDIRECTORY"
27
+
28
+ #- name: cuda-toolkit
29
+ # if: ${{ startsWith( inputs.build_type, 'cuda' ) }}
30
+ # uses: Jimver/cuda-toolkit@v0.2.17
31
+
32
+ #- name: Set up Python
33
+ # uses: actions/setup-python@v5
34
+ # with:
35
+ # python-version: "3.11"
36
+
37
+ #- name: Install Protoc
38
+ # run: sudo apt install protobuf-compiler
39
+
40
+ #- name: Install Python dependencies
41
+ # uses: py-actions/py-dependency-install@v4
42
+ # with:
43
+ # path: "PyTorch_requirements.txt"
44
+
45
+ #- name: Install cibuildwheel
46
+ # run: python -m pip install cibuildwheel==2.21.1
47
+
48
+ - uses: yezz123/setup-uv@v4
49
+
50
+ - uses: pypa/cibuildwheel@v2.21
51
+ if: runner.os == 'Linux'
52
+ env:
53
+ CIBW_BUILD_VERBOSITY: 1
54
+ CIBW_ARCHS_LINUX: "x86_64"
55
+ CIBW_SKIP: "*musl*"
56
+ CIBW_BEFORE_ALL: >
57
+ yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo &&
58
+ yum clean all &&
59
+ yum -y install cuda-toolkit &&
60
+ ls -al /usr/local &&
61
+ nvcc --version &&
62
+ echo nvcc location: &&
63
+ which nvcc &&
64
+ export CUDACXX="$(which nvcc)" &&
65
+ echo $CUDACXX &&
66
+ echo gcc version: &&
67
+ gcc --version &&
68
+ export BUILD_WITH_CUDA=1 &&
69
+ export TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0"
70
+ CIBW_ENVIRONMENT: >
71
+ PATH=$PATH:/usr/local/cuda/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(python -c 'import sys; print(sys.prefix + "/lib/python" + sys.version[:3] + "/site-packages")')/torch/lib/
72
+ CIBW_BEFORE_BUILD: >
73
+ python -m site &&
74
+ python -c 'import sys; print(sys.prefix + "/lib/python" + sys.version[:3] + "/site-packages")' &&
75
+ echo $LD_LIBRARY_PATH &&
76
+ ls $(python -c 'import sys; print(sys.prefix + "/lib/python" + sys.version[:3] + "/site-packages")')
77
+
78
+
79
+ #- name: Build wheels
80
+ # run: python -m cibuildwheel --output-dir dist
81
+ # env:
82
+ # CIBW_BEFORE_BUILD: pip install scikit-build-core
83
+
84
+ - name: Store the distribution packages
85
+ uses: actions/upload-artifact@v4
86
+ with:
87
+ name: python-package-distributions
88
+ path: dist/
89
+
90
+
91
+ publish-to-testpypi:
92
+ name: Publish Python 🐍 distribution 📦 to TestPyPI
93
+ needs:
94
+ - build
95
+ runs-on: ${{ inputs.platform }}
96
+
97
+ environment:
98
+ name: testPyPi-distribution
99
+ url: https://test.pypi.org/p/nuTens
100
+
101
+ permissions:
102
+ id-token: write # IMPORTANT: mandatory for trusted publishing
103
+
104
+ steps:
105
+ - name: Download all the dists
106
+ uses: actions/download-artifact@v4
107
+ with:
108
+ name: python-package-distributions
109
+ path: dist/
110
+ - name: Publish distribution 📦 to TestPyPI
111
+ uses: pypa/gh-action-pypi-publish@release/v1
112
+ with:
113
+ repository-url: https://test.pypi.org/legacy/
114
+
115
+ publish-to-pypi:
116
+ name: >-
117
+ Publish Python 🐍 distribution 📦 to PyPI
118
+ if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
119
+ needs:
120
+ - build
121
+ runs-on: ${{ inputs.platform }}
122
+ environment:
123
+ name: PyPi-distribution
124
+ url: https://pypi.org/p/nuTens # Replace <package-name> with your PyPI project name
125
+ permissions:
126
+ id-token: write # IMPORTANT: mandatory for trusted publishing
127
+
128
+ steps:
129
+ - name: Download all the dists
130
+ uses: actions/download-artifact@v4
131
+ with:
132
+ name: python-package-distributions
133
+ path: dist/
134
+ - name: Publish distribution 📦 to PyPI
135
+ uses: pypa/gh-action-pypi-publish@release/v1
136
+
137
+ github-release:
138
+ if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
139
+ name: >-
140
+ Sign the Python 🐍 distribution 📦 with Sigstore
141
+ and upload them to GitHub Release
142
+ needs:
143
+ - publish-to-pypi
144
+ runs-on: ${{ inputs.platform }}
145
+
146
+ permissions:
147
+ contents: write # IMPORTANT: mandatory for making GitHub Releases
148
+ id-token: write # IMPORTANT: mandatory for sigstore
149
+
150
+ steps:
151
+ - name: Download all the dists
152
+ uses: actions/download-artifact@v4
153
+ with:
154
+ name: python-package-distributions
155
+ path: dist/
156
+ - name: Sign the dists with Sigstore
157
+ uses: sigstore/gh-action-sigstore-python@v2.1.1
158
+ with:
159
+ inputs: >-
160
+ ./dist/*.tar.gz
161
+ ./dist/*.whl
162
+ - name: Create GitHub Release
163
+ env:
164
+ GITHUB_TOKEN: ${{ github.token }}
165
+ run: >-
166
+ gh release create
167
+ '${{ github.ref_name }}'
168
+ --repo '${{ github.repository }}'
169
+ --notes ""
170
+ - name: Upload artifact signatures to GitHub Release
171
+ env:
172
+ GITHUB_TOKEN: ${{ github.token }}
173
+ # Upload to GitHub Release using the `gh` CLI.
174
+ # `dist/` contains the built packages, and the
175
+ # sigstore-produced signatures and certificates.
176
+ run: >-
177
+ gh release upload
178
+ '${{ github.ref_name }}' dist/**
179
+ --repo '${{ github.repository }}'