luetge / flagser

Computing homology of directed flag complexes (based on https://github.com/Ripser/ripser). Online version: https://homepages.abdn.ac.uk/neurotopology/flagser.html
MIT License
35 stars 13 forks source link

compile with MANY_VERTICES and HDF5 at the same time? #38

Open flomlo opened 3 years ago

flomlo commented 3 years ago

Hi,

so it might just be that I'm too stupid to use CMake correctly. Sorry, I'm a noob. I've added this line set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMANY_VERTICES") into the CMakeLists.txt

and build flagser as described in the readme.

Now the binaries of flagser and flagser-memory are not even generated cause of compile time errors and flagser-count, while compiling, crashes at runtime (again, something with HDF5).

My questions are:

Best,

Florian

MonkeyBreaker commented 3 years ago

Hi,

Looking at the issue, when enabling MANY_VERTICES I get the same issue as you, it's because an hard coded type was in the code here, if you change int by index_t it compiles fine on my side. About the output, I don't have anything to check if it breaks something.

About enabling MANY_VERTICES in file CMakeLists.txt I would update like this (line 48):

add_executable(flagser src/flagser.cpp include/algorithms.h)
target_compile_definitions(flagser PRIVATE MANY_VERTICES=1)
add_dependencies(flagser generate_custom_algorithms)
set_target_properties(flagser PROPERTIES LINKER_LANGUAGE CXX)

add_executable(flagser_retrieve_persistence src/flagser.cpp include/algorithms.h)
add_dependencies(flagser_retrieve_persistence generate_custom_algorithms)
target_compile_definitions(flagser_retrieve_persistence PRIVATE RETRIEVE_PERSISTENCE MANY_VERTICES=1)
set_target_properties(flagser_retrieve_persistence PROPERTIES LINKER_LANGUAGE CXX)

add_executable(ripser src/ripser.cpp)
set_target_properties(ripser PROPERTIES LINKER_LANGUAGE CXX)

add_executable(flagser-count src/flagser-count.cpp)
target_compile_definitions(flagser-count PRIVATE MANY_VERTICES=1)
set_target_properties(flagser-count PROPERTIES LINKER_LANGUAGE CXX)

add_executable(er src/er.cpp)
set_target_properties(er PROPERTIES LINKER_LANGUAGE CXX)

IF(NOT MSVC)
add_executable(flagser-coefficients src/flagser.cpp)
add_dependencies(flagser-coefficients generate_custom_algorithms)
target_compile_definitions(flagser-coefficients PRIVATE USE_COEFFICIENTS=1 MANY_VERTICES=1)
set_target_properties(flagser-coefficients PROPERTIES LINKER_LANGUAGE CXX)

add_executable(ripser-coefficients src/ripser.cpp)
target_compile_definitions(ripser-coefficients PRIVATE USE_COEFFICIENTS=1)
set_target_properties(ripser-coefficients PROPERTIES LINKER_LANGUAGE CXX)
ELSE()
  message("On Windows, compilation with coefficients is currently not supported.")
ENDIF()

Best, Julián