Skip to content

Commit 0b355e1

Browse files
Add compile-time option for calculation precision selection
1 parent eb924ab commit 0b355e1

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
1616
# Option to use 32-bit pixel data instead of 16-bit
1717
option(PIXEL_DATA_32BIT "Use 32-bit pixel data instead of 16-bit" OFF)
1818

19+
# Option to use double precision for CUDA calculations
20+
option(USE_DOUBLE_PRECISION "Use double precision for CUDA calculations" OFF)
21+
1922
include(SetDefaultBuildRelWithDebInfo)
2023
include(AlwaysColourCompilation)
2124

@@ -89,6 +92,14 @@ if(PIXEL_DATA_32BIT)
8992
else()
9093
message(STATUS "Building with 16-bit pixel data support")
9194
endif()
95+
96+
if(USE_DOUBLE_PRECISION)
97+
target_compile_definitions(compile_options INTERFACE USE_DOUBLE_PRECISION)
98+
message(STATUS "Building with double precision")
99+
else()
100+
message(STATUS "Building with single precision")
101+
endif()
102+
92103
# Make a common C++ library for shared code
93104
add_library(ffs_common STATIC
94105
src/ffs/ffs_logger.cc

build.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,16 +190,16 @@ main() {
190190

191191
# Build production version
192192
if [[ "$PIXEL_32BIT" == "true" ]]; then
193-
build_directory "build" "-DPIXEL_DATA_32BIT=ON -DCMAKE_BUILD_TYPE=Release" "production (32-bit)"
193+
build_directory "build" "-DPIXEL_DATA_32BIT=ON -DUSE_DOUBLE_PRECISION=ON -DCMAKE_BUILD_TYPE=Release" "production (32-bit, double precision)"
194194
else
195-
build_directory "build" "-DCMAKE_BUILD_TYPE=Release" "production (16-bit)"
195+
build_directory "build" "-DUSE_DOUBLE_PRECISION=ON -DCMAKE_BUILD_TYPE=Release" "production (16-bit, double precision)"
196196
fi
197197
else
198198
print_status "Development build mode"
199199

200200
# Build both 16-bit and 32-bit versions
201-
build_directory "build" "-DCMAKE_BUILD_TYPE=RelWithDebInfo" "development (16-bit)"
202-
build_directory "build_32bit" "-DPIXEL_DATA_32BIT=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo" "development (32-bit)"
201+
build_directory "build" "-DUSE_DOUBLE_PRECISION=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo" "development (16-bit, double precision)"
202+
build_directory "build_32bit" "-DPIXEL_DATA_32BIT=ON -DUSE_DOUBLE_PRECISION=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo" "development (32-bit, double precision)"
203203
fi
204204

205205
print_success "Build completed successfully!"

0 commit comments

Comments
 (0)