Skip to content

Commit

Permalink
Without isa-l (#78)
Browse files Browse the repository at this point in the history
- Removes isa-l library to avoid build issues on cluster.

---------

Co-authored-by: Will Dumm <wrhdumm@gmail.com>
Co-authored-by: marybarker <marybarker103@gmail.com>
  • Loading branch information
3 people authored Apr 15, 2024
1 parent 8c165f2 commit a2f3486
Show file tree
Hide file tree
Showing 12 changed files with 281 additions and 228 deletions.
148 changes: 66 additions & 82 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
endif()

set(CMAKE_INTERPROCEDURAL_OPTIMIZATION yes)

set(CMAKE_EXPORT_COMPILE_COMMANDS yes)

include(FetchContent)

if (USE_USHER)
if(USE_USHER)
FetchContent_Declare(oneTBB-src
GIT_REPOSITORY https://github.com/oneapi-src/oneTBB
GIT_TAG 2019_U9
Expand Down Expand Up @@ -89,21 +88,6 @@ endif()

find_package(ZLIB)

#ExternalProject_Add(isa-l
# GIT_REPOSITORY https://github.com/intel/isa-l.git
# GIT_TAG v2.30.0
# GIT_SHALLOW true
# GIT_PROGRESS true
# UPDATE_DISCONNECTED true
# PREFIX isa-l
# SOURCE_DIR isa-l/source
# BINARY_DIR isa-l/source
# INSTALL_DIR isa-l/install
# CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env SED=/bin/sed GREP=/bin/grep ./autogen.sh && ${CMAKE_COMMAND} -E env AS=yasm ./configure --prefix=${CMAKE_BINARY_DIR}/isa-l/install --libdir=${CMAKE_BINARY_DIR}/isa-l/install
# BUILD_COMMAND make && make other
# INSTALL_COMMAND make install
#)
#set(isal_lib ${CMAKE_BINARY_DIR}/isa-l/install/libisal.a)
set(STRICT_WARNINGS -Werror -fno-common -Wno-unknown-warning-option -Wno-pragmas -Wall -Wextra -pedantic -Wold-style-cast -Wshadow -Wconversion -Wcast-align -Wcast-qual -Wlogical-op -Wlogical-not-parentheses -Wredundant-decls -Wunreachable-code -Wparentheses -Wno-dangling-reference -Wno-ignored-optimization-argument)

if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
Expand All @@ -112,7 +96,8 @@ endif()

function(larch_compile_opts PRODUCT)
target_compile_options(${PRODUCT} PUBLIC -march=native -std=c++17 -pipe)
if (CMAKE_BUILD_TYPE EQUAL "DEBUG")

if(CMAKE_BUILD_TYPE EQUAL "DEBUG")
target_compile_options(${PRODUCT} PUBLIC -fno-omit-frame-pointer -fno-stack-protector)
endif()

Expand Down Expand Up @@ -142,26 +127,26 @@ endfunction()
FIND_PACKAGE(Boost COMPONENTS program_options iostreams filesystem date_time REQUIRED)

if(${USE_USHER})
include_directories(deps/usher/)
file(GLOB MATOPTIMIZE_SRC
"deps/usher/src/matOptimize/apply_move/*.cpp"
"deps/usher/src/matOptimize/Profitable_Moves_Enumerators/*.cpp"
"deps/usher/src/matOptimize/Fitch_Sankoff.cpp"
"deps/usher/src/matOptimize/mutation_annotated_tree.cpp"
"deps/usher/src/matOptimize/mutation_annotated_tree_nuc_util.cpp"
"deps/usher/src/matOptimize/mutation_annotated_tree_node.cpp"
"deps/usher/src/matOptimize/mutation_annotated_tree_load_store.cpp"
"deps/usher/src/matOptimize/mutation_annotated_tree_nuc_utils.cpp"
"deps/usher/src/matOptimize/optimize_inner_loop.cpp"
"deps/usher/src/matOptimize/Mutation_Collection.cpp"
"deps/usher/src/matOptimize/condense.cpp"
"deps/usher/src/matOptimize/reassign_states.cpp"
"deps/usher/src/matOptimize/detailed_mutations_load.cpp"
"deps/usher/src/matOptimize/detailed_mutations_store.cpp"
"deps/usher/src/matOptimize/optimize_tree.cpp"
"deps/usher/src/matOptimize/priority_conflict_resolver.cpp"
"deps/usher/src/matOptimize/check_samples.cpp"
)
include_directories(deps/usher/)
file(GLOB MATOPTIMIZE_SRC
"deps/usher/src/matOptimize/apply_move/*.cpp"
"deps/usher/src/matOptimize/Profitable_Moves_Enumerators/*.cpp"
"deps/usher/src/matOptimize/Fitch_Sankoff.cpp"
"deps/usher/src/matOptimize/mutation_annotated_tree.cpp"
"deps/usher/src/matOptimize/mutation_annotated_tree_nuc_util.cpp"
"deps/usher/src/matOptimize/mutation_annotated_tree_node.cpp"
"deps/usher/src/matOptimize/mutation_annotated_tree_load_store.cpp"
"deps/usher/src/matOptimize/mutation_annotated_tree_nuc_utils.cpp"
"deps/usher/src/matOptimize/optimize_inner_loop.cpp"
"deps/usher/src/matOptimize/Mutation_Collection.cpp"
"deps/usher/src/matOptimize/condense.cpp"
"deps/usher/src/matOptimize/reassign_states.cpp"
"deps/usher/src/matOptimize/detailed_mutations_load.cpp"
"deps/usher/src/matOptimize/detailed_mutations_store.cpp"
"deps/usher/src/matOptimize/optimize_tree.cpp"
"deps/usher/src/matOptimize/priority_conflict_resolver.cpp"
"deps/usher/src/matOptimize/check_samples.cpp"
)
endif()

function(larch_link_opts PRODUCT)
Expand All @@ -177,6 +162,7 @@ function(larch_link_opts PRODUCT)
target_link_libraries(${PRODUCT} PUBLIC nlohmann_json::nlohmann_json)
target_link_libraries(${PRODUCT} PUBLIC ${Protobuf_LIBRARIES})
target_link_libraries(${PRODUCT} PUBLIC ${Boost_LIBRARIES})

if(${USE_USHER})
target_link_libraries(${PRODUCT} PUBLIC ${TBB_IMPORTED_TARGETS} -lstdc++fs)
else()
Expand Down Expand Up @@ -211,49 +197,46 @@ endif()
larch_link_opts(larch)

if(${USE_USHER})
add_library(usher
${MATOPTIMIZE_SRC}
src/usher_globals.cpp)
target_compile_options(usher PRIVATE -march=native -std=c++17 -w -fno-omit-frame-pointer -DUSE_USHER)
add_library(usher
${MATOPTIMIZE_SRC}
src/usher_globals.cpp)
target_compile_options(usher PRIVATE -march=native -std=c++17 -w -fno-omit-frame-pointer -DUSE_USHER)

if(${USE_ASAN})
target_compile_options(usher PUBLIC -O0 -g3 -fsanitize=address,undefined -fno-sanitize-recover)
elseif(${USE_TSAN})
target_compile_options(usher PUBLIC -O0 -g3 -fsanitize=thread)
endif()
if(${USE_ASAN})
target_compile_options(usher PUBLIC -O0 -g3 -fsanitize=address,undefined -fno-sanitize-recover)
elseif(${USE_TSAN})
target_compile_options(usher PUBLIC -O0 -g3 -fsanitize=thread)
endif()

target_include_directories(usher PUBLIC include)
target_include_directories(usher PUBLIC ${Protobuf_INCLUDE_DIR})
target_include_directories(usher PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/range-v3/install/include)
target_include_directories(usher PUBLIC include)
target_include_directories(usher PUBLIC ${Protobuf_INCLUDE_DIR})
target_include_directories(usher PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/range-v3/install/include)

#target_include_directories(usher PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/isa-l/install/include)
add_dependencies(usher range-v3)
add_dependencies(usher range-v3)

#add_dependencies(usher isa-l)
target_include_directories(usher PUBLIC ${PROTO_OUT_DIR}/deps/usher)
larch_link_opts(usher)
target_link_libraries(usher PRIVATE ${Boost_LIBRARIES} ZLIB::ZLIB ${MPI_CXX_LIBRARIES} ${MPI_CXX_LINK_FLAGS})
target_include_directories(usher PUBLIC ${PROTO_OUT_DIR}/deps/usher)
larch_link_opts(usher)
target_link_libraries(usher PRIVATE ${Boost_LIBRARIES} ZLIB::ZLIB ${MPI_CXX_LIBRARIES} ${MPI_CXX_LINK_FLAGS})

#target_link_libraries(usher PUBLIC ${CMAKE_BINARY_DIR}/isa-l/install/libisal.a)
set_target_properties(usher
PROPERTIES CXX_CLANG_TIDY ""
)
set_target_properties(usher
PROPERTIES CXX_CLANG_TIDY ""
)

add_library(larch-usher-glue
src/usher_glue.cpp)
larch_compile_opts(larch-usher-glue)
target_compile_options(larch-usher-glue PRIVATE ${STRICT_WARNINGS})
larch_link_opts(larch-usher-glue)
target_link_libraries(larch-usher-glue PUBLIC usher)
add_dependencies(larch-usher-glue larch usher)
set_target_properties(larch-usher-glue
PROPERTIES CXX_CLANG_TIDY ""
)
add_library(larch-usher-glue
src/usher_glue.cpp)
larch_compile_opts(larch-usher-glue)
target_compile_options(larch-usher-glue PRIVATE ${STRICT_WARNINGS})
larch_link_opts(larch-usher-glue)
target_link_libraries(larch-usher-glue PUBLIC usher)
add_dependencies(larch-usher-glue larch usher)
set_target_properties(larch-usher-glue
PROPERTIES CXX_CLANG_TIDY ""
)
endif()

larch_executable(larch-test
test/main.cpp
#test/test_ambiguous_vcf.cpp
test/test_ambiguous_vcf.cpp
test/test_ambiguities.cpp
test/test_compact_genome.cpp
test/test_count_trees.cpp
Expand All @@ -278,12 +261,13 @@ larch_executable(larch-test
test/test_write_parsimony.cpp
)
target_compile_options(larch-test PRIVATE ${STRICT_WARNINGS})

if(${USE_USHER})
target_link_libraries(larch-test PUBLIC larch-usher-glue usher)
add_dependencies(larch-test larch-usher-glue)
set_target_properties(larch-test
PROPERTIES CXX_CLANG_TIDY ""
)
target_link_libraries(larch-test PUBLIC larch-usher-glue usher)
add_dependencies(larch-test larch-usher-glue)
set_target_properties(larch-test
PROPERTIES CXX_CLANG_TIDY ""
)
endif()

larch_executable(merge
Expand All @@ -293,10 +277,10 @@ larch_executable(dag2dot
tools/dag2dot.cpp)

if(${USE_USHER})
larch_executable(larch-usher
tools/larch-usher.cpp
)
target_compile_options(larch-usher PRIVATE ${STRICT_WARNINGS})
target_link_libraries(larch-usher PRIVATE larch-usher-glue)
add_dependencies(larch-usher larch-usher-glue)
larch_executable(larch-usher
tools/larch-usher.cpp
)
target_compile_options(larch-usher PRIVATE ${STRICT_WARNINGS})
target_link_libraries(larch-usher PRIVATE larch-usher-glue)
add_dependencies(larch-usher larch-usher-glue)
endif()
43 changes: 32 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,61 @@ To get a recent cmake, download from `https://cmake.org/download/`, for example:

`wget https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-linux-x86_64.tar.gz`

To setup a conda environment capable of building Larch, use the environment
Build Environments
------------------

* singularity 3.5.3
* conda 22.9.0

Larch can be built utilizing a Singularity container or a Conda environment.

To build Singularity image, use the definition provided:

`singularity build larch-singularity.sif larch-singularity.def`
`singularity shell larch-singularity.sif --net`

To setup a conda environment capable of building Larch, use:

`conda create -n larch`
`conda activate larch`
`conda install --channel "conda-forge" --update-deps --override-channels cmake make cxx-compiler openmpi openmpi-mpicc openmpi-mpicxx boost-cpp automake autoconf libtool yasm ucx zlib`

To setup a conda environment capable of building Larch including development tools, create `larch-dev` using the environment
file provided:

`conda env create -f environment.yml`


Building
--------

`git submodule update --init --recursive`
`mkdir build`

`cd build`

`cmake -DCMAKE_BUILD_TYPE=Debug ..`

`make -j16`

Optionally add -DCMAKE_CXX_CLANG_TIDY="clang-tidy" to enable clang-tidy.

Optionally add -DUSE_ASAN=yes to enable asan and ubsan.
Cmake build options:
- add `-DCMAKE_CXX_CLANG_TIDY="clang-tidy"` to enable clang-tidy.
- add `-DUSE_ASAN=yes` to enable asan and ubsan.

Running
-------

From the build directory:

`ln -s ../data`

`./larch-test`

Passing *nocatch* to the tests executable will allow exceptions to escape, which is useful for debugging. A gdb session can be started with `gdb --args build/larch-test nocatch`.

*--list* produces a list of all available tests, along with an ID number.
*--range* runs tests by ID in [begin, end] range arguments.
larch-test options:

- `nocatch` allows test exceptions to escape, which is useful for debugging. A gdb session can be started with `gdb --args build/larch-test nocatch`.
- `--list` produces a list of all available tests, along with an ID number.
- `--range` runs tests by ID with a string of comma-separated range or single ID arguments [e.g. 1-5,7,9,12-13].
- `-tag` excludes tests with a given tag.
- `+tag` includes tests with a given tag.
- For example, the `-tag "slow"` removes tests which require an long runtime to complete.

Third-party
-----------
Expand Down
12 changes: 0 additions & 12 deletions build.sh

This file was deleted.

25 changes: 15 additions & 10 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,27 @@ channels:
- bioconda
- defaults
dependencies:
- git
- isa-l
- cmake=3.19.6
- make
- cxx-compiler
- mafft
- boost-cpp
- openmpi
- openmpi-mpicc
- openmpi-mpicxx
- boost-cpp
- automake
- autoconf
- libtool
- yasm
- ucx
- zlib

- git
- mafft
- python
- rsync
- wget
- cmake=3.19.6
- autoconf
- protobuf=3.12.3
- make
- openssh
- gdb
- bzip2
- backports.lzma
- libtool
- automake
- protobuf=3.12.3
Loading

0 comments on commit a2f3486

Please sign in to comment.