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

Merge into master #17

Closed
wants to merge 125 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
c968a42
added multipler for normalization to Config and CLI
Aug 16, 2016
e30b9d1
add default constructor to PopSift class
Aug 16, 2016
8729d3e
allow reconfiguration
Aug 16, 2016
14f68ef
configure is blocked by an initialized pipe
Aug 16, 2016
25f069a
[cmake] unused definition WITH_CUDA
simogasp Sep 30, 2016
f2d96aa
[cmake] simplified if for cuda detection
simogasp Sep 30, 2016
669a1d2
[cmake] add project version
simogasp Oct 1, 2016
9c15d7a
[cmake] using target_include_directories
simogasp Oct 1, 2016
323ed40
[cmake] header not needed for executable
simogasp Oct 1, 2016
bf7c5df
[cmake] added configuration files and install rules
simogasp Oct 1, 2016
e54fc35
[cmake] just formatting
simogasp Oct 1, 2016
22ffee3
[cmake] allow debug
simogasp Oct 1, 2016
7dcc22f
[doc] update readme
simogasp Oct 1, 2016
72606e3
[cmake] add doc to config.cmake
simogasp Oct 1, 2016
e335c85
[cmake] fix
simogasp Oct 1, 2016
b779429
[cmake] make install in travis #13
simogasp Oct 1, 2016
4f0b200
[cmake] separate project for application
simogasp Oct 2, 2016
23977ef
[CI] make travis build application with PopSift as 3rd party
simogasp Oct 2, 2016
03fcd91
Merge pull request #14 from poparteu/modernCmake
Oct 10, 2016
24056bf
avoid duplication of configure code
fcastan Nov 3, 2016
e477c89
Merge pull request #10 from poparteu/normalization_multiplier
fabiencastan Nov 4, 2016
19a47ae
create popart-demo in build root, new cmake style
Nov 30, 2016
fb7af5c
add an uninstall rule
Nov 30, 2016
1a8085b
bad template parameter name
Oct 24, 2016
6c78210
fix bad comment
Oct 24, 2016
5f6c58e
[cmake] fix nvcc error nothing to do with ""
simogasp Jan 19, 2017
f278f9b
Fix README.md with poparteu --> alicevision for travis
simogasp Jan 19, 2017
b542c72
Win port: aligned memory allocation and error reporting.
Jan 20, 2017
f9b8bd8
Include <algorithm>, qualify std::min.
Jan 20, 2017
d38f866
Teach windows about stat and mkdir.
Jan 20, 2017
14a8874
Missing includes. Must use iso646.h for not, and, ...
Jan 20, 2017
21bbb40
Removed unused include.
Jan 20, 2017
6c6b9de
Use boost::program_options instead of getopt().
Jan 20, 2017
ec953d7
Boost linking fix.
Jan 20, 2017
2750151
Use boost::program_options instead getopt().
Jan 20, 2017
eab5466
Bugfix: add 1 to vector size.
Jan 20, 2017
0031fe2
Add boost::po dependency for CI.
Jan 20, 2017
8c67a5d
Turn on C++11 support for popsift-demo.
Jan 20, 2017
8b293ae
Bugfix in handling of bool_switch arguments.
Jan 20, 2017
9a4d1af
bugfix: cudadevicesynchronize must be called after oct_obj.readExtrem…
Skarseth Jan 20, 2017
7f5393b
Use binary IO.
Jan 19, 2017
eafeca0
Merge pull request #18 from alicevision/win_port
fabiencastan Jan 26, 2017
be05584
Merge pull request #16 from alicevision/fixNvccError
fabiencastan Jan 26, 2017
51c8fe0
[app] let command line crash more gently showing error and usage
simogasp Feb 14, 2017
a8ad62d
Merge pull request #20 from alicevision/simogasp-patch-1
fabiencastan Feb 15, 2017
c8d6fb8
[ci] remove useless variable
simogasp Mar 16, 2017
fb56ded
[ci] added matrix with 7.{0,5} and 8.0
simogasp Mar 16, 2017
90e1132
fixup! Fix README.md with poparteu --> alicevision for travis
simogasp Mar 16, 2017
c7f6378
[cmake] boost is required only for samples
simogasp Mar 16, 2017
54f8df9
[cmake] option to enable/disable build examples
simogasp Mar 16, 2017
76f9b4b
[doc] updated README with latest changes
simogasp Mar 16, 2017
f56a651
Merge pull request #21 from alicevision/testCuda8
fabiencastan Mar 16, 2017
d78b3ee
Support asynchronous SIFT extraction
simogasp Mar 16, 2017
285e9fa
[cmake] fix to avoid nvcc complaining about ""
simogasp Mar 18, 2017
d12dad3
[ci] added required libboost-thread-dev
simogasp Mar 18, 2017
76b4f92
[ci] test with boost1.55
simogasp Mar 18, 2017
282df12
[cmake] fix optional make for example
Mar 19, 2017
62b5073
[cuda] powf instead of pow for cuda 7
Mar 19, 2017
fd7785a
improve backware compatibility
Mar 19, 2017
03115ad
updated README
Mar 19, 2017
ad5a748
add deprecated synchronous api
Mar 19, 2017
56e336e
Merge pull request #23 from alicevision/develop-vartest-bc
Mar 19, 2017
02f3f13
improved cmakes and readme
Mar 19, 2017
36c6f85
Merge pull request #22 from alicevision/develop-vartest
Mar 20, 2017
f7a8f06
reduced multiplication cost in Gauss filtering
Mar 20, 2017
51cd5f5
[cosmetic] updated defaults
Mar 23, 2017
6f33298
Merge pull request #24 from alicevision/relative-gauss
Apr 4, 2017
5d7ba75
ignoring profiler config
Apr 12, 2017
e99d547
[cuda] fixed a compilation error on pow(), required explicit type
simogasp May 4, 2017
fcf91dd
Merge pull request #25 from alicevision/powFix
fabiencastan May 12, 2017
9ec6795
[cmake] fix found DevIL
simogasp May 13, 2017
9753803
Merge pull request #26 from alicevision/findDevIL_bug
fabiencastan May 13, 2017
365351a
bug fix on Features iterator
fcastan May 26, 2017
d70578e
[cmake] cuda is required
fcastan May 26, 2017
6737242
[cmake] add option PopSift_USE_POSITION_INDEPENDENT_CODE
fcastan May 26, 2017
a7f75be
avoid methods without namespace
fcastan May 26, 2017
6d09ef6
Merge pull request #27 from alicevision/bugfix_iterator
fabiencastan May 26, 2017
791eb0b
[ci] fix env variables POPSIFT_APP_BUILD
simogasp Oct 31, 2017
169167b
Merge pull request #29 from alicevision/fixCI
Oct 31, 2017
998ccd1
[test] collection of some test scripts
Apr 4, 2017
bc83309
[feature] First steps to Grid filtering
Apr 4, 2017
ab65b2b
[feature] Grid filtering for CUDA 8 and newer
Sep 7, 2017
f10eb31
[test] fix typo in test script
Sep 7, 2017
6f65b63
[bugfix] per-layer extrema memory alloc too small
lcalvet Oct 17, 2017
fdd002e
[bugfix] linear tex in DOG is a bad choice
lcalvet Oct 18, 2017
e40e0bf
[bugfix] ellipse shape bad in writing descriptor to disk
lcalvet Oct 18, 2017
a7bdb01
[bugfix] finding peak in orientation histogram
lcalvet Oct 18, 2017
dabe350
[feature] choose between pgmread and DevIL loading
lcalvet Oct 18, 2017
cbd43db
isolate Feature(s) class, prepare new functionality
lcalvet Oct 19, 2017
ab19f54
[feature] brute-force matching with test program
lcalvet Oct 19, 2017
7b4a94d
increase max extrema per level for 4k frame
lcalvet Oct 19, 2017
4929f9a
[perf] make DoG speedup by 2
lcalvet Oct 19, 2017
8bb6c40
forward looping in make_dog start
lcalvet Oct 19, 2017
f1052aa
[debug] nvtx host reporting for extraction chain
Oct 31, 2017
8c5886f
rename Features classes
Nov 9, 2017
212103a
Apple-specific flags for C++ std 11
Nov 9, 2017
6e418b6
make std c++ flag unconditional again
Nov 9, 2017
2178992
Merge pull request #30 from alicevision/extremum-filter-grid-2
Nov 9, 2017
f11fbe0
[cmake] add more compute capabilities
Nov 15, 2017
f947957
[cosmetic] Gauss filter debug output
Nov 15, 2017
3df70c2
[cosmetic] wrap linear textures into a struct
Nov 15, 2017
4810bd0
[perf] switch to layered intermediate planes
Nov 15, 2017
6698ee8
moved thrust-based filter grid into own file
Nov 16, 2017
b00ec79
[bugfix] use correct intermediate level (layer)
Nov 16, 2017
a0eca45
[debug] introduce macro POP_SYNC_CHK, ccmake-controlled
Nov 16, 2017
e5486c8
[debug] cmake option to disable grid filtering (reduce compile time d…
Nov 17, 2017
550a0e6
[app] new command line for gauss filter mode
Nov 17, 2017
a24e46d
all Gauss filter tables get interpolated alternative
Nov 17, 2017
bbeceeb
[cosmetic] better namespace name for normalized sources
Nov 17, 2017
f65738e
rebuild normalizedInterpolated horizontal Gaussian
Nov 17, 2017
647b966
gauss filtering all levels in octave 0 directly from input image
Nov 17, 2017
af9b06b
intermediate stage for octave 0 gauss filter direct from input image
Nov 17, 2017
aa22b18
horizontal/vertical all from input file in octave 0 works - but is slow
Nov 17, 2017
d3256d5
[bugfix] rename cmake condition for nvtx
Nov 20, 2017
f9301c7
re-introducing gaussian elimination in an ifdef
Nov 23, 2017
522ade0
new implementation of notile descriptor extraction
Dec 1, 2017
322b4e9
[bugfix] dog surface bug
Dec 6, 2017
231724c
[tuning] remove useless clause + kernel configs
Dec 6, 2017
d19b434
[app] add pgm P3 to pgmread
Dec 7, 2017
c71799d
[algo] Changed default normalization to RootSift
Dec 7, 2017
29a2da3
[feature] config for descriptor normalization mode changed
Dec 8, 2017
a3028b1
[feature] support float input images
Dec 11, 2017
b7127c0
cuda version condition
Dec 11, 2017
e658ced
cmake selection of CUDA CC subset
Jan 10, 2018
d8700a1
Merge pull request #32 from alicevision/multigauss
fabiencastan Jan 29, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ popsift/playground/try-libav
*.out
*.app

# Support files
*.nvvp

# Temporary files
.DS_Store

39 changes: 27 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,28 @@ cache:
addons:
apt:
packages:
- libboost-filesystem-dev
- libboost-system-dev
- libboost-filesystem1.55-dev
- libboost-system1.55-dev
- libboost-program-options1.55-dev
- libboost-thread1.55-dev

env:
matrix:
- CUDA_VERSION_MAJOR="7" CUDA_VERSION_MINOR="0" CUDA_PKG_LONGVERSION="${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}-28" CUDA_PKG_VERSION="${CUDA_VERSION_MAJOR}-${CUDA_VERSION_MINOR}"
- CUDA_VERSION_MAJOR="7" CUDA_VERSION_MINOR="5" CUDA_PKG_LONGVERSION="${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}-18" CUDA_PKG_VERSION="${CUDA_VERSION_MAJOR}-${CUDA_VERSION_MINOR}"
- CUDA_VERSION_MAJOR="8" CUDA_VERSION_MINOR="0" CUDA_PKG_LONGVERSION="${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}.61-1" CUDA_PKG_VERSION="${CUDA_VERSION_MAJOR}-${CUDA_VERSION_MINOR}"

global:
- NUM_CPU="`grep processor /proc/cpuinfo | wc -l`"; echo $NUM_CPU
- BUILD_TYPE="RELEASE"
- BUILD_SYSTEM="`uname -s`"
- BUILD_PROCESSOR="`uname -p`"
- POPSIFT_SOURCE=${TRAVIS_BUILD_DIR}
- POPSIFT_BUILD=${TRAVIS_BUILD_DIR}/build
- POPSIFT_INSTALL=${POPSIFT_BUILD}/install
- POPSIFT_APP_SRC=${POPSIFT_SOURCE}/src/application
- POPSIFT_APP_BUILD=${POPSIFT_APP_SRC}/build
- POPSIFT_APP_INSTALL=${POPSIFT_APP_BUILD}/install
# CMAKE
# - CMAKE_URL="https://cmake.org/files/v3.6/cmake-3.6.1-Linux-x86_64.tar.gz"
- CMAKE_URL="https://cmake.org/files/v3.4/cmake-3.4.1-Linux-x86_64.tar.gz"
Expand All @@ -46,30 +57,34 @@ before_install:
fi

install:
- CUDA_REPO_PKG=cuda-repo-ubuntu1404_7.5-18_amd64.deb
- CUDA_REPO_PKG=cuda-repo-ubuntu1404_${CUDA_PKG_LONGVERSION}_amd64.deb
- wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/$CUDA_REPO_PKG
- sudo dpkg -i $CUDA_REPO_PKG
- rm $CUDA_REPO_PKG
- rm ${CUDA_REPO_PKG}
- sudo apt-get -y update
- CUDA_PKG_VERSION="7-5"
- CUDA_VERSION="7.5"
- sudo apt-get install -y --no-install-recommends cuda-core-$CUDA_PKG_VERSION cuda-cudart-dev-$CUDA_PKG_VERSION cuda-cublas-dev-$CUDA_PKG_VERSION cuda-curand-dev-$CUDA_PKG_VERSION
- sudo ln -s /usr/local/cuda-$CUDA_VERSION /usr/local/cuda
- sudo ln -s /usr/local/cuda-${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR} /usr/local/cuda

before_script:
# Create build folder
- mkdir $POPSIFT_BUILD
- cd $POPSIFT_BUILD
- mkdir -p ${POPSIFT_BUILD}
- cd ${POPSIFT_BUILD}
# Classic release build
- >
cmake . $POPSIFT_SOURCE
cmake . ${POPSIFT_SOURCE} -DCMAKE_INSTALL_PREFIX=${POPSIFT_INSTALL}

script:
# limit GCC builds to a reduced number of thread for the virtual machine
- make -j 2 VERBOSE=1
- make install -j 2 VERBOSE=1
# Perform unit tests
# - make test
# Perform tests building application with PopSift as 3rd party
- cd ${POPSIFT_APP_SRC}
- mkdir -p ${POPSIFT_APP_BUILD}
- cd ${POPSIFT_APP_BUILD}
- cmake .. -DPopSift_DIR=${POPSIFT_INSTALL}/lib/cmake/PopSift/ -DCMAKE_INSTALL_PREFIX=${POPSIFT_APP_INSTALL}
- make install -j 2 VERBOSE=1

cache:
directories:
- $CMAKE_INSTALL
- ${CMAKE_INSTALL}
191 changes: 138 additions & 53 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,61 +1,146 @@
# CMake below 3.4 does not work with CUDA separable compilation at all
CMAKE_MINIMUM_REQUIRED(VERSION 3.4)
cmake_minimum_required(VERSION 3.4)

PROJECT( PopSift )
project(PopSift VERSION 1.0.0)

OPTION(PopSift_BUILD_EXAMPLES "Build PopSift applications." ON)
OPTION(PopSift_USE_NVTX_PROFILING "Use CUDA NVTX for profiling." OFF)
OPTION(PopSift_ERRCHK_AFTER_KERNEL "Synchronize and check CUDA error after every kernel." OFF)
OPTION(PopSift_USE_POSITION_INDEPENDENT_CODE "Generate position independent code." ON)
OPTION(PopSift_USE_GRID_FILTER "Switch off grid filtering to massively reduce compile time while debugging other things." ON)

if(PopSift_USE_POSITION_INDEPENDENT_CODE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")

set(CMAKE_BUILD_TYPE Release) # Debug, Release

set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_DEBUG} -O3")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_DEBUG} -O3")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DGRIFF_DEBUG")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DGRIFF_DEBUG")

