Skip to content

Commit 07ea577

Browse files
committed
updated readme
1 parent 7e7afc6 commit 07ea577

1 file changed

Lines changed: 76 additions & 62 deletions

File tree

quaddtype/README.md

Lines changed: 76 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
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+
[![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://numfocus.org)
7+
38
A cross-platform Quad (128-bit) float Data-Type for NumPy.
49

10+
## Table of Contents
11+
12+
- [NumPy-QuadDType](#numpy-quaddtype)
13+
- [Table of Contents](#table-of-contents)
14+
- [Installation](#installation)
15+
- [Usage](#usage)
16+
- [Installation from source](#installation-from-source)
17+
- [Linux/Unix/macOS](#linuxunixmacos)
18+
- [Windows](#windows)
19+
- [Building with ThreadSanitizer (TSan)](#building-with-threadsanitizer-tsan)
20+
- [Building the documentation](#building-the-documentation)
21+
- [Serving the documentation](#serving-the-documentation)
22+
- [Development Tips](#development-tips)
23+
- [Cleaning the Build Directory](#cleaning-the-build-directory)
24+
525
## Installation
626

727
```bash
8-
pip install numpy
28+
pip install "numpy>=2.4"
929
pip install numpy-quaddtype
1030
```
1131

@@ -25,50 +45,31 @@ np.array([1,2,3], dtype=QuadPrecDType("longdouble"))
2545

2646
## Installation from source
2747

28-
### Prerequisites
29-
30-
- **gcc/clang**
31-
- **CMake** (≥3.15)
32-
- **Python 3.10+**
33-
- **Git**
34-
- **NumPy >= 2.4** (build from source)
35-
3648
### Linux/Unix/macOS
3749

38-
Building the `numpy-quaddtype` package:
50+
**Prerequisites:** gcc/clang, CMake (≥3.15), Python 3.11+, Git, NumPy ≥ 2.4
3951

4052
```bash
4153
# setup the virtual env
4254
python3 -m venv temp
4355
source temp/bin/activate
4456

45-
# Install NumPy from source
46-
pip install "numpy @ git+https://github.com/numpy/numpy.git"
47-
4857
# Install build and test dependencies
49-
pip install pytest meson meson-python
58+
pip install pytest meson meson-python "numpy>=2.4"
5059

5160
# To build without QBLAS (default for MSVC)
5261
# export CFLAGS="-DDISABLE_QUADBLAS"
5362
# export CXXFLAGS="-DDISABLE_QUADBLAS"
5463

55-
python -m pip install . -v --no-build-isolation
64+
python -m pip install ".[test]" -v
5665

5766
# Run the tests
58-
cd ..
59-
python -m pytest/quaddtype/tests/
67+
python -m pytest tests
6068
```
6169

6270
### Windows
6371

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
72+
**Prerequisites:** Visual Studio 2017+ (with MSVC), CMake (≥3.15), Python 3.11+, Git
7273

7374
1. **Setup Development Environment**
7475

@@ -98,14 +99,14 @@ python -m pytest/quaddtype/tests/
9899

99100
```powershell
100101
# Build and install the package
101-
python -m pip install . -v --no-build-isolation
102+
python -m pip install ".[test]" -v
102103
```
103104

104105
5. **Test Installation**
105106

106107
```powershell
107108
# Run tests
108-
pytest -s ..\quaddtype\tests\
109+
pytest -s tests
109110
```
110111

111112
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.
@@ -122,6 +123,7 @@ python -m pytest/quaddtype/tests/
122123
This is a development feature to help detect threading issues. To build `numpy-quaddtype` with TSan enabled, follow these steps:
123124

124125
> Use of clang is recommended with machine NOT supporting `libquadmath` (like ARM64). Set the compiler to clang/clang++ before proceeding.
126+
>
125127
> ```bash
126128
> export CC=clang
127129
> export CXX=clang++
@@ -131,46 +133,48 @@ This is a development feature to help detect threading issues. To build `numpy-q
131133
2. Create and activate a virtual environment using the TSan-enabled Python build.
132134
3. Installing dependencies:
133135
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-
```
136+
```bash
137+
python -m pip install meson meson-python wheel ninja
138+
# Need NumPy built with TSan as well
139+
python -m pip install "numpy @ git+https://github.com/numpy/numpy" -C'setup-args=-Db_sanitize=thread'
140+
```
141+
139142
4. Building SLEEF with TSan:
140143
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-
```
144+
```bash
145+
# clone the repository
146+
git clone https://github.com/shibatch/sleef.git
147+
cd sleef
148+
git checkout 43a0252ba9331adc7fb10755021f802863678c38
149+
150+
# Build SLEEF with TSan
151+
cmake \
152+
-DCMAKE_C_COMPILER=clang \
153+
-DCMAKE_CXX_COMPILER=clang++ \
154+
-DCMAKE_C_FLAGS="-fsanitize=thread -g -O1" \
155+
-DCMAKE_CXX_FLAGS="-fsanitize=thread -g -O1" \
156+
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=thread" \
157+
-DCMAKE_SHARED_LINKER_FLAGS="-fsanitize=thread" \
158+
-DSLEEF_BUILD_QUAD=ON \
159+
-DSLEEF_BUILD_TESTS=OFF \
160+
-DCMAKE_INSTALL_PREFIX=/usr/local
161+
-S . -B build
162+
163+
cmake --build build -j --clean-first
164+
cmake --install build
165+
```
166+
163167
5. Build and install `numpy-quaddtype` with TSan:
164168
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.
169+
```bash
170+
# SLEEF is already installed with TSan, we need to provide proper flags to numpy-quaddtype's meson file
171+
# So that it does not build SLEEF again and use the installed one.
168172
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-
```
173+
export CFLAGS="-fsanitize=thread -g -O0"
174+
export CXXFLAGS="-fsanitize=thread -g -O0"
175+
export LDFLAGS="-fsanitize=thread"
176+
python -m pip install . -vv -Csetup-args=-Db_sanitize=thread
177+
```
174178
175179
## Building the documentation
176180
@@ -204,3 +208,13 @@ https://numpy.github.io/numpy-user-dtypes/quaddtype/
204208
```
205209
206210
Check the `.github/workflows/build_docs.yml` file for details.
211+
212+
## Development Tips
213+
214+
### Cleaning the Build Directory
215+
216+
The subproject folders (`subprojects/sleef`, `subprojects/qblas`) are cloned as git repositories. To fully clean them, use double force:
217+
218+
```bash
219+
git clean -ffxd
220+
```

0 commit comments

Comments
 (0)