numpy-quaddtype 0.1.0__cp311-cp311-macosx_13_0_x86_64.whl
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.
Potentially problematic release.
This version of numpy-quaddtype might be problematic. Click here for more details.
- numpy_quaddtype/.dylibs/libomp.dylib +0 -0
- numpy_quaddtype/.dylibs/libsleef.3.8.0.dylib +0 -0
- numpy_quaddtype/.dylibs/libsleefquad.3.8.0.dylib +0 -0
- numpy_quaddtype/__init__.py +45 -0
- numpy_quaddtype/_quaddtype_main.cpython-311-darwin.so +0 -0
- numpy_quaddtype-0.1.0.dist-info/METADATA +170 -0
- numpy_quaddtype-0.1.0.dist-info/RECORD +8 -0
- numpy_quaddtype-0.1.0.dist-info/WHEEL +6 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from ._quaddtype_main import (
|
|
2
|
+
QuadPrecision,
|
|
3
|
+
QuadPrecDType,
|
|
4
|
+
is_longdouble_128,
|
|
5
|
+
get_sleef_constant,
|
|
6
|
+
set_num_threads,
|
|
7
|
+
get_num_threads,
|
|
8
|
+
get_quadblas_version
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
'QuadPrecision', 'QuadPrecDType', 'SleefQuadPrecision', 'LongDoubleQuadPrecision',
|
|
13
|
+
'SleefQuadPrecDType', 'LongDoubleQuadPrecDType', 'is_longdouble_128',
|
|
14
|
+
# Constants
|
|
15
|
+
'pi', 'e', 'log2e', 'log10e', 'ln2', 'ln10', 'max_value', 'epsilon',
|
|
16
|
+
'smallest_normal', 'smallest_subnormal', 'bits', 'precision', 'resolution',
|
|
17
|
+
# QuadBLAS related functions
|
|
18
|
+
'set_num_threads', 'get_num_threads', 'get_quadblas_version'
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
def SleefQuadPrecision(value):
|
|
22
|
+
return QuadPrecision(value, backend='sleef')
|
|
23
|
+
|
|
24
|
+
def LongDoubleQuadPrecision(value):
|
|
25
|
+
return QuadPrecision(value, backend='longdouble')
|
|
26
|
+
|
|
27
|
+
def SleefQuadPrecDType():
|
|
28
|
+
return QuadPrecDType(backend='sleef')
|
|
29
|
+
|
|
30
|
+
def LongDoubleQuadPrecDType():
|
|
31
|
+
return QuadPrecDType(backend='longdouble')
|
|
32
|
+
|
|
33
|
+
pi = get_sleef_constant("pi")
|
|
34
|
+
e = get_sleef_constant("e")
|
|
35
|
+
log2e = get_sleef_constant("log2e")
|
|
36
|
+
log10e = get_sleef_constant("log10e")
|
|
37
|
+
ln2 = get_sleef_constant("ln2")
|
|
38
|
+
ln10 = get_sleef_constant("ln10")
|
|
39
|
+
max_value = get_sleef_constant("max_value")
|
|
40
|
+
epsilon = get_sleef_constant("epsilon")
|
|
41
|
+
smallest_normal = get_sleef_constant("smallest_normal")
|
|
42
|
+
smallest_subnormal = get_sleef_constant("smallest_subnormal")
|
|
43
|
+
bits = get_sleef_constant("bits")
|
|
44
|
+
precision = get_sleef_constant("precision")
|
|
45
|
+
resolution = get_sleef_constant("resolution")
|
|
Binary file
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: numpy_quaddtype
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Quad (128-bit) float dtype for numpy
|
|
5
|
+
Author-Email: Swayam Singh <singhswayam008@gmail.com>
|
|
6
|
+
Requires-Python: >=3.10.0
|
|
7
|
+
Requires-Dist: numpy
|
|
8
|
+
Provides-Extra: test
|
|
9
|
+
Requires-Dist: pytest; extra == "test"
|
|
10
|
+
Requires-Dist: pytest-run-parallel; extra == "test"
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
# Numpy-QuadDType
|
|
14
|
+
|
|
15
|
+
A cross-platform Quad (128-bit) float Data-Type for NumPy.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install numpy
|
|
21
|
+
pip install numpy-quaddtype
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
import numpy as np
|
|
28
|
+
from numpy_quaddtype import QuadPrecDType, QuadPrecision
|
|
29
|
+
|
|
30
|
+
# using sleef backend (default)
|
|
31
|
+
np.array([1,2,3], dtype=QuadPrecDType())
|
|
32
|
+
np.array([1,2,3], dtype=QuadPrecDType("sleef"))
|
|
33
|
+
|
|
34
|
+
# using longdouble backend
|
|
35
|
+
np.array([1,2,3], dtype=QuadPrecDType("longdouble"))
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Installation from source
|
|
39
|
+
|
|
40
|
+
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.
|
|
41
|
+
|
|
42
|
+
### Linux/Unix/macOS
|
|
43
|
+
|
|
44
|
+
The below assumes one has the required pieces to build sleef (cmake and libmpfr-dev), and that one is in the package directory locally.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
git clone --branch 3.8 https://github.com/shibatch/sleef.git
|
|
48
|
+
cd sleef
|
|
49
|
+
cmake -S . -B build -DSLEEF_BUILD_QUAD:BOOL=ON -DSLEEF_BUILD_SHARED_LIBS:BOOL=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
|
50
|
+
cmake --build build/ --clean-first -j
|
|
51
|
+
cd ..
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Building the `numpy-quaddtype` package from locally installed sleef:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
export SLEEF_DIR=$PWD/sleef/build
|
|
58
|
+
export LIBRARY_PATH=$SLEEF_DIR/lib
|
|
59
|
+
export C_INCLUDE_PATH=$SLEEF_DIR/include
|
|
60
|
+
export CPLUS_INCLUDE_PATH=$SLEEF_DIR/include
|
|
61
|
+
|
|
62
|
+
# setup the virtual env
|
|
63
|
+
python3 -m venv temp
|
|
64
|
+
source temp/bin/activate
|
|
65
|
+
|
|
66
|
+
# Install the package
|
|
67
|
+
pip install meson-python numpy pytest
|
|
68
|
+
|
|
69
|
+
export LDFLAGS="-Wl,-rpath,$SLEEF_DIR/lib -fopenmp -latomic -lpthread"
|
|
70
|
+
export CFLAGS="-fPIC"
|
|
71
|
+
export CXXFLAGS="-fPIC"
|
|
72
|
+
|
|
73
|
+
# To build without QBLAS (default for MSVC)
|
|
74
|
+
# export CFLAGS="-fPIC -DDISABLE_QUADBLAS"
|
|
75
|
+
# export CXXFLAGS="-fPIC -DDISABLE_QUADBLAS"
|
|
76
|
+
|
|
77
|
+
python -m pip install . -v --no-build-isolation -Cbuilddir=build -C'compile-args=-v'
|
|
78
|
+
|
|
79
|
+
# Run the tests
|
|
80
|
+
cd ..
|
|
81
|
+
python -m pytest
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Windows
|
|
85
|
+
|
|
86
|
+
#### Prerequisites
|
|
87
|
+
|
|
88
|
+
- **Visual Studio 2017 or later** (with MSVC compiler)
|
|
89
|
+
- **CMake** (≥3.15)
|
|
90
|
+
- **Python 3.10+**
|
|
91
|
+
- **Git**
|
|
92
|
+
|
|
93
|
+
#### Step-by-Step Installation
|
|
94
|
+
|
|
95
|
+
1. **Setup Development Environment**
|
|
96
|
+
|
|
97
|
+
Open a **Developer Command Prompt for VS** or **Developer PowerShell for VS** to ensure MSVC is properly configured.
|
|
98
|
+
|
|
99
|
+
2. **Clone and Build SLEEF**
|
|
100
|
+
|
|
101
|
+
```powershell
|
|
102
|
+
# Clone SLEEF library
|
|
103
|
+
git clone --branch 3.8 https://github.com/shibatch/sleef.git
|
|
104
|
+
cd sleef
|
|
105
|
+
|
|
106
|
+
# Configure with CMake for Windows
|
|
107
|
+
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
|
|
108
|
+
|
|
109
|
+
# Build and install SLEEF
|
|
110
|
+
cmake --build build --config Release
|
|
111
|
+
cmake --install build --prefix "C:/sleef" --config Release
|
|
112
|
+
|
|
113
|
+
cd ..
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
3. **Setup Python Environment**
|
|
117
|
+
|
|
118
|
+
```powershell
|
|
119
|
+
# Create and activate virtual environment
|
|
120
|
+
python -m venv numpy_quad_env
|
|
121
|
+
.\numpy_quad_env\Scripts\Activate.ps1
|
|
122
|
+
|
|
123
|
+
# Install build dependencies
|
|
124
|
+
pip install -U pip
|
|
125
|
+
pip install meson-python numpy pytest ninja meson
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
4. **Set Environment Variables**
|
|
129
|
+
|
|
130
|
+
```powershell
|
|
131
|
+
# Set up paths and compiler flags
|
|
132
|
+
$env:INCLUDE = "C:/sleef/include;$env:INCLUDE"
|
|
133
|
+
$env:LIB = "C:/sleef/lib;$env:LIB"
|
|
134
|
+
$env:PATH = "C:/sleef/bin;$env:PATH"
|
|
135
|
+
|
|
136
|
+
# Note: QBLAS is disabled on Windows due to MSVC compatibility issues
|
|
137
|
+
$env:CFLAGS = "/IC:/sleef/include /DDISABLE_QUADBLAS"
|
|
138
|
+
$env:CXXFLAGS = "/IC:/sleef/include /DDISABLE_QUADBLAS"
|
|
139
|
+
$env:LDFLAGS = "C:/sleef/lib/sleef.lib C:/sleef/lib/sleefquad.lib"
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
5. **Build and Install numpy-quaddtype**
|
|
143
|
+
|
|
144
|
+
```powershell
|
|
145
|
+
# Ensure submodules are initialized
|
|
146
|
+
git submodule update --init --recursive
|
|
147
|
+
|
|
148
|
+
# Build and install the package
|
|
149
|
+
python -m pip install . -v --no-build-isolation -Cbuilddir=build -C'compile-args=-v'
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
6. **Test Installation**
|
|
153
|
+
|
|
154
|
+
```powershell
|
|
155
|
+
# Run tests
|
|
156
|
+
pytest -s tests/
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
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.
|
|
160
|
+
|
|
161
|
+
2. **Visual Studio Version**: The instructions assume Visual Studio 2022. For other versions, adjust the generator string:
|
|
162
|
+
- VS 2019: `"Visual Studio 16 2019"`
|
|
163
|
+
- VS 2017: `"Visual Studio 15 2017"`
|
|
164
|
+
|
|
165
|
+
3. **Architecture**: The instructions are for x64. For x86 builds, change `-A x64` to `-A Win32`.
|
|
166
|
+
|
|
167
|
+
4. **Alternative SLEEF Location**: If you prefer to install SLEEF elsewhere, update all path references accordingly.
|
|
168
|
+
|
|
169
|
+
#### Windows Troubleshooting
|
|
170
|
+
- **Link errors**: Verify that `sleef.lib` and `sleefquad.lib` exist in `C:/sleef/lib/`
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
numpy_quaddtype/_quaddtype_main.cpython-311-darwin.so,sha256=ZwYpIZ4asvaELMlLkzmgDLYsF3NGd4-o3HKb1aaoJII,267312
|
|
2
|
+
numpy_quaddtype/__init__.py,sha256=njWfTVMx1d6awqZvqo4WJW6jojpW3FHKoaJTuifDQKg,1474
|
|
3
|
+
numpy_quaddtype/.dylibs/libomp.dylib,sha256=sVBYbkOmmgO5OaOH-irGtpECHyhgJMtLIw5NGn5i7uc,749040
|
|
4
|
+
numpy_quaddtype/.dylibs/libsleefquad.3.8.0.dylib,sha256=nsuz-dhZ52KTn-V4JDep9OhFE9_qWU4Ki4Z-PJHcSR0,1891984
|
|
5
|
+
numpy_quaddtype/.dylibs/libsleef.3.8.0.dylib,sha256=YEHo0x8iNLxKKGmZBEwwAdBX4hc_n8OYJ_-T0QJbJO0,2490112
|
|
6
|
+
numpy_quaddtype-0.1.0.dist-info/RECORD,,
|
|
7
|
+
numpy_quaddtype-0.1.0.dist-info/WHEEL,sha256=S20l25iOAdd1WPH_Mci73XRzbOi8JQNL5ekc52EfESw,123
|
|
8
|
+
numpy_quaddtype-0.1.0.dist-info/METADATA,sha256=vE3pMJIWXPPflvYHU_ln5McTvzkTqxTsB5xHMXK648A,4889
|