find_package(Boost 1.53.0 REQUIRED COMPONENTS system filesystem)

if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
# link_directories(${Boost_LIB_DIR})
add_definitions(${Boost_DEFINITIONS})
message( STATUS "Found BOOST: ${Boost_LIBRARIES}" )
else(Boost_FOUND)
message( FATAL_ERROR "Boost not found" )
endif(Boost_FOUND)

find_package(CUDA 7.0)

IF(CUDA_FOUND)
SET(CUDA_SEPARABLE_COMPILATION ON)
include_directories(${CUDA_INCLUDE_DIRS})
add_definitions("-DWITH_CUDA")
set(CUDA_NVCC_FLAGS_DEBUG "${CUDA_NVCC_FLAGS_DEBUG};-G;-g")
set(CUDA_NVCC_FLAGS_RELEASE "${CUDA_NVCC_FLAGS_RELEASE};-O3")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-gencode;arch=compute_30,code=sm_30")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-gencode;arch=compute_35,code=sm_35")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-gencode;arch=compute_50,code=sm_50")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-gencode;arch=compute_52,code=sm_52")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-gencode;arch=compute_52,code=compute_52")
# default stream legacy implies that the 0 stream synchronizes all streams
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};--default-stream;legacy")
# default stream per-thread implies that each host thread has one non-synchronizing 0-stream
# set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};--default-stream;per-thread")
# print local memory usage per kernel: -Xptxas;-v
# CUDA >= 7.5: -Xptxas;--warn-on-local-memory-usage;-Xptxas;--warn-on-spills
message(STATUS "CUDA Version is ${CUDA_VERSION}")
if(CUDA_VERSION>=7.5)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-Xptxas;--warn-on-local-memory-usage")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-Xptxas;--warn-on-spills")
else(CUDA_VERSION>=7.5)
endif(CUDA_VERSION>=7.5)

