From b13e02f9751424dfc9ce6070676e2e318087a991 Mon Sep 17 00:00:00 2001 From: couriersud Date: Sat, 9 Apr 2016 03:37:52 +0200 Subject: [PATCH] Align with standalone-build. --- nl_examples/kidniki.c | 2 +- src/lib/netlist/build/makefile | 4 ++-- src/lib/netlist/solver/nld_ms_direct.h | 21 ++++++++++----------- src/lib/netlist/solver/nld_ms_sm.h | 6 +++--- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/nl_examples/kidniki.c b/nl_examples/kidniki.c index 6616a5c2a5d..c4ae39f68d9 100644 --- a/nl_examples/kidniki.c +++ b/nl_examples/kidniki.c @@ -4,7 +4,7 @@ #include "netlist/devices/nld_system.h" #include "netlist/analog/nld_bjt.h" -#define USE_FRONTIERS 0 +#define USE_FRONTIERS 1 #define USE_FIXED_STV 1 NETLIST_START(dummy) diff --git a/src/lib/netlist/build/makefile b/src/lib/netlist/build/makefile index be49d098a0d..684b2687ba1 100644 --- a/src/lib/netlist/build/makefile +++ b/src/lib/netlist/build/makefile @@ -20,8 +20,8 @@ CDEFS = -DPSTANDALONE=1 -DPTR64=1 #-Werror #CFLAGS = $(LTO) -g -O3 -std=c++98 -Doverride="" -march=native -msse4.2 -Wall -Wpedantic -Wsign-compare -Wextra -Wno-long-long -Wno-unused-parameter -Wno-unused-result -Wno-variadic-macros -I.. #LDFLAGS = $(LTO) -g -O3 -std=c++98 -CFLAGS = $(LTO) -g -O3 -std=c++11 -I.. -Wall -Wpedantic -Wsign-compare -Wextra -Wno-unused-parameter -LDFLAGS = $(LTO) -g -O3 -std=c++11 +CFLAGS = $(LTO) -g -O3 -std=c++11 -march=native -I.. -Wall -Wpedantic -Wsign-compare -Wextra -Wno-unused-parameter +LDFLAGS = $(LTO) -g -O3 -std=c++11 -lpthread CC = @g++-5 LD = @g++-5 diff --git a/src/lib/netlist/solver/nld_ms_direct.h b/src/lib/netlist/solver/nld_ms_direct.h index f0c892ab698..77deb330544 100644 --- a/src/lib/netlist/solver/nld_ms_direct.h +++ b/src/lib/netlist/solver/nld_ms_direct.h @@ -50,8 +50,7 @@ struct ti_t }; static ti_t ti[MAXTHR]; -//static std::thread thr[MAXTHR]; -static std::thread thr[num_thr]; +static std::thread thr[MAXTHR]; int thr_init = 0; @@ -485,15 +484,15 @@ void matrix_solver_direct_t::build_LE_RHS() nl_double rhsk_a = 0.0; nl_double rhsk_b = 0.0; - const int terms_count = m_terms[k]->count(); + const unsigned terms_count = m_terms[k]->count(); const nl_double * RESTRICT go = m_terms[k]->go(); const nl_double * RESTRICT Idr = m_terms[k]->Idr(); const nl_double * const * RESTRICT other_cur_analog = m_terms[k]->other_curanalog(); - for (int i = 0; i < terms_count; i++) + for (unsigned i = 0; i < terms_count; i++) rhsk_a = rhsk_a + Idr[i]; - for (int i = m_terms[k]->m_railstart; i < terms_count; i++) + for (unsigned i = m_terms[k]->m_railstart; i < terms_count; i++) //rhsk = rhsk + go[i] * terms[i]->m_otherterm->net().as_analog().Q_Analog(); rhsk_b = rhsk_b + go[i] * *other_cur_analog[i]; @@ -587,9 +586,9 @@ void matrix_solver_direct_t::LE_solve() { #if TEST_PARALLEL const unsigned eb = m_terms[i]->m_nzbd.size(); - if (eb > 16) + if (eb > 0) { - printf("here %d\n", eb); + //printf("here %d\n", eb); unsigned chunks = (eb) / (num_thr + 1); for (int p=0; p < num_thr + 1; p++) { @@ -617,10 +616,10 @@ void matrix_solver_direct_t::LE_solve() /* Eliminate column i from row j */ - for (auto j : nzbd) + for (auto & j : nzbd) { const nl_double f1 = - A(j,i) * f; - for (auto k : nzrd) + for (auto & k : nzrd) A(j,k) += A(i,k) * f1; //RHS(j) += RHS(i) * f1; } @@ -632,10 +631,10 @@ void matrix_solver_direct_t::LE_solve() /* Eliminate column i from row j */ - for (auto j : nzbd) + for (auto & j : nzbd) { const nl_double f1 = - A(j,i) * f; - for (auto k : nzrd) + for (auto & k : nzrd) A(j,k) += A(i,k) * f1; //RHS(j) += RHS(i) * f1; } diff --git a/src/lib/netlist/solver/nld_ms_sm.h b/src/lib/netlist/solver/nld_ms_sm.h index 3dd440d4b15..c515fd1e80f 100644 --- a/src/lib/netlist/solver/nld_ms_sm.h +++ b/src/lib/netlist/solver/nld_ms_sm.h @@ -369,15 +369,15 @@ void matrix_solver_sm_t::build_LE_RHS() nl_double rhsk_a = 0.0; nl_double rhsk_b = 0.0; - const int terms_count = m_terms[k]->count(); + const unsigned terms_count = m_terms[k]->count(); const nl_double * RESTRICT go = m_terms[k]->go(); const nl_double * RESTRICT Idr = m_terms[k]->Idr(); const nl_double * const * RESTRICT other_cur_analog = m_terms[k]->other_curanalog(); - for (int i = 0; i < terms_count; i++) + for (unsigned i = 0; i < terms_count; i++) rhsk_a = rhsk_a + Idr[i]; - for (int i = m_terms[k]->m_railstart; i < terms_count; i++) + for (unsigned i = m_terms[k]->m_railstart; i < terms_count; i++) //rhsk = rhsk + go[i] * terms[i]->m_otherterm->net().as_analog().Q_Analog(); rhsk_b = rhsk_b + go[i] * *other_cur_analog[i];