Skip to content

Commit

Permalink
Merge pull request #6 from Fluorescence-Tools/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
tpeulen authored Feb 12, 2024
2 parents b7865c8 + 0c603ae commit af4afe8
Show file tree
Hide file tree
Showing 10 changed files with 26,160 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/conda-build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Conda Build

on:
workflow_dispatch:
push:
branches:
- development
Expand Down Expand Up @@ -39,6 +40,7 @@ jobs:
- name: Build Conda Package
shell: bash -el {0}
run: |
conda config --add channels tpeulen
mamba install conda-build boa
cd conda-recipe
curl -sLO https://raw.githubusercontent.com/conda-forge/conda-forge-pinning-feedstock/084b098a28a7a66e9a0967d156bc55b9ebfc6726/recipe/conda_build_config.yaml
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/conda-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name: Build and Upload Conda Packages

on:
workflow_dispatch:
# push:
# branches:
# - develop
Expand Down Expand Up @@ -43,6 +44,7 @@ jobs:
shell: bash -el {0}
run: |
mamba install conda-build boa anaconda-client
conda config --add channels tpeulen
cd conda-recipe
# Use older conda_build_config -> boost-cpp 1.78
curl -sLO https://raw.githubusercontent.com/conda-forge/conda-forge-pinning-feedstock/084b098a28a7a66e9a0967d156bc55b9ebfc6726/recipe/conda_build_config.yaml
Expand Down
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty)
## CONDA
###########################
FIND_PACKAGE(Conda)

## TTTRLIB
###########################
LINK_LIBRARIES(tttrlib)

## Boost
Expand Down
7 changes: 7 additions & 0 deletions conda-recipe/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@ git submodule update --recursive --init --remote
md build
cd build

REM Call Python with the --version flag to get the version information
for /f "tokens=2 delims= " %%v in ('%PYTHON% --version 2^>^&1') do set PYTHON_VERSION=%%v

REM Extract only the numeric part of the version
for /f "tokens=1-3 delims=." %%a in ("%PYTHON_VERSION%") do set PYTHON_VERSION_NUMERIC=%%a.%%b.%%c

cmake .. -G "NMake Makefiles" ^
-DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^
-DCMAKE_PREFIX_PATH="%PREFIX%" ^
-DBUILD_PYTHON_INTERFACE=ON ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY="%SP_DIR%" ^
-DPYTHON_VERSION="%PYTHON_VERSION_NUMERIC%" ^
-DCMAKE_SWIG_OUTDIR="%SP_DIR%"

nmake
Expand Down
1 change: 1 addition & 0 deletions conda-recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$SP_DIR" \
-DCMAKE_SWIG_OUTDIR="$SP_DIR" \
-DPYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())')\
..

make
Expand Down
2 changes: 1 addition & 1 deletion conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ requirements:
- python
- boost-cpp
- {{ pin_compatible('numpy') }}
- {{ pin_compatible('tttrlib') }}
- {{ pin_compatible('tttrlib', max_pin='x.x.x') }}
- llvm-openmp # [osx]

test:
Expand Down
5 changes: 4 additions & 1 deletion ext/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}")


IF(BUILD_PYTHON_INTERFACE)
FIND_PACKAGE(Python)
FIND_PACKAGE(Python ${PYTHON_VERSION} EXACT COMPONENTS Interpreter Development.Module NumPy)
INCLUDE_DIRECTORIES(BEFORE ${Python_NumPy_INCLUDE_DIR} ${Python_INCLUDE_DIR})
LINK_LIBRARIES(${Python_LIBRARY} Python::NumPy)

MESSAGE(${SRC_files})
FILE(TO_CMAKE_PATH "${CMAKE_SWIG_OUTDIR}" CMAKE_SWIG_OUTDIR)
message(CMAKE_SWIG_OUTDIR="${CMAKE_SWIG_OUTDIR}")
Expand Down
5 changes: 3 additions & 2 deletions src/fsconv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void fconv(double *fit, double *x, double *lamp, int numexp, int start, int stop

// fast convolution AVX
void fconv_avx(double *fit, double *x, double *lamp, int numexp, int start, int stop, double dt) {
#ifdef WITH_AVX
#ifdef __AVX2__
int start1 = std::max(1, start);

// make sure that there are always multiple of 4 in the lifetimes
Expand Down Expand Up @@ -187,7 +187,8 @@ void fconv_per(double *fit, double *x, double *lamp, int numexp, int start, int
// fast convolution, high repetition rate, AVX
void fconv_per_avx(double *fit, double *x, double *lamp, int numexp, int start, int stop,
int n_points, double period, double dt) {
#ifdef WITH_AVX

#ifdef __AVX2__
#if VERBOSE_FIT2X
std::clog << "fconv_per_avx" << std::endl;
std::clog << "-- numexp: " << numexp << std::endl;
Expand Down
5 changes: 3 additions & 2 deletions test/test_fsconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ def test_fconv(self):
np.allclose(model_ref, model_fconv), True
)

# AVX won't be supported on Apple -> M1
if platform != "darwin":
model_fconv_avx = np.zeros_like(irf)
fit2x.fconv_avx(
Expand Down Expand Up @@ -200,7 +199,9 @@ def test_fconv_per(self):
stop=-1,
dt=dt
)
np.testing.assert_allclose(model_fconv_avx, model_fconv_per)
self.assertEqual(
np.allclose(model_fconv_avx, model_fconv_per), True
)

def test_fconv_per_cs(self):
period = 13.0
Expand Down
Loading

0 comments on commit af4afe8

Please sign in to comment.