# library required for CUDA dynamic parallelism, forgotten by CMake 3.4
cuda_find_library_local_first(CUDA_CUDADEVRT_LIBRARY cudadevrt "\"cudadevrt\" library")

include_directories("${CMAKE_SOURCE_DIR}/popsift/Cuda-7.0-cub")
ELSE(CUDA_FOUND)
message( FATAL_ERROR "Could not find CUDA >= 7.0" )
ENDIF(CUDA_FOUND)
# set(CMAKE_BUILD_TYPE Debug)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
message(STATUS "Build type not set, building in Release configuration")
else()
message(STATUS "Building in ${CMAKE_BUILD_TYPE} configuration")
endif()

set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -G")
# set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -G")

find_package(Boost 1.53.0 REQUIRED COMPONENTS system thread)
if(WIN32)
add_definitions("-DBOOST_ALL_NO_LIB")
link_directories(Boost_LIBRARRY_DIR_DEBUG)
link_directories(Boost_LIBRARRY_DIR_RELEASE)
endif(WIN32)

find_package(CUDA 7.0 REQUIRED)

if(NOT CUDA_FOUND)
message(FATAL_ERROR "Could not find CUDA >= 7.0")
endif()

#
# Default setting of the CUDA CC versions to compile.
# Shortening the lists saves a lot of compile time.
#
if(CUDA_VERSION_MAJOR GREATER 7)
set(PopSift_CUDA_CC_LIST_BASIC 30 35 50 52 60 61 62)
else(CUDA_VERSION_MAJOR GREATER 7)
set(PopSift_CUDA_CC_LIST_BASIC 30 35 50 52 )
endif(CUDA_VERSION_MAJOR GREATER 7)
set(PopSift_CUDA_CC_LIST ${PopSift_CUDA_CC_LIST_BASIC} CACHE STRING "CUDA CC versions to compile")

