Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d22d0a2
Add QBLAS wrap dependency system
SwayamInSync Sep 5, 2025
9c31ce0
Add -fext-numeric-literals compiler flag for QBLAS compatibility
SwayamInSync Sep 5, 2025
c1b35a8
Remove QBLAS submodule, replaced with Meson wrap dependency
SwayamInSync Sep 5, 2025
1fc111d
updating workflows
SwayamInSync Sep 5, 2025
43a7c84
numeric literal only for gcc I guess
SwayamInSync Sep 5, 2025
6124e14
Merge pull request #8 from SwayamInSync/sdist
SwayamInSync Sep 5, 2025
556988c
hmm sleef package works
SwayamInSync Sep 5, 2025
10e5d02
copying shared libs to somewhere consistent
SwayamInSync Sep 5, 2025
253322a
sleef shared libs not found
SwayamInSync Sep 6, 2025
84b2911
some utilities
SwayamInSync Sep 6, 2025
0fbe0e6
maybe build statically
SwayamInSync Sep 6, 2025
083f192
yeah static linking is fine
SwayamInSync Sep 6, 2025
bda104d
workflow-edit
SwayamInSync Sep 6, 2025
797fd82
workflow: fixing macos deployment target and dynamic libs on linux
SwayamInSync Sep 6, 2025
7c15c98
workflow: windows dlink fix
SwayamInSync Sep 6, 2025
976f8ed
workflow: -fopenmp for linux
SwayamInSync Sep 6, 2025
2181a3d
workflow: fix empty shared lib
SwayamInSync Sep 6, 2025
9bf047a
workflow: CI fix
SwayamInSync Sep 6, 2025
6ea6b33
workflow: redhat vs ubuntu
SwayamInSync Sep 6, 2025
1c1dd3c
workflow: redhat vs ubuntu
SwayamInSync Sep 6, 2025
69a7a99
workflow: redhat vs ubuntu
SwayamInSync Sep 6, 2025
77f1a8e
windows parllel build off
SwayamInSync Sep 6, 2025
724ea03
Merge pull request #9 from SwayamInSync/sdist
SwayamInSync Sep 6, 2025
4d8f170
copying LISCENSE to quaddtype
SwayamInSync Sep 6, 2025
4d1ad7e
Merge branch 'sdist'
SwayamInSync Sep 6, 2025
1d028fa
liscense in toml
SwayamInSync Sep 6, 2025
67fe2c5
building and testing sdist
SwayamInSync Sep 6, 2025
78c1465
verbose and dep
SwayamInSync Sep 6, 2025
58d59b9
verbose and dep
SwayamInSync Sep 6, 2025
e11c8df
updating README
SwayamInSync Sep 6, 2025
d0620af
Merge branch 'main' into sdist
SwayamInSync Sep 6, 2025
c90c009
Merge pull request #10 from SwayamInSync/sdist
SwayamInSync Sep 6, 2025
b726f21
small typos
SwayamInSync Sep 6, 2025
6bd71e9
Apply suggestion from @ngoldbaum
SwayamInSync Sep 8, 2025
f14424c
README simpilifications suggestions
SwayamInSync Sep 8, 2025
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
Prev Previous commit
Next Next commit
updating README
  • Loading branch information
SwayamInSync committed Sep 6, 2025
commit e11c8df576a5a23709bd92ab8e6ce68121e6e089
86 changes: 22 additions & 64 deletions quaddtype/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,18 @@ np.array([1,2,3], dtype=QuadPrecDType("longdouble"))

## Installation from source

The code needs the quad precision pieces of the sleef library, which is not available on most systems by default, so we have to generate that first. Choose the appropriate section below based on your operating system.

### Linux/Unix/macOS
#### Prerequisites

The below assumes one has the required pieces to build sleef (cmake and libmpfr-dev), and that one is in the package directory locally.
- **gcc/clang**
- **CMake** (≥3.15)
- **Python 3.10+**
- **Git**

```bash
git clone --branch 3.8 https://github.com/shibatch/sleef.git
cd sleef
cmake -S . -B build -DSLEEF_BUILD_QUAD:BOOL=ON -DSLEEF_BUILD_SHARED_LIBS:BOOL=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON
cmake --build build/ --clean-first -j
cd ..
```
### Linux/Unix/macOS

Building the `numpy-quaddtype` package from locally installed sleef:

