diff --git a/.github/workflows/bench_profile_serial.yml b/.github/workflows/bench_profile_serial.yml index 09272e2a..c185a2c9 100644 --- a/.github/workflows/bench_profile_serial.yml +++ b/.github/workflows/bench_profile_serial.yml @@ -24,6 +24,7 @@ jobs: run: | python -m pip install --upgrade pip pip install matplotlib + sudo apt install -y libboost-dev - name: Compile and run benchmark working-directory: ${{ github.workspace }}/benchmark/dataset_size diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index bc3a8db6..49d2e437 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -34,6 +34,7 @@ jobs: python -m pip install scikit-learn python -m pip install pandas python -m pip install matplotlib + sudo apt install -y libboost-dev - name: Compile CLUEstering modules working-directory: ${{github.workspace}} run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 49c56c74..0d2b1391 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,41 +21,17 @@ set(PYBIND11_FINDPYTHON ON) set(PYBIND11_PYTHON_VERSION ">=3.8") add_subdirectory(extern/pybind11) -include(FetchContent) +find_package(Boost 1.75.0 REQUIRED) -find_package(alpaka) -if (NOT alpaka_FOUND) - FetchContent_Declare( - alpaka - GIT_REPOSITORY https://github.com/alpaka-group/alpaka.git - GIT_TAG develop - ) - - FetchContent_GetProperties(alpaka) - if(NOT alpaka_POPULATED) - FetchContent_Populate(alpaka) - endif() - set(alpaka_PATH ./build/_deps/alpaka-src/include) -else() - set(alpaka_PATH ${alpaka_INCLUDE_DIRS}) -endif() +include(FetchContent) -find_package(Boost 1.75.0) -# if boost is not found, it's fetched from the official boost repository -if(NOT Boost_FOUND) - FetchContent_Declare( - boost - URL https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz - ) - - FetchContent_GetProperties(boost) - if(NOT boost_POPULATED) - FetchContent_Populate(boost) - endif() - set(Boost_PATH ./build/_deps/boost-src) -else() - set(Boost_PATH ${Boost_INCLUDE_DIRS}) -endif() +FetchContent_Declare( + alpaka + GIT_REPOSITORY https://github.com/alpaka-group/alpaka.git + GIT_TAG develop + GIT_SHALLOW TRUE + FIND_PACKAGE_ARGS) +FetchContent_MakeAvailable(alpaka) if(NOT DEFINED CPU_ONLY) set(CPU_ONLY OFF) @@ -70,10 +46,9 @@ execute_process(COMMAND mkdir -p ./CLUEstering/lib) # Convolutional Kernels compile convolutional kernel module pybind11_add_module(CLUE_Convolutional_Kernels SHARED ./CLUEstering/alpaka/BindingModules/binding_kernels.cc) -target_include_directories(CLUE_Convolutional_Kernels PRIVATE ${alpaka_PATH}) -# link boost -target_link_libraries(CLUE_Convolutional_Kernels PRIVATE ${Boost_LIBRARIES}) -target_include_directories(CLUE_Convolutional_Kernels PRIVATE ${Boost_PATH}) +target_include_directories( + CLUE_Convolutional_Kernels PRIVATE ${alpaka_SOURCE_DIR}/include + ${Boost_SOURCE_DIR}) # alpaka build flags target_compile_options( CLUE_Convolutional_Kernels @@ -95,10 +70,8 @@ endforeach() # CPU Serial compile cpu serial module pybind11_add_module(CLUE_CPU_Serial SHARED ./CLUEstering/alpaka/BindingModules/binding_cpu.cc) -target_include_directories(CLUE_CPU_Serial PRIVATE ${alpaka_PATH}) -# link boost -target_link_libraries(CLUE_CPU_Serial PRIVATE ${Boost_LIBRARIES}) -target_include_directories(CLUE_CPU_Serial PRIVATE ${Boost_PATH}) +target_include_directories(CLUE_CPU_Serial PRIVATE ${alpaka_SOURCE_DIR}/include + ${Boost_SOURCE_DIR}) # alpaka build flags target_compile_options( CLUE_CPU_Serial @@ -123,9 +96,8 @@ if(NOT ${SERIAL_ONLY}) # compile cpu tbb module pybind11_add_module(CLUE_CPU_TBB SHARED ./CLUEstering/alpaka/BindingModules/binding_cpu_tbb.cc) - target_include_directories(CLUE_CPU_TBB PRIVATE ${alpaka_PATH}) - target_link_libraries(CLUE_CPU_TBB PRIVATE ${Boost_LIBRARIES}) - target_include_directories(CLUE_CPU_TBB PRIVATE ${Boost_PATH}) + target_include_directories(CLUE_CPU_TBB PRIVATE ${alpaka_SOURCE_DIR}/include + ${Boost_SOURCE_DIR}) target_compile_options( CLUE_CPU_TBB PRIVATE -ltbb -DALPAKA_ACC_CPU_B_TBB_T_SEQ_PRESENT @@ -167,10 +139,8 @@ if((NOT ${CPU_ONLY}) AND (NOT ${SERIAL_ONLY})) # compile gpu cuda module pybind11_add_module(CLUE_GPU_CUDA SHARED ./CLUEstering/alpaka/BindingModules/binding_gpu_cuda.cc) - target_include_directories(CLUE_GPU_CUDA PRIVATE ${alpaka_PATH}) - # link boost - target_link_libraries(CLUE_GPU_CUDA PRIVATE ${Boost_LIBRARIES}) - target_include_directories(CLUE_GPU_CUDA PRIVATE ${Boost_PATH}) + target_include_directories( + CLUE_GPU_CUDA PRIVATE ${alpaka_SOURCE_DIR}/include ${Boost_SOURCE_DIR}) # set the cuda architectures set_target_properties(CLUE_GPU_CUDA PROPERTIES CUDA_ARCHITECTURES "50;60;61;62;70") @@ -210,10 +180,8 @@ if((NOT ${CPU_ONLY}) AND (NOT ${SERIAL_ONLY})) # compile gpu hip module pybind11_add_module(CLUE_GPU_HIP SHARED ./CLUEstering/alpaka/BindingModules/binding_gpu_hip.cc) - target_include_directories(CLUE_GPU_HIP PRIVATE ${alpaka_PATH}) - # link boost - target_link_libraries(CLUE_GPU_HIP PRIVATE ${Boost_LIBRARIES}) - target_include_directories(CLUE_GPU_HIP PRIVATE ${Boost_PATH}) + target_include_directories(CLUE_GPU_HIP PRIVATE ${alpaka_SOURCE_DIR}/include + ${Boost_SOURCE_DIR}) # alpaka build flags target_compile_options( CLUE_GPU_HIP diff --git a/README.md b/README.md index ea28c605..3f33208a 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,10 @@ clust.cluster_plotter()

## Installation +### Dependencies +The main dependencies of CLUEstering are [Boost](https://www.boost.org/) (version 1.75.0+) and [Alpaka](https://github.com/alpaka-group/alpaka). +If alpaka is not found, it will be automatically fetched from the official repository, so it's not mandatory to install it manually. + ### From source To install the library, first clone the repository recursively: ```shell diff --git a/setup.py b/setup.py index ffdca2dc..8be0db32 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup import subprocess -__version__ = "2.2.12" +__version__ = "2.3.0" this_directory = Path(__file__).parent long_description = (this_directory/'README.md').read_text()