if(PopSift_USE_NVTX_PROFILING)
message(STATUS "PROFILING CPU CODE: NVTX is in use")
endif(PopSift_USE_NVTX_PROFILING)

if(PopSift_ERRCHK_AFTER_KERNEL)
message(STATUS "Synchronizing and checking errors after every kernel call")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-DERRCHK_AFTER_KERNEL")
endif(PopSift_ERRCHK_AFTER_KERNEL)

set(CUDA_SEPARABLE_COMPILATION ON)

if(UNIX AND NOT APPLE)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-Xcompiler;-rdynamic;-lineinfo")
# set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-Xptxas;-v")
# set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-Xptxas;-warn-double-usage")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};--keep")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};--source-in-ptx")
endif(UNIX AND NOT APPLE)

# The following if should not be necessary, but apparently there is a bug in FindCUDA.cmake that
# generate an empty string in the nvcc command line causing the compilation to fail.
# see https://gitlab.kitware.com/cmake/cmake/issues/16411
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Building in debug mode")
set(CUDA_NVCC_FLAGS_DEBUG "${CUDA_NVCC_FLAGS_DEBUG};-G")
endif()
set(CUDA_NVCC_FLAGS_RELEASE "${CUDA_NVCC_FLAGS_RELEASE};-O3")

if(PopSift_USE_POSITION_INDEPENDENT_CODE)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-Xcompiler;-fPIC")
endif()

