Skip to content

Commit 72d2fc1

Browse files
committed
Merge branch 'develop'
* develop: (24 commits) Added build status tag. Added example and jupyter notebook. Tidying up everything… Rewrote the Python extension quite a bit. Can now reproduce the results from the C++ tests. Fixed the Python tests and the files used for the benchmark. Fixed benchmark runner. Additional: * added COPYRIGHT * updated README * minor fixes Documentations: * updated Doxygen doc * added Sphinx doc Removed legacy code + some cython cleaning. Cleaning Windows compilation by adding headers hack for debug config. Additional: * reduced tests duration by limiting tests to 100 iterations * removed legacy tests Added benchmark functionality from Caterina. Additional: * cmake updated * minor cleaning and updating the README Reorganized cmake and repository for making the code cross-platform and setting the CI. This includes: * builds passing on Win10, OSX, and Linux * python extension, including the infrastructure to build wheels * cleaning of the cmake Added a python wrapper to the algorithm. Added assortative case. Additional: * many tests including some for the algorithm types * added template for initializing w * major refactoring * printing out likelihood * minor review comments Implemented case when affinity is specified in a file. Additional: * added test for undirected graphs * cleaning + bug fixes in the solver and the application * a bit more consistency + comments as suggested by Ivan Improved interface, writing files is now part of the application. Additional: * random generator is now a template. Added CLI for the user to specify the seed * added tensor tests. * labels must be extracted to write the output files * writing files is now part of the application. * implementation of undirected graphs; Some general improvements: * added template types (vertex_t, weight_t…) * reorganized tests inside fixtures * added report class * added termination reason * initialization is now a template of the solver * added report output file * API simplified * more tests * documentation updated Removing unnecessary Makefile Added a lot of unit tests and ctests. Additional: * refactored of the network logic * comments from review * moved headers to separate folder. * added methods writing outputs into files Awesome documentation and consistent versioning across the project. Additional: * number of groups is now a required argument. * fixed some warnings during compilation Some additional changes: * reverted back legacy code * added timer * removed dependency on boost program options - not easy to handle required arguments First implementation finished. Reproduces the results for an non-assortative, undirected network with the adjacency data file. ...
2 parents 1fb6160 + 7f4917a commit 72d2fc1

File tree

131 files changed

+323729
-11099
lines changed

Some content is hidden

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

131 files changed

+323729
-11099
lines changed

.DS_Store

-6 KB
Binary file not shown.

.gitignore

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,18 @@
1-
# Compiled Object files
2-
*.slo
3-
*.lo
1+
build
2+
release
3+
debug
4+
*.DS_Store
45
*.o
5-
*.obj
6-
7-
# Precompiled Headers
8-
*.gch
9-
*.pch
10-
11-
# Compiled Dynamic libraries
12-
*.so
13-
*.dylib
14-
*.dll
15-
16-
# Fortran module files
17-
*.mod
18-
*.smod
19-
20-
# Compiled Static libraries
21-
*.lai
22-
*.la
23-
*.a
24-
*.lib
25-
26-
# Executables
276
*.exe
28-
*.out
29-
*.app
7+
*.vs*
8+
__pycache__
9+
dist/
10+
*egg-*
11+
.noseids
12+
13+
# data from tests
14+
u_*.dat
15+
v_*.dat
16+
w_*.dat
17+
*out*.dat
18+
results/

