### Install PopSift with demo apps via vcpkg Source: https://github.com/alicevision/popsift/blob/develop/doc/sphinx/source/install/install.rst Installs PopSift including the demo applications. Add the 'apps' feature to also build the sample programs. ```shell vcpkg install popsift[apps] --triplet ``` -------------------------------- ### Install dependencies on macOS with Homebrew Source: https://github.com/alicevision/popsift/blob/develop/doc/sphinx/source/install/install.rst Installs dependencies on macOS using Homebrew. ```shell brew install git boost devil ``` -------------------------------- ### Install PopSift library with vcpkg Source: https://github.com/alicevision/popsift/blob/develop/doc/sphinx/source/install/install.rst Installs the PopSift library via vcpkg. Replace with the target architecture, e.g., x64-windows or x64-linux-dynamic. ```shell vcpkg install popsift --triplet ``` -------------------------------- ### Install dependencies with vcpkg Source: https://github.com/alicevision/popsift/blob/develop/doc/sphinx/source/install/install.rst Installs all required dependencies via vcpkg. Add the --triplet flag to specify architecture and version, e.g., --triplet x64-windows for dynamic Windows 64-bit builds. ```shell vcpkg install cuda devil boost-system boost-program-options boost-thread boost-filesystem ``` -------------------------------- ### Install dependencies on Ubuntu/Debian Source: https://github.com/alicevision/popsift/blob/develop/doc/sphinx/source/install/install.rst Installs dependencies on Ubuntu/Debian using the apt package manager. ```shell sudo apt-get install g++ git-all libboost-all-dev libdevil-dev ``` -------------------------------- ### Install dependencies on CentOS Source: https://github.com/alicevision/popsift/blob/develop/doc/sphinx/source/install/install.rst Installs dependencies on CentOS using the yum package manager. ```shell sudo yum install gcc-c++ git boost-devel devil ``` -------------------------------- ### Run PopSift Docker image interactively Source: https://github.com/alicevision/popsift/blob/develop/doc/sphinx/source/install/install.rst Run the PopSift Docker image in interactive mode with nvidia-docker. Requires nvidia-docker version 2.0 to be installed. ```shell docker run -it --runtime=nvidia alicevision/popsift:cuda8.0-ubuntu18.04 ``` -------------------------------- ### CMake command line to set PopSift_DIR Source: https://github.com/alicevision/popsift/blob/develop/README.md Pass the location of PopSiftConfig.cmake from the cmake command line to configure your project. Replace with the installation prefix. ```bash cmake .. -DPopSift_DIR=/lib/cmake/PopSift/ ``` -------------------------------- ### CMake find_package and link PopSift Source: https://github.com/alicevision/popsift/blob/develop/doc/sphinx/source/install/install.rst Add PopSift as a dependency in a CMake project. The find_package command locates the installed PopSiftConfig.cmake file, and the target_link_libraries command links the PopSift::PopSift target to an executable. ```cmake find_package(PopSift CONFIG REQUIRED) ... # suppose you want to try it out in a executable add_executable(popsiftTest yourfile.cpp) # add link to the library target_link_libraries(popsiftTest PUBLIC PopSift::PopSift) ``` -------------------------------- ### Build PopSift with CMake Source: https://github.com/alicevision/popsift/blob/develop/README.md Builds the PopSift library by creating a build directory, configuring with CMake, and compiling/installing. Run these commands from the project root. ```shell mkdir build && cd build cmake .. make make install ``` -------------------------------- ### Configure and build PopSift with CMake Source: https://github.com/alicevision/popsift/blob/develop/doc/sphinx/source/install/install.rst Configures and builds PopSift from the root folder. On Windows, add -G "Visual Studio 16 2019" -A x64 to generate the Visual Studio solution. If using vcpkg dependencies, pass -DCMAKE_TOOLCHAIN_FILE=path/to/vcpkg/scripts/buildsystems/vcpkg.cmake. ```shell mkdir build && cd build cmake .. make -j `nproc` ``` -------------------------------- ### Build PopSift Docker image Source: https://github.com/alicevision/popsift/blob/develop/doc/sphinx/source/install/install.rst Build the PopSift Docker image using the Dockerfile, after building the dependency image. ```shell docker build --tag alicevision/popsift:cuda8.0-ubuntu18.04 . ``` -------------------------------- ### Add uninstall target Source: https://github.com/alicevision/popsift/blob/develop/CMakeLists.txt Generates an uninstall script from a template and adds a custom 'uninstall' target that runs it with CMake. ```cmake CONFIGURE_FILE( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake" IMMEDIATE @ONLY) ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake") ``` -------------------------------- ### Build PopSift dependency Docker image Source: https://github.com/alicevision/popsift/blob/develop/doc/sphinx/source/install/install.rst Build the PopSift dependency Docker image with a specific CUDA and Ubuntu version. The CUDA_TAG and OS_TAG build arguments select the versions; defaults are CUDA_TAG=10.2 and OS_TAG=18.04. ```shell docker build --build-arg CUDA_TAG=8.0 --tag alicevision/popsift-deps:cuda8.0-ubuntu18.04 -f Dockerfile_deps . ``` -------------------------------- ### Configure test file path and test scripts Source: https://github.com/alicevision/popsift/blob/develop/CMakeLists.txt Defines a cache variable for the test file directory and, when PopSift_USE_TEST_CMD is enabled, converts a relative path to absolute and adds the testScripts subdirectory. ```cmake set(PopSift_TESTFILE_PATH "popsift-samples/datasets/sample/big_set/" CACHE STRING "Base directory where your test files are stored") if(PopSift_USE_TEST_CMD) if(NOT IS_ABSOLUTE("${PopSift_TESTFILE_PATH}")) get_filename_component(PopSift_TESTFILES "${PopSift_TESTFILE_PATH}" ABSOLUTE) set(PopSift_TESTFILE_PATH "${PopSift_TESTFILES}") endif() add_subdirectory(testScripts) endif() ``` -------------------------------- ### Add src and optional doc subdirectories Source: https://github.com/alicevision/popsift/blob/develop/CMakeLists.txt Adds the src subdirectory and conditionally adds the doc subdirectory when PopSift_BUILD_DOCS is enabled. ```cmake add_subdirectory(src) if(PopSift_BUILD_DOCS) add_subdirectory(doc) endif() ``` -------------------------------- ### CMake command line with PopSift_DIR Source: https://github.com/alicevision/popsift/blob/develop/doc/sphinx/source/install/install.rst Pass the location of PopSiftConfig.cmake to CMake from the command line using the PopSift_DIR variable. ```shell cmake .. -DPopSift_DIR=/lib/cmake/PopSift/ ``` -------------------------------- ### Clone PopSift repository Source: https://github.com/alicevision/popsift/blob/develop/doc/sphinx/source/install/install.rst Clones the PopSift repository from GitHub. ```shell git clone https://github.com/alicevision/PopSift.git ``` -------------------------------- ### CMake find_package and target_link_libraries for PopSift Source: https://github.com/alicevision/popsift/blob/develop/README.md Add this to your CMakeLists.txt to find the PopSift package and link the popsift target to your executable. The package is located in /lib/cmake/PopSift/ and exposes the target PopSift::popsift. ```cmake # Find the package from the PopSiftConfig.cmake # in /lib/cmake/PopSift/. Under the namespace PopSift:: # it exposes the target popsift that allows you to compile # and link with the library find_package(PopSift CONFIG REQUIRED) ... # suppose you want to try it out in a executable add_executable(poptest yourfile.cpp) # add link to the library target_link_libraries(poptest PUBLIC PopSift::popsift) ``` -------------------------------- ### Set PopSift_HAVE_SHFL_DOWN_SYNC based on CUDA version Source: https://github.com/alicevision/popsift/blob/develop/CMakeLists.txt Sets PopSift_HAVE_SHFL_DOWN_SYNC to 1 for CUDA 9.0 and newer, otherwise 0. ```cmake if(CUDA_VERSION VERSION_GREATER_EQUAL "9.0") set(PopSift_HAVE_SHFL_DOWN_SYNC 1) else() set(PopSift_HAVE_SHFL_DOWN_SYNC 0) endif() ``` -------------------------------- ### Configure CUDA toolkit and NVCC flags Source: https://github.com/alicevision/popsift/blob/develop/CMakeLists.txt Detects the CUDA toolkit and configures CUDA compilation flags. Optionally enables error checking after every kernel call via PopSift_ERRCHK_AFTER_KERNEL, sets separable compilation, and forces legacy default stream mode. For CUDA 7.5+, adds NVCC warnings when PopSift_NVCC_WARNINGS is enabled. ```cmake include(CheckLanguage) check_language(CUDA) # Use this if necessary: "cmake -DCUDAToolkit_ROOT=/some/path" # target_link_libraries(binary_linking_to_cudart PRIVATE CUDA::cudart) find_package(CUDAToolkit) message(STATUS "CUDA Version is ${CUDAToolkit_VERSION}") set(CUDA_VERSION ${CUDAToolkit_VERSION}) if(PopSift_ERRCHK_AFTER_KERNEL) message(STATUS "Synchronizing and checking errors after every kernel call") list(APPEND CUDA_NVCC_FLAGS "-DERRCHK_AFTER_KERNEL") endif() # This may not be required any more. set(CMAKE_CUDA_SEPARABLE_COMPILATION ON) # default stream per-thread implies that each host thread has one non-synchronizing 0-stream # currently, the code requires legacy mode list(APPEND CUDA_NVCC_FLAGS "--default-stream;legacy") # set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};--default-stream;per-thread") if(CUDA_VERSION VERSION_GREATER_EQUAL "7.5") if(PopSift_NVCC_WARNINGS) list(APPEND CUDA_NVCC_FLAGS_RELEASE "-Xptxas;-warn-lmem-usage") list(APPEND CUDA_NVCC_FLAGS_RELEASE "-Xptxas;-warn-spills") list(APPEND CUDA_NVCC_FLAGS_RELEASE "-Xptxas;--warn-on-local-memory-usage") list(APPEND CUDA_NVCC_FLAGS_RELEASE "-Xptxas;--warn-on-spills") endif() endif() ``` -------------------------------- ### Require Threads package Source: https://github.com/alicevision/popsift/blob/develop/CMakeLists.txt Requires the Threads package because the project uses std::thread. ```cmake find_package(Threads REQUIRED) ``` -------------------------------- ### Set C++ and CUDA standard Source: https://github.com/alicevision/popsift/blob/develop/CMakeLists.txt Sets the C++ standard to 17 by default, falling back to 11 for CUDA 8 or older. Applies the standard to both CXX and CUDA compilation, and adds the -std flag for non-MSVC compilers. ```cmake set(PopSift_CXX_STANDARD 17) # Thrust/CUB requires C++14 starting with CUDA SDK 11 if(CUDA_VERSION_MAJOR LESS_EQUAL 8) set(PopSift_CXX_STANDARD 11) endif() if(NOT MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++${PopSift_CXX_STANDARD}") list(APPEND CUDA_NVCC_FLAGS "-std=c++${PopSift_CXX_STANDARD}") endif() set(CMAKE_CXX_STANDARD ${PopSift_CXX_STANDARD}) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CUDA_STANDARD ${PopSift_CXX_STANDARD}) set(CMAKE_CUDA_STANDARD_REQUIRED ON) ``` -------------------------------- ### Conditionally disable grid filter Source: https://github.com/alicevision/popsift/blob/develop/CMakeLists.txt Disables grid filter compilation when PopSift_USE_GRID_FILTER is not set, printing a status message and setting DISABLE_GRID_FILTER accordingly. ```cmake if(NOT PopSift_USE_GRID_FILTER) message(STATUS "Disabling grid filter compilation") set(DISABLE_GRID_FILTER 1) else() set(DISABLE_GRID_FILTER 0) endif() ```