#
# Add all requested CUDA CCs to the command line for offline compilation
#
list(SORT PopSift_CUDA_CC_LIST)
foreach(PopSift_CC_VERSION ${PopSift_CUDA_CC_LIST})
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-gencode;arch=compute_${PopSift_CC_VERSION},code=sm_${PopSift_CC_VERSION}")
endforeach(PopSift_CC_VERSION)

#
# Use the highest request CUDA CC for CUDA JIT compilation
#
list(LENGTH PopSift_CUDA_CC_LIST PopSift_CC_LIST_LEN)
MATH(EXPR PopSift_CC_LIST_LEN "${PopSift_CC_LIST_LEN}-1")
list(GET PopSift_CUDA_CC_LIST ${PopSift_CC_LIST_LEN} PopSift_CUDA_CC_LIST_LAST)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-gencode;arch=compute_${PopSift_CUDA_CC_LIST_LAST},code=compute_${PopSift_CUDA_CC_LIST_LAST}")

# default stream legacy implies that the 0 stream synchronizes all streams
# default stream per-thread implies that each host thread has one non-synchronizing 0-stream
# currently, the code requires legacy mode
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};--default-stream;legacy")
# set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};--default-stream;per-thread")

message(STATUS "CUDA Version is ${CUDA_VERSION}")
message(STATUS "Compiling for CUDA CCs: ${PopSift_CUDA_CC_LIST}")
if(CUDA_VERSION>=7.5)
set(CUDA_NVCC_FLAGS_RELEASE "${CUDA_NVCC_FLAGS_RELEASE};-Xptxas;-warn-lmem-usage")
set(CUDA_NVCC_FLAGS_RELEASE "${CUDA_NVCC_FLAGS_RELEASE};-Xptxas;-warn-spills")
set(CUDA_NVCC_FLAGS_RELEASE "${CUDA_NVCC_FLAGS_RELEASE};-Xptxas;--warn-on-local-memory-usage")
set(CUDA_NVCC_FLAGS_RELEASE "${CUDA_NVCC_FLAGS_RELEASE};-Xptxas;--warn-on-spills")
else(CUDA_VERSION>=7.5)
endif(CUDA_VERSION>=7.5)

