11# NumPy-QuadDType
22
3+ [ ![ PyPI] ( https://img.shields.io/pypi/v/numpy-quaddtype.svg )] ( https://pypi.org/project/numpy-quaddtype/ )
4+ [ ![ PyPI Downloads] ( https://static.pepy.tech/badge/numpy-quaddtype/month )] ( https://pepy.tech/project/numpy-quaddtype )
5+ [ ![ Conda Downloads] ( https://img.shields.io/conda/dn/conda-forge/numpy_quaddtype.svg?label=Conda%20downloads )] ( https://anaconda.org/conda-forge/numpy_quaddtype )
6+ [ ![ Documentation] ( https://img.shields.io/badge/docs-latest-blue.svg )] ( https://numpy.org/numpy-user-dtypes/quaddtype/ )
7+ [ ![ Powered by NumFOCUS] ( https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A )] ( https://numfocus.org )
8+
39A cross-platform Quad (128-bit) float Data-Type for NumPy.
410
11+ ** [ 📖 Read the full documentation] ( https://numpy.org/numpy-user-dtypes/quaddtype/ ) **
12+
13+ ## Table of Contents
14+
15+ - [ NumPy-QuadDType] ( #numpy-quaddtype )
16+ - [ Table of Contents] ( #table-of-contents )
17+ - [ Installation] ( #installation )
18+ - [ Usage] ( #usage )
19+ - [ Installation from source] ( #installation-from-source )
20+ - [ Linux/Unix/macOS] ( #linuxunixmacos )
21+ - [ Windows] ( #windows )
22+ - [ Building with ThreadSanitizer (TSan)] ( #building-with-threadsanitizer-tsan )
23+ - [ Building the documentation] ( #building-the-documentation )
24+ - [ Serving the documentation] ( #serving-the-documentation )
25+ - [ Development Tips] ( #development-tips )
26+ - [ Cleaning the Build Directory] ( #cleaning-the-build-directory )
27+
528## Installation
629
730``` bash
8- pip install numpy
31+ pip install " numpy>=2.4 "
932pip install numpy-quaddtype
1033```
1134
@@ -25,50 +48,31 @@ np.array([1,2,3], dtype=QuadPrecDType("longdouble"))
2548
2649## Installation from source
2750
28- ### Prerequisites
29-
30- - ** gcc/clang**
31- - ** CMake** (≥3.15)
32- - ** Python 3.10+**
33- - ** Git**
34- - ** NumPy >= 2.4** (build from source)
35-
3651### Linux/Unix/macOS
3752
38- Building the ` numpy-quaddtype ` package:
53+ ** Prerequisites: ** gcc/clang, CMake (≥3.15), Python 3.11+, Git, NumPy ≥ 2.4
3954
4055``` bash
4156# setup the virtual env
4257python3 -m venv temp
4358source temp/bin/activate
4459
45- # Install NumPy from source
46- pip install " numpy @ git+https://github.com/numpy/numpy.git"
47-
4860# Install build and test dependencies
49- pip install pytest meson meson-python
61+ pip install pytest meson meson-python " numpy>=2.4 "
5062
5163# To build without QBLAS (default for MSVC)
5264# export CFLAGS="-DDISABLE_QUADBLAS"
5365# export CXXFLAGS="-DDISABLE_QUADBLAS"
5466
55- python -m pip install . -v --no-build-isolation
67+ python -m pip install " .[test] " -v
5668
5769# Run the tests
58- cd ..
59- python -m pytest/quaddtype/tests/
70+ python -m pytest tests
6071```
6172
6273### Windows
6374
64- #### Prerequisites
65-
66- - ** Visual Studio 2017 or later** (with MSVC compiler)
67- - ** CMake** (≥3.15)
68- - ** Python 3.10+**
69- - ** Git**
70-
71- #### Step-by-Step Installation
75+ ** Prerequisites:** Visual Studio 2017+ (with MSVC), CMake (≥3.15), Python 3.11+, Git
7276
73771 . ** Setup Development Environment**
7478
@@ -98,14 +102,14 @@ python -m pytest/quaddtype/tests/
98102
99103 ``` powershell
100104 # Build and install the package
101- python -m pip install . -v --no-build-isolation
105+ python -m pip install ".[test]" -v
102106 ```
103107
1041085 . ** Test Installation**
105109
106110 ``` powershell
107111 # Run tests
108- pytest -s ..\quaddtype\ tests\
112+ pytest -s tests
109113 ```
110114
1111156 . ** QBLAS Disabled** : QuadBLAS optimization is automatically disabled on Windows builds due to MSVC compatibility issues. This is handled by the ` -DDISABLE_QUADBLAS ` compiler flag.
@@ -122,6 +126,7 @@ python -m pytest/quaddtype/tests/
122126This is a development feature to help detect threading issues. To build ` numpy-quaddtype ` with TSan enabled, follow these steps:
123127
124128> Use of clang is recommended with machine NOT supporting ` libquadmath ` (like ARM64). Set the compiler to clang/clang++ before proceeding.
129+ >
125130> ``` bash
126131> export CC=clang
127132> export CXX=clang++
@@ -131,46 +136,48 @@ This is a development feature to help detect threading issues. To build `numpy-q
1311362. Create and activate a virtual environment using the TSan-enabled Python build.
1321373. Installing dependencies:
133138
134- ` ` ` bash
135- python -m pip install meson meson-python wheel ninja
136- # Need NumPy built with TSan as well
137- python -m pip install " numpy @ git+https://github.com/numpy/numpy" -C' setup-args=-Db_sanitize=thread'
138- ` ` `
139+ ` ` ` bash
140+ python -m pip install meson meson-python wheel ninja
141+ # Need NumPy built with TSan as well
142+ python -m pip install " numpy @ git+https://github.com/numpy/numpy" -C' setup-args=-Db_sanitize=thread'
143+ ` ` `
144+
1391454. Building SLEEF with TSan:
140146
141- ` ` ` bash
142- # clone the repository
143- git clone -b 3.8 https://github.com/shibatch/sleef.git
144- cd sleef
145-
146- # Build SLEEF with TSan
147- cmake \
148- -DCMAKE_C_COMPILER=clang \
149- -DCMAKE_CXX_COMPILER=clang++ \
150- -DCMAKE_C_FLAGS=" -fsanitize=thread -g -O1" \
151- -DCMAKE_CXX_FLAGS=" -fsanitize=thread -g -O1" \
152- -DCMAKE_EXE_LINKER_FLAGS=" -fsanitize=thread" \
153- -DCMAKE_SHARED_LINKER_FLAGS=" -fsanitize=thread" \
154- -DSLEEF_BUILD_QUAD=ON \
155- -DSLEEF_BUILD_TESTS=OFF \
156- -S . -B build
157-
158- cmake --build build -j
159-
160- # Install the built library and headers into the system path (/usr/local)
161- sudo cmake --install build --prefix=/usr/local
162- ` ` `
147+ ` ` ` bash
148+ # clone the repository
149+ git clone https://github.com/shibatch/sleef.git
150+ cd sleef
151+ git checkout 43a0252ba9331adc7fb10755021f802863678c38
152+
153+ # Build SLEEF with TSan
154+ cmake \
155+ -DCMAKE_C_COMPILER=clang \
156+ -DCMAKE_CXX_COMPILER=clang++ \
157+ -DCMAKE_C_FLAGS=" -fsanitize=thread -g -O1" \
158+ -DCMAKE_CXX_FLAGS=" -fsanitize=thread -g -O1" \
159+ -DCMAKE_EXE_LINKER_FLAGS=" -fsanitize=thread" \
160+ -DCMAKE_SHARED_LINKER_FLAGS=" -fsanitize=thread" \
161+ -DSLEEF_BUILD_QUAD=ON \
162+ -DSLEEF_BUILD_TESTS=OFF \
163+ -DCMAKE_INSTALL_PREFIX=/usr/local
164+ -S . -B build
165+
166+ cmake --build build -j --clean-first
167+ cmake --install build
168+ ` ` `
169+
1631705. Build and install ` numpy-quaddtype` with TSan:
164171
165- ` ` ` bash
166- # SLEEF is already installed with TSan, we need to provide proper flags to numpy-quaddtype's meson file
167- # So that it does not build SLEEF again and use the installed one.
172+ ` ` ` bash
173+ # SLEEF is already installed with TSan, we need to provide proper flags to numpy-quaddtype's meson file
174+ # So that it does not build SLEEF again and use the installed one.
168175
169- export CFLAGS=" -fsanitize=thread -g -O0"
170- export CXXFLAGS=" -fsanitize=thread -g -O0"
171- export LDFLAGS=" -fsanitize=thread"
172- python -m pip install . -vv --no-build-isolation -Csetup-args=-Db_sanitize=thread
173- ` ` `
176+ export CFLAGS=" -fsanitize=thread -g -O0"
177+ export CXXFLAGS=" -fsanitize=thread -g -O0"
178+ export LDFLAGS=" -fsanitize=thread"
179+ python -m pip install . -vv -Csetup-args=-Db_sanitize=thread
180+ ` ` `
174181
175182# # Building the documentation
176183
@@ -200,7 +207,17 @@ The documentation for the `numpy-quaddtype` package is built using Sphinx. To bu
200207The documentation is automatically built and served using GitHub Pages. Every time changes are pushed to the ` main` branch, the documentation is rebuilt and deployed to the ` gh-pages` branch of the repository. You can access the documentation at:
201208
202209` ` `
203- https://numpy.github.io /numpy-user-dtypes/quaddtype/
210+ https://numpy.org /numpy-user-dtypes/quaddtype/
204211` ` `
205212
206213Check the ` .github/workflows/build_docs.yml` file for details.
214+
215+ # # Development Tips
216+
217+ # ## Cleaning the Build Directory
218+
219+ The subproject folders (` subprojects/sleef` , ` subprojects/qblas` ) are cloned as git repositories. To fully clean them, use double force:
220+
221+ ` ` ` bash
222+ git clean -ffxd
223+ ` ` `
0 commit comments