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

Try building without needing to move lal stuff around or declare lal functions #59

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
key: ${{ runner.os }}-conda-${{ matrix.python-version}}-${{ env.CACHE_NUMBER }}

- name: Configure conda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: test
channels: conda-forge
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/distribution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v2
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==1.9.0
run: python -m pip install cibuildwheel==2.17.0

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
Expand All @@ -26,11 +26,11 @@ jobs:
# against the lal library. However, the lal library installed through
# pip is hard to link against. This symlinks it into /usr/lib so
# that it can be found.
CIBW_BEFORE_BUILD: bash tools/cibuildwheel_prep.sh
CIBW_BUILD: cp36-* cp37-* cp38-* cp39-*
# CIBW_BEFORE_BUILD: bash tools/cibuildwheel_prep.sh
CIBW_BUILD: cp36-manylinux* cp37-manylinux* cp38-manylinux* cp39-manylinux* cp310-manylinux* cp311-manylinux* cp312-manylinux*
CIBW_ARCHS: auto64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux_2_28
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
Expand Down
21 changes: 4 additions & 17 deletions sbank/overlap_cpu_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,10 @@
#include <math.h>
#include <complex.h>
#include <sys/types.h>

/* ---------------- LAL STUFF NEEDED ----------------- */
typedef struct tagCOMPLEX8Vector {
uint32_t length; /**< Number of elements in array. */
float complex *data; /**< Pointer to the data array. */
} COMPLEX8Vector;

COMPLEX8Vector * XLALCreateCOMPLEX8Vector ( uint32_t length );
void XLALDestroyCOMPLEX8Vector ( COMPLEX8Vector * vector );

typedef struct tagCOMPLEX8FFTPlan COMPLEX8FFTPlan;

COMPLEX8FFTPlan * XLALCreateReverseCOMPLEX8FFTPlan( uint32_t size, int measurelvl );

void XLALDestroyCOMPLEX8FFTPlan( COMPLEX8FFTPlan *plan );

/* ----------------------------------------------- */
#include <lal/LALDatatypes.h>
#include <lal/AVFactories.h>
#include <lal/ComplexFFT.h>
#include <lal/XLALError.h>

typedef struct tagWS {
size_t n;
Expand Down
30 changes: 25 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""

import os
import subprocess

from setuptools import setup, Extension

Expand All @@ -15,6 +16,17 @@
__author__ = "Duncan Macleod <[email protected]>"


# Ensure we can find lal libraries
def pkgconfig(package, kw):
flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'}
output = subprocess.getoutput(
'pkg-config --cflags --libs {}'.format(package))
print(output)
for token in output.strip().split():
kw.setdefault(flag_map.get(token[:2]), []).append(token[2:])
return kw


# define cython options
cython_compile_args = [
"-O3",
Expand All @@ -33,16 +45,24 @@
cython_directives["linetrace"] = True
cython_compile_args.append("-DCYTHON_TRACE")

# Set extension arguments
extension_kwargs = {
'include_dirs': [numpy.get_include()],
'language': "c",
'libraries': ["lal"],
'extra_compile_args': cython_compile_args,
'extra_link_args': [],
}

# lal arguments
extension_kwargs = pkgconfig('lal', extension_kwargs)

# define compiled extensions
exts = [
Extension(
"sbank.overlap_cpu",
["sbank/overlap_cpu.pyx"],
include_dirs=[numpy.get_include()],
language="c",
libraries=["lal"],
extra_compile_args=cython_compile_args,
extra_link_args=[],
**extension_kwargs
),
]

Expand Down
Loading