# library required for CUDA dynamic parallelism, forgotten by CMake 3.4
cuda_find_library_local_first(CUDA_CUDADEVRT_LIBRARY cudadevrt "\"cudadevrt\" library")

if(PopSift_USE_NVTX_PROFILING)
# library required for NVTX profiling of the CPU
cuda_find_library_local_first(CUDA_NVTX_LIBRARY nvToolsExt "NVTX library")
add_definitions(-DUSE_NVTX)
endif(PopSift_USE_NVTX_PROFILING)

if(NOT PopSift_USE_GRID_FILTER)
message(STATUS "Disabling grid filter compilation")
add_definitions(-DDISABLE_GRID_FILTER)
endif(NOT PopSift_USE_GRID_FILTER)

add_subdirectory(src)

########### Add uninstall target ###############
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")

54 changes: 48 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@

PopSift
=======

PopSift is an implementation of the SIFT algorithm in CUDA.
PopSift tries to stick as closely as possible to David Lowe's famous paper (Lowe, D. G. (2004). Distinctive Image Features from Scale-Invariant Keypoints. International Journal of Computer Vision, 60(2), 91–110. doi:10.1023/B:VISI.0000029664.99615.94), while extracting features from an image in real-time at least on an NVidia GTX 980 Ti GPU.


