Skip to content

Commit d0620af

Browse files
authored
Merge branch 'main' into sdist
2 parents 58d59b9 + e11c8df commit d0620af

File tree

2 files changed

+23
-64
lines changed

2 files changed

+23
-64
lines changed

quaddtype/README.md

Lines changed: 22 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,18 @@ np.array([1,2,3], dtype=QuadPrecDType("longdouble"))
2525

2626
## Installation from source
2727

28-
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.
29-
30-
### Linux/Unix/macOS
28+
#### Prerequisites
3129

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

34-
```bash
35-
git clone --branch 3.8 https://github.com/shibatch/sleef.git
36-
cd sleef
37-
cmake -S . -B build -DSLEEF_BUILD_QUAD:BOOL=ON -DSLEEF_BUILD_SHARED_LIBS:BOOL=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON
38-
cmake --build build/ --clean-first -j
39-
cd ..
40-
```
35+
### Linux/Unix/macOS
4136

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

4439
```bash
45-
export SLEEF_DIR=$PWD/sleef/build
46-
export LIBRARY_PATH=$SLEEF_DIR/lib
47-
export C_INCLUDE_PATH=$SLEEF_DIR/include
48-
export CPLUS_INCLUDE_PATH=$SLEEF_DIR/include
49-
5040
# setup the virtual env
5141
python3 -m venv temp
5242
source temp/bin/activate
@@ -55,15 +45,13 @@ source temp/bin/activate
5545
pip install meson-python numpy pytest
5646

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

6250
# To build without QBLAS (default for MSVC)
63-
# export CFLAGS="-fPIC -DDISABLE_QUADBLAS"
64-
# export CXXFLAGS="-fPIC -DDISABLE_QUADBLAS"
51+
# export CFLAGS="-DDISABLE_QUADBLAS"
52+
# export CXXFLAGS="-DDISABLE_QUADBLAS"
6553

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

6856
# Run the tests
6957
cd ..
@@ -76,7 +64,7 @@ python -m pytest
7664

7765
- **Visual Studio 2017 or later** (with MSVC compiler)
7866
- **CMake** (≥3.15)
79-
- **Python 3.10+**
67+
- **Python 3.10+**
8068
- **Git**
8169

8270
#### Step-by-Step Installation
@@ -85,24 +73,7 @@ python -m pytest
8573

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

88-
2. **Clone and Build SLEEF**
89-
90-
```powershell
91-
# Clone SLEEF library
92-
git clone --branch 3.8 https://github.com/shibatch/sleef.git
93-
cd sleef
94-
95-
# Configure with CMake for Windows
96-
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
97-
98-
# Build and install SLEEF
99-
cmake --build build --config Release
100-
cmake --install build --prefix "C:/sleef" --config Release
101-
102-
cd ..
103-
```
104-
105-
3. **Setup Python Environment**
76+
2. **Setup Python Environment**
10677

10778
```powershell
10879
# Create and activate virtual environment
@@ -114,46 +85,33 @@ python -m pytest
11485
pip install meson-python numpy pytest ninja meson
11586
```
11687

117-
4. **Set Environment Variables**
88+
3. **Set Environment Variables**
11889

11990
```powershell
120-
# Set up paths and compiler flags
121-
$env:INCLUDE = "C:/sleef/include;$env:INCLUDE"
122-
$env:LIB = "C:/sleef/lib;$env:LIB"
123-
$env:PATH = "C:/sleef/bin;$env:PATH"
124-
12591
# Note: QBLAS is disabled on Windows due to MSVC compatibility issues
126-
$env:CFLAGS = "/IC:/sleef/include /DDISABLE_QUADBLAS"
127-
$env:CXXFLAGS = "/IC:/sleef/include /DDISABLE_QUADBLAS"
128-
$env:LDFLAGS = "C:/sleef/lib/sleef.lib C:/sleef/lib/sleefquad.lib"
92+
$env:CFLAGS = "/DDISABLE_QUADBLAS"
93+
$env:CXXFLAGS = "/DDISABLE_QUADBLAS"
12994
```
13095

131-
5. **Build and Install numpy-quaddtype**
96+
4. **Build and Install numpy-quaddtype**
13297

13398
```powershell
134-
# Ensure submodules are initialized
135-
git submodule update --init --recursive
136-
13799
# Build and install the package
138-
python -m pip install . -v --no-build-isolation -Cbuilddir=build -C'compile-args=-v'
100+
python -m pip install . -v --no-build-isolation
139101
```
140102

141-
6. **Test Installation**
103+
5. **Test Installation**
142104

143105
```powershell
144106
# Run tests
145107
pytest -s tests/
146108
```
147109

148-
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.
110+
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.
111+
112+
7. **Visual Studio Version**: The instructions assume Visual Studio 2022. For other versions, adjust the generator string:
149113

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

154-
3. **Architecture**: The instructions are for x64. For x86 builds, change `-A x64` to `-A Win32`.
155-
156-
4. **Alternative SLEEF Location**: If you prefer to install SLEEF elsewhere, update all path references accordingly.
157-
158-
#### Windows Troubleshooting
159-
- **Link errors**: Verify that `sleef.lib` and `sleefquad.lib` exist in `C:/sleef/lib/`
117+
8. **Architecture**: The instructions are for x64. For x86 builds, change `-A x64` to `-A Win32`.

quaddtype/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ name = "numpy_quaddtype"
1212
description = "Quad (128-bit) float dtype for numpy"
1313
version = "0.1.0"
1414
readme = 'README.md'
15+
license = { file = "LICENSE" }
1516
authors = [{name = "Swayam Singh", email = "[email protected]"}]
1617
requires-python = ">=3.10.0"
1718
dependencies = [

0 commit comments

Comments
 (0)