beampower 1.0.3__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.
- beampower-1.0.3/BUILDING_WHEELS.md +328 -0
- beampower-1.0.3/LICENSE +21 -0
- beampower-1.0.3/MANIFEST.in +24 -0
- beampower-1.0.3/Makefile +93 -0
- beampower-1.0.3/PKG-INFO +104 -0
- beampower-1.0.3/README.md +77 -0
- beampower-1.0.3/beampower/__init__.py +14 -0
- beampower-1.0.3/beampower/beampower.py +287 -0
- beampower-1.0.3/beampower/core.py +169 -0
- beampower-1.0.3/beampower/src/beamform.c +394 -0
- beampower-1.0.3/beampower/src/beamform.cu +661 -0
- beampower-1.0.3/beampower/src/beamform_cpu.h +7 -0
- beampower-1.0.3/beampower/src/beamform_gpu.h +2 -0
- beampower-1.0.3/beampower.egg-info/PKG-INFO +104 -0
- beampower-1.0.3/beampower.egg-info/SOURCES.txt +20 -0
- beampower-1.0.3/beampower.egg-info/dependency_links.txt +1 -0
- beampower-1.0.3/beampower.egg-info/not-zip-safe +1 -0
- beampower-1.0.3/beampower.egg-info/requires.txt +1 -0
- beampower-1.0.3/beampower.egg-info/top_level.txt +1 -0
- beampower-1.0.3/pyproject.toml +50 -0
- beampower-1.0.3/setup.cfg +4 -0
- beampower-1.0.3/setup.py +10 -0
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
# Building and Distributing BeamPower Wheels
|
|
2
|
+
|
|
3
|
+
This guide explains how to build, test, and distribute pre-compiled binary wheels for the `beampower` package so users don't need to compile the C/CUDA code.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Instead of requiring users to have compilers and the CUDA toolkit installed, `beampower` is now distributed as pre-built binary wheels. Users can simply run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install beampower
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Building Wheels Locally
|
|
14
|
+
|
|
15
|
+
### Prerequisites
|
|
16
|
+
|
|
17
|
+
- Python 3.8+
|
|
18
|
+
- `build` package: `pip install build wheel`
|
|
19
|
+
- For CPU wheels: GCC/Clang compiler, OpenMP
|
|
20
|
+
- For GPU wheels: NVIDIA CUDA Toolkit, NVIDIA cuDNN
|
|
21
|
+
|
|
22
|
+
### Build CPU Wheel
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Build the CPU library first
|
|
26
|
+
make clean
|
|
27
|
+
make python_CPU
|
|
28
|
+
|
|
29
|
+
# Create the wheel
|
|
30
|
+
python -m build --wheel
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Build GPU Wheel
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Build the GPU library (requires CUDA)
|
|
37
|
+
make clean
|
|
38
|
+
make python_GPU
|
|
39
|
+
|
|
40
|
+
# Create the wheel
|
|
41
|
+
python -m build --wheel
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Build Both CPU and GPU in the Same Wheel
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
make clean
|
|
48
|
+
make # builds both CPU and GPU
|
|
49
|
+
|
|
50
|
+
python -m build --wheel
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The resulting `.whl` file will be in the `dist/` directory.
|
|
54
|
+
|
|
55
|
+
## Automated Building with GitHub Actions (Recommended)
|
|
56
|
+
|
|
57
|
+
For cross-platform, multi-architecture builds, use the included GitHub Actions workflow.
|
|
58
|
+
|
|
59
|
+
### Setup
|
|
60
|
+
|
|
61
|
+
1. Ensure you have a GitHub repository for beampower
|
|
62
|
+
2. Add the `.github/workflows/build-wheels.yml` workflow file (see template below)
|
|
63
|
+
3. Push to GitHub
|
|
64
|
+
|
|
65
|
+
### Workflow Template
|
|
66
|
+
|
|
67
|
+
Create `.github/workflows/build-wheels.yml`:
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
name: Build and publish wheels
|
|
71
|
+
|
|
72
|
+
on:
|
|
73
|
+
push:
|
|
74
|
+
tags:
|
|
75
|
+
- 'v*' # Build on version tags
|
|
76
|
+
workflow_dispatch: # Allow manual builds
|
|
77
|
+
|
|
78
|
+
jobs:
|
|
79
|
+
build_wheels:
|
|
80
|
+
name: Build wheels on ${{ matrix.os }}
|
|
81
|
+
runs-on: ${{ matrix.os }}
|
|
82
|
+
strategy:
|
|
83
|
+
matrix:
|
|
84
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
85
|
+
|
|
86
|
+
steps:
|
|
87
|
+
- uses: actions/checkout@v3
|
|
88
|
+
|
|
89
|
+
- name: Set up Python
|
|
90
|
+
uses: actions/setup-python@v4
|
|
91
|
+
with:
|
|
92
|
+
python-version: '3.10'
|
|
93
|
+
|
|
94
|
+
- name: Install dependencies
|
|
95
|
+
run: |
|
|
96
|
+
python -m pip install --upgrade pip
|
|
97
|
+
pip install build wheel
|
|
98
|
+
# For Ubuntu: sudo apt-get install gcc make libomp-dev
|
|
99
|
+
# For macOS: brew install libomp (if needed)
|
|
100
|
+
|
|
101
|
+
- name: Build CPU library
|
|
102
|
+
run: |
|
|
103
|
+
make clean
|
|
104
|
+
make python_CPU
|
|
105
|
+
|
|
106
|
+
- name: Build wheel
|
|
107
|
+
run: python -m build --wheel
|
|
108
|
+
|
|
109
|
+
- name: Upload artifacts
|
|
110
|
+
uses: actions/upload-artifact@v3
|
|
111
|
+
with:
|
|
112
|
+
path: ./dist/*.whl
|
|
113
|
+
|
|
114
|
+
- name: Publish to PyPI
|
|
115
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
116
|
+
env:
|
|
117
|
+
TWINE_USERNAME: __token__
|
|
118
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
119
|
+
run: |
|
|
120
|
+
pip install twine
|
|
121
|
+
twine upload dist/*.whl --skip-existing
|
|
122
|
+
|
|
123
|
+
build_wheels_gpu:
|
|
124
|
+
name: Build GPU wheels (CUDA)
|
|
125
|
+
runs-on: ubuntu-latest
|
|
126
|
+
container: nvidia/cuda:11.8.0-devel-ubuntu22.04
|
|
127
|
+
|
|
128
|
+
steps:
|
|
129
|
+
- uses: actions/checkout@v3
|
|
130
|
+
|
|
131
|
+
- name: Install dependencies
|
|
132
|
+
run: |
|
|
133
|
+
apt-get update
|
|
134
|
+
apt-get install -y python3 python3-pip make gcc g++ git
|
|
135
|
+
python3 -m pip install --upgrade pip build wheel
|
|
136
|
+
|
|
137
|
+
- name: Build GPU library
|
|
138
|
+
run: |
|
|
139
|
+
make clean
|
|
140
|
+
make python_GPU
|
|
141
|
+
|
|
142
|
+
- name: Build wheel
|
|
143
|
+
run: python3 -m build --wheel
|
|
144
|
+
|
|
145
|
+
- name: Upload artifacts
|
|
146
|
+
uses: actions/upload-artifact@v3
|
|
147
|
+
with:
|
|
148
|
+
path: ./dist/*.whl
|
|
149
|
+
|
|
150
|
+
- name: Publish to PyPI
|
|
151
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
152
|
+
env:
|
|
153
|
+
TWINE_USERNAME: __token__
|
|
154
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
155
|
+
run: |
|
|
156
|
+
python3 -m pip install twine
|
|
157
|
+
twine upload dist/*.whl --skip-existing
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Using cibuildwheel (Advanced Alternative)
|
|
161
|
+
|
|
162
|
+
For maximum compatibility across Python versions and architectures, consider using `cibuildwheel`:
|
|
163
|
+
|
|
164
|
+
```yaml
|
|
165
|
+
name: Build wheels
|
|
166
|
+
|
|
167
|
+
on:
|
|
168
|
+
push:
|
|
169
|
+
tags: ['v*']
|
|
170
|
+
|
|
171
|
+
jobs:
|
|
172
|
+
build_wheels:
|
|
173
|
+
runs-on: ${{ matrix.os }}
|
|
174
|
+
strategy:
|
|
175
|
+
matrix:
|
|
176
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
177
|
+
|
|
178
|
+
steps:
|
|
179
|
+
- uses: actions/checkout@v3
|
|
180
|
+
- uses: PyO3/maturin-action@v1
|
|
181
|
+
with:
|
|
182
|
+
command: build
|
|
183
|
+
args: --release --out dist
|
|
184
|
+
- name: Upload wheels
|
|
185
|
+
uses: actions/upload-artifact@v3
|
|
186
|
+
with:
|
|
187
|
+
path: dist/*.whl
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Publishing to PyPI
|
|
191
|
+
|
|
192
|
+
### Option 1: Automated Publishing via GitHub Actions
|
|
193
|
+
|
|
194
|
+
1. Create a PyPI API token at https://pypi.org/account/
|
|
195
|
+
2. Add it to GitHub secrets as `PYPI_API_TOKEN`
|
|
196
|
+
3. Push a version tag: `git tag v1.0.3 && git push --tags`
|
|
197
|
+
4. GitHub Actions will automatically build and publish wheels
|
|
198
|
+
|
|
199
|
+
### Option 2: Manual Publishing
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# Build all wheels locally
|
|
203
|
+
make clean
|
|
204
|
+
make python_CPU
|
|
205
|
+
python -m build --wheel
|
|
206
|
+
|
|
207
|
+
# Install twine
|
|
208
|
+
pip install twine
|
|
209
|
+
|
|
210
|
+
# Upload to PyPI
|
|
211
|
+
twine upload dist/*
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Option 3: Test PyPI First
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
twine upload --repository testpypi dist/*
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Then test installation:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
pip install --index-url https://test.pypi.org/simple/ beampower
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Platform-Specific Considerations
|
|
227
|
+
|
|
228
|
+
### Linux (CPU)
|
|
229
|
+
- Uses `gcc`, `make`, and OpenMP
|
|
230
|
+
- `.so` files target Linux x86_64
|
|
231
|
+
|
|
232
|
+
### Linux (GPU)
|
|
233
|
+
- Requires NVIDIA CUDA Toolkit
|
|
234
|
+
- Builds `.so` files with CUDA support
|
|
235
|
+
- Docker/container recommended for reproducibility
|
|
236
|
+
|
|
237
|
+
### macOS
|
|
238
|
+
- Use `clang` (Apple Silicon) or `gcc` (Intel)
|
|
239
|
+
- Generates `.so` or `.dylib` files
|
|
240
|
+
- May need `brew install libomp`
|
|
241
|
+
|
|
242
|
+
### Windows
|
|
243
|
+
- Requires MinGW or Microsoft Visual C++
|
|
244
|
+
- Generates `.pyd` files
|
|
245
|
+
- More complex; recommend focusing on Linux/macOS first
|
|
246
|
+
|
|
247
|
+
## Verifying Wheels
|
|
248
|
+
|
|
249
|
+
After building, verify the wheel contents:
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
# List contents
|
|
253
|
+
unzip -l dist/beampower-1.0.3-py3-none-any.whl
|
|
254
|
+
|
|
255
|
+
# Should include:
|
|
256
|
+
# - beampower/__init__.py
|
|
257
|
+
# - beampower/beampower.py
|
|
258
|
+
# - beampower/core.py
|
|
259
|
+
# - beampower/lib/beamform_cpu.so (or .pyd, .dylib)
|
|
260
|
+
# - beampower/lib/beamform_gpu.so (optional)
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Test installation:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
pip install --force-reinstall dist/beampower-1.0.3-py3-none-any.whl
|
|
267
|
+
python -c "import beampower; print(beampower.__version__)"
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## Troubleshooting
|
|
271
|
+
|
|
272
|
+
### Missing `.so` files in wheel
|
|
273
|
+
|
|
274
|
+
Ensure `MANIFEST.in` includes:
|
|
275
|
+
```
|
|
276
|
+
recursive-include beampower/lib *.so
|
|
277
|
+
recursive-include beampower/lib *.pyd
|
|
278
|
+
recursive-include beampower/lib *.dylib
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
And run `make` before `python -m build --wheel`.
|
|
282
|
+
|
|
283
|
+
### "ModuleNotFoundError: No module named 'beampower.lib'"
|
|
284
|
+
|
|
285
|
+
The `.so` files weren't included in the wheel. Rebuild using the correct MANIFEST.in.
|
|
286
|
+
|
|
287
|
+
### CUDA not found when building GPU
|
|
288
|
+
|
|
289
|
+
Ensure `nvcc` is in your PATH:
|
|
290
|
+
```bash
|
|
291
|
+
export PATH=/usr/local/cuda/bin:$PATH
|
|
292
|
+
which nvcc
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Different Python versions
|
|
296
|
+
|
|
297
|
+
Build wheels for each supported Python version:
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
for python_version in 3.8 3.9 3.10 3.11 3.12; do
|
|
301
|
+
python${python_version} -m build --wheel
|
|
302
|
+
done
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## Distribution Channels
|
|
306
|
+
|
|
307
|
+
1. **PyPI (Python Package Index)** - Recommended for public packages
|
|
308
|
+
2. **GitHub Releases** - Good for alpha/beta versions
|
|
309
|
+
3. **Private PyPI Server** - For internal/proprietary packages
|
|
310
|
+
4. **Conda-Forge** - For conda users
|
|
311
|
+
5. **Direct downloads** - For enterprise customers
|
|
312
|
+
|
|
313
|
+
## Post-Release
|
|
314
|
+
|
|
315
|
+
After publishing:
|
|
316
|
+
|
|
317
|
+
1. Tag the release: `git tag v1.0.3`
|
|
318
|
+
2. Create GitHub Release with notes
|
|
319
|
+
3. Announce on relevant channels (email, forums, etc.)
|
|
320
|
+
4. Update documentation links
|
|
321
|
+
5. Monitor for installation issues
|
|
322
|
+
|
|
323
|
+
## References
|
|
324
|
+
|
|
325
|
+
- [Python Packaging Guide](https://packaging.python.org/)
|
|
326
|
+
- [Wheel Documentation](https://wheel.readthedocs.io/)
|
|
327
|
+
- [setuptools Documentation](https://setuptools.pypa.io/)
|
|
328
|
+
- [cibuildwheel Documentation](https://cibuildwheel.readthedocs.io/)
|
beampower-1.0.3/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
GNU GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2025 Eric Beaucé
|
|
5
|
+
|
|
6
|
+
This program is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
This program is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU General Public License
|
|
17
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
For the full license text, see: https://www.gnu.org/licenses/gpl-3.0.html
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Manifest file for Python distribution
|
|
2
|
+
# Include source files for reference
|
|
3
|
+
include beampower/src/beamform.c
|
|
4
|
+
include beampower/src/beamform_cpu.h
|
|
5
|
+
include beampower/src/beamform.cu
|
|
6
|
+
include beampower/src/beamform_gpu.h
|
|
7
|
+
|
|
8
|
+
# Include Python files
|
|
9
|
+
include beampower/__init__.py
|
|
10
|
+
include beampower/beampower.py
|
|
11
|
+
include beampower/core.py
|
|
12
|
+
|
|
13
|
+
# Include pre-built shared libraries (critical for distribution)
|
|
14
|
+
recursive-include beampower/lib *.so
|
|
15
|
+
recursive-include beampower/lib *.pyd
|
|
16
|
+
recursive-include beampower/lib *.dylib
|
|
17
|
+
|
|
18
|
+
# Include documentation and build files
|
|
19
|
+
include LICENSE
|
|
20
|
+
include Makefile
|
|
21
|
+
include README.md
|
|
22
|
+
include setup.py
|
|
23
|
+
include pyproject.toml
|
|
24
|
+
include BUILDING_WHEELS.md
|
beampower-1.0.3/Makefile
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# DIRECTORIES
|
|
2
|
+
maindir=beampower
|
|
3
|
+
srcdir=$(maindir)/src
|
|
4
|
+
libdir=$(maindir)/lib
|
|
5
|
+
|
|
6
|
+
# Automatic platform detection
|
|
7
|
+
UNAME_S := $(shell uname -s)
|
|
8
|
+
UNAME_M := $(shell uname -m)
|
|
9
|
+
|
|
10
|
+
# Define compilers
|
|
11
|
+
NVCC=nvcc
|
|
12
|
+
|
|
13
|
+
# Auto-detect C compiler based on platform
|
|
14
|
+
ifeq ($(UNAME_S),Darwin)
|
|
15
|
+
# macOS: prefer clang for ARM64, gcc for Intel
|
|
16
|
+
ifeq ($(UNAME_M),arm64)
|
|
17
|
+
CC=clang
|
|
18
|
+
else
|
|
19
|
+
CC=gcc
|
|
20
|
+
endif
|
|
21
|
+
else
|
|
22
|
+
# Linux and others: use gcc
|
|
23
|
+
CC=gcc
|
|
24
|
+
endif
|
|
25
|
+
|
|
26
|
+
# Define commands
|
|
27
|
+
all: $(libdir)/beamform_cpu.so $(libdir)/beamform_gpu.so
|
|
28
|
+
python_CPU: $(libdir)/beamform_cpu.so
|
|
29
|
+
python_GPU: $(libdir)/beamform_gpu.so
|
|
30
|
+
.SUFFIXES: .c .cu
|
|
31
|
+
|
|
32
|
+
# -----------------------------------------------
|
|
33
|
+
# CPU FLAGS
|
|
34
|
+
# -----------------------------------------------
|
|
35
|
+
COPTIMFLAGS_CPU=-O3
|
|
36
|
+
|
|
37
|
+
# Auto-detect OpenMP configuration for macOS and Linux
|
|
38
|
+
ifeq ($(UNAME_S),Darwin)
|
|
39
|
+
# macOS: Priority order - venv/conda (with -fopenmp=libomp) > brew libomp (with paths) > system
|
|
40
|
+
|
|
41
|
+
# Check for venv/conda first
|
|
42
|
+
VENV_PATHS := $(shell python -c "import sys, os; is_venv = hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix); in_conda = 'CONDA_PREFIX' in os.environ; prefix = os.environ.get('CONDA_PREFIX', sys.prefix) if (is_venv or in_conda) else ''; print(prefix if prefix else '')")
|
|
43
|
+
|
|
44
|
+
ifneq ($(VENV_PATHS),)
|
|
45
|
+
# In venv/conda: use -fopenmp=libomp with venv paths
|
|
46
|
+
CFLAGS_CPU=-fopenmp=libomp -L$(VENV_PATHS)/lib -I$(VENV_PATHS)/include -fPIC -ftree-vectorize -march=native -std=c99
|
|
47
|
+
LDFLAGS_CPU=-shared -fuse-ld=lld
|
|
48
|
+
else
|
|
49
|
+
# Not in venv/conda: check for brew libomp
|
|
50
|
+
ifeq ($(UNAME_M),arm64)
|
|
51
|
+
BREW_LIBOMP_PATH := /opt/homebrew/opt/libomp
|
|
52
|
+
else
|
|
53
|
+
BREW_LIBOMP_PATH := /usr/local/opt/libomp
|
|
54
|
+
endif
|
|
55
|
+
|
|
56
|
+
ifeq ($(shell [ -d $(BREW_LIBOMP_PATH) ] && echo 1 || echo 0),1)
|
|
57
|
+
# Use brew libomp with explicit linking (GitHub Actions)
|
|
58
|
+
# Don't use -fopenmp flag; instead explicitly link with -lomp
|
|
59
|
+
CFLAGS_CPU=-L$(BREW_LIBOMP_PATH)/lib -I$(BREW_LIBOMP_PATH)/include -fPIC -ftree-vectorize -march=native -std=c99
|
|
60
|
+
LDFLAGS_CPU=-L$(BREW_LIBOMP_PATH)/lib -lomp -shared
|
|
61
|
+
else
|
|
62
|
+
# Fall back to system OpenMP
|
|
63
|
+
CFLAGS_CPU=-fopenmp -fPIC -ftree-vectorize -march=native -std=c99
|
|
64
|
+
LDFLAGS_CPU=-shared
|
|
65
|
+
endif
|
|
66
|
+
endif
|
|
67
|
+
else
|
|
68
|
+
# Linux and Unix-like systems
|
|
69
|
+
CFLAGS_CPU=-fopenmp -fPIC -ftree-vectorize -march=native -std=c99
|
|
70
|
+
LDFLAGS_CPU=-shared
|
|
71
|
+
endif
|
|
72
|
+
|
|
73
|
+
# -----------------------------------------------
|
|
74
|
+
# GPU FLAGS
|
|
75
|
+
# -----------------------------------------------
|
|
76
|
+
COPTIMFLAGS_GPU=-O3
|
|
77
|
+
CFLAGS_GPU=-Xcompiler "-fopenmp -fPIC -march=native -ftree-vectorize" -Xlinker -lgomp
|
|
78
|
+
ARCHFLAG=-gencode arch=compute_70,code=sm_70\
|
|
79
|
+
-gencode arch=compute_75,code=sm_75\
|
|
80
|
+
-gencode arch=compute_80,code=sm_80
|
|
81
|
+
|
|
82
|
+
LDFLAGS_GPU=--shared
|
|
83
|
+
|
|
84
|
+
# build for python
|
|
85
|
+
$(libdir)/beamform_cpu.so: $(srcdir)/beamform.c
|
|
86
|
+
$(CC) $(COPTIMFLAGS_CPU) $(CFLAGS_CPU) $(LDFLAGS_CPU) $< -o $@
|
|
87
|
+
|
|
88
|
+
$(libdir)/beamform_gpu.so: $(srcdir)/beamform.cu
|
|
89
|
+
$(NVCC) $(COPTIMFLAGS_GPU) $(CFLAGS_GPU) $(ARCHFLAG) $(LDFLAGS_GPU) $< -o $@
|
|
90
|
+
|
|
91
|
+
clean:
|
|
92
|
+
rm -f $(libdir)/*.so
|
|
93
|
+
|
beampower-1.0.3/PKG-INFO
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: beampower
|
|
3
|
+
Version: 1.0.3
|
|
4
|
+
Summary: Package for beamforming/backprojection.
|
|
5
|
+
Author: William Frank, Léonard Seydoux
|
|
6
|
+
Author-email: Eric Beaucé <ebeauce@ldeo.columbia.edu>
|
|
7
|
+
Maintainer: William Frank, Léonard Seydoux
|
|
8
|
+
Maintainer-email: Eric Beaucé <ebeauce@ldeo.columbia.edu>
|
|
9
|
+
License: GPL-3.0
|
|
10
|
+
Project-URL: GitHub, https://github.com/ebeauce/beampower
|
|
11
|
+
Project-URL: Documentation, https://ebeauce.github.io/beampower
|
|
12
|
+
Project-URL: Issues, https://github.com/ebeauce/beampower/issues
|
|
13
|
+
Keywords: earthquake detection,backprojection,beamforming
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
22
|
+
Requires-Python: >=3.8
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: numpy>=1.19.5
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# Welcome to the __beampower__ repository!
|
|
29
|
+
|
|
30
|
+
<p align="center">
|
|
31
|
+
<img src="data/beampower_logo.png" width=350>
|
|
32
|
+
</p><br><br><br><br>
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
[](https://github.com/psf/black)
|
|
36
|
+

|
|
37
|
+

|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
### About the package
|
|
41
|
+
`beampower` is a package for beamforming (or backprojection) of seismic signal for event detection and location. The Python wrapper
|
|
42
|
+
can call the C (CPU) or CUDA-C (GPU) implementation. See the documentation at [https://ebeauce.github.io/beampower/](https://ebeauce.github.io/beampower/).
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## Installation
|
|
46
|
+
|
|
47
|
+
The simplest way to use BeamPower:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install beampower
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
GPU support is included if available.
|
|
54
|
+
|
|
55
|
+
## Learn More
|
|
56
|
+
|
|
57
|
+
- **Documentation**: https://ebeauce.github.io/beampower/
|
|
58
|
+
- **Tutorials**: See the notebooks in the `notebooks/` folder
|
|
59
|
+
- Download seismic data
|
|
60
|
+
- Pre-process waveforms
|
|
61
|
+
- Calculate travel times
|
|
62
|
+
- Locate events
|
|
63
|
+
|
|
64
|
+
## For Developers
|
|
65
|
+
|
|
66
|
+
**Clone and install locally:**
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
git clone https://github.com/ebeauce/beampower.git
|
|
70
|
+
cd beampower
|
|
71
|
+
|
|
72
|
+
# Build the libraries FIRST (required for local development)
|
|
73
|
+
make clean
|
|
74
|
+
make # builds both CPU and GPU libraries
|
|
75
|
+
|
|
76
|
+
# Then install
|
|
77
|
+
pip install .
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**If you modify C or CUDA code:**
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# For C code changes:
|
|
84
|
+
make clean
|
|
85
|
+
make python_CPU
|
|
86
|
+
|
|
87
|
+
# For CUDA code changes:
|
|
88
|
+
make clean
|
|
89
|
+
make python_GPU
|
|
90
|
+
|
|
91
|
+
# For both:
|
|
92
|
+
make clean
|
|
93
|
+
make
|
|
94
|
+
|
|
95
|
+
# Then reinstall to pick up changes:
|
|
96
|
+
pip install --force-reinstall .
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
## Reference
|
|
101
|
+
Please, if you use this package for your research, cite:
|
|
102
|
+
|
|
103
|
+
Beaucé, Eric and Frank, William B. and Seydoux, Léonard and Poli, Piero and Groebner, Nathan
|
|
104
|
+
and van der Hilst, Robert D. and Campillo, Michel (2023). BPMF: A Backprojection and Matched‐Filtering Workflow for Automated Earthquake Detection and Location. *Seismological Research Letters*. DOI: [https://doi.org/10.1785/0220230230](https://doi.org/10.1785/0220230230).
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Welcome to the __beampower__ repository!
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="data/beampower_logo.png" width=350>
|
|
5
|
+
</p><br><br><br><br>
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
[](https://github.com/psf/black)
|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
### About the package
|
|
14
|
+
`beampower` is a package for beamforming (or backprojection) of seismic signal for event detection and location. The Python wrapper
|
|
15
|
+
can call the C (CPU) or CUDA-C (GPU) implementation. See the documentation at [https://ebeauce.github.io/beampower/](https://ebeauce.github.io/beampower/).
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
The simplest way to use BeamPower:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install beampower
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
GPU support is included if available.
|
|
27
|
+
|
|
28
|
+
## Learn More
|
|
29
|
+
|
|
30
|
+
- **Documentation**: https://ebeauce.github.io/beampower/
|
|
31
|
+
- **Tutorials**: See the notebooks in the `notebooks/` folder
|
|
32
|
+
- Download seismic data
|
|
33
|
+
- Pre-process waveforms
|
|
34
|
+
- Calculate travel times
|
|
35
|
+
- Locate events
|
|
36
|
+
|
|
37
|
+
## For Developers
|
|
38
|
+
|
|
39
|
+
**Clone and install locally:**
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
git clone https://github.com/ebeauce/beampower.git
|
|
43
|
+
cd beampower
|
|
44
|
+
|
|
45
|
+
# Build the libraries FIRST (required for local development)
|
|
46
|
+
make clean
|
|
47
|
+
make # builds both CPU and GPU libraries
|
|
48
|
+
|
|
49
|
+
# Then install
|
|
50
|
+
pip install .
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**If you modify C or CUDA code:**
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# For C code changes:
|
|
57
|
+
make clean
|
|
58
|
+
make python_CPU
|
|
59
|
+
|
|
60
|
+
# For CUDA code changes:
|
|
61
|
+
make clean
|
|
62
|
+
make python_GPU
|
|
63
|
+
|
|
64
|
+
# For both:
|
|
65
|
+
make clean
|
|
66
|
+
make
|
|
67
|
+
|
|
68
|
+
# Then reinstall to pick up changes:
|
|
69
|
+
pip install --force-reinstall .
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## Reference
|
|
74
|
+
Please, if you use this package for your research, cite:
|
|
75
|
+
|
|
76
|
+
Beaucé, Eric and Frank, William B. and Seydoux, Léonard and Poli, Piero and Groebner, Nathan
|
|
77
|
+
and van der Hilst, Robert D. and Campillo, Michel (2023). BPMF: A Backprojection and Matched‐Filtering Workflow for Automated Earthquake Detection and Location. *Seismological Research Letters*. DOI: [https://doi.org/10.1785/0220230230](https://doi.org/10.1785/0220230230).
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""
|
|
2
|
+
beampower is a Python package wrapping a C and CUDA-C implementation
|
|
3
|
+
of beamforming, sometimes also called back-projection.
|
|
4
|
+
|
|
5
|
+
If you have any question, don't hesitate contacting me at:
|
|
6
|
+
ebeauce@ldeo.columbia.edu
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
__all__ = ["load_library", "beamform"]
|
|
10
|
+
|
|
11
|
+
from .core import load_library
|
|
12
|
+
from .beampower import beamform
|
|
13
|
+
|
|
14
|
+
__version__ = "1.0.3"
|