Build
-----

PopSift has been developed and tested on Linux machines, mostly a variant of Ubuntu, but compiles on MacOSX as well. It comes as a CMake project and requires at least CUDA 7.0. It is known to compile and work with NVidia cards of compute capability 3.0 (including the GT 650M), but the code is developed with the compute capability 5.2 card GTX 980 Ti in mind.
PopSift requires boost to compile the test application.
PopSift has been developed and tested on Linux machines, mostly a variant of Ubuntu, but compiles on MacOSX as well. It comes as a CMake project and requires at least CUDA 7.0 and Boost >= 1.55. It is known to compile and work with NVidia cards of compute capability 3.0 (including the GT 650M), but the code is developed with the compute capability 5.2 card GTX 980 Ti in mind.

If you want to avoid building the application you can run cmake with the option `-DPopSift_BUILD_EXAMPLES:BOOL=OFF`.

In order to build the library you can run:

```
mkdir build && cd build
Expand All @@ -18,24 +23,61 @@ make install
```

Continuous integration:
- [![Build Status](https://travis-ci.org/poparteu/popsift.svg?branch=master)](https://travis-ci.org/poparteu/popsift) master branch.
- [![Build Status](https://travis-ci.org/poparteu/popsift.svg?branch=develop)](https://travis-ci.org/poparteu/popsift) develop branch.
- [![Build Status](https://travis-ci.org/alicevision/popsift.svg?branch=master)](https://travis-ci.org/alicevision/popsift) master branch.
- [![Build Status](https://travis-ci.org/alicevision/popsift.svg?branch=develop)](https://travis-ci.org/alicevision/popsift) develop branch.



Usage
-----

Two artifacts are made: libpopsift and the test application popsift-demo. Calling popsift-demo without parameters shows an option.
Two artifacts are made: `libpopsift` and the test application `popsift-demo`. Calling popsift-demo without parameters shows the options.

To integrate PopSift into other software, link with libpopsift. The caller must create a popart::Config struct (documented in src/sift/sift_conf.h) to control the behaviour of the PopSift, and instantiate an object of class PopSift (found in src/sift/popsift.h). After creating an instance, it must be configured to the constant width and height of the input image (init()). After that, it can be fed a one image at a time (execute()). The only valid input format is a single plane of grayscale unsigned characters. The execute() function returns a pointer to an object of type Features that must be deleted by the caller after use. Features offer iterators that iterate over objects of type Feature. Both classes are documented in sift_extremum.h. Each feature represents a feature point in the coordinate system of the input image, providing X and Y coordinates and scale (sigma), as well as several alternative descriptors for the feature point (according to Lowe, 15% of the feature points should be expected to have 2 or more descriptors).
### Using PopSift as third party

To integrate PopSift into other software, link with `libpopsift`. If your are using CMake for building your project you can easily add PopSift to your project. Once you have built and installed PopSift in a directory (say, `<prefix>`), in your `CMakeLists.txt` file just add the dependency

```cmake
# Find the package from the PopSiftConfig.cmake
# in <prefix>/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)
```

Then, in order to build just pass the location of `PopSiftConfig.cmake` from the cmake command line:

```bash
cmake .. -DPopSift_DIR=<prefix>/lib/cmake/PopSift/
```



### Calling the API

The caller must create a `popart::Config` struct (documented in `src/sift/sift_conf.h`) to control the behaviour of the PopSift, and instantiate an object of class `PopSift` (found in `src/sift/popsift.h`).

After this, images can be enqueued for SIFT extraction using (`enqueue()`). The only valid input format is a single plane of grayscale unsigned characters. Only host memory limits the number of images that can be enqueued. The `enqueue` function returns a pointer to a `SiftJob` immediately and performs the feature extraction asynchronously. The memory of the image passed to enqueue remains the caller's responsibility. Calling `SiftJob::get` on the returned job blocks until features are extracted, and returns them.

Features offer iterators that iterate over objects of type `Feature`. Both classes are documented in `sift_extremum.h`. Each feature represents a feature point in the coordinate system of the input image, providing X and Y coordinates and scale (sigma), as well as several alternative descriptors for the feature point (according to Lowe, 15% of the feature points should be expected to have 2 or more descriptors).

In an alternate, deprecated, blocking API, `init()` must be called to pass image width and height to PopSift, followed by a call to `executed()` that takes image data and returns the extracted features. `execute()` is synchronous and blocking.

As far as we know, no implementation that is faster than PopSift at the time of PopSift's release comes under a license that allows commercial use and sticks close to the original paper at the same time as well. PopSift can be configured at runtime to use constants that affect it behaviours. In particular, users can choose to generate results very similar to VLFeat or results that are closer (but not as close) to the SIFT implementation of the OpenCV extras. We acknowledge that there is at least one SIFT implementation that is vastly faster, but it makes considerable sacifices in terms of accuracy and compatibility.


License
-------

PopSift is licensed under [MPL v2 license](LICENSE.md).
However, SIFT is patented in the US and perhaps other countries, and this license does not release users of this code from any requirements that may arise from such patents.


Authors
-------

Expand Down
23 changes: 23 additions & 0 deletions cmake/cmake_uninstall.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
MESSAGE(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")

FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
# STRING(REGEX REPLACE " " ";" files "${files}")
STRING(REGEX REPLACE "\n" ";" file_list "${files}")
FOREACH(file ${file_list})
MESSAGE(STATUS "Uninstalling $ENV{DESTDIR}${file}")
IF(EXISTS "$ENV{DESTDIR}${file}")
EXEC_PROGRAM(
"@CMAKE_COMMAND@" ARGS "-E remove $ENV{DESTDIR}${file}"
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
IF(NOT "${rm_retval}" STREQUAL 0)
MESSAGE(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
ENDIF(NOT "${rm_retval}" STREQUAL 0)
ELSE(EXISTS "$ENV{DESTDIR}${file}")
MESSAGE(STATUS "File $ENV{DESTDIR}${file} does not exist.")
ENDIF(EXISTS "$ENV{DESTDIR}${file}")
ENDFOREACH(file)

Loading