Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
uses: actions/checkout@v4

- name: Install dependencies
run: brew install libomp
run: brew install libomp abseil

- name: Detect SIMD capability
id: detect-simd
Expand Down Expand Up @@ -176,12 +176,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install Abseil
run: vcpkg install abseil[core]:x64-windows

- name: Configure (generic)
run: |
cmake -B build `
-DNSPARSE_ENABLE_TESTS=ON `
-DNSPARSE_OPT_LEVEL=generic `
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"

- name: Build (generic)
run: cmake --build build --config Release -j $env:NUMBER_OF_PROCESSORS
Expand Down
27 changes: 14 additions & 13 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
- [Run Benchmarks](#run-benchmarks)
- [Python Bindings](#python-bindings)
- [Build Python Bindings](#build-python-bindings)
- [Python Environment Setup](#python-environment-setup)
- [Using venv](#using-venv)
- [Using Conda](#using-conda)
- [Python Usage](#python-usage)
- [Debugging](#debugging)
- [Major Dependencies](#major-dependencies)
Expand Down Expand Up @@ -148,29 +149,29 @@ On Linux, the benchmarks support hardware performance counters via [libpfm](http

### Build Python Bindings

#### Using venv

```bash
python3 -m venv venv
source venv/bin/activate
pip install -r nsparse/python/requirements.txt
cmake -S . -B build -DNSPARSE_ENABLE_PYTHON=ON -DNSPARSE_OPT_LEVEL=avx2
cmake --build build -j
cd build/nsparse/python
pip install .
```

### Python Environment Setup
#### Using Conda

**Using venv**
```bash
python3 -m venv venv
source venv/bin/activate
```

**Using Conda**
```bash
conda create -n nsparse python=3.12
conda create -n nsparse python=3.12 numpy
conda activate nsparse
cmake -S . -B build -DNSPARSE_ENABLE_PYTHON=ON -DNSPARSE_OPT_LEVEL=avx2
cmake --build build -j
cd build/nsparse/python
pip install .
```

Then build and install the Python bindings as described above.

### Python Usage

After building and installing, you can run the demo scripts:
Expand Down Expand Up @@ -200,7 +201,7 @@ gdb ./build/tests/nsparse_test
lldb ./build/tests/nsparse_test
```

In CLion or VS Code, you can set breakpoints and debug directly from the IDE using the test or benchmark targets.
In VS Code, you can set breakpoints and debug directly from the IDE using the test or benchmark targets.

### Major Dependencies

Expand Down
6 changes: 3 additions & 3 deletions demos/seismic_sq.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ def main():
params = nsparse.SeismicSearchParameters(k, 1.2)

# Perform search
labels = index.search(
distances, labels = index.search(
n_queries, query_indptr, query_indices, query_values, k, params
)

print(f"\nTop {k} nearest neighbors:")
print(f"Labels shape: {labels.shape}")
print(f"Distances shape: {distances.shape}")
for i in range(n_queries):
neighbors = labels[i]
print(f"Query {i}: {neighbors}")
print(f"Query {i}: labels={labels[i]}, distances={distances[i]}")


if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions nsparse/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
numpy>=2.0
Loading