Skip to content

Commit

Permalink
Merge pull request #4 from Fluorescence-Tools/develop
Browse files Browse the repository at this point in the history
Add option to disable AVX support
  • Loading branch information
tpeulen authored Feb 3, 2024
2 parents d8f7dae + 011f60c commit 76001b0
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/conda-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build Conda Recipe
on:
push:
branches:
- development # You can change this to the branch you want to trigger on
- develop # You can change this to the branch you want to trigger on

jobs:
build-linux:
Expand All @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.8", "3.11"]
python-version: ["3.8", "3.10"]
steps:
- name: Checkout Repository
uses: actions/checkout@v2
Expand Down
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)

imp_build_module(${CMAKE_SOURCE_DIR} bff)

# # libmongoc
# ###########################
# FIND_PACKAGE (mongoc-1.0 1.7 REQUIRED)
# LINK_LIBRARIES (mongo::mongoc_shared)

else()
INCLUDE(ModuleBuild.cmake)
endif()
Expand Down
45 changes: 26 additions & 19 deletions Setup.cmake
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
# SIMD
###########################
IF(NOT APPLE)
IF(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/dependency)
INCLUDE(simd)
IF(${AVX_FOUND})
MESSAGE("BUILD WITH SIMD")
ADD_DEFINITIONS(-DWITH_AVX)
IF (MSVC)
# https://devblogs.microsoft.com/cppblog/simd-extension-to-c-openmp-in-visual-studio/
# /Oi is for intrinsics
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX /Oi")
ELSE(MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx -mfma")
ENDIF (MSVC)
ELSE(${AVX_FOUND})
UNSET(WITH_AVX)
ENDIF(${AVX_FOUND})
ENDIF()
ENDIF()

option(WITH_AVX "Enable AVX support" OFF)

if (WITH_AVX AND NOT APPLE AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/dependency)
include(simd)

if (${AVX_FOUND})
message("BUILD WITH SIMD")
add_definitions(-DWITH_AVX)

if (MSVC)
# https://devblogs.microsoft.com/cppblog/simd-extension-to-c-openmp-in-visual-studio/
# /Oi is for intrinsics
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX /Oi")
else (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx -mfma")
endif (MSVC)
else (${AVX_FOUND})
unset(WITH_AVX)
endif (${AVX_FOUND})
else ()
# AVX only on x86_64 and not on Apple
message("BUILD WITHOUT SIMD")
unset(WITH_AVX)
endif()
1 change: 1 addition & 0 deletions conda-recipe/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ cmake -G Ninja .. ^
-DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^
-DCMAKE_INSTALL_LIBDIR=bin ^
-DCMAKE_INSTALL_PYTHONDIR="%SP_DIR%" ^
-DWITH_AVX=OFF ^
-DCMAKE_CXX_FLAGS="/DBOOST_ALL_DYN_LINK /EHsc /DWIN32 /DMSMPI_NO_DEPRECATE_20 /bigobj /DBOOST_ZLIB_BINARY=kernel32"

if errorlevel 1 exit 1
Expand Down
2 changes: 1 addition & 1 deletion conda-recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -G Ninja -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_INSTALL_PREFIX=$PREFIX
cmake .. -DCMAKE_BUILD_TYPE=Release -G Ninja -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_INSTALL_PREFIX=$PREFIX -DWITH_AVX=OFF
ninja install -k 0 -j 4

# Copy examples
Expand Down
3 changes: 1 addition & 2 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set version = "0.14.2" %}
{% set version = "0.14.3" %}

package:
name: imp.bff
Expand Down Expand Up @@ -38,7 +38,6 @@ requirements:
- python
- {{ pin_compatible('imp', max_pin='x.x') }}
- boost-cpp
# - libmongoc
- pandas
- mdtraj
- tqdm
Expand Down

0 comments on commit 76001b0

Please sign in to comment.