Commit 2099e079 authored by Sylvain Jasson's avatar Sylvain Jasson
Browse files
parents 1b76b172 294a9c43
This diff is collapsed.
...@@ -21,10 +21,12 @@ project(spell_qtl) ...@@ -21,10 +21,12 @@ project(spell_qtl)
#INCLUDE(pandocology) #INCLUDE(pandocology)
find_package(Boost 1.55.0 REQUIRED) find_package(Boost 1.55.0 REQUIRED)
set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE TYPE INTERNAL FORCE) #set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE INTERNAL FORCE)
set(CMAKE_VERBOSE_MAKEFILE ON) set(CMAKE_VERBOSE_MAKEFILE ON)
set(BUILD_FOR_DEPLOYMENT FALSE CACHE BOOL "Link against static libc++ and use minimal symbol version where possible")
MESSAGE(STATUS "CMAKE VERSION ${CMAKE_VERSION}") MESSAGE(STATUS "CMAKE VERSION ${CMAKE_VERSION}")
MESSAGE(STATUS "${CMAKE_CURRENT_SOURCE_DIR}") MESSAGE(STATUS "${CMAKE_CURRENT_SOURCE_DIR}")
...@@ -70,6 +72,14 @@ include_directories(AFTER ${CMAKE_SOURCE_DIR}/include/ ${CMAKE_SOURCE_DIR}/inclu ...@@ -70,6 +72,14 @@ include_directories(AFTER ${CMAKE_SOURCE_DIR}/include/ ${CMAKE_SOURCE_DIR}/inclu
include_directories(SYSTEM /usr/include ${Boost_INCLUDE_DIRS} ${EXPAT_INCLUDE_DIR} ${X2C_INCLUDE_DIR}) include_directories(SYSTEM /usr/include ${Boost_INCLUDE_DIRS} ${EXPAT_INCLUDE_DIR} ${X2C_INCLUDE_DIR})
include_directories(AFTER /usr/include ${Boost_INCLUDE_DIRS} ${EXPAT_INCLUDE_DIR} ${X2C_INCLUDE_DIR}) include_directories(AFTER /usr/include ${Boost_INCLUDE_DIRS} ${EXPAT_INCLUDE_DIR} ${X2C_INCLUDE_DIR})
if(${BUILD_FOR_DEPLOYMENT})
set(libstdcpp ${CMAKE_BINARY_DIR}/libstdc++.a)
else(${BUILD_FOR_DEPLOYMENT})
set(libstdcpp "")
endif(${BUILD_FOR_DEPLOYMENT})
MESSAGE(STATUS "libstdcpp = ${libstdcpp}")
set(SPELL_PEDIGREE_SRC set(SPELL_PEDIGREE_SRC
src/static_data.cc src/static_data.cc
src/pedigree/main.cc src/pedigree/main.cc
...@@ -89,13 +99,66 @@ set(SPELL_QTL_SRC ...@@ -89,13 +99,66 @@ set(SPELL_QTL_SRC
src/computations/basic_data.cc src/computations/probabilities.cc src/computations/model.cc src/computations/frontends.cc src/computations/basic_data.cc src/computations/probabilities.cc src/computations/model.cc src/computations/frontends.cc
) )
add_executable(spell-pedigree ${SPELL_PEDIGREE_SRC}) MESSAGE(STATUS "spell-pedigree src = ${SPELL_PEDIGREE_SRC}")
add_executable(spell-marker ${SPELL_MARKER_SRC})
add_executable(spell-qtl ${SPELL_QTL_SRC})
#get_cmake_property(_variableNames VARIABLES)
target_link_libraries(spell-marker dl) #foreach (_variableName ${_variableNames})
target_link_libraries(spell-qtl expat dl) # message(STATUS "${_variableName}=${${_variableName}}")
set(CMAKE_EXE_LINKER_FLAGS "-rdynamic") #endforeach()
if(${BUILD_FOR_DEPLOYMENT})
add_executable(spell-pedigree ${SPELL_PEDIGREE_SRC} ${libstdcpp})
add_executable(spell-marker ${SPELL_MARKER_SRC})
add_executable(spell-qtl ${SPELL_QTL_SRC} ${libstdcpp})
add_custom_command(OUTPUT glibc.h libstdc++.a COMMAND ${CMAKE_SOURCE_DIR}/deploy/make_old_libc_header.sh WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_custom_command(OUTPUT libgmp.a COMMAND ${CMAKE_SOURCE_DIR}/deploy/compile_gmp.sh ${CMAKE_BINARY_DIR}/glibc.h ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/deploy)
add_custom_target(glibc.h)
#add_custom_target(stdc++ ${CMAKE_BINARY_DIR}/libstdc++.a)
#add_library(stdc++ INTERFACE IMPORTED)
#set_property(TARGET stdc++ PROPERTY INTERFACE_LINK_LIBRARIES ${CMAKE_BINARY_DIR}/libstdc++.a)
add_library(gmp INTERFACE IMPORTED)
add_custom_target(pouet ALL DEPENDS ${CMAKE_BINARY_DIR}/libgmp.a)
#set_property(TARGET gmp PROPERTY INTERFACE_LINK_LIBRARIES ${CMAKE_BINARY_DIR}/libgmp.a)
#set_target_properties(stdc++ PROPERTIES LINKER_LANGUAGE CXX)
#set_target_properties(gmp PROPERTIES LINKER_LANGUAGE C)
#add_dependencies(gmp stdc++)
#set_source_files_properties(${CMAKE_BINARY_DIR}/libgmp.a PROPERTIES GENERATED TRUE)
#set_source_files_properties(${libstdcpp} PROPERTIES GENERATED TRUE)
#set_source_files_properties(${CMAKE_BINARY_DIR}/libstdc++.a PROPERTIES EXTERNAL_OBJECT TRUE GENERATED TRUE)
SET_SOURCE_FILES_PROPERTIES(${SPELL_PEDIGREE_SRC} ${SPELL_MARKER_SRC} ${SPELL_QTL_SRC}
PROPERTIES
OBJECT_DEPENDS glibc.h
COMPILE_FLAGS "-include ${CMAKE_BINARY_DIR}/glibc.h -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0")
#add_dependencies(stdc++ libstdc++.a)
#add_dependencies(gmp libgmp.a)
add_dependencies(spell-pedigree glibc.h)
add_dependencies(spell-marker glibc.h pouet)
add_dependencies(spell-qtl glibc.h)
MESSAGE(STATUS " PROUT ${libstdcpp}")
set(CMAKE_EXE_LINKER_FLAGS "-include ${CMAKE_BINARY_DIR}/glibc.h -rdynamic -static-libgcc")
target_link_libraries(spell-marker ${libstdcpp} ${CMAKE_BINARY_DIR}/libgmp.a)
target_link_libraries(spell-qtl ${libstdcpp})
target_link_libraries(spell-pedigree ${libstdcpp})
#list(APPEND spell-pedigree_SRC "${CMAKE_BINARY_DIR}/libstdc++.a")
#list(APPEND spell-qtl_SRC "${CMAKE_BINARY_DIR}/libstdc++.a")
#list(APPEND spell-marker_SRC "${CMAKE_BINARY_DIR}/libstdc++.a")
else()
add_executable(spell-pedigree ${SPELL_PEDIGREE_SRC})
add_executable(spell-marker ${SPELL_MARKER_SRC})
add_executable(spell-qtl ${SPELL_QTL_SRC})
set(CMAKE_EXE_LINKER_FLAGS "-rdynamic")
endif()
target_link_libraries(spell-marker dl gmp)
target_link_libraries(spell-qtl expat dl rt)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
......
#!/bin/bash
PATH_TO_GLIBC_H=$1
OUTPUT_PATH=$2
cd gmp
# fetch GMP
cd gmp-6.1.2 || (curl https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz -o - | xz -d | tar xf - && cd gmp-6.1.2)
# cleanup and configure
[ -f Makefile ] && make clean
CFLAGS="-include $PATH_TO_GLIBC_H" ./configure --disable-shared --enable-fake-cpuid --enable-fat
# build
make
# deploy lib
cp .libs/libgmp.a $OUTPUT_PATH
#!/bin/bash
LIBCPP=/usr/lib/gcc/x86_64-linux-gnu/5/libstdc++.a
maxver=2.9
headerf=${1:-glibc.h}
set -e
for lib in libc.so.6 libm.so.6 libpthread.so.0 libdl.so.2 libresolv.so.2 librt.so.1; do
objdump -T /lib/x86_64-linux-gnu/$lib
done | awk -v maxver=${maxver} -vheaderf=${headerf} -vredeff=${headerf}.redef -f <(cat <<'EOF'
BEGIN {
split(maxver, ver, /\./)
limit_ver = ver[1] * 10000 + ver[2]*100 + ver[3]
}
/GLIBC_/ {
gsub(/\(|\)/, "",$(NF-1))
split($(NF-1), ver, /GLIBC_|\./)
vers = ver[2] * 10000 + ver[3]*100 + ver[4]
if (vers > 0) {
if (symvertext[$(NF)] != $(NF-1))
count[$(NF)]++
if (vers <= limit_ver && vers > symvers[$(NF)]) {
symvers[$(NF)] = vers
symvertext[$(NF)] = $(NF-1)
}
}
}
END {
for (s in symvers) {
if (count[s] > 1) {
printf("__asm__(\".symver %s,%s@%s\");\n", s, s, symvertext[s]) > headerf
printf("%s %s@%s\n", s, s, symvertext[s]) > redeff
}
}
}
EOF
)
sort ${headerf} -o ${headerf}
objcopy --redefine-syms=${headerf}.redef $LIBCPP libstdc++.a
rm ${headerf}.redef
...@@ -58,24 +58,47 @@ Enabled by default only if output is on a terminal. ...@@ -58,24 +58,47 @@ Enabled by default only if output is on a terminal.
**-na**,**--no-ansi** **-na**,**--no-ansi**
: Don't use ANSI escape sequences, don't display colors or realtime progress information. : Don't use ANSI escape sequences, don't display colors or realtime progress information.
## Model options **-rj**,**--join-radius** *DISTANCE*
: Specify the maximum distance from a selected locus to compute joint probabilities. Default is **10**.
**-rs**,**--skip-radius** *DISTANCE*
: Specify the maximum distance from a selected locus to skip tests. Default is **1**.
## Input datasets
The following configures the construction of the linear model. The following configures the construction of the linear model.
The following specifies the datasets you want processed. A dataset specification starts with argument -p, followed by one or more arguments -m.
**output-nppop** **-gm**,**-genetic-map** *PATH*
: Compute the n-point Parental Origin Probabilities and exit. The results will be written under the **WORK_DIRECTORY/NAME.n-point** directory. : Path to the genetic map file.
**-p**,**-population** *QTL_generation_name* *PHEN_PATH*
: Specify a new population (dataset) to work on.
## Model options
The following configures the construction of the linear model.
**connected** **connected**
: Select connected mode. Disabled by default. : Select connected mode. Disabled by default.
In connected mode, the same ancestors in two datasets share the same column in the linear model. In connected mode, the same ancestors in two datasets share the same column in the linear model.
**epistasis** ## Working set options
: Detect epistasis. Disabled by default.
The following configures the analysis domain.
**lg** *LINKAGE GROUP NAMES*
: Specify the list of linkage groupe to study.
**covar** *COVARIABLE NAMES*
: Specify the list of covariables to put in the model.
**traits** *TRAIT NAMES*
: Specify the list of traits to analyse.
**pleiotropy** *TOLERANCE* **pleiotropy** *PLEIOTROPIC_TRAIT_NAME* *TOLERANCE* *TRAIT_NAMES*
: Detect pleiotropic QTLs. Disabled by default. : Specify a pleiotropic trait. This trait will be added to the list of traits to analyze. 1.e-3 is a good default value for *TOLERANCE*.
## Processing options ## Processing options
...@@ -86,6 +109,9 @@ The standard pipeline is: ...@@ -86,6 +109,9 @@ The standard pipeline is:
3. QTLs detection 3. QTLs detection
4. effects estimation 4. effects estimation
**output-nppop**
: Compute the n-point Parental Origin Probabilities and exit. The results will be written under the **WORK_DIRECTORY/NAME.n-point** directory.
**qtl-threshold-permutations** *VALUE* **qtl-threshold-permutations** *VALUE*
: Set the number of permutations to compute the QTL threshold value in automatic mode. Default is **10000**. : Set the number of permutations to compute the QTL threshold value in automatic mode. Default is **10000**.
...@@ -104,6 +130,9 @@ The standard pipeline is: ...@@ -104,6 +130,9 @@ The standard pipeline is:
**step** *VALUE* **step** *VALUE*
: Step size in cM. Defaults to **1**. : Step size in cM. Defaults to **1**.
**lod-support** *VALUE*
: LOD support value. Defaults to **1**.
**skeleton** *MODE* *marker,...\ OR \ distance* **skeleton** *MODE* *marker,...\ OR \ distance*
: Setup the cofactor detection skeleton. Mode can be either *manual*, *auto* or *none*. : Setup the cofactor detection skeleton. Mode can be either *manual*, *auto* or *none*.
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <cstring> #include <cstring>
#include <unordered_map> #include <unordered_map>
#include <boost/dynamic_bitset.hpp> #include <boost/dynamic_bitset.hpp>
#include <gmp.h>
/* La spec est dans le code. */ /* La spec est dans le code. */
...@@ -369,6 +369,7 @@ struct table_descr { ...@@ -369,6 +369,7 @@ struct table_descr {
std::vector<state_index_type> offset_to_cursor; std::vector<state_index_type> offset_to_cursor;
uint64_t offset; uint64_t offset;
state_index_type mask; state_index_type mask;
bool unif;
inline inline
const genotype_comb_type::element_type& const genotype_comb_type::element_type&
...@@ -639,11 +640,14 @@ struct joint_variable_product_type { ...@@ -639,11 +640,14 @@ struct joint_variable_product_type {
tab.offset = 0; tab.offset = 0;
coordinates.resize(tab.variable_names.size()); coordinates.resize(tab.variable_names.size());
tab.offset_to_cursor.reserve(tab.data->size()); tab.offset_to_cursor.reserve(tab.data->size());
tab.unif = true;
double coef = tab.data->begin()->coef;
for (uint64_t i = 0; i < tab.data->size(); ++i) { for (uint64_t i = 0; i < tab.data->size(); ++i) {
get_coords_at(tab, i, coordinates); get_coords_at(tab, i, coordinates);
state_index_type cursor = compute_local_index(coordinates, tab); state_index_type cursor = compute_local_index(coordinates, tab);
tab.offset_to_cursor.push_back(cursor); tab.offset_to_cursor.push_back(cursor);
tab.domain_to_offset[cursor] = i; tab.domain_to_offset[cursor] = i;
tab.unif = tab.unif && std::abs(coef - tab.data->m_combination[i].coef) > _EPSILON;
} }
if (0) { if (0) {
std::stringstream ss; std::stringstream ss;
...@@ -881,33 +885,40 @@ struct joint_variable_product_type { ...@@ -881,33 +885,40 @@ struct joint_variable_product_type {
#endif #endif
inline inline
double void
compute_coef() compute_coef(mpf_t& accum)
{ {
auto ti = tables.begin(); auto ti = tables.begin();
auto tj = tables.end(); auto tj = tables.end();
double accum = ti->current_element().coef;
mpf_t coef;
mpf_init_set_d(accum, ti->current_element().coef);
mpf_init(coef);
for (++ti; ti != tj; ++ti) { for (++ti; ti != tj; ++ti) {
accum *= ti->current_element().coef; if (!ti->unif) {
mpf_set_d(coef, ti->current_element().coef);
mpf_mul(accum, accum, coef);
}
} }
return accum;
} }
inline inline
state_index_type state_index_type
next_state(state_index_type from) next_state(state_index_type from)
{ {
uint64_t valid = 0, all = (1 << tables.size()) - 1; // uint64_t valid = 0, all = (1 << tables.size()) - 1;
boost::dynamic_bitset<> valid;
valid.resize(tables.size(), 0);
size_t ti = 0; size_t ti = 0;
while (valid != all && !from.is_bad()) { while (!valid.all() && !from.is_bad()) {
/*MSG_DEBUG("valid " << valid << " all " << all << " table " << (*tables[ti].data));*/ // MSG_DEBUG("valid " << valid << " all " << all << " table " << (*tables[ti].data));
if (!move_cursor_if_state_is_valid(tables[ti], from)) { if (!move_cursor_if_state_is_valid(tables[ti], from)) {
auto range = find_offsets_around_cursor(tables[ti], tables[ti].local(from)); auto range = find_offsets_around_cursor(tables[ti], tables[ti].local(from));
/*MSG_DEBUG("offsets are " << range.first << " and " << range.second);*/ // MSG_DEBUG("offsets are " << range.first << " and " << range.second);
state_index_type state_index_type
c1 = merge_cursors(tables[ti], from, tables[ti].offset_to_cursor[range.first]), c1 = merge_cursors(tables[ti], from, tables[ti].offset_to_cursor[range.first]),
c2 = merge_cursors(tables[ti], from, tables[ti].offset_to_cursor[range.second]); c2 = merge_cursors(tables[ti], from, tables[ti].offset_to_cursor[range.second]);
/*MSG_DEBUG("from = " << dump(from) << " c1 = " << dump(c1, tables[ti]) << " c2 = " << dump(c2, tables[ti]));*/ // MSG_DEBUG("from = " << dump(from) << " c1 = " << dump(c1, tables[ti]) << " c2 = " << dump(c2, tables[ti]));
state_index_type tmp; // = std::min(c1, c2); state_index_type tmp; // = std::min(c1, c2);
if (c1 > from) { if (c1 > from) {
if (c2 > from) { if (c2 > from) {
...@@ -920,15 +931,16 @@ struct joint_variable_product_type { ...@@ -920,15 +931,16 @@ struct joint_variable_product_type {
} else { } else {
return state_index_type::bad(); return state_index_type::bad();
} }
/*MSG_DEBUG("new lower bound is now " << dump(tmp));*/ // MSG_DEBUG("new lower bound is now " << dump(tmp));
if (tmp < from) { if (tmp < from) {
return state_index_type::bad(); return state_index_type::bad();
} }
from = tmp; from = tmp;
valid = 0; valid.reset();
// valid = 0;
/*ti = !ti;*/ /*ti = !ti;*/
} else { } else {
valid |= 1 << ti; valid.set(ti);
} }
++ti; ++ti;
ti %= tables.size(); ti %= tables.size();
...@@ -964,6 +976,8 @@ struct joint_variable_product_type { ...@@ -964,6 +976,8 @@ struct joint_variable_product_type {
genotype_comb_type genotype_comb_type
compute_generic() compute_generic()
{ {
if (invalid_product) { return {}; }
if (total_bits >= 32) { if (total_bits >= 32) {
std::vector<size_t> output_variable_indices; std::vector<size_t> output_variable_indices;
for (size_t i = 0; i < output_variables_in_use.size(); ++i) { for (size_t i = 0; i < output_variables_in_use.size(); ++i) {
...@@ -1010,7 +1024,6 @@ struct joint_variable_product_type { ...@@ -1010,7 +1024,6 @@ struct joint_variable_product_type {
} }
key_computing_variant key_update; key_computing_variant key_update;
if (invalid_product) { return {}; }
genotype_comb_type ret; genotype_comb_type ret;
size_t counter = 0; size_t counter = 0;
...@@ -1019,27 +1032,39 @@ struct joint_variable_product_type { ...@@ -1019,27 +1032,39 @@ struct joint_variable_product_type {
/*MSG_DEBUG(key.size()); MSG_QUEUE_FLUSH();*/ /*MSG_DEBUG(key.size()); MSG_QUEUE_FLUSH();*/
state_index_type z; state_index_type z;
z.reset(); z.reset();
state_index_type cursor = next_state(z), last = cursor; MSG_DEBUG("Initializing cursor");
std::unordered_map<genotype_comb_type::key_list, double> values; state_index_type
double norm = 0; cursor = next_state(z),
last = cursor;
std::unordered_map<genotype_comb_type::key_list, mpf_t> values;
mpf_t norm;
mpf_init(norm);
if (cursor.is_bad()) { if (cursor.is_bad()) {
return ret; return ret;
} }
for (;;) mpf_t accum;
{ mpf_init(accum);
for (;;) {
/*if (++counter > 10) {*/ /*if (++counter > 10) {*/
/*break;*/ /*break;*/
/*}*/ /*}*/
/*jvp.compute_coordinates(cursor, coords);*/ /*jvp.compute_coordinates(cursor, coords);*/
/*MSG_DEBUG(std::bitset<7>(cursor) << ' ' << coords[0] << ' ' << coords[1] << ' ' << coords[2]);*/ /*MSG_DEBUG(std::bitset<7>(cursor) << ' ' << coords[0] << ' ' << coords[1] << ' ' << coords[2]);*/
/*MSG_DEBUG("COMPUTE @" << dump(cursor));*/ // MSG_DEBUG("COMPUTE @" << dump(cursor));
key_update(*this, key); key_update(*this, key);
double coef = compute_coef(); mpf_clear(accum);
if (coef != 0) { compute_coef(accum);
norm += coef; if (mpf_cmp_d(accum, 0)) {
values[key] += coef; mpf_add(norm, norm, accum);
auto it = values.find(key);
mpf_t& value = values[key];
if (it == values.end()) {
mpf_init_set(value, accum);
} else {
mpf_add(value, value, accum);
}
} }
++counter; ++counter;
...@@ -1062,15 +1087,17 @@ struct joint_variable_product_type { ...@@ -1062,15 +1087,17 @@ struct joint_variable_product_type {
} }
} }
ret.m_combination.reserve(values.size()); ret.m_combination.reserve(values.size());
if (norm > 0) { if (mpf_cmp_d(norm, 0) > 0) {
norm = 1. / norm; mpf_ui_div(norm, 1, norm);
// norm = 1. / norm;
} }
for (const auto& kv: values) { for (const auto& kv: values) {
ret.m_combination.emplace_back(kv.first, kv.second * norm); mpf_mul(accum, kv.second, norm);
ret.m_combination.emplace_back(kv.first, mpf_get_d(accum));
/*ret.m_combination.emplace_back(kv.first, kv.second);*/ /*ret.m_combination.emplace_back(kv.first, kv.second);*/
} }
std::sort(ret.m_combination.begin(), ret.m_combination.end()); std::sort(ret.m_combination.begin(), ret.m_combination.end());
/*MSG_DEBUG("Computed " << counter << " coefficients, projected onto " << ret.size() << " elements");*/ MSG_DEBUG("Computed " << counter << " coefficients, projected onto " << ret.size() << " elements");
return ret; return ret;
} }
......
...@@ -1494,18 +1494,20 @@ struct instance_type { ...@@ -1494,18 +1494,20 @@ struct instance_type {
return sub_instances[op.emitter]->compute(op.receiver, domains); return sub_instances[op.emitter]->compute(op.receiver, domains);
} }
multiple_product_type mp; multiple_product_type mp;
/*MSG_DEBUG("evidence: " << evidence[op.emitter]);*/ MSG_DEBUG("evidence: " << evidence[op.emitter]);
mp.add(evidence[op.emitter]); mp.add(evidence[op.emitter]);
/*MSG_DEBUG("internal evidence: " << internal_evidence[op.emitter]);*/ MSG_DEBUG("internal evidence: " << internal_evidence[op.emitter]);
mp.add(internal_evidence[op.emitter]); mp.add(internal_evidence[op.emitter]);
/*MSG_DEBUG("table: " << tables[op.emitter]);*/ // MSG_DEBUG("table: " << tables[op.emitter]);
/*MSG_DEBUG("incoming domains: " << op.incoming_domains);*/ /*MSG_DEBUG("incoming domains: " << op.incoming_domains);*/
MSG_DEBUG("Add emitter");
mp.add(tables[op.emitter]); mp.add(tables[op.emitter]);
auto inci = op.incoming_messages.begin(), incj = op.incoming_messages.end(); auto inci = op.incoming_messages.begin(), incj = op.incoming_messages.end();
auto domi = op.incoming_domains.begin(); auto domi = op.incoming_domains.begin();
std::vector<message_type> msgs; std::vector<message_type> msgs;
msgs.reserve(op.incoming_messages.size()); msgs.reserve(op.incoming_messages.size());
for (; inci != incj; ++inci, ++domi) { for (; inci != incj; ++inci, ++domi) {
MSG_DEBUG("Add incoming");
msgs.emplace_back(messages[*inci] % *domi); msgs.emplace_back(messages[*inci] % *domi);
/*MSG_DEBUG("input #" << (*inci) << ": raw " << messages[*inci]);*/ /*MSG_DEBUG("input #" << (*inci) << ": raw " << messages[*inci]);*/
/*MSG_DEBUG("input #" << (*inci) << ": dom " << (*domi));*/ /*MSG_DEBUG("input #" << (*inci) << ": dom " << (*domi));*/
...@@ -1513,6 +1515,7 @@ struct instance_type { ...@@ -1513,6 +1515,7 @@ struct instance_type {
/*mp.add(msgs.back());*/ /*mp.add(msgs.back());*/
mp.add(messages[*inci]); mp.add(messages[*inci]);
} }
MSG_DEBUG("Compute.");
auto ret = mp.compute(op.output, domains); auto ret = mp.compute(op.output, domains);
MSG_DEBUG("" << ret); MSG_DEBUG("" << ret);
MSG_DEBUG(""); MSG_DEBUG("");
......
...@@ -34,7 +34,7 @@ extern "C" { ...@@ -34,7 +34,7 @@ extern "C" {
#include <ftw.h> #include <ftw.h>
} }
#define OUT(__x__) do { msg_handler_t::cout() << __x__ << std::endl; } while (0) #define OUT(__x__) do { msg_handler_t::cout() << __x__; } while (0)
/*#include "computations.h"*/ /*#include "computations.h"*/
......
...@@ -525,11 +525,16 @@ inline ...@@ -525,11 +525,16 @@ inline
std::vector<trait> std::vector<trait>
assemble_traits(const std::vector<trait>& src, const std::vector<std::string>& with_traits, const std::vector<pleiotropy_descr>& pleio) { assemble_traits(const std::vector<trait>& src, const std::vector<std::string>& with_traits, const std::vector<pleiotropy_descr>& pleio) {
std::vector<trait> ret(src.size() + pleio.size()); std::vector<trait> ret(src.size() + pleio.size());
auto it = std::copy_if(src.begin(), src.end(), ret.begin(), [&](const trait& t) { return std::find(with_traits.begin(), with_traits.end(), t.name) != with_traits.end(); }); MSG_DEBUG("with_traits.empty() ? " << with_traits.empty());
auto it = with_traits.empty()