```bash
export SLEEF_DIR=$PWD/sleef/build
export LIBRARY_PATH=$SLEEF_DIR/lib
export C_INCLUDE_PATH=$SLEEF_DIR/include
export CPLUS_INCLUDE_PATH=$SLEEF_DIR/include

# setup the virtual env
python3 -m venv temp
source temp/bin/activate
Expand All @@ -55,15 +45,13 @@ source temp/bin/activate
pip install meson-python numpy pytest

# If you see errors about a missing atomics library, you might need -latomic
export LDFLAGS="-Wl,-rpath,$SLEEF_DIR/lib -fopenmp -lpthread"
export CFLAGS="-fPIC"
export CXXFLAGS="-fPIC"
export LDFLAGS="-fopenmp -lpthread"

# To build without QBLAS (default for MSVC)
# export CFLAGS="-fPIC -DDISABLE_QUADBLAS"
# export CXXFLAGS="-fPIC -DDISABLE_QUADBLAS"
# export CFLAGS="-DDISABLE_QUADBLAS"
# export CXXFLAGS="-DDISABLE_QUADBLAS"

python -m pip install . -v --no-build-isolation -Cbuilddir=build -C'compile-args=-v'
python -m pip install . -v --no-build-isolation

# Run the tests
cd ..
Expand All @@ -76,7 +64,7 @@ python -m pytest

- **Visual Studio 2017 or later** (with MSVC compiler)
- **CMake** (≥3.15)
- **Python 3.10+**
- **Python 3.10+**
- **Git**

#### Step-by-Step Installation
Expand All @@ -85,24 +73,7 @@ python -m pytest

Open a **Developer Command Prompt for VS** or **Developer PowerShell for VS** to ensure MSVC is properly configured.

2. **Clone and Build SLEEF**

```powershell
# Clone SLEEF library
git clone --branch 3.8 https://github.com/shibatch/sleef.git
cd sleef

# Configure with CMake for Windows
cmake -S . -B build -G "Visual Studio 17 2022" -A x64 -DSLEEF_BUILD_QUAD:BOOL=ON -DSLEEF_BUILD_SHARED_LIBS:BOOL=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON

# Build and install SLEEF
cmake --build build --config Release
cmake --install build --prefix "C:/sleef" --config Release

cd ..
```

3. **Setup Python Environment**
2. **Setup Python Environment**

```powershell
# Create and activate virtual environment
Expand All @@ -114,46 +85,33 @@ python -m pytest
pip install meson-python numpy pytest ninja meson
```

4. **Set Environment Variables**
3. **Set Environment Variables**

```powershell
# Set up paths and compiler flags
$env:INCLUDE = "C:/sleef/include;$env:INCLUDE"
$env:LIB = "C:/sleef/lib;$env:LIB"
$env:PATH = "C:/sleef/bin;$env:PATH"

# Note: QBLAS is disabled on Windows due to MSVC compatibility issues
$env:CFLAGS = "/IC:/sleef/include /DDISABLE_QUADBLAS"
$env:CXXFLAGS = "/IC:/sleef/include /DDISABLE_QUADBLAS"
$env:LDFLAGS = "C:/sleef/lib/sleef.lib C:/sleef/lib/sleefquad.lib"
$env:CFLAGS = "/DDISABLE_QUADBLAS"
$env:CXXFLAGS = "/DDISABLE_QUADBLAS"
```

5. **Build and Install numpy-quaddtype**
4. **Build and Install numpy-quaddtype**

```powershell
# Ensure submodules are initialized
git submodule update --init --recursive

# Build and install the package
python -m pip install . -v --no-build-isolation -Cbuilddir=build -C'compile-args=-v'
python -m pip install . -v --no-build-isolation
```

6. **Test Installation**
5. **Test Installation**

```powershell
# Run tests
pytest -s tests/
```

1. **QBLAS Disabled**: QuadBLAS optimization is automatically disabled on Windows builds due to MSVC compatibility issues. This is handled by the `-DDISABLE_QUADBLAS` compiler flag.
6. **QBLAS Disabled**: QuadBLAS optimization is automatically disabled on Windows builds due to MSVC compatibility issues. This is handled by the `-DDISABLE_QUADBLAS` compiler flag.

7. **Visual Studio Version**: The instructions assume Visual Studio 2022. For other versions, adjust the generator string:

2. **Visual Studio Version**: The instructions assume Visual Studio 2022. For other versions, adjust the generator string:
- VS 2019: `"Visual Studio 16 2019"`
- VS 2017: `"Visual Studio 15 2017"`

3. **Architecture**: The instructions are for x64. For x86 builds, change `-A x64` to `-A Win32`.

4. **Alternative SLEEF Location**: If you prefer to install SLEEF elsewhere, update all path references accordingly.

#### Windows Troubleshooting
- **Link errors**: Verify that `sleef.lib` and `sleefquad.lib` exist in `C:/sleef/lib/`
8. **Architecture**: The instructions are for x64. For x86 builds, change `-A x64` to `-A Win32`.
Loading