CMakeLists.txt

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
# Copyright (c) 2019, Max Planck Society / Software Workshop - Max Planck Institute for Intelligent Systems
2+
# Distributed under the GNU GPL license version 3
3+
# See file LICENSE.md or at https://github.com/MPI-IS/multitensor/LICENSE.md
4+
5+
6+
cmake_minimum_required (VERSION 3.5)
7+
cmake_policy(SET CMP0054 NEW)
8+
9+
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13")
10+
cmake_policy(SET CMP0076 OLD)
11+
endif()
12+
13+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
14+
15+
# Extract version number
16+
file(READ ${CMAKE_SOURCE_DIR}/version.txt ver)
17+
project(MultiTensor VERSION ${ver})
18+
message(STATUS "Project ${CMAKE_PROJECT_NAME} v${CMAKE_PROJECT_VERSION}")
19+
20+
enable_testing()
21+
22+
option(ENABLE_PYTHON_WRAPPER "Enable the python extensions" ON)
23+
option(ENABLE_BENCHMARK "Enable the benchmark" ON)
24+
25+
# 0:silent
26+
add_definitions(-DMULTITENSOR_VERBOSE=1)
27+
28+
#################################
29+
# thirdparties and configurations
30+
include(cmake/compiler_settings.cmake)
31+
include(cmake/thirdparty.cmake)
32+
33+
34+
################################
35+
# Main libraries and executables
36+
set(multitensor_src
37+
${CMAKE_SOURCE_DIR}/include/multitensor/graph.hpp
38+
${CMAKE_SOURCE_DIR}/include/multitensor/initialization.hpp
39+
${CMAKE_SOURCE_DIR}/include/multitensor/params.hpp
40+
${CMAKE_SOURCE_DIR}/include/multitensor/solver.hpp
41+
${CMAKE_SOURCE_DIR}/include/multitensor/tensor.hpp
42+
${CMAKE_SOURCE_DIR}/include/multitensor/utils.hpp
43+
${CMAKE_SOURCE_DIR}/include/multitensor/main.hpp)
44+
45+
# libraries
46+
add_library(multitensor INTERFACE)
47+
target_include_directories(multitensor
48+
INTERFACE
49+
${CMAKE_SOURCE_DIR}/include/
50+
${CMAKE_SOURCE_DIR}/src/)
51+
target_sources(multitensor
52+
INTERFACE
53+
$<BUILD_INTERFACE:${multitensor_src} >) # for the IDE to see the library
54+
55+
add_library(multitensor_utils
56+
${CMAKE_SOURCE_DIR}/applications/include/app_params.hpp
57+
${CMAKE_SOURCE_DIR}/applications/include/app_utils.hpp
58+
${CMAKE_SOURCE_DIR}/applications/src/app_utils.cpp)
59+
target_link_libraries(multitensor_utils PUBLIC multitensor Boost::filesystem)
60+
target_include_directories(multitensor_utils
61+
PUBLIC
62+
${CMAKE_SOURCE_DIR}/applications/include/
63+
${CMAKE_SOURCE_DIR}/applications/src/)
64+
65+
# executables
66+
add_executable(Multitensor applications/src/multitensor.cpp)
67+
target_link_libraries(Multitensor multitensor multitensor_utils)
68+
69+
# Unit tests
70+
add_executable(test_multitensor
71+
tests/fixtures.hpp
72+
tests/test_graph.cpp
73+
tests/test_initialization.cpp
74+
tests/test_multitensor.cpp
75+
tests/test_solver.cpp
76+
tests/test_tensor.cpp
77+
tests/test_utils.cpp)
78+
target_link_libraries(test_multitensor
79+
multitensor
80+
Boost::unit_test_framework
81+
Boost::system
82+
Boost::filesystem)
83+
add_test(
84+
NAME multitensor_unit_tests
85+
COMMAND test_multitensor)
86+
87+
# Functional tests
88+
# Helper for command line run
89+
function(add_test_cmd_line
90+
test_name
91+
test_program)
92+
93+
# Set test folder and copy adjacency file
94+
set(test_folder ${CMAKE_BINARY_DIR}/tests/${test_name})
95+
file(COPY ${CMAKE_SOURCE_DIR}/data/${test_name}/ DESTINATION ${test_folder}/)
96+
file(COPY ${CMAKE_SOURCE_DIR}/tests/data/compare.sh DESTINATION ${test_folder}/)
97+
file(COPY ${CMAKE_SOURCE_DIR}/tests/data/${test_name}/ DESTINATION ${test_folder}/)
98+
99+
# Run
100+
add_test(
101+
NAME "command-line-${test_name}-run"
102+
COMMAND ${test_program} ${ARGN}
103+
WORKING_DIRECTORY ${test_folder}
104+
)
105+
106+
if("${test_program}" STREQUAL "Multitensor")
107+
add_test(
108+
NAME "command-line-${test_name}-verify-content"
109+
COMMAND ${CMAKE_COMMAND}
110+
"-Dresults=${test_folder}/results"
111+
"-Dground_truth=${CMAKE_SOURCE_DIR}/tests/data/${test_name}"
112+
-P ${CMAKE_SOURCE_DIR}/cmake/verify_content.cmake
113+
)
114+
115+
set_tests_properties(
116+
"command-line-${test_name}-verify-content"
117+
PROPERTIES
118+
DEPENDS "command-line-${test_name}-run"
119+
)
120+
endif()
121+
122+
endfunction()
123+
124+
add_test_cmd_line(
125+
"main"
126+
Multitensor
127+
--a adjacency.dat
128+
--k 2
129+
--s 5489
130+
--maxit 100)
131+
132+
add_test_cmd_line(
133+
"undirected"
134+
Multitensor
135+
--a adjacency.dat
136+
--k 2
137+
--s 5489
138+
--undirected
139+
--maxit 100)
140+
141+
add_test_cmd_line(
142+
"w_input"
143+
Multitensor
144+
--a adjacency_k2L4.dat
145+
--k 2
146+
--s 5489
147+
--w w_k2_k2L4_A.dat
148+
--maxit 100)
149+
150+
add_test_cmd_line(
151+
"multi_real"
152+
Multitensor
153+
--a adjacency_k2L4.dat
154+
--k 2
155+
--s 5489
156+
--w w_k2_k2L4_r2.dat
157+
--r 2
158+
--maxit 100)
159+
160+
add_test_cmd_line(
161+
"assortative"
162+
Multitensor
163+
--a adjacency_assortative_k3L4.dat
164+
--k 3
165+
--s 5489
166+
--assortative
167+
--maxit 100)
168+
169+
170+
#########################
171+
# Python Bindings + Tests
172+
include(cmake/python.cmake)
173+
174+
175+
#########################
176+
# Documentation (Doxygen)
177+
include(cmake/doxygen_doc.cmake)
178+
179+
180+
###########
181+
# Benchmark
182+
include(cmake/benchmark.cmake)

0 commit comments

Comments
 (0)