Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Quaddtype #98

Merged
merged 44 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
ccfc64a
initial commit, adding Float128 dtype
SwayamInSync Jul 29, 2024
d9005a9
sleef based quadprecision
SwayamInSync Jul 29, 2024
4702764
fixing numpy absolute include path
SwayamInSync Jul 31, 2024
6ec99a5
fixing numpy absolute include path
SwayamInSync Jul 31, 2024
a8b2599
adding quad precision support with sleef
SwayamInSync Aug 1, 2024
d6bdb99
fixing sleef linking issues in meson
SwayamInSync Aug 2, 2024
8ff6e0c
adding NPY_SAME_KIND_CASTING
SwayamInSync Aug 2, 2024
3559232
fixing NPY_SAME_CAST
SwayamInSync Aug 2, 2024
a481648
fixing quad precsion printing issue
SwayamInSync Aug 3, 2024
a33ea7f
fixing quad precsion printing issue
SwayamInSync Aug 3, 2024
220e0ae
removing hardcoded paths from meson build
SwayamInSync Aug 5, 2024
4dfe490
adding CI changes
SwayamInSync Aug 7, 2024
64d1e9e
adding quaddtype branch in CI
SwayamInSync Aug 7, 2024
ae9d8b8
fixing sleefquad dep in CI
SwayamInSync Aug 7, 2024
28c205b
fixing cmake sleefquad dep in CI
SwayamInSync Aug 7, 2024
7dd8611
fixing sleef compiling issue with FPIC
SwayamInSync Aug 7, 2024
d0da3e5
adding Build position-independent
SwayamInSync Aug 7, 2024
9077bec
adding Build position-independent
SwayamInSync Aug 7, 2024
982fba2
adding Build position-independent
SwayamInSync Aug 7, 2024
5a3ae94
adding Build position-independent
SwayamInSync Aug 7, 2024
18b537a
fixing tests
SwayamInSync Aug 7, 2024
f53c130
fixing test namings
SwayamInSync Aug 7, 2024
77e9967
debugging sleef installation issues
SwayamInSync Aug 7, 2024
375a621
debugging sleef installation issues
SwayamInSync Aug 7, 2024
820588d
fixing sleef linking issues
SwayamInSync Aug 7, 2024
53396db
fixing sleef linking issues
SwayamInSync Aug 7, 2024
e91104e
fixing sleef linking issues
SwayamInSync Aug 7, 2024
9639628
fixing sleef linking issues
SwayamInSync Aug 7, 2024
bef1cc2
Update CI branch
SwayamInSync Aug 7, 2024
4f242fd
fixing pandas meson==0.13.1 dependency issue as --no-build-isolation
SwayamInSync Aug 8, 2024
58fbc6f
merging CI fixes
SwayamInSync Aug 9, 2024
96ee075
adding ufuncs
SwayamInSync Aug 9, 2024
7f7ebc3
added ufuncs, castings and scalar ops
SwayamInSync Aug 10, 2024
ffaa617
more castings and ufuncs
SwayamInSync Aug 10, 2024
299568b
updated meson.build
SwayamInSync Aug 11, 2024
d13f863
adding more scalar tests
SwayamInSync Aug 11, 2024
78a6931
defining scalar ops in struct sequence
SwayamInSync Aug 13, 2024
6fbe989
resolving fixing unaligned loop and casting issues
SwayamInSync Aug 15, 2024
6e124e3
resolving error catching and removing initial data init for dtype
SwayamInSync Aug 15, 2024
63dc446
added destructor function for tp_dealloc
SwayamInSync Aug 15, 2024
d2e1ded
changing quad->quad cast to NPY_NO_CASTING from NPY_SAME_CASTING
SwayamInSync Aug 16, 2024
96270bc
added dtype promoter functions
SwayamInSync Aug 16, 2024
fb04515
fixed memory issues and more ufuncs
SwayamInSync Aug 16, 2024
c76cf36
fixed destructor for bad memory access
SwayamInSync Aug 16, 2024
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
14 changes: 12 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,21 @@ jobs:
working-directory: unytdtype
run: |
pytest -vvv --color=yes
- name: Install quaddtype dependencies
run: |
sudo apt-get update
sudo apt-get install -y libmpfr-dev libssl-dev libfftw3-dev
- name: Install SLEEF
run: |
git clone 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
sudo cmake --install build --prefix /usr
- name: Install quaddtype
working-directory: quaddtype
run: |
python -m build --no-isolation --wheel -Cbuilddir=build
find ./dist/*.whl | xargs python -m pip install
LDFLAGS="-Wl,-rpath,/usr/lib" python -m pip install . -v --no-build-isolation -Cbuilddir=build -C'compile-args=-v' -Csetup-args="-Dbuildtype=debug"
- name: Run quaddtype tests
working-directory: quaddtype
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,4 @@ compile_commands.json

.ruff-cache/
.asv
.vscode/
6 changes: 0 additions & 6 deletions quaddtype/.flake8

This file was deleted.

16 changes: 0 additions & 16 deletions quaddtype/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +0,0 @@
# quaddtype

Quad (128-bit) float dtype for numpy

## Installation

To install, make sure you have `numpy` nightly installed. Then build without
isolation so that the `quaddtype` can link against the experimental dtype API
headers, which aren't in the latest releases of `numpy`:

```bash
pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
pip install . --no-build-isolation
```

Developed with Python 3.11, but 3.9 and 3.10 will probably also work.
63 changes: 36 additions & 27 deletions quaddtype/meson.build
Original file line number Diff line number Diff line change
@@ -1,47 +1,56 @@
project(
'quaddtype',
'c',
)
project('quaddtype', 'c', 'cpp', default_options : ['cpp_std=c++17', 'b_pie=true'])

py_mod = import('python')
py = py_mod.find_installation()

c = meson.get_compiler('c')

sleef_dep = c.find_library('sleef')
sleefquad_dep = c.find_library('sleefquad')

incdir_numpy = run_command(py,
[
'-c',
'import numpy; print(numpy.get_include())'
'import numpy; import os; print(os.path.relpath(numpy.get_include()))'
],
check: true
).stdout().strip()

includes = include_directories(
[
incdir_numpy,
'quaddtype/src'
]
[
incdir_numpy,
'quaddtype/src',
]
)

srcs = [
'quaddtype/src/umath.c',
'quaddtype/src/casts.c',
'quaddtype/src/dtype.c',
'quaddtype/src/quaddtype_main.c',
'quaddtype/src/casts.h',
'quaddtype/src/casts.cpp',
'quaddtype/src/scalar.h',
'quaddtype/src/scalar.c',
'quaddtype/src/dtype.h',
'quaddtype/src/dtype.c',
'quaddtype/src/quaddtype_main.c',
'quaddtype/src/scalar_ops.h',
'quaddtype/src/scalar_ops.cpp',
'quaddtype/src/ops.hpp',
'quaddtype/src/umath.h',
'quaddtype/src/umath.cpp'
]

py.install_sources(
[
'quaddtype/__init__.py',
'quaddtype/quadscalar.py'
],
subdir: 'quaddtype',
pure: false
[
'quaddtype/__init__.py',
],
subdir: 'quaddtype',
pure: false
)

py.extension_module(
'_quaddtype_main',
srcs,
c_args: ['-g', '-O0'],
install: true,
subdir: 'quaddtype',
include_directories: includes
)
py.extension_module('_quaddtype_main',
srcs,
c_args: ['-g', '-O0', '-lsleef', '-lsleefquad'],
dependencies: [sleef_dep, sleefquad_dep],
install: true,
subdir: 'quaddtype',
include_directories: includes
)
4 changes: 2 additions & 2 deletions quaddtype/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = [
"meson>=0.63.0",
"meson>=1.3.2",
"meson-python",
"patchelf",
"wheel",
Expand All @@ -13,7 +13,7 @@ name = "quaddtype"
description = "Quad (128-bit) float dtype for numpy"
version = "0.0.1"
readme = 'README.md'
author = "Peyton Murray"
author = "Swayam Singh"
requires-python = ">=3.9.0"
dependencies = [
"numpy"
Expand Down
9 changes: 1 addition & 8 deletions quaddtype/quaddtype/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
# Scalar quantity must be defined _before_ the dtype, so don't isort it.
# During initialization of _quaddtype_main, QuadScalar is imported from this
# (partially initialized)
# module, and therefore has to be defined first.
from .quadscalar import QuadScalar # isort: skip
from ._quaddtype_main import QuadDType

__all__ = ["QuadScalar", "QuadDType"]
from ._quaddtype_main import QuadPrecDType, QuadPrecision
11 changes: 0 additions & 11 deletions quaddtype/quaddtype/quadscalar.py

This file was deleted.

157 changes: 0 additions & 157 deletions quaddtype/quaddtype/src/casts.c

This file was deleted.

Loading
Loading