diff --git a/.github/workflows/build_and_test_on_push.yml b/.github/workflows/build_and_test_on_push.yml index e667041..73039d6 100644 --- a/.github/workflows/build_and_test_on_push.yml +++ b/.github/workflows/build_and_test_on_push.yml @@ -23,7 +23,7 @@ jobs: - name: Init and update submodules run: git submodule update --init --recursive - name: Build seqwish - run: sed -i 's/CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -mcx16 -g/CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O -mcx16 -g -fsanitize=address/g' CMakeLists.txt && sed -i 's/CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -mcx16 -g/CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O -mcx16 -g -fsanitize=address/g' CMakeLists.txt && cmake -H. -Bbuild && cmake --build build -- -j 2 + run: cmake -H. -DCMAKE_BUILD_TYPE=Debug -Bbuild && cmake --build build -- -j 2 - name: Execute tests run: cd test && ASAN_OPTIONS=detect_leaks=1:symbolize=1 LSAN_OPTIONS=verbosity=0:log_threads=1 make test diff --git a/CMakeLists.txt b/CMakeLists.txt index 5fa5cb2..628f006 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,11 +10,30 @@ set(CMAKE_CXX_STANDARD 14) set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) -# Use all standard-compliant optimizations -set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -mcx16 -g") -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -mcx16 -g") -#set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O -mcx16 -g -fsanitize=address") -#set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O -mcx16 -g -fsanitize=address") +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build, options are: Release Debug Generic." FORCE) +endif() + +# set(CMAKE_BUILD_TYPE Debug) -- don't uncomment this, instead run +# cmake -DCMAKE_BUILD_TYPE=Debug .. + +message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") + +if (${CMAKE_BUILD_TYPE} MATCHES Release) + set(EXTRA_FLAGS "-Ofast -march=native") + set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG") # reset CXX_FLAGS to replace -O3 with -Ofast +endif () + +if (${CMAKE_BUILD_TYPE} MATCHES Debug) + # Debug use the defaults + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O -mcx16 -g -fsanitize=address") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O -mcx16 -g -fsanitize=address") +else() + # Use all standard-compliant optimizations - always add these: + set (CMAKE_C_FLAGS "${OpenMP_C_FLAGS} ${PIC_FLAG} ${EXTRA_FLAGS} -mcx16") + set (CMAKE_CXX_FLAGS "${OpenMP_CXX_FLAGS} ${PIC_FLAG} ${EXTRA_FLAGS} -mcx16") +endif () # Set the output folder where your program will be created set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin) @@ -114,7 +133,7 @@ ExternalProject_Add(atomicqueue BUILD_COMMAND "" CONFIGURE_COMMAND "") ExternalProject_Get_property(atomicqueue SOURCE_DIR) -set(atomicqueue_INCLUDE "${SOURCE_DIR}") +set(atomicqueue_INCLUDE "${SOURCE_DIR}/include/atomic_queue") # ska ExternalProject_Add(ska diff --git a/README.md b/README.md index 8c9b75f..c24111c 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,13 @@ cmake -DBUILD_STATIC=1 -H. -Bbuild && cmake --build build -- -j 3 You'll need to set this flag to 0 or remove and rebuild your build directory if you want to unset this behavior. Static builds are unlikely to be supported on OSX, and require appropriate static libraries on linux. +#### Notes for distribution + +If you need to avoid machine-specific optimizations, use the `CMAKE_BUILD_TYPE=Generic` build type: + +```shell +cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Generic && cmake --build build -- -j 3 +``` ### Docker diff --git a/deps/atomic_queue b/deps/atomic_queue index 430f732..7d75e9e 160000 --- a/deps/atomic_queue +++ b/deps/atomic_queue @@ -1 +1 @@ -Subproject commit 430f732da0889b090705ad00ce15d4463fe7b536 +Subproject commit 7d75e9ed0359650224b29cdf6728c5fe0a19fffb diff --git a/src/dset64-gccAtomic.hpp b/src/dset64-gccAtomic.hpp index 3d341e0..319aa05 100644 --- a/src/dset64-gccAtomic.hpp +++ b/src/dset64-gccAtomic.hpp @@ -60,11 +60,6 @@ * */ -// Sanity check that we are compiling on x86_64. -#if !__x86_64__ -#error "seqwish can only be built on an x86_64 machine (64-bit Intel/AMD)" -#endif - namespace seqwish { class DisjointSets { diff --git a/src/dset64.hpp b/src/dset64.hpp index 74b6191..f053093 100644 --- a/src/dset64.hpp +++ b/src/dset64.hpp @@ -57,11 +57,6 @@ * */ -// Sanity check that we are compiling on x86_64. -#if !__x86_64__ -#error "seqwish can only be built on an x86_64 machine (64-bit Intel/AMD)" -#endif - namespace seqwish { class DisjointSets {