Skip to content

Commit b2e72c4

Browse files
authored
Merge pull request #131 from AdaptiveParticles/develop
Develop: Preparing Master for APR Version 2.0 bump.
2 parents d09af3a + ade9fb5 commit b2e72c4

File tree

180 files changed

+29103
-4825
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+29103
-4825
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11

22
# Created by https://www.gitignore.io/api/c++,intellij,matlab
33

4+
#ignore for apr files unless they are directly updated
5+
*.apr
6+
47
### C++ ###
58
# Prerequisites
69
*.d

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,18 @@ matrix:
1818
- libhdf5-dev
1919
- libtiff5
2020
- os: osx
21-
osx_image: xcode9.2
21+
osx_image: xcode11.4
2222

2323
install:
2424
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
25-
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install hdf5; fi
25+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install c-blosc; fi
2626
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then echo "UPDATESTARTUPTTY" | gpg-connect-agent > /dev/null 2>&1; fi
2727
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install cmake || brew upgrade cmake ; fi
2828
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export COMPILER=clang++-3.6; fi
2929
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CXX=clang++-3.6; fi
3030
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CC=clang-3.6; fi
3131
- git submodule init
3232
- git submodule update
33-
- pip install --user -U pip
34-
- pip install --user numpy
3533

3634
script:
3735
- sh ./cmake-build.sh

