diff options
author | couriersud <couriersud@users.noreply.github.com> | 2022-05-11 04:09:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-11 12:09:08 +1000 |
commit | 4c187626e322611202d2f0738babc53251eefb4a (patch) | |
tree | bb8938df9bb5cb97a9eda19ca43816c8ce26d7d2 /src/lib | |
parent | a1604f3b29983a4b84a3785bcbb9ebe051389241 (diff) |
netlist: Fixed standalone nltool building with nvcc. (#9731)
nvcc 11.3 (latest cuda tools) has an issue with some auto x(some
variable) declarations.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/netlist/build/makefile | 6 | ||||
-rw-r--r-- | src/lib/netlist/core/base_objects.h | 8 | ||||
-rw-r--r-- | src/lib/netlist/plib/gmres.h | 4 | ||||
-rw-r--r-- | src/lib/netlist/plib/pconfig.h | 5 | ||||
-rw-r--r-- | src/lib/netlist/plib/pmath.h | 2 | ||||
-rw-r--r-- | src/lib/netlist/plib/pmatrix_cr.h | 16 | ||||
-rw-r--r-- | src/lib/netlist/plib/prandom.h | 6 | ||||
-rw-r--r-- | src/lib/netlist/plib/psource.h | 2 | ||||
-rw-r--r-- | src/lib/netlist/plib/pstream.h | 2 | ||||
-rw-r--r-- | src/lib/netlist/plib/pstring.cpp | 2 | ||||
-rw-r--r-- | src/lib/netlist/prg/nlwav.cpp | 2 | ||||
-rw-r--r-- | src/lib/netlist/solver/nld_matrix_solver_ext.h | 12 | ||||
-rw-r--r-- | src/lib/netlist/solver/nld_ms_gmres.h | 2 |
13 files changed, 36 insertions, 33 deletions
diff --git a/src/lib/netlist/build/makefile b/src/lib/netlist/build/makefile index 549ec9c5ace..f011532a114 100644 --- a/src/lib/netlist/build/makefile +++ b/src/lib/netlist/build/makefile @@ -300,11 +300,11 @@ clang-libc: LDEXTRAFLAGS=-stdlib=libc++ nvcc: - $(MAKE) CC=/usr/local/cuda-10.2/bin/nvcc LD=/usr/local/cuda-10.2/bin/nvcc \ - OBJ=obj/nvcc CEXTRAFLAGS="--std c++14 -x cu -DNVCCBUILD=102 --expt-extended-lambda \ + $(MAKE) CC=/usr/local/cuda-11.3/bin/nvcc LD=/usr/local/cuda-11.3/bin/nvcc \ + OBJ=obj/nvcc CEXTRAFLAGS="--std c++17 -x cu -DNVCCBUILD=113 --expt-extended-lambda \ --expt-relaxed-constexpr --default-stream per-thread --restrict \ --ftemplate-depth 1024 \ - -Xcompiler -O6 -Xcompiler -march=native -ccbin g++-8 " \ + -Xcompiler -O6 -Xcompiler -march=native -ccbin g++-9 " \ DEPENDCC=g++ mingw: diff --git a/src/lib/netlist/core/base_objects.h b/src/lib/netlist/core/base_objects.h index 4317df35af7..a9f8d41dfd0 100644 --- a/src/lib/netlist/core/base_objects.h +++ b/src/lib/netlist/core/base_objects.h @@ -28,6 +28,8 @@ namespace netlist::detail { { using value_type = T; using key_type = const C *; + using store_type = std::unordered_map<key_type, value_type>; + static void add(key_type obj, const value_type &aname) noexcept { store().insert({obj, aname}); @@ -37,7 +39,7 @@ namespace netlist::detail { { try { - auto ret(store().find(obj)); + typename store_type::iterator ret(store().find(obj)); if (ret == store().end()) return nullptr; return &ret->second; @@ -54,9 +56,9 @@ namespace netlist::detail { store().erase(store().find(obj)); } - static std::unordered_map<key_type, value_type> &store() noexcept + static store_type &store() noexcept { - static std::unordered_map<key_type, value_type> lstore; + static store_type lstore; return lstore; } diff --git a/src/lib/netlist/plib/gmres.h b/src/lib/netlist/plib/gmres.h index 78d6c0f4a35..1beb4b20041 100644 --- a/src/lib/netlist/plib/gmres.h +++ b/src/lib/netlist/plib/gmres.h @@ -258,7 +258,7 @@ namespace plib //------------------------------------------------------------------------ std::size_t itr_used = 0; - auto rho_delta(plib::constants<float_type>::zero()); + float_type rho_delta(plib::constants<float_type>::zero()); const std::size_t n = size(); @@ -390,7 +390,7 @@ namespace plib // x += m_v[j] * m_y[j] for (std::size_t i = k + 1; i-- > 0;) { - auto tmp(m_g[i]); + auto tmp = m_g[i]; const auto htii=plib::reciprocal(m_ht[i][i]); for (std::size_t j = i + 1; j <= k; j++) tmp -= m_ht[i][j] * m_y[j]; diff --git a/src/lib/netlist/plib/pconfig.h b/src/lib/netlist/plib/pconfig.h index 049a975f21b..be56ad86507 100644 --- a/src/lib/netlist/plib/pconfig.h +++ b/src/lib/netlist/plib/pconfig.h @@ -115,16 +115,17 @@ // //============================================================ - #if (NVCCBUILD > 0) - #if NVCCBUILD == 101 + #if NVCCBUILD >= 101 #define NVCC_CONSTEXPR constexpr #else #define NVCC_CONSTEXPR constexpr #endif + #if NVCCBUILD < 113 #if __cplusplus != 201402L #error nvcc - use c++14 to compile #endif + #endif #else #define NVCC_CONSTEXPR constexpr #if __cplusplus == 201103L diff --git a/src/lib/netlist/plib/pmath.h b/src/lib/netlist/plib/pmath.h index e3f2d27fd06..d28090079e3 100644 --- a/src/lib/netlist/plib/pmath.h +++ b/src/lib/netlist/plib/pmath.h @@ -256,7 +256,7 @@ namespace plib static constexpr std::enable_if_t<std::is_floating_point<T>::value, T> signum(T v, T r = static_cast<T>(1)) { - constexpr const auto z(static_cast<T>(0)); + constexpr const T z(static_cast<T>(0)); return (v > z) ? r : ((v < z) ? -r : v); } diff --git a/src/lib/netlist/plib/pmatrix_cr.h b/src/lib/netlist/plib/pmatrix_cr.h index 29b04ef213c..0456190bb1b 100644 --- a/src/lib/netlist/plib/pmatrix_cr.h +++ b/src/lib/netlist/plib/pmatrix_cr.h @@ -564,8 +564,8 @@ namespace plib // printf("occ %d\n", (int)i); for (auto i_k = base_type::row_idx[i]; i_k < base_type::diag[i]; i_k++) { - const auto k(base_type::col_idx[i_k]); - const auto p_k_end(base_type::row_idx[k + 1]); + const index_type k(base_type::col_idx[i_k]); + const index_type p_k_end(base_type::row_idx[k + 1]); const typename base_type::value_type LUp_i_k = base_type::A[i_k] = base_type::A[i_k] / base_type::A[base_type::diag[k]]; std::size_t k_j(base_type::diag[k] + 1); @@ -574,8 +574,8 @@ namespace plib while (i_j < p_i_end && k_j < p_k_end ) // pj = (i, j) { // we can assume that within a row ja increases continuously - const std::size_t c_i_j(base_type::col_idx[i_j]); // row i, column j - const auto c_k_j(base_type::col_idx[k_j]); // row k, column j + const index_type c_i_j(base_type::col_idx[i_j]); // row i, column j + const index_type c_k_j(base_type::col_idx[k_j]); // row k, column j if (c_k_j == c_i_j) base_type::A[i_j] -= LUp_i_k * base_type::A[k_j]; @@ -616,8 +616,8 @@ namespace plib for (std::size_t i = 1; i < base_type::size(); ++i ) { typename base_type::value_type tmp(0); - const auto j1(base_type::row_idx[i]); - const auto j2(base_type::diag[i]); + const index_type j1(base_type::row_idx[i]); + const index_type j2(base_type::diag[i]); for (auto j = j1; j < j2; ++j ) tmp += base_type::A[j] * r[base_type::col_idx[j]]; @@ -627,8 +627,8 @@ namespace plib for (std::size_t i = base_type::size(); i-- > 0; ) { typename base_type::value_type tmp(0); - const auto di(base_type::diag[i]); - const auto j2(base_type::row_idx[i+1]); + const index_type di(base_type::diag[i]); + const index_type j2(base_type::row_idx[i+1]); for (std::size_t j = di + 1; j < j2; j++ ) tmp += base_type::A[j] * r[base_type::col_idx[j]]; r[i] = (r[i] - tmp) / base_type::A[di]; diff --git a/src/lib/netlist/plib/prandom.h b/src/lib/netlist/plib/prandom.h index 6f0aa9c9a6b..03e066f94cd 100644 --- a/src/lib/netlist/plib/prandom.h +++ b/src/lib/netlist/plib/prandom.h @@ -123,8 +123,8 @@ namespace plib template <typename FT, typename T> FT normalize_uniform(T &p, FT m = constants<FT>::one(), FT b = constants<FT>::zero()) noexcept { - constexpr const auto mmin(narrow_cast<FT>(T::min())); - constexpr const auto mmax(narrow_cast<FT>(T::max())); + constexpr const FT mmin(narrow_cast<FT>(T::min())); + constexpr const FT mmax(narrow_cast<FT>(T::max())); // -> 0 to a return (narrow_cast<FT>(p())- mmin) / (mmax - mmin) * m - b; } @@ -206,7 +206,7 @@ namespace plib // double: 1.000000e-305 // float: 9.999999e-37 // FIXME: with 128 bit randoms log(s)/w will fail 1/(2^128) ~ 2.9e-39 - const auto m(m_stddev * plib::sqrt(-constants<FT>::two() * plib::log(s)/s)); + const FT m(m_stddev * plib::sqrt(-constants<FT>::two() * plib::log(s)/s)); m_buf[i] = /*mean+*/ m * v1; m_buf[i+1] = /*mean+*/ m * v2; } diff --git a/src/lib/netlist/plib/psource.h b/src/lib/netlist/plib/psource.h index 86bef9a03fd..a26480aaad9 100644 --- a/src/lib/netlist/plib/psource.h +++ b/src/lib/netlist/plib/psource.h @@ -131,7 +131,7 @@ namespace plib { static_assert(std::is_base_of<psource_t, S>::value, "S must inherit from plib::psource_t"); - auto src(std::make_unique<S>(std::forward<Args>(args)...)); + auto src = std::make_unique<S>(std::forward<Args>(args)...); m_collection.push_back(std::move(src)); } diff --git a/src/lib/netlist/plib/pstream.h b/src/lib/netlist/plib/pstream.h index 4e4d0c9f8bb..0d1545e58b3 100644 --- a/src/lib/netlist/plib/pstream.h +++ b/src/lib/netlist/plib/pstream.h @@ -299,7 +299,7 @@ public: template <typename T> void write(const std::vector<T> &val) { - const auto sz(val.size()); + const typename std::vector<T>::size_type sz(val.size()); write(sz); ostream_write(m_strm, val.data(), sz); } diff --git a/src/lib/netlist/plib/pstring.cpp b/src/lib/netlist/plib/pstring.cpp index 78614162fa0..7d5d5a7dbc7 100644 --- a/src/lib/netlist/plib/pstring.cpp +++ b/src/lib/netlist/plib/pstring.cpp @@ -83,7 +83,7 @@ typename pstring_t<F>::size_type pstring_t<F>::find(const pstring_t &search, siz auto istart = std::next(begin(), static_cast<difference_type>(start)); for (; istart != end(); ++istart) { - auto itc(istart); + auto itc = istart; auto cmp = search.begin(); while (itc != end() && cmp != search.end() && *itc == *cmp) { diff --git a/src/lib/netlist/prg/nlwav.cpp b/src/lib/netlist/prg/nlwav.cpp index 886fed0a306..9685e87bd97 100644 --- a/src/lib/netlist/prg/nlwav.cpp +++ b/src/lib/netlist/prg/nlwav.cpp @@ -88,7 +88,7 @@ public: sample *= mmax; sample = std::max(mmin, sample); sample = std::min(mmax, sample); - const auto dest(static_cast<T>(sample)); + const T dest(static_cast<T>(sample)); write(dest); } diff --git a/src/lib/netlist/solver/nld_matrix_solver_ext.h b/src/lib/netlist/solver/nld_matrix_solver_ext.h index 4c43db74208..f0bef62b0a9 100644 --- a/src/lib/netlist/solver/nld_matrix_solver_ext.h +++ b/src/lib/netlist/solver/nld_matrix_solver_ext.h @@ -140,13 +140,13 @@ namespace netlist::solver // and thus belong into a different calculation. This applies to all solvers. const std::size_t iN = size(); - const auto reltol(static_cast<float_type>(m_params.m_reltol)); - const auto vntol(static_cast<float_type>(m_params.m_vntol)); + const float_type reltol(static_cast<float_type>(m_params.m_reltol)); + const float_type vntol(static_cast<float_type>(m_params.m_vntol)); for (std::size_t i = 0; i < iN; i++) { - const auto vold(static_cast<float_type>(this->m_terms[i].getV())); - const auto vnew(m_new_V[i]); - const auto tol(vntol + reltol * std::max(plib::abs(vnew),plib::abs(vold))); + const float_type vold(static_cast<float_type>(this->m_terms[i].getV())); + const float_type vnew(m_new_V[i]); + const float_type tol(vntol + reltol * std::max(plib::abs(vnew),plib::abs(vold))); if (plib::abs(vnew - vold) > tol) return true; } @@ -263,7 +263,7 @@ namespace netlist::solver for (std::size_t i = 0; i < railstart; i++) *tcr_r[i] += static_cast<FT>(go[i]); - auto RHS_t(std::accumulate(Idr, Idr + term_count, plib::constants<source_type>::zero())); + auto RHS_t = std::accumulate(Idr, Idr + term_count, plib::constants<source_type>::zero()); for (std::size_t i = railstart; i < term_count; i++) RHS_t += (- go[i]) * *cnV[i]; diff --git a/src/lib/netlist/solver/nld_ms_gmres.h b/src/lib/netlist/solver/nld_ms_gmres.h index cb9f1f68cba..c7579313939 100644 --- a/src/lib/netlist/solver/nld_ms_gmres.h +++ b/src/lib/netlist/solver/nld_ms_gmres.h @@ -108,7 +108,7 @@ namespace netlist::solver this->m_new_V[k] = static_cast<float_type>(this->m_terms[k].getV()); } - const auto accuracy(static_cast<float_type>(this->m_params.m_accuracy)); + const float_type accuracy(static_cast<float_type>(this->m_params.m_accuracy)); auto iter = std::max(plib::constants<std::size_t>::one(), this->m_params.m_gs_loops()); auto gsl = m_gmres.solve(m_ops, this->m_new_V, this->m_RHS, iter, accuracy); |