CMakeLists.txt

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ option(APR_USE_LIBTIFF "Use LibTIFF" ON)
1616
option(APR_TESTS "Build APR tests" OFF)
1717
option(APR_PREFER_EXTERNAL_GTEST "When found, use the installed GTEST libs instead of included sources" OFF)
1818
option(APR_PREFER_EXTERNAL_BLOSC "When found, use the installed BLOSC libs instead of included sources" OFF)
19-
option(APR_BUILD_PYTHON_WRAPPERS "Build APR PYTHON wrappers (experimental - under development)" OFF)
2019
option(APR_USE_CUDA "should APR use CUDA? (experimental - under development)" OFF)
2120
option(APR_USE_OPENMP "should APR use OpenMP?" ON)
2221
option(APR_BENCHMARK "add benchmarking code" OFF)
@@ -38,8 +37,9 @@ list(APPEND CMAKE_MODULE_PATH
3837
###############################################################################
3938
# Generate configuration file
4039
###############################################################################
41-
set (APR_VERSION_MAJOR 1)
42-
set (APR_VERSION_MINOR 2)
40+
41+
set (APR_VERSION_MAJOR 2)
42+
set (APR_VERSION_MINOR 0)
4343
set (APR_VERSION_PATCH 0)
4444
set (APR_VERSION_STRING ${APR_VERSION_MAJOR}.${APR_VERSION_MINOR}.${APR_VERSION_PATCH})
4545
execute_process(COMMAND git rev-parse HEAD
@@ -53,10 +53,14 @@ configure_file (
5353
include_directories("${PROJECT_BINARY_DIR}")
5454
message("Configuring for APR version: " ${APR_VERSION_STRING})
5555

56-
5756
###############################################################################
5857
# Find all required libraries
5958
###############################################################################
59+
60+
#pthreads
61+
set(THREADS_PREFER_PTHREAD_FLAG ON)
62+
find_package(Threads REQUIRED)
63+
6064
find_package(HDF5 REQUIRED)
6165
find_package(ZLIB REQUIRED)
6266
if(APR_USE_LIBTIFF)
@@ -113,17 +117,17 @@ include_directories("external/glm")
113117
# If you ever want to compile with Intel's icc (or any other compiler) provide
114118
# compiler names/paths in cmake command like this:
115119
# CC="icc" CXX="icc" CXXFLAGS="-O3" cmake -DAPR_TESTS=1
116-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -pedantic ")
120+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 ")
117121
if(CMAKE_COMPILER_IS_GNUCC)
118122
set(CMAKE_CXX_FLAGS_RELEASE "-O4 -ffast-math")
119-
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
123+
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wall -pedantic")
120124
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Bdynamic")
121125
if(NOT WIN32)
122126
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ldl -lz")
123127
endif()
124128
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
125129
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -ffast-math")
126-
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
130+
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wall -pedantic")
127131
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lz")
128132
endif()
129133

@@ -160,8 +164,13 @@ if(APR_USE_CUDA)
160164
src/algorithm/ComputeGradientCuda.cu
161165
src/data_structures/Mesh/PixelData.cu
162166
src/algorithm/LocalIntensityScale.cu
167+
src/algorithm/OVPC.cu
168+
src/data_structures/APR/access/GPUAccess.cu
169+
src/numerics/APRDownsampleGPU.cu
170+
src/numerics/APRIsoConvGPU.cu
163171
)
164172
include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
173+
165174
endif()
166175

167176
if(APR_BUILD_STATIC_LIB)
@@ -296,21 +305,15 @@ if(APR_TESTS)
296305
endif(APR_TESTS)
297306

298307
###############################################################################
299-
# PYTHON wrappers
308+
# Performance Benchmarks
300309
###############################################################################
301-
if(APR_BUILD_PYTHON_WRAPPERS)
302-
message(STATUS "APR: Building PYTHON wrappers")
303-
set(PYBIND11_PYTHON_VERSION 2.7)
304-
305-
add_subdirectory("external/pybind11")
306-
307-
set(APR_PYTHON_MODULE_NAME pyApr)
308-
add_definitions(-DAPR_PYTHON_MODULE_NAME=${APR_PYTHON_MODULE_NAME})
309-
add_library(${APR_PYTHON_MODULE_NAME} MODULE src/wrapper/pythonBind.cpp $<TARGET_OBJECTS:aprObjLib>)
310-
target_include_directories(${APR_PYTHON_MODULE_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
311-
target_link_libraries(${APR_PYTHON_MODULE_NAME} PRIVATE pybind11::module ${HDF5_LIBRARIES} ${TIFF_LIBRARIES} ${BLOSC_LIBRARIES} ${ZLIB_LIBRARIES})
312-
set_target_properties(${APR_PYTHON_MODULE_NAME} PROPERTIES OUTPUT_NAME ${APR_PYTHON_MODULE_NAME})
313-
set_target_properties(${APR_PYTHON_MODULE_NAME} PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
314-
SUFFIX "${PYTHON_MODULE_EXTENSION}")
315-
316-
endif(APR_BUILD_PYTHON_WRAPPERS)
310+
311+
if(APR_BENCHMARK)
312+
message(STATUS "APR: Benchmarking performance")
313+
add_subdirectory(benchmarks)
314+
endif(APR_BENCHMARK)
315+
316+
###############################################################################
317+
# PYTHON wrappers These are now external please ask us for access
318+
###############################################################################
319+

README.md

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Labeled Zebrafish nuclei: Gopi Shah, Huisken Lab ([MPI-CBG](https://www.mpi-cbg.
1616
* CMake 3.6 or higher
1717
* LibTIFF 4.0 or higher
1818

19-
NB: This branch introduces changes to IO and iteration that are not compatable with old versions.
19+
NB: This update to 2.0 introduces changes to IO and iteration that are not compatable with old versions.
2020

2121
## Building
2222

@@ -50,7 +50,7 @@ This will create the `libapr.so` library in the `build` directory, as well as al
5050

5151
### Docker build
5252

53-
We provide working Dockerfile that install the library within the image on a separate [repo](https://github.com/MSusik/libaprdocker).
53+
We provide a working Dockerfile that install the library within the image on a separate [repo](https://github.com/MSusik/libaprdocker).
5454

5555
### Building on OSX
5656

@@ -75,11 +75,14 @@ In case you want to use the homebrew-installed clang (OpenMP support), modify th
7575
CC="/usr/local/opt/llvm/bin/clang" CXX="/usr/local/opt/llvm/bin/clang++" LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib" CPPFLAGS="-I/usr/local/opt/llvm/include" cmake ..
7676
```
7777

78-
7978
### Building on Windows
8079

80+
__The simplest way to utilise the library from Windows 10 is through using the Windows Subsystem for Linux; see: https://docs.microsoft.com/en-us/windows/wsl/install-win10 then follow linux instructions.__
81+
8182
__Compilation only works with mingw64/clang or the Intel C++ Compiler, with Intel C++ being the recommended way__
8283

84+
The below instructions for VS can be attempted; however they have not been reproduced.
85+
8386
You need to have Visual Studio 2017 installed, with [the community edition](https://www.visualstudio.com/downloads/) being sufficient. LibAPR does not compile correctly with the default Visual Studio compiler, so you also need to have the [Intel C++ Compiler, 18.0 or higher](https://software.intel.com/en-us/c-compilers) installed. [`cmake`](https://cmake.org/download/) is also a requirement.
8487

8588
Furthermore, you need to have HDF5 installed (binary distribution download at [The HDF Group](http://hdfgroup.org) and LibTIFF (source download from [SimpleSystems](http://www.simplesystems.org/libtiff/). LibTIFF needs to be compiled via `cmake`. LibTIFF's install target will then install the library into `C:\Program Files\tiff`.
@@ -96,6 +99,8 @@ cmake --build . --config Debug
9699
This will set the appropriate hints for Visual Studio to find both LibTIFF and HDF5. This will create the `apr.dll` library in the `build/Debug` directory, as well as all of the examples. If you need a `Release` build, run `cmake --build . --config Release` from the `build` directory.
97100

98101
## Examples and Documentation
102+
These examples can be turned on by adding -DAPR_BUILD_EXAMPLES=ON to the cmake command.
103+
99104
There are nine basic examples, that show how to generate and compute with the APR:
100105

101106
| Example | How to ... |
@@ -104,8 +109,6 @@ There are nine basic examples, that show how to generate and compute with the AP
104109
| [Example_apr_iterate](./examples/Example_apr_iterate.cpp) | iterate through a given APR. |
105110
| [Example_neighbour_access](./examples/Example_neighbour_access.cpp) | access particle and face neighbours. |
106111
| [Example_compress_apr](./examples/Example_compress_apr.cpp) | additionally compress the intensities stored in an APR. |
107-
| [Example_compute_gradient](./examples/Example_compute_gradient.cpp) | compute a gradient based on the stored particles in an APR. |
108-
| [Example_produce_paraview_file](./examples/Example_produce_paraview_file.cpp) | produce a file for visualisation in ParaView or reading in Matlab. |
109112
| [Example_random_access](./examples/Example_random_access.cpp) | perform random access operations on particles. |
110113
| [Example_ray_cast](./examples/Example_ray_cast.cpp) | perform a maximum intensity projection ray cast directly on the APR data structures read from an APR. |
111114
| [Example_reconstruct_image](./examples/Example_reconstruct_image.cpp) | reconstruct a pixel image from an APR. |
@@ -114,22 +117,17 @@ All examples except Example_get_apr require an already produced APR, such as tho
114117

115118
For tutorial on how to use the examples, and explanation of data-structures see [the library guide](./docs/lib_guide.pdf).
116119

117-
## Python support
118-
119-
Basic functionality is supported in Python through wrappers. To build the python module,
120-
use the CMake option
120+
## LibAPR Tests
121121

122-
`-DAPR_BUILD_PYTHON_WRAPPERS=ON`
123-
124-
Example usage of the available functionality:
122+
The testing framework can be turned on by adding -DAPR_TESTS=ON to the cmake command. All tests can then be run by executing on the command line your build folder.
123+
```
124+
ctest
125+
```
126+
Please let us know by creating an issue, if any of these tests are failing on your machine.
125127

126-
| Example | How to ... |
127-
|:--|:--|
128-
| [Example_get_apr_from_array](./examples/python_examples/Example_get_apr_from_array.py) | create an APR from an ndarray and store as hdf5. |
129-
| [Example_get_apr_from_file](./examples/python_examples/Example_get_apr_from_file.py) | create an APR from a TIFF and store as hdf5. |
130-
| [Example_reconstruct_image](./examples/python_examples/Example_reconstruct_image.py) | read in an APR and reconstruct a pixel image |
128+
## Python support
131129

132-
Note that you may have to manually change the `sys.path.insert()` statements before `import pyApr` in these scripts to insert your build folder.
130+
Note: These have been updated and externalised, and will be released shortly.
133131

134132
## Java wrappers
135133

0 commit comments

Comments
 (0)