author
int64
658
755k
date
stringlengths
19
19
timezone
int64
-46,800
43.2k
hash
stringlengths
40
40
message
stringlengths
5
490
mods
list
language
stringclasses
20 values
license
stringclasses
3 values
repo
stringlengths
5
68
original_message
stringlengths
12
491
8,490
11.01.2017 09:57:14
-3,600
02a452f485bdcef69189ebcb6b3f5e40c37d3eb4
Add an installation guide for Windows.
[ { "change_type": "ADD", "old_path": null, "new_path": "doc/pages/Windows_install.md", "diff": "+# Install on Windows\n+\n+## Download & install Git\n+\n+> https://git-scm.com/download/win\n+\n+Next next next... Install!\n+\n+## Download & install MinGW64\n+\n+> https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/6.2.0/threads-posix/seh/x86_64-6.2.0-release-posix-seh-rt_v5-rev1.7z\n+\n+Unzip the archive.\n+Copy the mingw64 folder in the /C/Programmes/Git/mingw64 folder (erase all duplicated files).\n+\n+## Download & install CMake\n+\n+> https://cmake.org/files/v3.7/cmake-3.7.1-win64-x64.msi\n+\n+Next next next... Install!\n+\n+Launch `Git Bash`.\n+Add cmake to the PATH:\n+\n+ $ echo '#!/bin/bash' >> ~/.bashrc\n+ $ echo 'export PATH=$PATH:\"C:\\Program Files\\CMake\\bin\"' >> ~/.bashrc\n+ $ source ~/.bashrc\n+\n+## Install AFF3CT\n+\n+ $ cd ~/\n+ $ git clone https://github.com/aff3ct/aff3ct.git\n+ $ cd aff3ct\n+ $ mkdir build\n+ $ cd build\n+ $ cmake .. -G\"MinGW Makefiles\"\n+ $ cmake .. -DCMAKE_CXX_COMPILER=g++.exe -DCMAKE_CC_COMPILER=gcc.exe -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -DMULTI_PREC -march=native\" -DCMAKE_CXX_FLAGS_RELEASE=\"-Ofast\"\n+ $ mingw32-make -j2\n+\n+## Install Python 3\n+\n+https://www.python.org/ftp/python/3.6.0/python-3.6.0.exe\n+\n+ $ echo 'export PATH=$PATH:~/AppData/Local/Programs/Python/Python36-32/' >> ~/.bashrc\n+ $ echo 'export PATH=$PATH:~/AppData/Local/Programs/Python/Python36-32/Scripts/' >> ~/.bashrc\n+ $ source ~/.bashrc\n+ $ pip3.6 install pyqt5\n+ $ pip3.6 install numpy\n+\n+## Run PyBER\n+\n+ $ cd ~/aff3ct/plotter/PyBER/\n+ $ python pyBER.py &\n" } ]
C++
MIT License
aff3ct/aff3ct
Add an installation guide for Windows.
8,490
11.01.2017 14:55:12
-3,600
70c3a21928f8d45ce1e5dc8878ef730cf165a888
Improve a little bit the windows install guide.
[ { "change_type": "MODIFY", "old_path": "doc/pages/Windows_install.md", "new_path": "doc/pages/Windows_install.md", "diff": "@@ -39,7 +39,9 @@ Add cmake to the PATH:\n## Install Python 3\n-https://www.python.org/ftp/python/3.6.0/python-3.6.0.exe\n+> https://www.python.org/ftp/python/3.6.0/python-3.6.0.exe\n+\n+Next next next... Install!\n$ echo 'export PATH=$PATH:~/AppData/Local/Programs/Python/Python36-32/' >> ~/.bashrc\n$ echo 'export PATH=$PATH:~/AppData/Local/Programs/Python/Python36-32/Scripts/' >> ~/.bashrc\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve a little bit the windows install guide.
8,490
11.01.2017 18:09:55
-3,600
7102c3b218884bd52eb65b586a33580924a17a01
Fix Python install guide.
[ { "change_type": "MODIFY", "old_path": "doc/pages/Windows_install.md", "new_path": "doc/pages/Windows_install.md", "diff": "@@ -39,16 +39,10 @@ Add cmake to the PATH:\n## Install Python 3\n-> https://www.python.org/ftp/python/3.6.0/python-3.6.0.exe\n+> https://repo.continuum.io/archive/Anaconda3-4.2.0-Windows-x86_64.exe\nNext next next... Install!\n- $ echo 'export PATH=$PATH:~/AppData/Local/Programs/Python/Python36-32/' >> ~/.bashrc\n- $ echo 'export PATH=$PATH:~/AppData/Local/Programs/Python/Python36-32/Scripts/' >> ~/.bashrc\n- $ source ~/.bashrc\n- $ pip3.6 install pyqt5\n- $ pip3.6 install numpy\n-\n## Run PyBER\n$ cd ~/aff3ct/plotter/PyBER/\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix Python install guide.
8,490
06.01.2017 17:15:36
-3,600
ce57fbd8af25412574b7eb978dccad5e2152e187
First implem. of the hard input LDPC Gallager A decoder.
[ { "change_type": "MODIFY", "old_path": "src/Launcher/BFER/LDPC/Launcher_BFER_LDPC.cpp", "new_path": "src/Launcher/BFER/LDPC/Launcher_BFER_LDPC.cpp", "diff": "@@ -35,7 +35,7 @@ void Launcher_BFER_LDPC<B,R,Q>\n// ------------------------------------------------------------------------------------------------------- decoder\nthis->opt_args[{\"dec-type\", \"D\"}].push_back(\"BP, BP_FLOODING, BP_LAYERED\");\n- this->opt_args[{\"dec-implem\" }].push_back(\"ONMS, SPA, LSPA\");\n+ this->opt_args[{\"dec-implem\" }].push_back(\"ONMS, SPA, LSPA, GALA\");\nthis->opt_args[{\"dec-ite\", \"i\"}] =\n{\"positive_int\",\n\"maximal number of iterations in the turbo decoder.\"};\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A.cpp", "diff": "+#include \"Decoder_LDPC_BP_flooding_Gallager_A.hpp\"\n+\n+#include <limits>\n+\n+#include \"Tools/Display/bash_tools.h\"\n+#include \"Tools/Math/utils.h\"\n+\n+template <typename B, typename R>\n+Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n+::Decoder_LDPC_BP_flooding_Gallager_A(const int &K, const int &N, const int& n_ite,\n+ const AList_reader &alist_data,\n+ const bool enable_syndrome,\n+ const int n_frames,\n+ const std::string name)\n+: Decoder_SISO<B,R> (K, N, n_frames, 1, name ),\n+ n_ite (n_ite ),\n+ n_V_nodes (N ), // same as N but more explicit\n+ n_C_nodes ((int)alist_data.get_n_CN() ),\n+ n_branches ((int)alist_data.get_n_branches() ),\n+ enable_syndrome (enable_syndrome ),\n+\n+ n_variables_per_parity (alist_data.get_n_VN_per_CN() ),\n+ n_parities_per_variable(alist_data.get_n_CN_per_VN() ),\n+ transpose (alist_data.get_branches_transpose()),\n+\n+ Y_N (N ),\n+ C_to_V (this->n_branches, 0),\n+ V_to_C (this->n_branches, 0)\n+{\n+ assert(N == (int)alist_data.get_n_VN());\n+ assert(n_ite > 0);\n+}\n+\n+template <typename B, typename R>\n+Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n+::~Decoder_LDPC_BP_flooding_Gallager_A()\n+{\n+}\n+\n+template <typename B, typename R>\n+void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n+::load(const mipp::vector<R>& Y_N)\n+{\n+ assert(Y_N.size() >= this->Y_N.size());\n+\n+ for (auto i = 0; i < this->N; i++)\n+ this->Y_N[i] = Y_N[i] < 0;\n+}\n+\n+template <typename B, typename R>\n+void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n+::hard_decode()\n+{\n+ // actual decoding\n+ for (auto ite = 0; ite < this->n_ite; ite++)\n+ {\n+ // beginning of the iteration upon all the matrix lines\n+ auto C_to_V_ptr = this->C_to_V.data();\n+ auto V_to_C_ptr = this->V_to_C.data();\n+\n+ // V -> C\n+ for (auto i = 0; i < this->n_V_nodes; i++)\n+ {\n+ // VN node accumulate all the incoming messages\n+ const auto length = this->n_parities_per_variable[i];\n+\n+ auto cur_state = this->Y_N[i];\n+ if (ite > 0)\n+ {\n+ auto j = 0;\n+ while (C_to_V_ptr[j] != cur_state && j++ < length);\n+ cur_state = (j == length) ? !cur_state : cur_state;\n+ }\n+\n+ // generate the outcoming messages to the CNs\n+ for (auto j = 0; j < length; j++)\n+ V_to_C_ptr[j] = cur_state;\n+\n+ C_to_V_ptr += length; // jump to the next node\n+ V_to_C_ptr += length; // jump to the next node\n+ }\n+\n+ // C -> V\n+ auto syndrome = 0;\n+ auto transpose_ptr = this->transpose.data();\n+ for (auto i = 0; i < this->n_C_nodes; i++)\n+ {\n+ const auto length = this->n_variables_per_parity[i];\n+\n+ // accumulate the incoming information in CN\n+ auto acc = 0;\n+ for (auto j = 0; j < length; j++)\n+ acc ^= this->V_to_C[transpose_ptr[j]];\n+\n+ // regenerate the CN outcoming values\n+ for (auto j = 0; j < length; j++)\n+ {\n+ const auto val = this->V_to_C[transpose_ptr[j]];\n+ this->C_to_V[transpose_ptr[j]] = acc ^ val;\n+ }\n+\n+ transpose_ptr += length;\n+ syndrome = syndrome || acc;\n+ }\n+\n+ // stop criterion\n+ if (this->enable_syndrome && (syndrome == 0))\n+ break;\n+ }\n+}\n+\n+template <typename B, typename R>\n+void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n+::store(mipp::vector<B>& V_K) const\n+{\n+ assert((int)V_K.size() >= this->K);\n+\n+ // majority vote\n+ auto C_to_V_ptr = this->C_to_V.data();\n+ for (auto i = 0; i < this->K; i++)\n+ {\n+ const auto length = this->n_parities_per_variable[i];\n+ auto count = 0;\n+\n+ for (auto j = 0; j < length; j++)\n+ count += C_to_V_ptr[j] ? 1 : -1;\n+\n+ if (length % 2 == 0)\n+ count += Y_N[i] ? 1 : -1;\n+\n+ // take the hard decision\n+ V_K[i] = count > 0 ? 1 : 0;\n+\n+ C_to_V_ptr += length;\n+ }\n+}\n+\n+template <typename B, typename R>\n+void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n+::soft_decode(const mipp::vector<R> &sys, const mipp::vector<R> &par, mipp::vector<R> &ext)\n+{\n+ std::cerr << bold_red(\"(EE) This decoder does not support this interface.\") << std::endl;\n+ std::exit(-1);\n+}\n+\n+template <typename B, typename R>\n+void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n+::_soft_decode(const mipp::vector<R> &Y_N1, mipp::vector<R> &Y_N2)\n+{\n+ std::cerr << bold_red(\"(EE) This decoder does not support this interface.\") << std::endl;\n+ std::exit(-1);\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class Decoder_LDPC_BP_flooding_Gallager_A<B_8,Q_8>;\n+template class Decoder_LDPC_BP_flooding_Gallager_A<B_16,Q_16>;\n+template class Decoder_LDPC_BP_flooding_Gallager_A<B_32,Q_32>;\n+template class Decoder_LDPC_BP_flooding_Gallager_A<B_64,Q_64>;\n+#else\n+template class Decoder_LDPC_BP_flooding_Gallager_A<B,Q>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A.hpp", "diff": "+#ifndef DECODER_LDPC_BP_FLOODING_GALLAGER_A_HPP_\n+#define DECODER_LDPC_BP_FLOODING_GALLAGER_A_HPP_\n+\n+#include \"Tools/Code/LDPC/AList_reader/AList_reader.hpp\"\n+\n+#include \"../../../Decoder_SISO.hpp\"\n+\n+template <typename B, typename R>\n+class Decoder_LDPC_BP_flooding_Gallager_A : public Decoder_SISO<B,R>\n+{\n+protected:\n+ const int n_ite; // number of iterations to perform\n+ const int n_V_nodes; // number of variable nodes (= N)\n+ const int n_C_nodes; // number of check nodes\n+ const int n_branches; // number of branched in the bi-partite graph (connexions between the V and C nodes)\n+\n+ const bool enable_syndrome;\n+\n+ const mipp::vector<unsigned char> n_variables_per_parity;\n+ const mipp::vector<unsigned char> n_parities_per_variable;\n+ const mipp::vector<unsigned int > transpose;\n+\n+ mipp::vector<unsigned char> Y_N; // input LLRs\n+\n+ // data structures for iterative decoding\n+ mipp::vector<unsigned char> C_to_V; // check nodes to variable nodes messages\n+ mipp::vector<unsigned char> V_to_C; // variable nodes to check nodes messages\n+\n+public:\n+ Decoder_LDPC_BP_flooding_Gallager_A(const int &K, const int &N, const int& n_ite,\n+ const AList_reader &alist_data,\n+ const bool enable_syndrome = true,\n+ const int n_frames = 1,\n+ const std::string name = \"Decoder_LDPC_BP_flooding_Gallager_A\");\n+ virtual ~Decoder_LDPC_BP_flooding_Gallager_A();\n+\n+protected:\n+ // hard decoder (load -> decode -> store)\n+ void load (const mipp::vector<R>& Y_N);\n+ void hard_decode( );\n+ void store ( mipp::vector<B>& V_K) const;\n+\n+ void _soft_decode(const mipp::vector<R> &Y_N1, mipp::vector<R> &Y_N2);\n+\n+public:\n+ void soft_decode(const mipp::vector<R> &sys, const mipp::vector<R> &par, mipp::vector<R> &ext);\n+\n+};\n+\n+#endif /* DECODER_LDPC_BP_FLOODING_GALLAGER_A_HPP_ */\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.cpp", "new_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.cpp", "diff": "#include \"Module/Decoder/LDPC/BP/Flooding/SPA/Decoder_LDPC_BP_flooding_sum_product.hpp\"\n#include \"Module/Decoder/LDPC/BP/Flooding/LSPA/Decoder_LDPC_BP_flooding_log_sum_product.hpp\"\n#include \"Module/Decoder/LDPC/BP/Flooding/ONMS/Decoder_LDPC_BP_flooding_offset_normalize_min_sum.hpp\"\n+#include \"Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A.hpp\"\n#include \"Module/Decoder/LDPC/BP/Layered/SPA/Decoder_LDPC_BP_layered_sum_product.hpp\"\n#include \"Module/Decoder/LDPC/BP/Layered/LSPA/Decoder_LDPC_BP_layered_log_sum_product.hpp\"\n#include \"Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_offset_normalize_min_sum.hpp\"\n@@ -25,6 +26,13 @@ Decoder_SISO<B,R>* Factory_decoder_LDPC<B,R>\nparams.decoder.offset,\nparams.decoder.enable_syndrome,\nparams.simulation.inter_frame_level);\n+ else if (params.decoder.implem == \"GALA\")\n+ decoder = new Decoder_LDPC_BP_flooding_Gallager_A<B,R>(params.code.K,\n+ params.code.N,\n+ params.decoder.n_ite,\n+ alist_data,\n+ params.decoder.enable_syndrome,\n+ params.simulation.inter_frame_level);\nelse if (params.decoder.implem == \"SPA\")\ndecoder = new Decoder_LDPC_BP_flooding_sum_product<B,R>(params.code.K,\nparams.code.N,\n" } ]
C++
MIT License
aff3ct/aff3ct
First implem. of the hard input LDPC Gallager A decoder.
8,490
09.01.2017 10:19:55
-3,600
f6288b85e3f2fbee5c0148dbc359652682bc2360
Add a naive Gallager A.
[ { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A_naive.cpp", "diff": "+#include \"Decoder_LDPC_BP_flooding_Gallager_A_naive.hpp\"\n+\n+#include <limits>\n+\n+#include \"Tools/Display/bash_tools.h\"\n+#include \"Tools/Math/utils.h\"\n+\n+template <typename B, typename R>\n+Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n+::Decoder_LDPC_BP_flooding_Gallager_A_naive(const int &K, const int &N, const int& n_ite,\n+ const AList_reader &alist_data,\n+ const bool enable_syndrome,\n+ const int n_frames,\n+ const std::string name)\n+: Decoder_SISO<B,R> (K, N, n_frames, 1, name ),\n+ n_ite (n_ite ),\n+ n_V_nodes (N ), // same as N but more explicit\n+ n_C_nodes ((int)alist_data.get_n_CN() ),\n+ n_branches ((int)alist_data.get_n_branches() ),\n+ enable_syndrome (enable_syndrome ),\n+\n+ n_variables_per_parity (alist_data.get_n_VN_per_CN() ),\n+ n_parities_per_variable(alist_data.get_n_CN_per_VN() ),\n+ transpose (alist_data.get_branches_transpose()),\n+\n+ Y_N (N ),\n+ C_to_V (this->n_branches, 0),\n+ V_to_C (this->n_branches, 0)\n+{\n+ assert(N == (int)alist_data.get_n_VN());\n+ assert(n_ite > 0);\n+}\n+\n+template <typename B, typename R>\n+Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n+::~Decoder_LDPC_BP_flooding_Gallager_A_naive()\n+{\n+}\n+\n+template <typename B, typename R>\n+void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n+::load(const mipp::vector<R>& Y_N)\n+{\n+ assert(Y_N.size() >= this->Y_N.size());\n+\n+ for (auto i = 0; i < this->N; i++)\n+ this->Y_N[i] = Y_N[i] < 0;\n+}\n+\n+template <typename B, typename R>\n+void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n+::hard_decode()\n+{\n+ for (auto ite = 0; ite < this->n_ite; ite++)\n+ {\n+ auto C_to_V_ptr = this->C_to_V.data();\n+ auto V_to_C_ptr = this->V_to_C.data();\n+\n+ // V -> C\n+ for (auto i = 0; i < this->n_V_nodes; i++)\n+ {\n+ const auto length = this->n_parities_per_variable[i];\n+ for (auto j = 0; j < length; j++)\n+ {\n+ auto cur_state = this->Y_N[i];\n+ if (ite > 0)\n+ {\n+ auto count = 0;\n+ for (auto k = 0; k < length; k++)\n+ if (k != j && C_to_V_ptr[k] != cur_state)\n+ count++;\n+\n+ cur_state = count == (length -1) ? !cur_state : cur_state;\n+ }\n+\n+ V_to_C_ptr[j] = cur_state;\n+ }\n+\n+ C_to_V_ptr += length; // jump to the next node\n+ V_to_C_ptr += length; // jump to the next node\n+ }\n+\n+ // C -> V\n+ auto syndrome = 0;\n+ auto transpose_ptr = this->transpose.data();\n+ for (auto i = 0; i < this->n_C_nodes; i++)\n+ {\n+ const auto length = this->n_variables_per_parity[i];\n+\n+ // accumulate the incoming information in CN\n+ auto acc = 0;\n+ for (auto j = 0; j < length; j++)\n+ acc ^= this->V_to_C[transpose_ptr[j]];\n+\n+ // regenerate the CN outcoming values\n+ for (auto j = 0; j < length; j++)\n+ this->C_to_V[transpose_ptr[j]] = acc ^ this->V_to_C[transpose_ptr[j]];\n+\n+ transpose_ptr += length;\n+ syndrome = syndrome || acc;\n+ }\n+\n+ // stop criterion\n+ if (this->enable_syndrome && (syndrome == 0))\n+ break;\n+ }\n+}\n+\n+template <typename B, typename R>\n+void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n+::store(mipp::vector<B>& V_K) const\n+{\n+ assert((int)V_K.size() >= this->K);\n+\n+ // majority vote\n+ auto C_to_V_ptr = this->C_to_V.data();\n+ for (auto i = 0; i < this->K; i++)\n+ {\n+ const auto length = this->n_parities_per_variable[i];\n+ auto count = 0;\n+\n+ for (auto j = 0; j < length; j++)\n+ count += C_to_V_ptr[j] ? 1 : -1;\n+\n+ if (length % 2 == 0)\n+ count += Y_N[i] ? 1 : -1;\n+\n+ // take the hard decision\n+ V_K[i] = count > 0 ? 1 : 0;\n+\n+ C_to_V_ptr += length;\n+ }\n+}\n+\n+template <typename B, typename R>\n+void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n+::soft_decode(const mipp::vector<R> &sys, const mipp::vector<R> &par, mipp::vector<R> &ext)\n+{\n+ std::cerr << bold_red(\"(EE) This decoder does not support this interface.\") << std::endl;\n+ std::exit(-1);\n+}\n+\n+template <typename B, typename R>\n+void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n+::_soft_decode(const mipp::vector<R> &Y_N1, mipp::vector<R> &Y_N2)\n+{\n+ std::cerr << bold_red(\"(EE) This decoder does not support this interface.\") << std::endl;\n+ std::exit(-1);\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class Decoder_LDPC_BP_flooding_Gallager_A_naive<B_8,Q_8>;\n+template class Decoder_LDPC_BP_flooding_Gallager_A_naive<B_16,Q_16>;\n+template class Decoder_LDPC_BP_flooding_Gallager_A_naive<B_32,Q_32>;\n+template class Decoder_LDPC_BP_flooding_Gallager_A_naive<B_64,Q_64>;\n+#else\n+template class Decoder_LDPC_BP_flooding_Gallager_A_naive<B,Q>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A_naive.hpp", "diff": "+#ifndef DECODER_LDPC_BP_FLOODING_GALLAGER_A_NAIVE_HPP_\n+#define DECODER_LDPC_BP_FLOODING_GALLAGER_A_NAIVE_HPP_\n+\n+#include \"Tools/Code/LDPC/AList_reader/AList_reader.hpp\"\n+\n+#include \"../../../Decoder_SISO.hpp\"\n+\n+template <typename B, typename R>\n+class Decoder_LDPC_BP_flooding_Gallager_A_naive : public Decoder_SISO<B,R>\n+{\n+protected:\n+ const int n_ite; // number of iterations to perform\n+ const int n_V_nodes; // number of variable nodes (= N)\n+ const int n_C_nodes; // number of check nodes\n+ const int n_branches; // number of branched in the bi-partite graph (connexions between the V and C nodes)\n+\n+ const bool enable_syndrome;\n+\n+ const mipp::vector<unsigned char> n_variables_per_parity;\n+ const mipp::vector<unsigned char> n_parities_per_variable;\n+ const mipp::vector<unsigned int > transpose;\n+\n+ mipp::vector<unsigned char> Y_N; // input LLRs\n+\n+ // data structures for iterative decoding\n+ mipp::vector<unsigned char> C_to_V; // check nodes to variable nodes messages\n+ mipp::vector<unsigned char> V_to_C; // variable nodes to check nodes messages\n+\n+public:\n+ Decoder_LDPC_BP_flooding_Gallager_A_naive(const int &K, const int &N, const int& n_ite,\n+ const AList_reader &alist_data,\n+ const bool enable_syndrome = true,\n+ const int n_frames = 1,\n+ const std::string name = \"Decoder_LDPC_BP_flooding_Gallager_A_naive\");\n+ virtual ~Decoder_LDPC_BP_flooding_Gallager_A_naive();\n+\n+protected:\n+ // hard decoder (load -> decode -> store)\n+ void load (const mipp::vector<R>& Y_N);\n+ void hard_decode( );\n+ void store ( mipp::vector<B>& V_K) const;\n+\n+ void _soft_decode(const mipp::vector<R> &Y_N1, mipp::vector<R> &Y_N2);\n+\n+public:\n+ void soft_decode(const mipp::vector<R> &sys, const mipp::vector<R> &par, mipp::vector<R> &ext);\n+\n+};\n+\n+#endif /* DECODER_LDPC_BP_FLOODING_GALLAGER_A_NAIVE_HPP_ */\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a naive Gallager A.
8,490
09.01.2017 11:10:27
-3,600
5360e3cd5b3cd6f807d8d86bb37c21169e6ba3fa
Connect the naive Gallager A.
[ { "change_type": "MODIFY", "old_path": "src/Launcher/BFER/LDPC/Launcher_BFER_LDPC.cpp", "new_path": "src/Launcher/BFER/LDPC/Launcher_BFER_LDPC.cpp", "diff": "@@ -35,7 +35,7 @@ void Launcher_BFER_LDPC<B,R,Q>\n// ------------------------------------------------------------------------------------------------------- decoder\nthis->opt_args[{\"dec-type\", \"D\"}].push_back(\"BP, BP_FLOODING, BP_LAYERED\");\n- this->opt_args[{\"dec-implem\" }].push_back(\"ONMS, SPA, LSPA, GALA\");\n+ this->opt_args[{\"dec-implem\" }].push_back(\"ONMS, SPA, LSPA, GALA, GALAN\");\nthis->opt_args[{\"dec-ite\", \"i\"}] =\n{\"positive_int\",\n\"maximal number of iterations in the turbo decoder.\"};\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.cpp", "new_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.cpp", "diff": "#include \"Module/Decoder/LDPC/BP/Flooding/LSPA/Decoder_LDPC_BP_flooding_log_sum_product.hpp\"\n#include \"Module/Decoder/LDPC/BP/Flooding/ONMS/Decoder_LDPC_BP_flooding_offset_normalize_min_sum.hpp\"\n#include \"Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A.hpp\"\n+#include \"Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A_naive.hpp\"\n#include \"Module/Decoder/LDPC/BP/Layered/SPA/Decoder_LDPC_BP_layered_sum_product.hpp\"\n#include \"Module/Decoder/LDPC/BP/Layered/LSPA/Decoder_LDPC_BP_layered_log_sum_product.hpp\"\n#include \"Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_offset_normalize_min_sum.hpp\"\n@@ -33,6 +34,13 @@ Decoder_SISO<B,R>* Factory_decoder_LDPC<B,R>\nalist_data,\nparams.decoder.enable_syndrome,\nparams.simulation.inter_frame_level);\n+ else if (params.decoder.implem == \"GALAN\")\n+ decoder = new Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>(params.code.K,\n+ params.code.N,\n+ params.decoder.n_ite,\n+ alist_data,\n+ params.decoder.enable_syndrome,\n+ params.simulation.inter_frame_level);\nelse if (params.decoder.implem == \"SPA\")\ndecoder = new Decoder_LDPC_BP_flooding_sum_product<B,R>(params.code.K,\nparams.code.N,\n" } ]
C++
MIT License
aff3ct/aff3ct
Connect the naive Gallager A.
8,490
09.01.2017 11:59:30
-3,600
f1041c9d76f368b51b2df80546a729501f216670
A real naive version...
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A_naive.cpp", "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A_naive.cpp", "diff": "template <typename B, typename R>\nDecoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n-::Decoder_LDPC_BP_flooding_Gallager_A_naive(const int &K, const int &N, const int& n_ite,\n- const AList_reader &alist_data,\n- const bool enable_syndrome,\n- const int n_frames,\n- const std::string name)\n+::Decoder_LDPC_BP_flooding_Gallager_A_naive(const int &K, const int &N, const int& n_ite, const AList_reader &H,\n+ const int n_frames, const std::string name)\n: Decoder_SISO<B,R>(K, N, n_frames, 1, name ),\nn_ite (n_ite ),\n- n_V_nodes (N ), // same as N but more explicit\n- n_C_nodes ((int)alist_data.get_n_CN() ),\n- n_branches ((int)alist_data.get_n_branches() ),\n- enable_syndrome (enable_syndrome ),\n-\n- n_variables_per_parity (alist_data.get_n_VN_per_CN() ),\n- n_parities_per_variable(alist_data.get_n_CN_per_VN() ),\n- transpose (alist_data.get_branches_transpose()),\n-\n+ H (H ),\n+ transpose (H.get_branches_transpose()),\nY_N (N ),\n- C_to_V (this->n_branches, 0),\n- V_to_C (this->n_branches, 0)\n+ C_to_V (H.get_n_branches(), 0),\n+ V_to_C (H.get_n_branches(), 0)\n{\n- assert(N == (int)alist_data.get_n_VN());\n+ assert(this->N == (int)H.get_n_VN());\nassert(n_ite > 0);\n}\n@@ -39,30 +29,30 @@ Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n-::load(const mipp::vector<R>& Y_N)\n+::load(const mipp::vector<R>& Y_N_chn)\n{\n- assert(Y_N.size() >= this->Y_N.size());\n+ assert(Y_N_chn.size() >= Y_N.size());\nfor (auto i = 0; i < this->N; i++)\n- this->Y_N[i] = Y_N[i] < 0;\n+ Y_N[i] = Y_N_chn[i] < 0;\n}\ntemplate <typename B, typename R>\nvoid Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n::hard_decode()\n{\n- for (auto ite = 0; ite < this->n_ite; ite++)\n+ for (auto ite = 0; ite < n_ite; ite++)\n{\n- auto C_to_V_ptr = this->C_to_V.data();\n- auto V_to_C_ptr = this->V_to_C.data();\n+ auto C_to_V_ptr = C_to_V.data();\n+ auto V_to_C_ptr = V_to_C.data();\n// V -> C\n- for (auto i = 0; i < this->n_V_nodes; i++)\n+ for (auto i = 0; i < H.get_n_VN(); i++)\n{\n- const auto length = this->n_parities_per_variable[i];\n+ const auto length = (int)H.get_VN_to_CN()[i].size();\nfor (auto j = 0; j < length; j++)\n{\n- auto cur_state = this->Y_N[i];\n+ auto cur_state = Y_N[i];\nif (ite > 0)\n{\nauto count = 0;\n@@ -82,26 +72,26 @@ void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n// C -> V\nauto syndrome = 0;\n- auto transpose_ptr = this->transpose.data();\n- for (auto i = 0; i < this->n_C_nodes; i++)\n+ auto transpose_ptr = transpose.data();\n+ for (auto i = 0; i < H.get_n_CN(); i++)\n{\n- const auto length = this->n_variables_per_parity[i];\n+ const auto length = (int)H.get_CN_to_VN()[i].size();\n// accumulate the incoming information in CN\nauto acc = 0;\nfor (auto j = 0; j < length; j++)\n- acc ^= this->V_to_C[transpose_ptr[j]];\n+ acc ^= V_to_C[transpose_ptr[j]];\n// regenerate the CN outcoming values\nfor (auto j = 0; j < length; j++)\n- this->C_to_V[transpose_ptr[j]] = acc ^ this->V_to_C[transpose_ptr[j]];\n+ C_to_V[transpose_ptr[j]] = acc ^ V_to_C[transpose_ptr[j]];\ntranspose_ptr += length;\nsyndrome = syndrome || acc;\n}\n// stop criterion\n- if (this->enable_syndrome && (syndrome == 0))\n+ if (syndrome == 0)\nbreak;\n}\n}\n@@ -113,10 +103,10 @@ void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\nassert((int)V_K.size() >= this->K);\n// majority vote\n- auto C_to_V_ptr = this->C_to_V.data();\n+ auto C_to_V_ptr = C_to_V.data();\nfor (auto i = 0; i < this->K; i++)\n{\n- const auto length = this->n_parities_per_variable[i];\n+ const auto length = (int)H.get_VN_to_CN()[i].size();\nauto count = 0;\nfor (auto j = 0; j < length; j++)\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A_naive.hpp", "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A_naive.hpp", "diff": "@@ -10,26 +10,15 @@ class Decoder_LDPC_BP_flooding_Gallager_A_naive : public Decoder_SISO<B,R>\n{\nprotected:\nconst int n_ite; // number of iterations to perform\n- const int n_V_nodes; // number of variable nodes (= N)\n- const int n_C_nodes; // number of check nodes\n- const int n_branches; // number of branched in the bi-partite graph (connexions between the V and C nodes)\n-\n- const bool enable_syndrome;\n-\n- const mipp::vector<unsigned char> n_variables_per_parity;\n- const mipp::vector<unsigned char> n_parities_per_variable;\n+ const AList_reader &H; // LDPC H matrix\nconst mipp::vector<unsigned int > transpose;\n- mipp::vector<unsigned char> Y_N; // input LLRs\n-\n- // data structures for iterative decoding\n+ mipp::vector<unsigned char> Y_N; // input LLRs (transformed in bit)\nmipp::vector<unsigned char> C_to_V; // check nodes to variable nodes messages\nmipp::vector<unsigned char> V_to_C; // variable nodes to check nodes messages\npublic:\n- Decoder_LDPC_BP_flooding_Gallager_A_naive(const int &K, const int &N, const int& n_ite,\n- const AList_reader &alist_data,\n- const bool enable_syndrome = true,\n+ Decoder_LDPC_BP_flooding_Gallager_A_naive(const int &K, const int &N, const int& n_ite, const AList_reader &H,\nconst int n_frames = 1,\nconst std::string name = \"Decoder_LDPC_BP_flooding_Gallager_A_naive\");\nvirtual ~Decoder_LDPC_BP_flooding_Gallager_A_naive();\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.cpp", "new_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.cpp", "diff": "@@ -39,7 +39,6 @@ Decoder_SISO<B,R>* Factory_decoder_LDPC<B,R>\nparams.code.N,\nparams.decoder.n_ite,\nalist_data,\n- params.decoder.enable_syndrome,\nparams.simulation.inter_frame_level);\nelse if (params.decoder.implem == \"SPA\")\ndecoder = new Decoder_LDPC_BP_flooding_sum_product<B,R>(params.code.K,\n" } ]
C++
MIT License
aff3ct/aff3ct
A real naive version...
8,490
09.01.2017 14:46:52
-3,600
999a59f93acc572b72341d08631ea846d6734584
Renaming in the naive Gallager A decoder.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A_naive.cpp", "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A_naive.cpp", "diff": "@@ -12,10 +12,9 @@ Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n: Decoder_SISO<B,R>(K, N, n_frames, 1, name),\nn_ite (n_ite ),\nH (H ),\n- transpose (H.get_branches_transpose()),\nY_N (N ),\n- C_to_V (H.get_n_branches(), 0),\n- V_to_C (H.get_n_branches(), 0)\n+ C_to_V_messages (H.get_n_branches(), 0),\n+ V_to_C_messages (H.get_n_branches(), 0)\n{\nassert(this->N == (int)H.get_n_VN());\nassert(n_ite > 0);\n@@ -43,51 +42,53 @@ void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n{\nfor (auto ite = 0; ite < n_ite; ite++)\n{\n- auto C_to_V_ptr = C_to_V.data();\n- auto V_to_C_ptr = V_to_C.data();\n+ auto C_to_V_mess_ptr = C_to_V_messages.data();\n+ auto V_to_C_mess_ptr = V_to_C_messages.data();\n- // V -> C\n+ // V -> C (for each variable nodes)\nfor (auto i = 0; i < H.get_n_VN(); i++)\n{\n- const auto length = (int)H.get_VN_to_CN()[i].size();\n- for (auto j = 0; j < length; j++)\n+ const auto node_degree = (int)H.get_VN_to_CN()[i].size();\n+\n+ for (auto j = 0; j < node_degree; j++)\n{\nauto cur_state = Y_N[i];\nif (ite > 0)\n{\nauto count = 0;\n- for (auto k = 0; k < length; k++)\n- if (k != j && C_to_V_ptr[k] != cur_state)\n+ for (auto k = 0; k < node_degree; k++)\n+ if (k != j && C_to_V_mess_ptr[k] != cur_state)\ncount++;\n- cur_state = count == (length -1) ? !cur_state : cur_state;\n+ cur_state = count == (node_degree -1) ? !cur_state : cur_state;\n}\n- V_to_C_ptr[j] = cur_state;\n+ V_to_C_mess_ptr[j] = cur_state;\n}\n- C_to_V_ptr += length; // jump to the next node\n- V_to_C_ptr += length; // jump to the next node\n+ C_to_V_mess_ptr += node_degree; // jump to the next node\n+ V_to_C_mess_ptr += node_degree; // jump to the next node\n}\n- // C -> V\n+ // C -> V (for each check nodes)\nauto syndrome = 0;\n- auto transpose_ptr = transpose.data();\n+ auto transpose_ptr = H.get_branches_transpose().data();\nfor (auto i = 0; i < H.get_n_CN(); i++)\n{\n- const auto length = (int)H.get_CN_to_VN()[i].size();\n+ const auto node_degree = (int)H.get_CN_to_VN()[i].size();\n// accumulate the incoming information in CN\nauto acc = 0;\n- for (auto j = 0; j < length; j++)\n- acc ^= V_to_C[transpose_ptr[j]];\n+ for (auto j = 0; j < node_degree; j++)\n+ acc ^= V_to_C_messages[transpose_ptr[j]];\n// regenerate the CN outcoming values\n- for (auto j = 0; j < length; j++)\n- C_to_V[transpose_ptr[j]] = acc ^ V_to_C[transpose_ptr[j]];\n+ for (auto j = 0; j < node_degree; j++)\n+ C_to_V_messages[transpose_ptr[j]] = acc ^ V_to_C_messages[transpose_ptr[j]];\n+\n+ syndrome = syndrome || acc; // compute the syndrome\n- transpose_ptr += length;\n- syndrome = syndrome || acc;\n+ transpose_ptr += node_degree; // jump to the next node\n}\n// stop criterion\n@@ -102,23 +103,24 @@ void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n{\nassert((int)V_K.size() >= this->K);\n- // majority vote\n- auto C_to_V_ptr = C_to_V.data();\n+ auto C_to_V_ptr = C_to_V_messages.data();\n+\n+ // for the K first variable nodes (make a majority vote with the entering messages)\nfor (auto i = 0; i < this->K; i++)\n{\n- const auto length = (int)H.get_VN_to_CN()[i].size();\n+ const auto node_degree = (int)H.get_VN_to_CN()[i].size();\nauto count = 0;\n- for (auto j = 0; j < length; j++)\n+ for (auto j = 0; j < node_degree; j++)\ncount += C_to_V_ptr[j] ? 1 : -1;\n- if (length % 2 == 0)\n+ if (node_degree % 2 == 0)\ncount += Y_N[i] ? 1 : -1;\n// take the hard decision\nV_K[i] = count > 0 ? 1 : 0;\n- C_to_V_ptr += length;\n+ C_to_V_ptr += node_degree; // jump to the next node\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A_naive.hpp", "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A_naive.hpp", "diff": "#include \"Tools/Code/LDPC/AList_reader/AList_reader.hpp\"\n-#include \"../../../Decoder_SISO.hpp\"\n+#include \"Module/Decoder/Decoder_SISO.hpp\"\ntemplate <typename B, typename R>\nclass Decoder_LDPC_BP_flooding_Gallager_A_naive : public Decoder_SISO<B,R>\n@@ -11,11 +11,9 @@ class Decoder_LDPC_BP_flooding_Gallager_A_naive : public Decoder_SISO<B,R>\nprotected:\nconst int n_ite; // number of iterations to perform\nconst AList_reader &H; // LDPC H matrix\n- const mipp::vector<unsigned int > transpose;\n-\n- mipp::vector<unsigned char> Y_N; // input LLRs (transformed in bit)\n- mipp::vector<unsigned char> C_to_V; // check nodes to variable nodes messages\n- mipp::vector<unsigned char> V_to_C; // variable nodes to check nodes messages\n+ mipp::vector<char> Y_N; // input LLRs (transformed in bit)\n+ mipp::vector<char> C_to_V_messages; // check nodes to variable nodes messages\n+ mipp::vector<char> V_to_C_messages; // variable nodes to check nodes messages\npublic:\nDecoder_LDPC_BP_flooding_Gallager_A_naive(const int &K, const int &N, const int& n_ite, const AList_reader &H,\n" } ]
C++
MIT License
aff3ct/aff3ct
Renaming in the naive Gallager A decoder.
8,490
12.01.2017 17:26:39
-3,600
532d086be2f5b0e39d51951bd950f9f08ee2cb61
Finalize the LDPC Flooding Gallager A decoder integration.
[ { "change_type": "MODIFY", "old_path": "src/Launcher/BFER/LDPC/Launcher_BFER_LDPC.cpp", "new_path": "src/Launcher/BFER/LDPC/Launcher_BFER_LDPC.cpp", "diff": "@@ -35,7 +35,7 @@ void Launcher_BFER_LDPC<B,R,Q>\n// ------------------------------------------------------------------------------------------------------- decoder\nthis->opt_args[{\"dec-type\", \"D\"}].push_back(\"BP, BP_FLOODING, BP_LAYERED\");\n- this->opt_args[{\"dec-implem\" }].push_back(\"ONMS, SPA, LSPA, GALA, GALAN\");\n+ this->opt_args[{\"dec-implem\" }].push_back(\"ONMS, SPA, LSPA, GALA\");\nthis->opt_args[{\"dec-ite\", \"i\"}] =\n{\"positive_int\",\n\"maximal number of iterations in the turbo decoder.\"};\n" }, { "change_type": "DELETE", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A.cpp", "new_path": null, "diff": "-#include \"Decoder_LDPC_BP_flooding_Gallager_A.hpp\"\n-\n-#include <limits>\n-\n-#include \"Tools/Display/bash_tools.h\"\n-#include \"Tools/Math/utils.h\"\n-\n-template <typename B, typename R>\n-Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n-::Decoder_LDPC_BP_flooding_Gallager_A(const int &K, const int &N, const int& n_ite,\n- const AList_reader &alist_data,\n- const bool enable_syndrome,\n- const int n_frames,\n- const std::string name)\n-: Decoder_SISO<B,R> (K, N, n_frames, 1, name ),\n- n_ite (n_ite ),\n- n_V_nodes (N ), // same as N but more explicit\n- n_C_nodes ((int)alist_data.get_n_CN() ),\n- n_branches ((int)alist_data.get_n_branches() ),\n- enable_syndrome (enable_syndrome ),\n-\n- n_variables_per_parity (alist_data.get_n_VN_per_CN() ),\n- n_parities_per_variable(alist_data.get_n_CN_per_VN() ),\n- transpose (alist_data.get_branches_transpose()),\n-\n- Y_N (N ),\n- C_to_V (this->n_branches, 0),\n- V_to_C (this->n_branches, 0)\n-{\n- assert(N == (int)alist_data.get_n_VN());\n- assert(n_ite > 0);\n-}\n-\n-template <typename B, typename R>\n-Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n-::~Decoder_LDPC_BP_flooding_Gallager_A()\n-{\n-}\n-\n-template <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n-::load(const mipp::vector<R>& Y_N)\n-{\n- assert(Y_N.size() >= this->Y_N.size());\n-\n- for (auto i = 0; i < this->N; i++)\n- this->Y_N[i] = Y_N[i] < 0;\n-}\n-\n-template <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n-::hard_decode()\n-{\n- for (auto ite = 0; ite < this->n_ite; ite++)\n- {\n- auto C_to_V_ptr = this->C_to_V.data();\n- auto V_to_C_ptr = this->V_to_C.data();\n-\n- // V -> C\n- for (auto i = 0; i < this->n_V_nodes; i++)\n- {\n- const auto length = this->n_parities_per_variable[i];\n- for (auto j = 0; j < length; j++)\n- {\n- auto cur_state = this->Y_N[i];\n- if (ite > 0)\n- {\n- auto count = 0;\n- for (auto k = 0; k < length; k++)\n- if (k != j && C_to_V_ptr[k] != cur_state)\n- count++;\n-\n- cur_state = count == (length -1) ? !cur_state : cur_state;\n- }\n-\n- V_to_C_ptr[j] = cur_state;\n- }\n-\n- C_to_V_ptr += length; // jump to the next node\n- V_to_C_ptr += length; // jump to the next node\n- }\n-\n- // C -> V\n- auto syndrome = 0;\n- auto transpose_ptr = this->transpose.data();\n- for (auto i = 0; i < this->n_C_nodes; i++)\n- {\n- const auto length = this->n_variables_per_parity[i];\n-\n- // accumulate the incoming information in CN\n- auto acc = 0;\n- for (auto j = 0; j < length; j++)\n- acc ^= this->V_to_C[transpose_ptr[j]];\n-\n- // regenerate the CN outcoming values\n- for (auto j = 0; j < length; j++)\n- this->C_to_V[transpose_ptr[j]] = acc ^ this->V_to_C[transpose_ptr[j]];\n-\n- transpose_ptr += length;\n- syndrome = syndrome || acc;\n- }\n-\n- // stop criterion\n- if (this->enable_syndrome && (syndrome == 0))\n- break;\n- }\n-}\n-\n-template <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n-::store(mipp::vector<B>& V_K) const\n-{\n- assert((int)V_K.size() >= this->K);\n-\n- // majority vote\n- auto C_to_V_ptr = this->C_to_V.data();\n- for (auto i = 0; i < this->K; i++)\n- {\n- const auto length = this->n_parities_per_variable[i];\n- auto count = 0;\n-\n- for (auto j = 0; j < length; j++)\n- count += C_to_V_ptr[j] ? 1 : -1;\n-\n- if (length % 2 == 0)\n- count += Y_N[i] ? 1 : -1;\n-\n- // take the hard decision\n- V_K[i] = count > 0 ? 1 : 0;\n-\n- C_to_V_ptr += length;\n- }\n-}\n-\n-template <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n-::soft_decode(const mipp::vector<R> &sys, const mipp::vector<R> &par, mipp::vector<R> &ext)\n-{\n- std::cerr << bold_red(\"(EE) This decoder does not support this interface.\") << std::endl;\n- std::exit(-1);\n-}\n-\n-template <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n-::_soft_decode(const mipp::vector<R> &Y_N1, mipp::vector<R> &Y_N2)\n-{\n- std::cerr << bold_red(\"(EE) This decoder does not support this interface.\") << std::endl;\n- std::exit(-1);\n-}\n-\n-// ==================================================================================== explicit template instantiation\n-#include \"Tools/types.h\"\n-#ifdef MULTI_PREC\n-template class Decoder_LDPC_BP_flooding_Gallager_A<B_8,Q_8>;\n-template class Decoder_LDPC_BP_flooding_Gallager_A<B_16,Q_16>;\n-template class Decoder_LDPC_BP_flooding_Gallager_A<B_32,Q_32>;\n-template class Decoder_LDPC_BP_flooding_Gallager_A<B_64,Q_64>;\n-#else\n-template class Decoder_LDPC_BP_flooding_Gallager_A<B,Q>;\n-#endif\n-// ==================================================================================== explicit template instantiation\n" }, { "change_type": "DELETE", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A.hpp", "new_path": null, "diff": "-#ifndef DECODER_LDPC_BP_FLOODING_GALLAGER_A_HPP_\n-#define DECODER_LDPC_BP_FLOODING_GALLAGER_A_HPP_\n-\n-#include \"Tools/Code/LDPC/AList_reader/AList_reader.hpp\"\n-\n-#include \"../../../Decoder_SISO.hpp\"\n-\n-template <typename B, typename R>\n-class Decoder_LDPC_BP_flooding_Gallager_A : public Decoder_SISO<B,R>\n-{\n-protected:\n- const int n_ite; // number of iterations to perform\n- const int n_V_nodes; // number of variable nodes (= N)\n- const int n_C_nodes; // number of check nodes\n- const int n_branches; // number of branched in the bi-partite graph (connexions between the V and C nodes)\n-\n- const bool enable_syndrome;\n-\n- const mipp::vector<unsigned char> n_variables_per_parity;\n- const mipp::vector<unsigned char> n_parities_per_variable;\n- const mipp::vector<unsigned int > transpose;\n-\n- mipp::vector<unsigned char> Y_N; // input LLRs\n-\n- // data structures for iterative decoding\n- mipp::vector<unsigned char> C_to_V; // check nodes to variable nodes messages\n- mipp::vector<unsigned char> V_to_C; // variable nodes to check nodes messages\n-\n-public:\n- Decoder_LDPC_BP_flooding_Gallager_A(const int &K, const int &N, const int& n_ite,\n- const AList_reader &alist_data,\n- const bool enable_syndrome = true,\n- const int n_frames = 1,\n- const std::string name = \"Decoder_LDPC_BP_flooding_Gallager_A\");\n- virtual ~Decoder_LDPC_BP_flooding_Gallager_A();\n-\n-protected:\n- // hard decoder (load -> decode -> store)\n- void load (const mipp::vector<R>& Y_N);\n- void hard_decode( );\n- void store ( mipp::vector<B>& V_K) const;\n-\n- void _soft_decode(const mipp::vector<R> &Y_N1, mipp::vector<R> &Y_N2);\n-\n-public:\n- void soft_decode(const mipp::vector<R> &sys, const mipp::vector<R> &par, mipp::vector<R> &ext);\n-\n-};\n-\n-#endif /* DECODER_LDPC_BP_FLOODING_GALLAGER_A_HPP_ */\n" }, { "change_type": "RENAME", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A_naive.cpp", "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.cpp", "diff": "-#include \"Decoder_LDPC_BP_flooding_Gallager_A_naive.hpp\"\n-\n#include <limits>\n#include \"Tools/Display/bash_tools.h\"\n#include \"Tools/Math/utils.h\"\n+#include \"Decoder_LDPC_BP_flooding_Gallager_A.hpp\"\n+\ntemplate <typename B, typename R>\n-Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n-::Decoder_LDPC_BP_flooding_Gallager_A_naive(const int &K, const int &N, const int& n_ite, const AList_reader &H,\n- const int n_frames, const std::string name)\n+Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n+::Decoder_LDPC_BP_flooding_Gallager_A(const int &K, const int &N, const int& n_ite, const AList_reader &H,\n+ const bool enable_syndrome, const int n_frames, const std::string name)\n: Decoder_SISO<B,R>(K, N, n_frames, 1, name),\nn_ite (n_ite ),\nH (H ),\n+ enable_syndrome (enable_syndrome ),\nY_N (N ),\nC_to_V_messages (H.get_n_branches(), 0),\nV_to_C_messages (H.get_n_branches(), 0)\n@@ -21,13 +22,13 @@ Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n}\ntemplate <typename B, typename R>\n-Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n-::~Decoder_LDPC_BP_flooding_Gallager_A_naive()\n+Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n+::~Decoder_LDPC_BP_flooding_Gallager_A()\n{\n}\ntemplate <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n+void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n::load(const mipp::vector<R>& Y_N_chn)\n{\nassert(Y_N_chn.size() >= Y_N.size());\n@@ -37,7 +38,7 @@ void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n}\ntemplate <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n+void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n::hard_decode()\n{\nfor (auto ite = 0; ite < n_ite; ite++)\n@@ -46,7 +47,7 @@ void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\nauto V_to_C_mess_ptr = V_to_C_messages.data();\n// V -> C (for each variable nodes)\n- for (auto i = 0; i < H.get_n_VN(); i++)\n+ for (auto i = 0; i < (int)H.get_n_VN(); i++)\n{\nconst auto node_degree = (int)H.get_VN_to_CN()[i].size();\n@@ -73,7 +74,7 @@ void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n// C -> V (for each check nodes)\nauto syndrome = 0;\nauto transpose_ptr = H.get_branches_transpose().data();\n- for (auto i = 0; i < H.get_n_CN(); i++)\n+ for (auto i = 0; i < (int)H.get_n_CN(); i++)\n{\nconst auto node_degree = (int)H.get_CN_to_VN()[i].size();\n@@ -92,13 +93,13 @@ void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n}\n// stop criterion\n- if (syndrome == 0)\n+ if (this->enable_syndrome && (syndrome == 0))\nbreak;\n}\n}\ntemplate <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n+void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n::store(mipp::vector<B>& V_K) const\n{\nassert((int)V_K.size() >= this->K);\n@@ -125,7 +126,7 @@ void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n}\ntemplate <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n+void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n::soft_decode(const mipp::vector<R> &sys, const mipp::vector<R> &par, mipp::vector<R> &ext)\n{\nstd::cerr << bold_red(\"(EE) This decoder does not support this interface.\") << std::endl;\n@@ -133,7 +134,7 @@ void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n}\ntemplate <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n+void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n::_soft_decode(const mipp::vector<R> &Y_N1, mipp::vector<R> &Y_N2)\n{\nstd::cerr << bold_red(\"(EE) This decoder does not support this interface.\") << std::endl;\n@@ -143,11 +144,11 @@ void Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template class Decoder_LDPC_BP_flooding_Gallager_A_naive<B_8,Q_8>;\n-template class Decoder_LDPC_BP_flooding_Gallager_A_naive<B_16,Q_16>;\n-template class Decoder_LDPC_BP_flooding_Gallager_A_naive<B_32,Q_32>;\n-template class Decoder_LDPC_BP_flooding_Gallager_A_naive<B_64,Q_64>;\n+template class Decoder_LDPC_BP_flooding_Gallager_A<B_8,Q_8>;\n+template class Decoder_LDPC_BP_flooding_Gallager_A<B_16,Q_16>;\n+template class Decoder_LDPC_BP_flooding_Gallager_A<B_32,Q_32>;\n+template class Decoder_LDPC_BP_flooding_Gallager_A<B_64,Q_64>;\n#else\n-template class Decoder_LDPC_BP_flooding_Gallager_A_naive<B,Q>;\n+template class Decoder_LDPC_BP_flooding_Gallager_A<B,Q>;\n#endif\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "RENAME", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A_naive.hpp", "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.hpp", "diff": "-#ifndef DECODER_LDPC_BP_FLOODING_GALLAGER_A_NAIVE_HPP_\n-#define DECODER_LDPC_BP_FLOODING_GALLAGER_A_NAIVE_HPP_\n+#ifndef DECODER_LDPC_BP_FLOODING_GALLAGER_A_HPP_\n+#define DECODER_LDPC_BP_FLOODING_GALLAGER_A_HPP_\n#include \"Tools/Code/LDPC/AList_reader/AList_reader.hpp\"\n#include \"Module/Decoder/Decoder_SISO.hpp\"\ntemplate <typename B, typename R>\n-class Decoder_LDPC_BP_flooding_Gallager_A_naive : public Decoder_SISO<B,R>\n+class Decoder_LDPC_BP_flooding_Gallager_A : public Decoder_SISO<B,R>\n{\nprotected:\nconst int n_ite; // number of iterations to perform\nconst AList_reader &H; // LDPC H matrix\n+ const bool enable_syndrome; // stop criterion\nmipp::vector<char> Y_N; // input LLRs (transformed in bit)\nmipp::vector<char> C_to_V_messages; // check nodes to variable nodes messages\nmipp::vector<char> V_to_C_messages; // variable nodes to check nodes messages\npublic:\n- Decoder_LDPC_BP_flooding_Gallager_A_naive(const int &K, const int &N, const int& n_ite, const AList_reader &H,\n+ Decoder_LDPC_BP_flooding_Gallager_A(const int &K, const int &N, const int& n_ite, const AList_reader &H,\n+ const bool enable_syndrome = true,\nconst int n_frames = 1,\n- const std::string name = \"Decoder_LDPC_BP_flooding_Gallager_A_naive\");\n- virtual ~Decoder_LDPC_BP_flooding_Gallager_A_naive();\n+ const std::string name = \"Decoder_LDPC_BP_flooding_Gallager_A\");\n+ virtual ~Decoder_LDPC_BP_flooding_Gallager_A();\nprotected:\n// hard decoder (load -> decode -> store)\n@@ -34,4 +36,4 @@ public:\n};\n-#endif /* DECODER_LDPC_BP_FLOODING_GALLAGER_A_NAIVE_HPP_ */\n+#endif /* DECODER_LDPC_BP_FLOODING_GALLAGER_A_HPP_ */\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.cpp", "new_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.cpp", "diff": "#include \"Module/Decoder/LDPC/BP/Flooding/SPA/Decoder_LDPC_BP_flooding_sum_product.hpp\"\n#include \"Module/Decoder/LDPC/BP/Flooding/LSPA/Decoder_LDPC_BP_flooding_log_sum_product.hpp\"\n#include \"Module/Decoder/LDPC/BP/Flooding/ONMS/Decoder_LDPC_BP_flooding_offset_normalize_min_sum.hpp\"\n-#include \"Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A.hpp\"\n-#include \"Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_Gallager_A_naive.hpp\"\n+#include \"Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.hpp\"\n#include \"Module/Decoder/LDPC/BP/Layered/SPA/Decoder_LDPC_BP_layered_sum_product.hpp\"\n#include \"Module/Decoder/LDPC/BP/Layered/LSPA/Decoder_LDPC_BP_layered_log_sum_product.hpp\"\n#include \"Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_offset_normalize_min_sum.hpp\"\n@@ -34,12 +33,6 @@ Decoder_SISO<B,R>* Factory_decoder_LDPC<B,R>\nalist_data,\nparams.decoder.enable_syndrome,\nparams.simulation.inter_frame_level);\n- else if (params.decoder.implem == \"GALAN\")\n- decoder = new Decoder_LDPC_BP_flooding_Gallager_A_naive<B,R>(params.code.K,\n- params.code.N,\n- params.decoder.n_ite,\n- alist_data,\n- params.simulation.inter_frame_level);\nelse if (params.decoder.implem == \"SPA\")\ndecoder = new Decoder_LDPC_BP_flooding_sum_product<B,R>(params.code.K,\nparams.code.N,\n" } ]
C++
MIT License
aff3ct/aff3ct
Finalize the LDPC Flooding Gallager A decoder integration.
8,490
12.01.2017 18:28:14
-3,600
e5feab5b5e9472942cd5eb0a22af95963782da10
Add a Gallager A ref.
[ { "change_type": "ADD", "old_path": null, "new_path": "tests/data/BFER/ldpc/BP_FLOODING/GALA/504_1008_MCKAY.txt", "diff": "+Run command:\n+./bin/aff3ct --sim-type BFER --cde-type LDPC -m 0.0 -M 8.51 -s 0.25 -K 504 -N 1008 --cde-alist-path ../conf/dec/LDPC/LDPC_504_1008.alist --dec-type BP_FLOODING --dec-implem GALA -i 200\n+Curve name:\n+LDPC Gallager A\n+# -------------------------------------------------\n+# ---- A FAST FORWARD ERROR CORRECTION TOOL >> ----\n+# -------------------------------------------------\n+# Parameters:\n+# * Simulation ------------------------------------\n+# ** Type = BFER\n+# ** SNR min (m) = 0.000000 dB\n+# ** SNR max (M) = 8.510000 dB\n+# ** SNR step (s) = 0.250000 dB\n+# ** Type of bits = int (32 bits)\n+# ** Type of reals = float (32 bits)\n+# ** Inter frame level = 1\n+# ** Seed = 0\n+# ** Multi-threading (t) = 4 thread(s)\n+# * Code ------------------------------------------\n+# ** Type = LDPC\n+# ** Info. bits (K) = 504\n+# ** Codeword size (N) = 1008\n+# ** Coset approach (c) = off\n+# ** AList file path = ../conf/dec/LDPC/LDPC_504_1008.alist\n+# * Source ----------------------------------------\n+# ** Type = AZCW\n+# * Encoder ---------------------------------------\n+# ** Type = AZCW\n+# ** Systematic encoding = on\n+# * Modulator -------------------------------------\n+# ** Type = BPSK\n+# * Channel ---------------------------------------\n+# ** Type = AWGN\n+# ** Domain = LLR\n+# * Demodulator -----------------------------------\n+# ** Sigma square = on\n+# ** Max type = unused\n+# * Decoder ---------------------------------------\n+# ** Type (D) = BP_FLOODING\n+# ** Implementation = GALA\n+# ** Num. of iterations (i) = 200\n+# ** Syndrome detection = on\n+# * Monitor ---------------------------------------\n+# ** Frame error count (e) = 100\n+#\n+# The simulation is running...\n+# -------------------------------------------------------------||--------------------------------||---------------------\n+# Bit Error Rate (BER) and Frame Error Rate (FER) depending || Decoder throughput and || Global throughput\n+# on the Signal Noise Ratio (SNR) Eb/N0 || latency (per thread) || and elapsed time\n+# -------------------------------------------------------------||--------------------------------||---------------------\n+# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n+# SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n+# (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n+# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n+ 0.00 | 103 | 25898 | 103 | 4.99e-01 | 1.00e+00 || 0.12 | 0.06 | 8539.66 || 0.45 | 00h00'00\n+ 0.25 | 103 | 25647 | 103 | 4.94e-01 | 1.00e+00 || 0.12 | 0.06 | 8459.26 || 0.47 | 00h00'00\n+ 0.50 | 103 | 25884 | 103 | 4.99e-01 | 1.00e+00 || 0.12 | 0.06 | 8603.35 || 0.46 | 00h00'00\n+ 0.75 | 103 | 25845 | 103 | 4.98e-01 | 1.00e+00 || 0.12 | 0.06 | 8429.42 || 0.47 | 00h00'00\n+ 1.00 | 103 | 25532 | 103 | 4.92e-01 | 1.00e+00 || 0.12 | 0.06 | 8411.02 || 0.47 | 00h00'00\n+ 1.25 | 103 | 25608 | 103 | 4.93e-01 | 1.00e+00 || 0.11 | 0.06 | 8928.73 || 0.44 | 00h00'00\n+ 1.50 | 103 | 25878 | 103 | 4.98e-01 | 1.00e+00 || 0.12 | 0.06 | 8623.79 || 0.46 | 00h00'00\n+ 1.75 | 103 | 25373 | 103 | 4.89e-01 | 1.00e+00 || 0.11 | 0.06 | 8781.37 || 0.45 | 00h00'00\n+ 2.00 | 103 | 25383 | 103 | 4.89e-01 | 1.00e+00 || 0.12 | 0.06 | 8576.86 || 0.46 | 00h00'00\n+ 2.25 | 103 | 25393 | 103 | 4.89e-01 | 1.00e+00 || 0.12 | 0.06 | 8500.83 || 0.46 | 00h00'00\n+ 2.50 | 103 | 25495 | 103 | 4.91e-01 | 1.00e+00 || 0.10 | 0.05 | 9833.06 || 0.40 | 00h00'00\n+ 2.75 | 103 | 25547 | 103 | 4.92e-01 | 1.00e+00 || 0.10 | 0.05 | 10153.98 || 0.39 | 00h00'00\n+ 3.00 | 103 | 25305 | 103 | 4.87e-01 | 1.00e+00 || 0.11 | 0.06 | 9014.50 || 0.43 | 00h00'00\n+ 3.25 | 103 | 25130 | 103 | 4.84e-01 | 1.00e+00 || 0.11 | 0.06 | 8983.32 || 0.43 | 00h00'00\n+ 3.50 | 103 | 25064 | 103 | 4.83e-01 | 1.00e+00 || 0.11 | 0.06 | 8964.21 || 0.43 | 00h00'00\n+ 3.75 | 103 | 25492 | 103 | 4.91e-01 | 1.00e+00 || 0.11 | 0.06 | 9022.11 || 0.43 | 00h00'00\n+ 4.00 | 105 | 25185 | 103 | 4.76e-01 | 9.81e-01 || 0.11 | 0.06 | 8870.46 || 0.44 | 00h00'00\n+ 4.25 | 115 | 24961 | 103 | 4.31e-01 | 8.96e-01 || 0.12 | 0.06 | 8136.94 || 0.48 | 00h00'00\n+ 4.50 | 132 | 25202 | 103 | 3.79e-01 | 7.80e-01 || 0.14 | 0.07 | 7391.29 || 0.52 | 00h00'00\n+ 4.75 | 168 | 24813 | 103 | 2.93e-01 | 6.13e-01 || 0.18 | 0.09 | 5741.04 || 0.68 | 00h00'00\n+ 5.00 | 288 | 24537 | 103 | 1.69e-01 | 3.58e-01 || 0.29 | 0.15 | 3467.55 || 1.11 | 00h00'00\n+ 5.25 | 671 | 23380 | 102 | 6.91e-02 | 1.52e-01 || 0.61 | 0.31 | 1640.82 || 2.31 | 00h00'00\n+ 5.50 | 1875 | 22203 | 100 | 2.35e-02 | 5.33e-02 || 1.34 | 0.67 | 752.48 || 5.03 | 00h00'00\n+ 5.75 | 7333 | 19565 | 102 | 5.29e-03 | 1.39e-02 || 2.69 | 1.35 | 374.65 || 9.51 | 00h00'00\n+ 6.00 | 28289 | 9046 | 100 | 6.34e-04 | 3.53e-03 || 4.29 | 2.14 | 235.17 || 14.47 | 00h00'01\n+ 6.25 | 61705 | 1798 | 100 | 5.78e-05 | 1.62e-03 || 5.20 | 2.60 | 193.67 || 17.05 | 00h00'03\n+ 6.50 | 111741 | 154 | 100 | 2.73e-06 | 8.95e-04 || 6.03 | 3.01 | 167.25 || 19.30 | 00h00'05\n+ 6.75 | 176577 | 161 | 100 | 1.81e-06 | 5.66e-04 || 6.61 | 3.30 | 152.52 || 20.70 | 00h00'08\n+ 7.00 | 283637 | 161 | 100 | 1.13e-06 | 3.53e-04 || 7.45 | 3.73 | 135.21 || 22.70 | 00h00'12\n+ 7.25 | 464917 | 159 | 100 | 6.79e-07 | 2.15e-04 || 8.24 | 4.12 | 122.31 || 24.51 | 00h00'19\n+ 7.50 | 703970 | 157 | 100 | 4.43e-07 | 1.42e-04 || 9.05 | 4.52 | 111.42 || 26.37 | 00h00'26\n+ 7.75 | 1351762 | 153 | 100 | 2.25e-07 | 7.40e-05 || 9.73 | 4.87 | 103.56 || 27.69 | 00h00'49\n+ 8.00 | 2531411 | 163 | 100 | 1.28e-07 | 3.95e-05 || 10.09 | 5.04 | 99.93 || 27.96 | 00h01'31\n+ 8.25 | 4266143 | 160 | 100 | 7.44e-08 | 2.34e-05 || 11.10 | 5.55 | 90.81 || 30.06 | 00h02'23\n+ 8.50 | 10046057 | 165 | 100 | 3.26e-08 | 9.95e-06 || 11.93 | 5.96 | 84.50 || 31.46 | 00h05'21\n+# End of the simulation.\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a Gallager A ref.
8,490
12.01.2017 18:37:14
-3,600
01838f6148d9f4187f8bde3d4fc91d401dd27611
Fix the 10GE curve.
[ { "change_type": "MODIFY", "old_path": "tests/data/BFER/ldpc/BP_LAYERED/SPA/ETH_SPA_1723_2048.txt", "new_path": "tests/data/BFER/ldpc/BP_LAYERED/SPA/ETH_SPA_1723_2048.txt", "diff": "@@ -14,6 +14,8 @@ Trace:\n# ** SNR step (s) = 0.200000 dB\n# ** Type of bits = int (32 bits)\n# ** Type of reals = float (32 bits)\n+# ** Inter frame level = 1\n+# ** Seed = 0\n# ** Multi-threading (t) = 56 thread(s)\n# * Code ------------------------------------------\n# ** Type = LDPC\n@@ -38,6 +40,7 @@ Trace:\n# ** Type (D) = BP_LAYERED\n# ** Implementation = SPA\n# ** Num. of iterations (i) = 100\n+# ** Syndrome detection = off\n# * Monitor ---------------------------------------\n# ** Frame error count (e) = 100\n#\n@@ -50,26 +53,27 @@ Trace:\n# SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n# (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n- 0.00 | 155 | 26127 | 155 | 9.80e-02 | 1.00e+00 || 0.01 | 0.01 | 2.14e+05 || 0.40 | 00h00'00\n- 0.20 | 155 | 24693 | 155 | 9.26e-02 | 1.00e+00 || 0.01 | 0.01 | 2.02e+05 || 0.46 | 00h00'00\n- 0.40 | 155 | 23337 | 155 | 8.75e-02 | 1.00e+00 || 0.01 | 0.01 | 1.86e+05 || 0.53 | 00h00'00\n- 0.60 | 155 | 22077 | 155 | 8.28e-02 | 1.00e+00 || 0.01 | 0.01 | 1.86e+05 || 0.54 | 00h00'00\n- 0.80 | 155 | 20804 | 155 | 7.80e-02 | 1.00e+00 || 0.01 | 0.01 | 1.84e+05 || 0.54 | 00h00'00\n- 1.00 | 155 | 19469 | 155 | 7.30e-02 | 1.00e+00 || 0.01 | 0.01 | 1.86e+05 || 0.51 | 00h00'00\n- 1.20 | 155 | 18148 | 155 | 6.81e-02 | 1.00e+00 || 0.01 | 0.01 | 1.85e+05 || 0.52 | 00h00'00\n- 1.40 | 155 | 16927 | 155 | 6.35e-02 | 1.00e+00 || 0.01 | 0.01 | 1.84e+05 || 0.50 | 00h00'00\n- 1.60 | 155 | 15683 | 155 | 5.88e-02 | 1.00e+00 || 0.01 | 0.01 | 1.84e+05 || 0.52 | 00h00'00\n- 1.80 | 155 | 14519 | 155 | 5.45e-02 | 1.00e+00 || 0.01 | 0.01 | 1.84e+05 || 0.55 | 00h00'00\n- 2.00 | 155 | 13388 | 155 | 5.02e-02 | 1.00e+00 || 0.01 | 0.01 | 1.85e+05 || 0.53 | 00h00'00\n- 2.20 | 155 | 12252 | 155 | 4.60e-02 | 1.00e+00 || 0.01 | 0.01 | 1.82e+05 || 0.54 | 00h00'00\n- 2.40 | 155 | 11008 | 155 | 4.13e-02 | 1.00e+00 || 0.01 | 0.01 | 1.83e+05 || 0.51 | 00h00'00\n- 2.60 | 156 | 9855 | 155 | 3.67e-02 | 9.94e-01 || 0.01 | 0.01 | 1.84e+05 || 0.50 | 00h00'00\n- 2.80 | 162 | 8706 | 155 | 3.12e-02 | 9.57e-01 || 0.01 | 0.01 | 1.84e+05 || 0.52 | 00h00'00\n- 3.00 | 185 | 7527 | 151 | 2.37e-02 | 8.16e-01 || 0.01 | 0.01 | 1.62e+05 || 0.60 | 00h00'00\n- 3.20 | 267 | 6190 | 141 | 1.35e-02 | 5.28e-01 || 0.02 | 0.01 | 1.27e+05 || 0.77 | 00h00'00\n- 3.40 | 645 | 5226 | 128 | 4.71e-03 | 1.98e-01 || 0.02 | 0.02 | 86273.49 || 1.18 | 00h00'01\n- 3.60 | 2427 | 4333 | 107 | 1.04e-03 | 4.41e-02 || 0.03 | 0.03 | 63251.28 || 1.74 | 00h00'02\n- 3.80 | 19883 | 3927 | 100 | 1.15e-04 | 5.03e-03 || 0.04 | 0.03 | 57191.11 || 2.00 | 00h00'20\n- 4.00 | 219402 | 4226 | 101 | 1.12e-05 | 4.60e-04 || 0.04 | 0.03 | 55849.83 || 2.05 | 00h03'39\n- 4.20 | 5680722 | 3967 | 100 | 4.06e-07 | 1.76e-05 || 0.04 | 0.03 | 55156.52 || 2.07 | 01h33'26\n- 4.40 | 78250880 | 1196 | 42 | 8.89e-09 | 5.37e-07 || 0.04 | 0.03 | 54729.25 || 2.09 | 21h17'15\n\\ No newline at end of file\n+ 0.00 | 155 | 25990 | 155 | 9.73e-02 | 1.00e+00 || 0.02 | 0.01 | 1.35e+05 || 0.63 | 00h00'00\n+ 0.20 | 155 | 24651 | 155 | 9.23e-02 | 1.00e+00 || 0.02 | 0.01 | 1.33e+05 || 0.73 | 00h00'00\n+ 0.40 | 155 | 23289 | 155 | 8.72e-02 | 1.00e+00 || 0.01 | 0.01 | 1.38e+05 || 0.71 | 00h00'00\n+ 0.60 | 155 | 22001 | 155 | 8.24e-02 | 1.00e+00 || 0.02 | 0.01 | 1.32e+05 || 0.70 | 00h00'00\n+ 0.80 | 155 | 20798 | 155 | 7.79e-02 | 1.00e+00 || 0.01 | 0.01 | 1.37e+05 || 0.71 | 00h00'00\n+ 1.00 | 155 | 19397 | 155 | 7.26e-02 | 1.00e+00 || 0.02 | 0.01 | 1.35e+05 || 0.72 | 00h00'00\n+ 1.20 | 155 | 18103 | 155 | 6.78e-02 | 1.00e+00 || 0.01 | 0.01 | 1.37e+05 || 0.67 | 00h00'00\n+ 1.40 | 155 | 16853 | 155 | 6.31e-02 | 1.00e+00 || 0.01 | 0.01 | 1.42e+05 || 0.64 | 00h00'00\n+ 1.60 | 155 | 15623 | 155 | 5.85e-02 | 1.00e+00 || 0.01 | 0.01 | 1.41e+05 || 0.70 | 00h00'00\n+ 1.80 | 155 | 14397 | 155 | 5.39e-02 | 1.00e+00 || 0.02 | 0.01 | 1.36e+05 || 0.71 | 00h00'00\n+ 2.00 | 155 | 13357 | 155 | 5.00e-02 | 1.00e+00 || 0.01 | 0.01 | 1.39e+05 || 0.66 | 00h00'00\n+ 2.20 | 155 | 12213 | 155 | 4.57e-02 | 1.00e+00 || 0.01 | 0.01 | 1.39e+05 || 0.73 | 00h00'00\n+ 2.40 | 155 | 10904 | 155 | 4.08e-02 | 1.00e+00 || 0.01 | 0.01 | 1.39e+05 || 0.72 | 00h00'00\n+ 2.60 | 157 | 9563 | 154 | 3.54e-02 | 9.81e-01 || 0.02 | 0.01 | 1.33e+05 || 0.71 | 00h00'00\n+ 2.80 | 176 | 8518 | 153 | 2.81e-02 | 8.69e-01 || 0.02 | 0.01 | 1.27e+05 || 0.77 | 00h00'00\n+ 3.00 | 249 | 7624 | 149 | 1.78e-02 | 5.98e-01 || 0.02 | 0.02 | 1.01e+05 || 0.95 | 00h00'00\n+ 3.20 | 530 | 6010 | 131 | 6.58e-03 | 2.47e-01 || 0.03 | 0.03 | 65941.86 || 1.50 | 00h00'00\n+ 3.40 | 1718 | 5267 | 113 | 1.78e-03 | 6.58e-02 || 0.04 | 0.04 | 48325.79 || 2.22 | 00h00'01\n+ 3.60 | 13074 | 4538 | 102 | 2.01e-04 | 7.80e-03 || 0.05 | 0.04 | 41356.45 || 2.74 | 00h00'09\n+ 3.80 | 153256 | 4609 | 100 | 1.75e-05 | 6.53e-04 || 0.05 | 0.04 | 39924.73 || 2.86 | 00h01'49\n+ 4.00 | 3477966 | 4487 | 100 | 7.49e-07 | 2.88e-05 || 0.05 | 0.04 | 39473.35 || 2.90 | 00h40'58\n+ 4.20 | 1.10e+08 | 3993 | 100 | 2.10e-08 | 9.08e-07 || 0.05 | 0.04 | 39271.59 || 2.91 | 21h31'30\n+ 4.40 | 1.36e+08 | 109 | 8 | 4.64e-10 | 5.87e-08 || 0.05 | 0.04 | 39032.86 || 2.93 | 304h35'33\n+# End of the simulation.\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the 10GE curve.
8,490
13.01.2017 09:40:49
-3,600
4eef998d280b95c0e21be41e6d154303b7386ad2
Add a LDPC 10GE curve with NMS (N=0.5, ite=30).
[ { "change_type": "ADD", "old_path": null, "new_path": "tests/data/BFER/ldpc/BP_FLOODING/ONMS/ETH_NMS_1723_2048.txt", "diff": "+Run command:\n+./bin/aff3ct --sim-type BFER --cde-type LDPC --src-type AZCW -K 1723 -N 2048 -m 0.00 -M 4.51 -s 0.25 -e 100 --dec-type BP_FLOODING --dec-implem ONMS --dec-norm 0.5 -i 30 --cde-alist-path ../conf/dec/LDPC/10GBPS-ETHERNET_1723_2048.alist\n+Curve name:\n+LDPC (2048, 1723), Scaled Min-Sum, 30 ite.\n+Trace:\n+# -------------------------------------------------\n+# ---- A FAST FORWARD ERROR CORRECTION TOOL >> ----\n+# -------------------------------------------------\n+# Parameters:\n+# * Simulation ------------------------------------\n+# ** Type = BFER\n+# ** SNR min (m) = 0.000000 dB\n+# ** SNR max (M) = 4.510000 dB\n+# ** SNR step (s) = 0.250000 dB\n+# ** Type of bits = int (32 bits)\n+# ** Type of reals = float (32 bits)\n+# ** Inter frame level = 1\n+# ** Seed = 0\n+# ** Multi-threading (t) = 56 thread(s)\n+# * Code ------------------------------------------\n+# ** Type = LDPC\n+# ** Info. bits (K) = 1723\n+# ** Codeword size (N) = 2048\n+# ** Coset approach (c) = off\n+# ** AList file path = ../conf/dec/LDPC/10GBPS-ETHERNET_1723_2048.alist\n+# * Source ----------------------------------------\n+# ** Type = AZCW\n+# * Encoder ---------------------------------------\n+# ** Type = AZCW\n+# ** Systematic encoding = on\n+# * Modulator -------------------------------------\n+# ** Type = BPSK\n+# * Channel ---------------------------------------\n+# ** Type = AWGN\n+# ** Domain = LLR\n+# * Demodulator -----------------------------------\n+# ** Sigma square = on\n+# ** Max type = unused\n+# * Decoder ---------------------------------------\n+# ** Type (D) = BP_FLOODING\n+# ** Implementation = ONMS\n+# ** Num. of iterations (i) = 30\n+# ** Offset = 0.000000\n+# ** Normalize factor = 0.500000\n+# ** Syndrome detection = on\n+# * Monitor ---------------------------------------\n+# ** Frame error count (e) = 100\n+#\n+# The simulation is running...\n+# -------------------------------------------------------------||--------------------------------||---------------------\n+# Bit Error Rate (BER) and Frame Error Rate (FER) depending || Decoder throughput and || Global throughput\n+# on the Signal Noise Ratio (SNR) Eb/N0 || latency (per thread) || and elapsed time\n+# -------------------------------------------------------------||--------------------------------||---------------------\n+# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n+# SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n+# (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n+# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n+ 0.00 | 154 | 26455 | 154 | 9.97e-02 | 1.00e+00 || 0.29 | 0.24 | 7092.03 || 4.79 | 00h00'00\n+ 0.25 | 154 | 24762 | 154 | 9.33e-02 | 1.00e+00 || 0.28 | 0.23 | 7360.17 || 5.89 | 00h00'00\n+ 0.50 | 155 | 23339 | 155 | 8.74e-02 | 1.00e+00 || 0.28 | 0.23 | 7433.08 || 6.55 | 00h00'00\n+ 0.75 | 155 | 21680 | 155 | 8.12e-02 | 1.00e+00 || 0.28 | 0.23 | 7382.53 || 5.83 | 00h00'00\n+ 1.00 | 150 | 19518 | 150 | 7.55e-02 | 1.00e+00 || 0.31 | 0.26 | 6658.91 || 6.22 | 00h00'00\n+ 1.25 | 155 | 18550 | 155 | 6.95e-02 | 1.00e+00 || 0.28 | 0.24 | 7275.17 || 5.89 | 00h00'00\n+ 1.50 | 154 | 16859 | 154 | 6.35e-02 | 1.00e+00 || 0.29 | 0.24 | 7165.50 || 6.42 | 00h00'00\n+ 1.75 | 155 | 15495 | 155 | 5.80e-02 | 1.00e+00 || 0.28 | 0.23 | 7424.98 || 5.88 | 00h00'00\n+ 2.00 | 155 | 13889 | 155 | 5.20e-02 | 1.00e+00 || 0.27 | 0.23 | 7465.23 || 6.49 | 00h00'00\n+ 2.25 | 154 | 12448 | 154 | 4.69e-02 | 1.00e+00 || 0.29 | 0.24 | 7045.55 || 5.79 | 00h00'00\n+ 2.50 | 156 | 10919 | 155 | 4.06e-02 | 9.94e-01 || 0.28 | 0.24 | 7276.65 || 6.48 | 00h00'00\n+ 2.75 | 162 | 9188 | 153 | 3.29e-02 | 9.44e-01 || 0.28 | 0.24 | 7292.26 || 6.12 | 00h00'00\n+ 3.00 | 203 | 7616 | 151 | 2.18e-02 | 7.44e-01 || 0.31 | 0.26 | 6630.17 || 7.73 | 00h00'00\n+ 3.25 | 387 | 5416 | 128 | 8.12e-03 | 3.31e-01 || 0.51 | 0.43 | 4050.78 || 12.56 | 00h00'00\n+ 3.50 | 1594 | 4688 | 120 | 1.71e-03 | 7.53e-02 || 0.77 | 0.65 | 2667.23 || 28.99 | 00h00'00\n+ 3.75 | 22392 | 3692 | 100 | 9.57e-05 | 4.47e-03 || 1.16 | 0.98 | 1759.24 || 58.08 | 00h00'00\n+ 4.00 | 607016 | 3666 | 100 | 3.51e-06 | 1.65e-04 || 1.46 | 1.23 | 1400.92 || 74.42 | 00h00'16\n+ 4.25 | 84878776 | 3500 | 100 | 2.39e-08 | 1.18e-06 || 1.71 | 1.44 | 1198.83 || 85.82 | 00h33'45\n+ 4.50 | 2.46e+10 | 3293 | 100 | 7.75e-11 | 4.06e-09 || 1.92 | 1.62 | 1065.51 || 95.34 | 147h04'47\n+# End of the simulation.\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a LDPC 10GE curve with NMS (N=0.5, ite=30).
8,490
13.01.2017 11:22:56
-3,600
b2b779acb167159144abc4e4ccdcbf928ae24870
Display a warning when an argument is not valid.
[ { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -352,7 +352,7 @@ void Launcher<B,R,Q>\n\"print this help.\"};\nauto display_help = true;\n- if (ar.parse_arguments(req_args, opt_args))\n+ if (ar.parse_arguments(req_args, opt_args, cmd_warn))\n{\nthis->store_args();\n@@ -684,6 +684,9 @@ void Launcher<B,R,Q>\n// launch the simulation\nif (params.simulation.mpi_rank == 0)\nstream << \"# The simulation is running...\" << std::endl;\n+ // print the warnings\n+ if (params.simulation.mpi_rank == 0)\n+ stream << cmd_warn;\nsimu->launch();\nif (params.simulation.mpi_rank == 0)\nstream << \"# End of the simulation.\" << std::endl;\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.hpp", "new_path": "src/Launcher/Launcher.hpp", "diff": "@@ -38,7 +38,6 @@ private:\nSimulation *simu; /*!< A generic simulation pointer to allocate a specific simulation. */\nprotected:\n-\nArguments_reader ar; /*!< An argument reader to manage the parsing and the documentation of the command line parameters. */\nparameters params; /*!< A structure of parameters to store and pass to the simulation. */\nstd::ostream &stream; /*!< The dedicated stream in which the Launcher writes the parameters. */\n@@ -46,6 +45,7 @@ protected:\n*!< req_args[{\"key1\", \"key2\", [...]}] = {\"type\", [\"doc\"], [\"possible choices separated by a comma\"]}. */\nstd::map<std::vector<std::string>, std::vector<std::string>> opt_args; /*!< List of the optional arguments, syntax is the following:\n*!< opt_args[{\"key1\", \"key2\", [...]}] = {\"type\", [\"doc\"], [\"possible choices separated by a comma\"]}. */\n+ std::string cmd_warn;\npublic:\n/*!\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments_reader.cpp", "new_path": "src/Tools/Arguments_reader.cpp", "diff": "@@ -27,7 +27,8 @@ Arguments_reader\nbool Arguments_reader\n::parse_arguments(const map<vector<string>, vector<string>> &required_args,\n- const map<vector<string>, vector<string>> &optional_args)\n+ const map<vector<string>, vector<string>> &optional_args,\n+ const bool enable_warnings)\n{\nunsigned short int n_req_arg = 0;\n@@ -38,9 +39,53 @@ bool Arguments_reader\nfor(unsigned short i = 0; i < this->m_argv.size(); ++i)\n{\n+ bool valid_arg = false;\nif(this->sub_parse_arguments(this->m_required_args, i))\n+ {\n+ valid_arg = true;\nn_req_arg++;\n- this->sub_parse_arguments(this->m_optional_args, i);\n+ }\n+ valid_arg = this->sub_parse_arguments(this->m_optional_args, i) || valid_arg;\n+ if(!valid_arg && enable_warnings && this->m_argv[i][0] == '-')\n+ {\n+ std::cout << bold_yellow(\"(WW) Unknown argument \\\"\")\n+ << bold_yellow(this->m_argv[i])\n+ << bold_yellow(\"\\\".\")\n+ << std::endl;\n+ }\n+ }\n+\n+ return n_req_arg >= required_args.size();\n+}\n+\n+bool Arguments_reader\n+::parse_arguments(const map<vector<string>, vector<string>> &required_args,\n+ const map<vector<string>, vector<string>> &optional_args,\n+ string &warnings)\n+{\n+ unsigned short int n_req_arg = 0;\n+\n+ this->clear_arguments();\n+\n+ this->m_required_args = required_args;\n+ this->m_optional_args = optional_args;\n+\n+ for(unsigned short i = 0; i < this->m_argv.size(); ++i)\n+ {\n+ bool valid_arg = false;\n+ if(this->sub_parse_arguments(this->m_required_args, i))\n+ {\n+ valid_arg = true;\n+ n_req_arg++;\n+ }\n+ valid_arg = this->sub_parse_arguments(this->m_optional_args, i) || valid_arg;\n+ if(!valid_arg && this->m_argv[i][0] == '-')\n+ {\n+ warnings += bold_yellow(\"(WW) Unknown argument \\\"\");\n+ warnings += bold_yellow(this->m_argv[i]);\n+ warnings += bold_yellow(\"\\\".\");\n+ warnings += \"\\n\";\n+ }\n}\nreturn n_req_arg >= required_args.size();\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments_reader.hpp", "new_path": "src/Tools/Arguments_reader.hpp", "diff": "@@ -61,7 +61,12 @@ public:\n* \\return true if all the required arguments are in \"m_argv\", false otherwise.\n*/\nbool parse_arguments(const std::map<std::vector<std::string>, std::vector<std::string>> &required_args,\n- const std::map<std::vector<std::string>, std::vector<std::string>> &optional_args);\n+ const std::map<std::vector<std::string>, std::vector<std::string>> &optional_args,\n+ const bool enable_warnings = false);\n+\n+ bool parse_arguments(const std::map<std::vector<std::string>, std::vector<std::string>> &required_args,\n+ const std::map<std::vector<std::string>, std::vector<std::string>> &optional_args,\n+ std::string &warnings);\n/*!\n* \\brief Searches if the tags exist.\n" } ]
C++
MIT License
aff3ct/aff3ct
Display a warning when an argument is not valid.
8,483
09.01.2017 12:35:46
-3,600
4e2210868ac71d4dc6b1bcf45d4367f2001b759b
script correction and add symbol type SIMPLE_PRECISION support
[ { "change_type": "MODIFY", "old_path": "scripts/gsm_BPF_MAXS_SPA.sh", "new_path": "scripts/gsm_BPF_MAXS_SPA.sh", "diff": "cd ../build\n-./aff3ct \\\n+./bin/aff3ct \\\n--sim-type BFERI \\\n--sim-prec 32 \\\n--sim-snr-min 0.0 \\\n" }, { "change_type": "MODIFY", "old_path": "scripts/gsm_BPF_MAX_NMS.sh", "new_path": "scripts/gsm_BPF_MAX_NMS.sh", "diff": "cd ../build\n-./aff3ct \\\n+./bin/aff3ct \\\n--sim-type BFERI \\\n--sim-prec 32 \\\n--sim-snr-min 0.0 \\\n" }, { "change_type": "MODIFY", "old_path": "scripts/gsm_BPL_MAXS_SPA.sh", "new_path": "scripts/gsm_BPL_MAXS_SPA.sh", "diff": "cd ../build\n-./aff3ct \\\n+./bin/aff3ct \\\n--sim-type BFERI \\\n--sim-prec 32 \\\n--sim-snr-min 0.0 \\\n" }, { "change_type": "MODIFY", "old_path": "scripts/gsm_BPL_MAX_NMS.sh", "new_path": "scripts/gsm_BPL_MAX_NMS.sh", "diff": "cd ../build\n-./aff3ct \\\n+./bin/aff3ct \\\n--sim-type BFERI \\\n--sim-prec 32 \\\n--sim-snr-min 0.0 \\\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/types.h", "new_path": "src/Tools/types.h", "diff": "@@ -36,21 +36,25 @@ using QD_64 = double;\nusing R = R_8;\nusing Q = Q_8;\nusing QD = QD_8;\n+ using S = S_8;\n#elif defined(PREC_16_BIT)\nusing B = B_16;\nusing R = R_16;\nusing Q = Q_16;\nusing QD = QD_16;\n+ using S = S_16;\n#elif defined(PREC_64_BIT)\nusing B = B_64;\nusing R = R_64;\nusing Q = Q_64;\nusing QD = QD_64;\n+ using S = S_64;\n#else // PREC_32_BIT\nusing B = B_32;\nusing R = R_32;\nusing Q = Q_32;\nusing QD = QD_32;\n+ using S = S_32;\n#ifndef PREC_32_BIT\n#define PREC_32_BIT\n#endif\n" } ]
C++
MIT License
aff3ct/aff3ct
script correction and add symbol type SIMPLE_PRECISION support
8,483
10.01.2017 10:13:06
-3,600
7c3dba948cd0b8a12f52ba55cb96fa10154e3c38
change the use of the arguments in the scripts by for infinite possibilities
[ { "change_type": "RENAME", "old_path": "scripts/gsm_BPF_MAXS_SPA.sh", "new_path": "scripts/CPM/gsm_BPF_MAXS_SPA.sh", "diff": "" }, { "change_type": "RENAME", "old_path": "scripts/gsm_BPF_MAX_NMS.sh", "new_path": "scripts/CPM/gsm_BPF_MAX_NMS.sh", "diff": "" }, { "change_type": "RENAME", "old_path": "scripts/gsm_BPL_MAXS_SPA.sh", "new_path": "scripts/CPM/gsm_BPL_MAXS_SPA.sh", "diff": "" }, { "change_type": "RENAME", "old_path": "scripts/gsm_BPL_MAX_NMS.sh", "new_path": "scripts/CPM/gsm_BPL_MAX_NMS.sh", "diff": "" }, { "change_type": "MODIFY", "old_path": "scripts/run_bfer_polar_SC.sh", "new_path": "scripts/run_bfer_polar_SC.sh", "diff": "@@ -13,4 +13,4 @@ cd ../build\n--mnt-max-fe 100 \\\n--dec-type SC \\\n--dec-implem FAST \\\n- $1 $2 $3 $4 $5 $6 $7 $8 $9 $10\n+ $*\n" }, { "change_type": "MODIFY", "old_path": "scripts/run_bfer_polar_SCL.sh", "new_path": "scripts/run_bfer_polar_SCL.sh", "diff": "@@ -15,5 +15,5 @@ cd ../build\n--dec-implem NAIVE \\\n-L 4 \\\n--crc-type 8-DVB-S2 \\\n- $1 $2 $3 $4 $5 $6 $7 $8 $9 $10\n+ $*\n" }, { "change_type": "MODIFY", "old_path": "scripts/run_bfer_polar_SC_debug.sh", "new_path": "scripts/run_bfer_polar_SC_debug.sh", "diff": "@@ -15,4 +15,4 @@ cd ../build\n--sim-debug \\\n--dec-type SC \\\n--dec-implem NAIVE \\\n- $1 $2 $3 $4 $5 $6 $7 $8 $9 $10\n+ $*\n" }, { "change_type": "MODIFY", "old_path": "scripts/run_bfer_polar_SC_small.sh", "new_path": "scripts/run_bfer_polar_SC_small.sh", "diff": "@@ -13,4 +13,4 @@ cd ../build\n--mnt-max-fe 100 \\\n--dec-type SC \\\n--dec-implem NAIVE \\\n- $1 $2 $3 $4 $5 $6 $7 $8 $9 $10\n+ $*\n" }, { "change_type": "MODIFY", "old_path": "scripts/run_bfer_turbo_LTE.sh", "new_path": "scripts/run_bfer_turbo_LTE.sh", "diff": "@@ -14,4 +14,4 @@ cd ../build\n--dec-ite 6 \\\n--dec-type LTE \\\n--dec-implem FAST \\\n- $1 $2 $3 $4 $5 $6 $7 $8 $9 $10\n+ $*\n" }, { "change_type": "MODIFY", "old_path": "scripts/run_exit_polar_SCAN.sh", "new_path": "scripts/run_exit_polar_SCAN.sh", "diff": "@@ -17,4 +17,4 @@ cd ../build\n--dec-type SCAN \\\n--dec-implem NAIVE \\\n--cde-sigma 0.8 \\\n- $1 $2 $3 $4 $5 $6 $7 $8 $9 $10\n+ $*\n" } ]
C++
MIT License
aff3ct/aff3ct
change the use of the arguments in the scripts by for infinite possibilities
8,483
10.01.2017 10:45:34
-3,600
832db1617ed733f1bd9f4942df69699f1807e882
add default values to the arguments descriptions and check run command in simus
[ { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -169,24 +169,24 @@ void Launcher<B,R,Q>\nopt_args[{\"mod-cpm-std\"}] =\n{\"string\",\n- \"the selection of a default cpm standard hardly implemented\",\n+ \"the selection of a default cpm standard hardly implemented (any of those parameters is overwritten if the argument is given by the user)\",\n\"GSM\"};\nopt_args[{\"mod-cpm-L\"}] =\n{\"positive_int\",\n- \"cpm pulse width or cpm memory\"};\n+ \"cpm pulse width or cpm memory (default is 2)\"};\nopt_args[{\"mod-cpm-k\"}] =\n{\"positive_int\",\n- \"modulation index numerator\"};\n+ \"modulation index numerator (default is 1)\"};\nopt_args[{\"mod-cpm-p\"}] =\n{\"positive_int\",\n- \"modulation index denumerator\"};\n+ \"modulation index denumerator (default is 2)\"};\nopt_args[{\"mod-map\"}] =\n{\"string\",\n- \"symbols mapping layout\",\n+ \"symbols mapping layout (default is NATURAL)\",\n\"NATURAL, GRAY\"};\nopt_args[{\"mod-ws\"}] =\n{\"string\",\n- \"wave shape\",\n+ \"wave shape (default is GMSK)\",\n\"GMSK, REC, RCOS\"};\n// --------------------------------------------------------------------------------------------------- demodulator\n@@ -347,7 +347,7 @@ void Launcher<B,R,Q>\n}\nelse\n{\n- std::cerr<<bold_red(\"(EE) Unknown chain standard\")<<std::endl;\n+ std::cerr<<bold_red(\"(EE) Unknown CPM standard!\")<<std::endl;\nexit(-1);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_NMS_MAX_it10_0.0_2.5.txt", "new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_NMS_MAX_it10_0.0_2.5.txt", "diff": "Run command:\n-./aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 10 --dec-type BP_FLOODING --cde-alist-path ../../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 10 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\nCurve name:\nGSM-BPL MAX NMS, 10 glob. ite.\nTrace:\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_NMS_MAX_it20_0.0_2.5.txt", "new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_NMS_MAX_it20_0.0_2.5.txt", "diff": "Run command:\n-./aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 20 --dec-type BP_FLOODING --cde-alist-path ../../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 20 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\nCurve name:\nGSM-BPL MAX NMS, 20 glob. ite.\nTrace:\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_NMS_MAX_it30_0.0_2.5.txt", "new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_NMS_MAX_it30_0.0_2.5.txt", "diff": "Run command:\n-./aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 30 --dec-type BP_FLOODING --cde-alist-path ../../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 30 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\nCurve name:\nGSM-BPL MAX NMS, 30 glob. ite.\nTrace:\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_SPA_MAXS_it10_0.0_2.5.txt", "new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_SPA_MAXS_it10_0.0_2.5.txt", "diff": "Run command:\n-./aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 10 --dec-type BP_FLOODING --cde-alist-path ../../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 10 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\nCurve name:\nGSM-BPF MAXS SPA, 10 glob. ite.\nTrace:\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_SPA_MAXS_it20_0.0_2.5.txt", "new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_SPA_MAXS_it20_0.0_2.5.txt", "diff": "Run command:\n-./aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 20 --dec-type BP_FLOODING --cde-alist-path ../../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 20 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\nCurve name:\nGSM-BPF MAXS SPA, 20 glob. ite.\nTrace:\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_SPA_MAXS_it30_0.0_2.5.txt", "new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_SPA_MAXS_it30_0.0_2.5.txt", "diff": "Run command:\n-./aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 30 --dec-type BP_FLOODING --cde-alist-path ../../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 30 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\nCurve name:\nGSM-BPF MAXS SPA, 30 glob. ite.\nTrace:\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_NMS_MAX_it10_0.0_3.0.txt", "new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_NMS_MAX_it10_0.0_3.0.txt", "diff": "Run command:\n-./aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 10 --dec-type BP_LAYERED --cde-alist-path ../../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 10 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\nCurve name:\nGSM-BPL MAX NMS, 10 glob. ite.\nTrace:\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_NMS_MAX_it20_0.0_3.0.txt", "new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_NMS_MAX_it20_0.0_3.0.txt", "diff": "Run command:\n-./aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 20 --dec-type BP_LAYERED --cde-alist-path ../../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 20 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\nCurve name:\nGSM-BPL MAX NMS, 20 glob. ite.\nTrace:\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_NMS_MAX_it30_0.0_3.0.txt", "new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_NMS_MAX_it30_0.0_3.0.txt", "diff": "Run command:\n-./aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 30 --dec-type BP_LAYERED --cde-alist-path ../../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 30 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\nCurve name:\nGSM-BPL MAX NMS, 30 glob. ite.\nTrace:\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_NMS_MAX_it40_0.0_3.0.txt", "new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_NMS_MAX_it40_0.0_3.0.txt", "diff": "Run command:\n-./aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 40 --dec-type BP_LAYERED --cde-alist-path ../../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 40 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\nCurve name:\nGSM-BPL MAX NMS, 40 glob. ite.\nTrace:\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_SPA_MAXS_it10_0.0_2.5.txt", "new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_SPA_MAXS_it10_0.0_2.5.txt", "diff": "Run command:\n-./aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 10 --dec-type BP_LAYERED --cde-alist-path ../../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 10 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\nCurve name:\nGSM-BPL MAXS SPA, 10 glob. ite.\nTrace:\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_SPA_MAXS_it20_0.0_2.5.txt", "new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_SPA_MAXS_it20_0.0_2.5.txt", "diff": "Run command:\n-./aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 20 --dec-type BP_LAYERED --cde-alist-path ../../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 20 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\nCurve name:\nGSM-BPL MAXS SPA, 20 glob. ite.\nTrace:\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_SPA_MAXS_it30_0.0_2.5.txt", "new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_SPA_MAXS_it30_0.0_2.5.txt", "diff": "Run command:\n-./aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 30 --dec-type BP_LAYERED --cde-alist-path ../../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 30 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\nCurve name:\nGSM-BPL MAXS SPA, 30 glob. ite.\nTrace:\n" } ]
C++
MIT License
aff3ct/aff3ct
add default values to the arguments descriptions and check run command in simus
8,490
13.01.2017 18:16:05
-3,600
dc707b6f74b7614eaa1ad5c8505e041190cac899
Working on a bug when BFERI, inter-frame and LDPC decoders.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding.cpp", "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding.cpp", "diff": "@@ -56,7 +56,7 @@ void Decoder_LDPC_BP_flooding<B,R>\n::_soft_decode(const mipp::vector<R> &Y_N1, mipp::vector<R> &Y_N2)\n{\nassert(Y_N1.size() == Y_N2.size());\n- assert(Y_N1.size() == this->Y_N.size());\n+ assert(Y_N1.size() >= this->Y_N.size());\n// memory zones initialization\nif (this->init_flag)\n@@ -69,7 +69,7 @@ void Decoder_LDPC_BP_flooding<B,R>\nthis->BP_decode(Y_N1);\n// prepare for next round by processing extrinsic information\n- for (auto i = 0; i < (int)Y_N2.size(); i++)\n+ for (auto i = 0; i < this->N; i++)\nY_N2[i] = this->Lp_N[i] - Y_N1[i];\n// saturate<R>(Y_N2, (R)-C_to_V_max, (R)C_to_V_max);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/LDPC/BP/Layered/Decoder_LDPC_BP_layered.cpp", "new_path": "src/Module/Decoder/LDPC/BP/Layered/Decoder_LDPC_BP_layered.cpp", "diff": "@@ -55,7 +55,7 @@ void Decoder_LDPC_BP_layered<B,R>\nthis->BP_decode();\n// prepare for next round by processing extrinsic information\n- for (auto i = 0; i < (int)this->N; i++)\n+ for (auto i = 0; i < this->N; i++)\nY_N2[i] = this->var_nodes[i] - Y_N1[i];\n// copy extrinsic information into var_nodes for next TURBO iteration\n" } ]
C++
MIT License
aff3ct/aff3ct
Working on a bug when BFERI, inter-frame and LDPC decoders.
8,490
13.01.2017 18:16:25
-3,600
6b03c52fe968bab4afa7f19f7cfa9097b7017800
Improve curves.
[ { "change_type": "MODIFY", "old_path": "tests/data/BFER/ldpc/BP_LAYERED/SPA/ETH_SPA_1723_2048.txt", "new_path": "tests/data/BFER/ldpc/BP_LAYERED/SPA/ETH_SPA_1723_2048.txt", "diff": "@@ -75,5 +75,5 @@ Trace:\n3.80 | 153256 | 4609 | 100 | 1.75e-05 | 6.53e-04 || 0.05 | 0.04 | 39924.73 || 2.86 | 00h01'49\n4.00 | 3477966 | 4487 | 100 | 7.49e-07 | 2.88e-05 || 0.05 | 0.04 | 39473.35 || 2.90 | 00h40'58\n4.20 | 1.10e+08 | 3993 | 100 | 2.10e-08 | 9.08e-07 || 0.05 | 0.04 | 39271.59 || 2.91 | 21h31'30\n- 4.40 | 1.36e+08 | 109 | 8 | 4.64e-10 | 5.87e-08 || 0.05 | 0.04 | 39032.86 || 2.93 | 304h35'33\n+ 4.40 | 2.58e+08 | 210 | 13 | 4.72e-10 | 5.04e-08 || 0.05 | 0.04 | 39018.98 || 2.93 | 335h25'35\n# End of the simulation.\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFER/uncoded/gsm-max_N4003.txt", "new_path": "tests/data/BFER/uncoded/gsm-max_N4003.txt", "diff": "Run command:\n-./bin/aff3ct -p 32 --sim-type BFER --cde-type UNCODED -m 0.0 -M 12.1 -s 1.0 -e 500 -K 4003 -N 4003 -e 500 --mod-type GSM --dmod-max MAX --chn-type AWGN_FAST --src-type RAND_FAST -t 48\n+./bin/aff3ct -p 32 --sim-type BFER --cde-type UNCODED -m 0.0 -M 12.1 -s 1.0 -e 500 -K 4003 -N 4003 -e 500 --mod-type CPM --mod-cpm-std GSM --dmod-max MAX --chn-type AWGN_FAST --src-type RAND_FAST -t 48\nCurve name:\nGSM\nTrace:\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve curves.
8,490
13.01.2017 23:13:09
-3,600
3239b077142bd183ae51a934b0a4eb95a603b530
Enable the mapping only with the CPM modulation. This option is not available for the other modulation by now.
[ { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -546,11 +546,11 @@ std::vector<std::pair<std::string,std::string>> Launcher<B,R,Q>\nstd::string(\"/\") +\nstd::to_string(this->params.modulator.cpm_p)) ));\np.push_back(std::make_pair(\"CPM wave shape\", this->params.modulator.wave_shape));\n+ p.push_back(std::make_pair(\"CPM mapping\", this->params.modulator.mapping ));\n}\np.push_back(std::make_pair(\"Bits per symbol\", std::to_string(this->params.modulator.bits_per_symbol)));\np.push_back(std::make_pair(\"Sampling factor\", std::to_string(this->params.modulator.upsample_factor)));\n- p.push_back(std::make_pair(\"Mapping\", this->params.modulator.mapping ));\nreturn p;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Enable the mapping only with the CPM modulation. This option is not available for the other modulation by now.
8,490
14.01.2017 11:25:04
-3,600
c2a151401097e901658a57b734637fc7e7bec913
Add a new option '--sim-pyber' to print a specific output for the PyBER plotter (Run command & Curve name).
[ { "change_type": "MODIFY", "old_path": "aff3ct_completion.sh", "new_path": "aff3ct_completion.sh", "diff": "@@ -50,7 +50,7 @@ _aff3ct() {\n--mod-cpm-std --mod-const-path --dmod-max --dmod-no-sig2 \\\n--chn-type --chn-path --chn-blk-fad --qnt-type --qnt-int \\\n--qnt-bits --qnt-range --dec-type --dec-implem --term-no \\\n- --term-freq --sim-seed --sim-mpi-comm\"\n+ --term-freq --sim-seed --sim-mpi-comm --sim-pyber\"\nfi\n# add contents of Launcher_BFER.cpp\n@@ -207,7 +207,7 @@ _aff3ct() {\n--sim-siga-min | -a | --sim-siga-max | -A | --sim-siga-step | \\\n--dmod-ite | --cde-sigma | --dec-snr | --dec-ite |-i | --dec-lists | \\\n-L | --sim-json-path | --dec-off | --dec-norm | --term-freq | \\\n- --sim-seed | --sim-mpi-comm)\n+ --sim-seed | --sim-mpi-comm | --sim-pyber)\nCOMPREPLY=()\n;;\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -20,6 +20,17 @@ Launcher<B,R,Q>\n::Launcher(const int argc, const char **argv, std::ostream &stream)\n: max_n_chars(0), simu(nullptr), ar(argc, argv), stream(stream)\n{\n+ cmd_line += std::string(argv[0]) + std::string(\" \");\n+ for (auto i = 1; i < argc; i++)\n+ {\n+ if (argv[i][0] == '-')\n+ cmd_line += std::string(argv[i]);\n+ else\n+ cmd_line += std::string(\"\\\"\") + std::string(argv[i]) + std::string(\"\\\"\");\n+\n+ cmd_line += std::string(\" \");\n+ }\n+\n// define type names\ntype_names[typeid(char)] = \"char (\" + std::to_string(sizeof(char)*8) + \" bits)\";\ntype_names[typeid(signed char)] = \"signed char (\" + std::to_string(sizeof(signed char)*8) + \" bits)\";\n@@ -38,6 +49,7 @@ Launcher<B,R,Q>\nparams.simulation .mpi_rank = 0;\nparams.simulation .mpi_size = 1;\nparams.simulation .mpi_comm_freq = std::chrono::milliseconds(1000);\n+ params.simulation .pyber = \"\";\nparams.code .tail_length = 0;\nparams.source .type = \"RAND\";\nparams.source .path = \"\";\n@@ -97,6 +109,9 @@ void Launcher<B,R,Q>\n{\"string\",\n\"select the type of simulation to launch (default is BFER).\",\n\"BFER, BFERI, EXIT, GEN\"};\n+ opt_args[{\"sim-pyber\"}] =\n+ {\"string\",\n+ \"prepare the output for the PyBER plotter tool, takes the name of the curve in PyBER.\"};\nopt_args[{\"sim-stop-time\"}] =\n{\"positive_int\",\n\"time in sec after what the current SNR iteration should stop.\"};\n@@ -274,6 +289,7 @@ void Launcher<B,R,Q>\nparams.simulation.snr_max = ar.get_arg_float({\"sim-snr-max\", \"M\"}); // required\nif(ar.exist_arg({\"sim-type\" })) params.simulation.type = ar.get_arg ({\"sim-type\" });\n+ if(ar.exist_arg({\"sim-pyber\" })) params.simulation.pyber = ar.get_arg ({\"sim-pyber\" });\nif(ar.exist_arg({\"sim-snr-step\", \"s\" })) params.simulation.snr_step = ar.get_arg_float({\"sim-snr-step\", \"s\" });\nif(ar.exist_arg({\"sim-domain\" })) params.channel.domain = ar.get_arg ({\"sim-domain\" });\nif(ar.exist_arg({\"sim-inter-lvl\" })) params.simulation.inter_frame_level = ar.get_arg_int ({\"sim-inter-lvl\" });\n@@ -735,6 +751,16 @@ void Launcher<B,R,Q>\n}\nthis->read_arguments();\n+\n+ // write the command and he curve name in the PyBER format\n+ if (!params.simulation.pyber.empty() && params.simulation.mpi_rank == 0)\n+ {\n+ stream << \"Run command:\" << std::endl;\n+ stream << cmd_line << std::endl;\n+ stream << \"Curve name:\" << std::endl;\n+ stream << params.simulation.pyber << std::endl;\n+ }\n+\nif (params.simulation.mpi_rank == 0)\nthis->print_header();\nsimu = this->build_simu();\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.hpp", "new_path": "src/Launcher/Launcher.hpp", "diff": "@@ -36,6 +36,8 @@ private:\nint max_n_chars; /*!< The number of characters of the largest parameter name. */\nstd::unordered_map<std::type_index,std::string> type_names; /*!< An internal map to store a string associated to a type. */\nSimulation *simu; /*!< A generic simulation pointer to allocate a specific simulation. */\n+ std::string cmd_line;\n+ std::string cmd_warn;\nprotected:\nArguments_reader ar; /*!< An argument reader to manage the parsing and the documentation of the command line parameters. */\n@@ -45,7 +47,6 @@ protected:\n*!< req_args[{\"key1\", \"key2\", [...]}] = {\"type\", [\"doc\"], [\"possible choices separated by a comma\"]}. */\nstd::map<std::vector<std::string>, std::vector<std::string>> opt_args; /*!< List of the optional arguments, syntax is the following:\n*!< opt_args[{\"key1\", \"key2\", [...]}] = {\"type\", [\"doc\"], [\"possible choices separated by a comma\"]}. */\n- std::string cmd_warn;\npublic:\n/*!\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/params.h", "new_path": "src/Tools/params.h", "diff": "@@ -13,6 +13,7 @@ struct simulation_parameters\nstd::string trace_path;\nstd::string bin_pb_path;\nstd::string json_path;\n+ std::string pyber;\nfloat snr_min;\nfloat snr_max;\nfloat snr_step;\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a new option '--sim-pyber' to print a specific output for the PyBER plotter (Run command & Curve name).
8,490
14.01.2017 11:44:10
-3,600
6279146c1b3dafe2a7dffc0e4f634474d04403d1
Update the README example with the new working GA frozen bit generator.
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -37,7 +37,7 @@ If you use `ctrl+C` twice in a small time-step (500ms), the program will stop.\nOpen a shell and type (from the `$ROOT_AFF3CT/build/` folder):\n- $ ./bin/aff3ct --sim-type BFER --cde-type POLAR -K 1024 -N 2048 -m 1.5 -M 3.01 --cde-fb-gen-method GA --cde-sigma 0.862 --dec-type SC --dec-implem FAST -t 1\n+ $ ./bin/aff3ct --sim-type BFER --cde-type POLAR -K 1024 -N 2048 -m 1.5 -M 2.81 --cde-fb-gen-method GA -t 1\nExpected output:\n@@ -48,23 +48,29 @@ Expected output:\n# * Simulation ------------------------------------\n# ** Type = BFER\n# ** SNR min (m) = 1.500000 dB\n- # ** SNR max (M) = 3.010000 dB\n+ # ** SNR max (M) = 2.810000 dB\n# ** SNR step (s) = 0.100000 dB\n# ** Type of bits = int (32 bits)\n# ** Type of reals = float (32 bits)\n+ # ** Inter frame level = 1\n+ # ** Seed = 0\n# ** Multi-threading (t) = 1 thread(s)\n# * Code ------------------------------------------\n- # ** Type = POLAR codes\n+ # ** Type = POLAR\n# ** Info. bits (K) = 1024\n# ** Codeword size (N) = 2048\n- # ** Sigma for code gen. = 0.862000\n+ # ** Coset approach (c) = off\n+ # ** Sigma for code gen. = adaptative\n# ** Frozen bits gen. method = GA\n# * Source ----------------------------------------\n# ** Type = RAND\n# * Encoder ---------------------------------------\n+ # ** Type = POLAR\n# ** Systematic encoding = on\n# * Modulator -------------------------------------\n# ** Type = BPSK\n+ # ** Bits per symbol = 1\n+ # ** Sampling factor = 1\n# * Channel ---------------------------------------\n# ** Type = AWGN\n# ** Domain = LLR\n@@ -77,7 +83,6 @@ Expected output:\n# * Monitor ---------------------------------------\n# ** Frame error count (e) = 100\n#\n- (WW) The GA (Gaussian Approximation) frozen bits generator is inaccurate.\n# The simulation is running...\n# -------------------------------------------------------------||--------------------------------||---------------------\n# Bit Error Rate (BER) and Frame Error Rate (FER) depending || Decoder throughput and || Global throughput\n@@ -87,22 +92,20 @@ Expected output:\n# SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n# (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n- 1.50 | 137 | 14915 | 100 | 1.06e-01 | 7.30e-01 || 84.68 | 42.34 | 24.19 || 13.92 | 00h00'00\n- 1.60 | 173 | 14517 | 100 | 8.19e-02 | 5.78e-01 || 91.34 | 45.67 | 22.42 || 15.42 | 00h00'00\n- 1.70 | 200 | 13867 | 100 | 6.77e-02 | 5.00e-01 || 86.87 | 43.43 | 23.58 || 14.76 | 00h00'00\n- 1.80 | 232 | 13271 | 100 | 5.59e-02 | 4.31e-01 || 89.39 | 44.70 | 22.91 || 15.56 | 00h00'00\n- 1.90 | 320 | 12323 | 100 | 3.76e-02 | 3.12e-01 || 91.01 | 45.50 | 22.50 || 15.94 | 00h00'00\n- 2.00 | 449 | 11957 | 100 | 2.60e-02 | 2.23e-01 || 94.18 | 47.09 | 21.74 || 16.54 | 00h00'00\n- 2.10 | 627 | 11253 | 100 | 1.75e-02 | 1.59e-01 || 93.19 | 46.60 | 21.98 || 16.45 | 00h00'00\n- 2.20 | 965 | 11123 | 100 | 1.13e-02 | 1.04e-01 || 94.02 | 47.01 | 21.78 || 16.71 | 00h00'00\n- 2.30 | 1644 | 10204 | 100 | 6.06e-03 | 6.08e-02 || 94.50 | 47.25 | 21.67 || 16.75 | 00h00'00\n- 2.40 | 2634 | 9371 | 100 | 3.47e-03 | 3.80e-02 || 94.76 | 47.38 | 21.61 || 16.84 | 00h00'00\n- 2.50 | 3634 | 9491 | 100 | 2.55e-03 | 2.75e-02 || 94.54 | 47.27 | 21.66 || 16.79 | 00h00'00\n- 2.60 | 6227 | 9152 | 100 | 1.44e-03 | 1.61e-02 || 86.86 | 43.43 | 23.58 || 15.64 | 00h00'00\n- 2.70 | 11502 | 8602 | 100 | 7.30e-04 | 8.69e-03 || 82.97 | 41.48 | 24.68 || 15.07 | 00h00'01\n- 2.80 | 24300 | 8359 | 100 | 3.36e-04 | 4.12e-03 || 94.45 | 47.22 | 21.68 || 16.86 | 00h00'02\n- 2.90 | 58746 | 7961 | 100 | 1.32e-04 | 1.70e-03 || 92.75 | 46.37 | 22.08 || 16.55 | 00h00'07\n- 3.00 | 130491 | 8150 | 100 | 6.10e-05 | 7.66e-04 || 93.19 | 46.60 | 21.98 || 16.65 | 00h00'16\n+ 1.50 | 397 | 6512 | 100 | 1.60e-02 | 2.52e-01 || 97.92 | 48.96 | 20.91 || 13.19 | 00h00'00\n+ 1.60 | 522 | 6100 | 100 | 1.14e-02 | 1.92e-01 || 119.57 | 59.79 | 17.13 || 17.35 | 00h00'00\n+ 1.70 | 695 | 6232 | 100 | 8.76e-03 | 1.44e-01 || 118.62 | 59.31 | 17.27 || 17.42 | 00h00'00\n+ 1.80 | 988 | 5160 | 100 | 5.10e-03 | 1.01e-01 || 119.23 | 59.62 | 17.18 || 17.53 | 00h00'00\n+ 1.90 | 1540 | 4590 | 100 | 2.91e-03 | 6.49e-02 || 117.27 | 58.63 | 17.46 || 17.78 | 00h00'00\n+ 2.00 | 2593 | 4880 | 100 | 1.84e-03 | 3.86e-02 || 117.29 | 58.64 | 17.46 || 17.96 | 00h00'00\n+ 2.10 | 3519 | 4488 | 100 | 1.25e-03 | 2.84e-02 || 117.14 | 58.57 | 17.48 || 18.02 | 00h00'00\n+ 2.20 | 5374 | 4636 | 100 | 8.42e-04 | 1.86e-02 || 115.91 | 57.95 | 17.67 || 18.02 | 00h00'00\n+ 2.30 | 11013 | 3728 | 100 | 3.31e-04 | 9.08e-03 || 115.70 | 57.85 | 17.70 || 18.02 | 00h00'01\n+ 2.40 | 20949 | 3812 | 100 | 1.78e-04 | 4.77e-03 || 114.89 | 57.45 | 17.83 || 17.92 | 00h00'02\n+ 2.50 | 30454 | 3226 | 100 | 1.03e-04 | 3.28e-03 || 115.22 | 57.61 | 17.77 || 18.01 | 00h00'03\n+ 2.60 | 40835 | 3990 | 100 | 9.54e-05 | 2.45e-03 || 113.05 | 56.52 | 18.12 || 17.93 | 00h00'04\n+ 2.70 | 93116 | 3216 | 100 | 3.37e-05 | 1.07e-03 || 111.32 | 55.66 | 18.40 || 17.73 | 00h00'10\n+ 2.80 | 199253 | 2795 | 100 | 1.37e-05 | 5.02e-04 || 109.16 | 54.58 | 18.76 || 17.82 | 00h00'22\n# End of the simulation.\n## More\n" } ]
C++
MIT License
aff3ct/aff3ct
Update the README example with the new working GA frozen bit generator.
8,490
14.01.2017 13:08:09
-3,600
25aeb7f3830f28fda437e3f8dcf675e629b72d90
Fix bad curve names.
[ { "change_type": "MODIFY", "old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_NMS_MAX_it10_0.0_2.5.txt", "new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_NMS_MAX_it10_0.0_2.5.txt", "diff": "Run command:\n./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 10 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\nCurve name:\n-GSM-BPL MAX NMS, 10 glob. ite.\n+GSM-BPF MAX NMS, 10 glob. ite.\nTrace:\n# -------------------------------------------------\n# ---- A FAST FORWARD ERROR CORRECTION TOOL >> ----\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_NMS_MAX_it20_0.0_2.5.txt", "new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_NMS_MAX_it20_0.0_2.5.txt", "diff": "Run command:\n./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 20 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\nCurve name:\n-GSM-BPL MAX NMS, 20 glob. ite.\n+GSM-BPF MAX NMS, 20 glob. ite.\nTrace:\n# -------------------------------------------------\n# ---- A FAST FORWARD ERROR CORRECTION TOOL >> ----\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_NMS_MAX_it30_0.0_2.5.txt", "new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_NMS_MAX_it30_0.0_2.5.txt", "diff": "Run command:\n./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 30 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\nCurve name:\n-GSM-BPL MAX NMS, 30 glob. ite.\n+GSM-BPF MAX NMS, 30 glob. ite.\nTrace:\n# -------------------------------------------------\n# ---- A FAST FORWARD ERROR CORRECTION TOOL >> ----\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix bad curve names.
8,490
15.01.2017 14:25:38
-3,600
11d6901aba52d0bacf3173a3c291037a75f3ac99
Update the 10GE layered curve.
[ { "change_type": "MODIFY", "old_path": "tests/data/BFER/ldpc/BP_LAYERED/SPA/ETH_SPA_1723_2048.txt", "new_path": "tests/data/BFER/ldpc/BP_LAYERED/SPA/ETH_SPA_1723_2048.txt", "diff": "@@ -75,5 +75,5 @@ Trace:\n3.80 | 153256 | 4609 | 100 | 1.75e-05 | 6.53e-04 || 0.05 | 0.04 | 39924.73 || 2.86 | 00h01'49\n4.00 | 3477966 | 4487 | 100 | 7.49e-07 | 2.88e-05 || 0.05 | 0.04 | 39473.35 || 2.90 | 00h40'58\n4.20 | 1.10e+08 | 3993 | 100 | 2.10e-08 | 9.08e-07 || 0.05 | 0.04 | 39271.59 || 2.91 | 21h31'30\n- 4.40 | 2.58e+08 | 210 | 13 | 4.72e-10 | 5.04e-08 || 0.05 | 0.04 | 39018.98 || 2.93 | 335h25'35\n+ 4.40 | 4.86e+08 | 420 | 26 | 5.02e-10 | 5.35e-08 || 0.05 | 0.04 | 39010.39 || 2.93 | 268h12'59\n# End of the simulation.\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Update the 10GE layered curve.
8,490
15.01.2017 15:35:22
-3,600
528234d17f206d1ad66c926d0c387ab041fd3c1e
Automatically disable the cool bash mode when the '--sim-pyber' option is used + improve the Terminal.
[ { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -314,6 +314,9 @@ void Launcher<B,R,Q>\nparams.simulation.seed = max_n_threads_global * params.simulation.mpi_rank + params.simulation.seed;\n#endif\n+ // disable the cool bash mode for PyBER\n+ if (!params.simulation.pyber.empty())\n+ enable_bash_tools = false;\n// ---------------------------------------------------------------------------------------------------------- code\nparams.code.type = ar.get_arg ({\"cde-type\" }); // required\n@@ -772,7 +775,7 @@ void Launcher<B,R,Q>\nstream << \"# The simulation is running...\" << std::endl;\n// print the warnings\nif (params.simulation.mpi_rank == 0)\n- stream << cmd_warn;\n+ stream << bold_yellow(cmd_warn);\nsimu->launch();\nif (params.simulation.mpi_rank == 0)\nstream << \"# End of the simulation.\" << std::endl;\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments_reader.cpp", "new_path": "src/Tools/Arguments_reader.cpp", "diff": "@@ -28,34 +28,15 @@ Arguments_reader\nbool Arguments_reader\n::parse_arguments(const map<vector<string>, vector<string>> &required_args,\nconst map<vector<string>, vector<string>> &optional_args,\n- const bool enable_warnings)\n+ const bool display_warnings)\n{\n- unsigned short int n_req_arg = 0;\n-\n- this->clear_arguments();\n+ string warns;\n+ const bool result = parse_arguments(required_args, optional_args, warns);\n- this->m_required_args = required_args;\n- this->m_optional_args = optional_args;\n+ if (display_warnings)\n+ std::cout << bold_yellow(warns);\n- for(unsigned short i = 0; i < this->m_argv.size(); ++i)\n- {\n- bool valid_arg = false;\n- if(this->sub_parse_arguments(this->m_required_args, i))\n- {\n- valid_arg = true;\n- n_req_arg++;\n- }\n- valid_arg = this->sub_parse_arguments(this->m_optional_args, i) || valid_arg;\n- if(!valid_arg && enable_warnings && this->m_argv[i][0] == '-')\n- {\n- std::cout << bold_yellow(\"(WW) Unknown argument \\\"\")\n- << bold_yellow(this->m_argv[i])\n- << bold_yellow(\"\\\".\")\n- << std::endl;\n- }\n- }\n-\n- return n_req_arg >= required_args.size();\n+ return result;\n}\nbool Arguments_reader\n@@ -81,9 +62,7 @@ bool Arguments_reader\nvalid_arg = this->sub_parse_arguments(this->m_optional_args, i) || valid_arg;\nif(!valid_arg && this->m_argv[i][0] == '-')\n{\n- warnings += bold_yellow(\"(WW) Unknown argument \\\"\");\n- warnings += bold_yellow(this->m_argv[i]);\n- warnings += bold_yellow(\"\\\".\");\n+ warnings += string(\"(WW) Unknown argument \\\"\") + string(this->m_argv[i]) + string(\"\\\".\");\nwarnings += \"\\n\";\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments_reader.hpp", "new_path": "src/Tools/Arguments_reader.hpp", "diff": "@@ -62,7 +62,7 @@ public:\n*/\nbool parse_arguments(const std::map<std::vector<std::string>, std::vector<std::string>> &required_args,\nconst std::map<std::vector<std::string>, std::vector<std::string>> &optional_args,\n- const bool enable_warnings = false);\n+ const bool display_warnings = false);\nbool parse_arguments(const std::map<std::vector<std::string>, std::vector<std::string>> &required_args,\nconst std::map<std::vector<std::string>, std::vector<std::string>> &optional_args,\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.cpp", "new_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.cpp", "diff": "@@ -47,48 +47,48 @@ void Terminal_BFER<B,R>\n#ifdef _WIN32\nif (this->d_decod_total == nullptr)\n{\n- stream << \"# \" << \"------------------------------------------------------------------||---------------------\" << std::endl;\n- stream << \"# \" << \" Bit Error Rate (BER) and Frame Error Rate (FER) depending || Global throughput \" << std::endl;\n- stream << \"# \" << \" on the Signal Noise Ratio (SNR) Eb/N0 || and elapsed time \" << std::endl;\n- stream << \"# \" << \"------------------------------------------------------------------||---------------------\" << std::endl;\n- stream << \"# \" << \"------|-----------|-----------|-----------|-----------|-----------||----------|----------\" << std::endl;\n- stream << \"# \" << \" SNR | FRA | BE | FE | BER | FER || SIM_CTHR | ET/RT \" << std::endl;\n- stream << \"# \" << \" (dB) | | | | | || (Mb/s) | (hhmmss) \" << std::endl;\n- stream << \"# \" << \"------|-----------|-----------|-----------|-----------|-----------||----------|----------\" << std::endl;\n+ stream << \"# \" << bold(\"------------------------------------------------------------------||---------------------\") << std::endl;\n+ stream << \"# \" << bold(\" Bit Error Rate (BER) and Frame Error Rate (FER) depending || Global throughput \") << std::endl;\n+ stream << \"# \" << bold(\" on the Signal Noise Ratio (SNR) Eb/N0 || and elapsed time \") << std::endl;\n+ stream << \"# \" << bold(\"------------------------------------------------------------------||---------------------\") << std::endl;\n+ stream << \"# \" << bold(\"------|-----------|-----------|-----------|-----------|-----------||----------|----------\") << std::endl;\n+ stream << \"# \" << bold(\" SNR | FRA | BE | FE | BER | FER || SIM_CTHR | ET/RT \") << std::endl;\n+ stream << \"# \" << bold(\" (dB) | | | | | || (Mb/s) | (hhmmss) \") << std::endl;\n+ stream << \"# \" << bold(\"------|-----------|-----------|-----------|-----------|-----------||----------|----------\") << std::endl;\n}\nelse\n{\n- stream << \"# \" << \"------------------------------------------------------------------||---------------------------------||---------------------\" << std::endl;\n- stream << \"# \" << \" Bit Error Rate (BER) and Frame Error Rate (FER) depending || Decoder throughput and || Global throughput \" << std::endl;\n- stream << \"# \" << \" on the Signal Noise Ratio (SNR) Eb/N0 || latency (per thread) || and elapsed time \" << std::endl;\n- stream << \"# \" << \"------------------------------------------------------------------||---------------------------------||---------------------\" << std::endl;\n- stream << \"# \" << \"------|-----------|-----------|-----------|-----------|-----------||----------|----------|-----------||----------|----------\" << std::endl;\n- stream << \"# \" << \" SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT \" << std::endl;\n- stream << \"# \" << \" (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss) \" << std::endl;\n- stream << \"# \" << \"------|-----------|-----------|-----------|-----------|-----------||----------|----------|-----------||----------|----------\" << std::endl;\n+ stream << \"# \" << bold(\"------------------------------------------------------------------||---------------------------------||---------------------\") << std::endl;\n+ stream << \"# \" << bold(\" Bit Error Rate (BER) and Frame Error Rate (FER) depending || Decoder throughput and || Global throughput \") << std::endl;\n+ stream << \"# \" << bold(\" on the Signal Noise Ratio (SNR) Eb/N0 || latency (per thread) || and elapsed time \") << std::endl;\n+ stream << \"# \" << bold(\"------------------------------------------------------------------||---------------------------------||---------------------\") << std::endl;\n+ stream << \"# \" << bold(\"------|-----------|-----------|-----------|-----------|-----------||----------|----------|-----------||----------|----------\") << std::endl;\n+ stream << \"# \" << bold(\" SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT \") << std::endl;\n+ stream << \"# \" << bold(\" (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss) \") << std::endl;\n+ stream << \"# \" << bold(\"------|-----------|-----------|-----------|-----------|-----------||----------|----------|-----------||----------|----------\") << std::endl;\n}\n#else\nif (this->d_decod_total == nullptr)\n{\n- stream << \"# \" << \"-------------------------------------------------------------||---------------------\" << std::endl;\n- stream << \"# \" << \" Bit Error Rate (BER) and Frame Error Rate (FER) depending || Global throughput \" << std::endl;\n- stream << \"# \" << \" on the Signal Noise Ratio (SNR) Eb/N0 || and elapsed time \" << std::endl;\n- stream << \"# \" << \"-------------------------------------------------------------||---------------------\" << std::endl;\n- stream << \"# \" << \"------|----------|----------|----------|----------|----------||----------|----------\" << std::endl;\n- stream << \"# \" << \" SNR | FRA | BE | FE | BER | FER || SIM_CTHR | ET/RT \" << std::endl;\n- stream << \"# \" << \" (dB) | | | | | || (Mb/s) | (hhmmss) \" << std::endl;\n- stream << \"# \" << \"------|----------|----------|----------|----------|----------||----------|----------\" << std::endl;\n+ stream << \"# \" << bold(\"-------------------------------------------------------------||---------------------\") << std::endl;\n+ stream << \"# \" << bold(\" Bit Error Rate (BER) and Frame Error Rate (FER) depending || Global throughput \") << std::endl;\n+ stream << \"# \" << bold(\" on the Signal Noise Ratio (SNR) Eb/N0 || and elapsed time \") << std::endl;\n+ stream << \"# \" << bold(\"-------------------------------------------------------------||---------------------\") << std::endl;\n+ stream << \"# \" << bold(\"------|----------|----------|----------|----------|----------||----------|----------\") << std::endl;\n+ stream << \"# \" << bold(\" SNR | FRA | BE | FE | BER | FER || SIM_CTHR | ET/RT \") << std::endl;\n+ stream << \"# \" << bold(\" (dB) | | | | | || (Mb/s) | (hhmmss) \") << std::endl;\n+ stream << \"# \" << bold(\"------|----------|----------|----------|----------|----------||----------|----------\") << std::endl;\n}\nelse\n{\n- stream << \"# \" << \"-------------------------------------------------------------||--------------------------------||---------------------\" << std::endl;\n- stream << \"# \" << \" Bit Error Rate (BER) and Frame Error Rate (FER) depending || Decoder throughput and || Global throughput \" << std::endl;\n- stream << \"# \" << \" on the Signal Noise Ratio (SNR) Eb/N0 || latency (per thread) || and elapsed time \" << std::endl;\n- stream << \"# \" << \"-------------------------------------------------------------||--------------------------------||---------------------\" << std::endl;\n- stream << \"# \" << \"------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\" << std::endl;\n- stream << \"# \" << \" SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT \" << std::endl;\n- stream << \"# \" << \" (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss) \" << std::endl;\n- stream << \"# \" << \"------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\" << std::endl;\n+ stream << \"# \" << bold(\"-------------------------------------------------------------||--------------------------------||---------------------\") << std::endl;\n+ stream << \"# \" << bold(\" Bit Error Rate (BER) and Frame Error Rate (FER) depending || Decoder throughput and || Global throughput \") << std::endl;\n+ stream << \"# \" << bold(\" on the Signal Noise Ratio (SNR) Eb/N0 || latency (per thread) || and elapsed time \") << std::endl;\n+ stream << \"# \" << bold(\"-------------------------------------------------------------||--------------------------------||---------------------\") << std::endl;\n+ stream << \"# \" << bold(\"------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\") << std::endl;\n+ stream << \"# \" << bold(\" SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT \") << std::endl;\n+ stream << \"# \" << bold(\" (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss) \") << std::endl;\n+ stream << \"# \" << bold(\"------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\") << std::endl;\n}\n#endif\n}\n@@ -151,17 +151,17 @@ void Terminal_BFER<B,R>\nauto l1 = 99999999; // limit 1\nauto l2 = 99999.99f; // limit 2\nstream << \" \";\n- stream << setprecision( 2) << fixed << setw(5) << snr << \" | \";\n- stream << setprecision((fra > l0) ? 2 : 0) << ((fra > l0) ? scientific : fixed) << setw(9) << ((fra > l0) ? (float)fra : fra) << \" | \";\n- stream << setprecision(( be > l1) ? 2 : 0) << ((be > l1) ? scientific : fixed) << setw(9) << (( be > l1) ? (float) be : be) << \" | \";\n- stream << setprecision(( fe > l1) ? 2 : 0) << ((fe > l1) ? scientific : fixed) << setw(9) << (( fe > l1) ? (float) fe : fe) << \" | \";\n- stream << str_ber.str() << \" | \";\n- stream << str_fer.str() << \" || \";\n+ stream << setprecision( 2) << fixed << setw(5) << snr << bold(\" | \");\n+ stream << setprecision((fra > l0) ? 2 : 0) << ((fra > l0) ? scientific : fixed) << setw(9) << ((fra > l0) ? (float)fra : fra) << bold(\" | \");\n+ stream << setprecision(( be > l1) ? 2 : 0) << ((be > l1) ? scientific : fixed) << setw(9) << (( be > l1) ? (float) be : be) << bold(\" | \");\n+ stream << setprecision(( fe > l1) ? 2 : 0) << ((fe > l1) ? scientific : fixed) << setw(9) << (( fe > l1) ? (float) fe : fe) << bold(\" | \");\n+ stream << str_ber.str() << bold(\" | \");\n+ stream << str_fer.str() << bold(\" || \");\nif (this->d_decod_total != nullptr)\n{\n- stream << setprecision( 2) << fixed << setw(8) << dec_cthr << \" | \";\n- stream << setprecision( 2) << fixed << setw(8) << dec_ithr << \" | \";\n- stream << setprecision( 2) << ((lat > l2) ? scientific : fixed) << setw(9) << lat << \" || \";\n+ stream << setprecision( 2) << fixed << setw(8) << dec_cthr << bold(\" | \");\n+ stream << setprecision( 2) << fixed << setw(8) << dec_ithr << bold(\" | \");\n+ stream << setprecision( 2) << ((lat > l2) ? scientific : fixed) << setw(9) << lat << bold(\" || \");\n}\nstream << setprecision( 2) << fixed << setw(8) << simu_cthr;\n#else\n@@ -173,17 +173,17 @@ void Terminal_BFER<B,R>\nauto l1 = 99999999; // limit 1\nauto l2 = 99999.99f; // limit 2\nstream << \" \";\n- stream << setprecision( 2) << fixed << setw(5) << snr << \" | \";\n- stream << setprecision((fra > l0) ? 2 : 0) << ((fra > l0) ? scientific : fixed) << setw(8) << ((fra > l0) ? (float)fra : fra) << \" | \";\n- stream << setprecision(( be > l1) ? 2 : 0) << ((be > l1) ? scientific : fixed) << setw(8) << (( be > l1) ? (float) be : be) << \" | \";\n- stream << setprecision(( fe > l1) ? 2 : 0) << ((fe > l1) ? scientific : fixed) << setw(8) << (( fe > l1) ? (float) fe : fe) << \" | \";\n- stream << str_ber.str() << \" | \";\n- stream << str_fer.str() << \" || \";\n+ stream << setprecision( 2) << fixed << setw(5) << snr << bold(\" | \");\n+ stream << setprecision((fra > l0) ? 2 : 0) << ((fra > l0) ? scientific : fixed) << setw(8) << ((fra > l0) ? (float)fra : fra) << bold(\" | \");\n+ stream << setprecision(( be > l1) ? 2 : 0) << ((be > l1) ? scientific : fixed) << setw(8) << (( be > l1) ? (float) be : be) << bold(\" | \");\n+ stream << setprecision(( fe > l1) ? 2 : 0) << ((fe > l1) ? scientific : fixed) << setw(8) << (( fe > l1) ? (float) fe : fe) << bold(\" | \");\n+ stream << str_ber.str() << bold(\" | \");\n+ stream << str_fer.str() << bold(\" || \");\nif (this->d_decod_total != nullptr)\n{\n- stream << setprecision( 2) << fixed << setw(8) << dec_cthr << \" | \";\n- stream << setprecision( 2) << fixed << setw(8) << dec_ithr << \" | \";\n- stream << setprecision( 2) << ((lat > l2) ? scientific : fixed) << setw(8) << lat << \" || \";\n+ stream << setprecision( 2) << fixed << setw(8) << dec_cthr << bold(\" | \");\n+ stream << setprecision( 2) << fixed << setw(8) << dec_ithr << bold(\" | \");\n+ stream << setprecision( 2) << ((lat > l2) ? scientific : fixed) << setw(8) << lat << bold(\" || \");\n}\nstream << setprecision( 2) << fixed << setw(8) << simu_cthr;\n#endif\n@@ -201,15 +201,15 @@ void Terminal_BFER<B,R>\nauto tr = et * ((float)monitor.get_fe_limit() / (float)monitor.get_n_fe()) - et;\nauto tr_format = get_time_format((monitor.get_n_fe() == 0) ? 0 : tr);\n- stream << \" | \" << std::setprecision(0) << std::fixed << std::setw(8) << tr_format;\n+ stream << bold(\" | \") << std::setprecision(0) << std::fixed << std::setw(8) << tr_format;\nstream << \" \";\nswitch (real_time_state)\n{\n- case 0: stream << \"*\"; break;\n- case 1: stream << \"*\"; break;\n- case 2: stream << \" \"; break;\n- case 3: stream << \" \"; break;\n+ case 0: stream << bold(\"*\"); break;\n+ case 1: stream << bold(\"*\"); break;\n+ case 2: stream << bold(\" \"); break;\n+ case 3: stream << bold(\" \"); break;\ndefault: break;\n}\nreal_time_state = (real_time_state +1) % 4;\n@@ -229,7 +229,7 @@ void Terminal_BFER<B,R>\nauto et = duration_cast<milliseconds>(steady_clock::now() - t_snr).count() / 1000.f;\nauto et_format = get_time_format(et);\n- stream << \" | \" << std::setprecision(0) << std::fixed << std::setw(8) << et_format;\n+ stream << bold(\" | \") << std::setprecision(0) << std::fixed << std::setw(8) << et_format;\nif (Monitor<B>::is_interrupt()) stream << \" x\" << std::endl;\nelse stream << \" \" << std::endl;\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Display/bash_tools.cpp", "new_path": "src/Tools/Display/bash_tools.cpp", "diff": "#include \"bash_tools.h\"\n+bool enable_bash_tools = true;\n+\nstd::string bold(std::string str)\n{\n#ifndef ENABLE_COOL_BASH\nreturn str;\n#else\n+ if (enable_bash_tools)\nreturn \"\\e[1m\" + str + \"\\e[0m\";\n+ else\n+ return str;\n#endif\n}\n@@ -14,7 +19,10 @@ std::string italic(std::string str)\n#ifndef ENABLE_COOL_BASH\nreturn str;\n#else\n+ if (enable_bash_tools)\nreturn \"\\e[3m\" + str + \"\\e[0m\";\n+ else\n+ return str;\n#endif\n}\n@@ -23,7 +31,10 @@ std::string bold_italic(std::string str)\n#ifndef ENABLE_COOL_BASH\nreturn str;\n#else\n+ if (enable_bash_tools)\nreturn \"\\e[1m\\e[3m\" + str + \"\\e[0m\";\n+ else\n+ return str;\n#endif\n}\n@@ -32,7 +43,10 @@ std::string underlined(std::string str)\n#ifndef ENABLE_COOL_BASH\nreturn str;\n#else\n+ if (enable_bash_tools)\nreturn \"\\e[4m\" + str + \"\\e[0m\";\n+ else\n+ return str;\n#endif\n}\n@@ -41,7 +55,10 @@ std::string bold_underlined(std::string str)\n#ifndef ENABLE_COOL_BASH\nreturn str;\n#else\n+ if (enable_bash_tools)\nreturn \"\\e[1m\\e[4m\" + str + \"\\e[0m\";\n+ else\n+ return str;\n#endif\n}\n@@ -50,7 +67,10 @@ std::string inverted(std::string str)\n#ifndef ENABLE_COOL_BASH\nreturn str;\n#else\n+ if (enable_bash_tools)\nreturn \"\\e[7m\" + str + \"\\e[0m\";\n+ else\n+ return str;\n#endif\n}\n@@ -59,7 +79,10 @@ std::string red(std::string str)\n#ifndef ENABLE_COOL_BASH\nreturn str;\n#else\n+ if (enable_bash_tools)\nreturn \"\\e[31m\" + str + \"\\e[39m\";\n+ else\n+ return str;\n#endif\n}\n@@ -68,7 +91,10 @@ std::string bold_red(std::string str)\n#ifndef ENABLE_COOL_BASH\nreturn str;\n#else\n+ if (enable_bash_tools)\nreturn \"\\e[1m\\e[31m\" + str + \"\\e[39m\\e[0m\";\n+ else\n+ return str;\n#endif\n}\n@@ -77,7 +103,10 @@ std::string green(std::string str)\n#ifndef ENABLE_COOL_BASH\nreturn str;\n#else\n+ if (enable_bash_tools)\nreturn \"\\e[32m\" + str + \"\\e[39m\";\n+ else\n+ return str;\n#endif\n}\n@@ -86,7 +115,10 @@ std::string bold_green(std::string str)\n#ifndef ENABLE_COOL_BASH\nreturn str;\n#else\n+ if (enable_bash_tools)\nreturn \"\\e[1m\\e[32m\" + str + \"\\e[39m\\e[0m\";\n+ else\n+ return str;\n#endif\n}\n@@ -95,7 +127,10 @@ std::string yellow(std::string str)\n#ifndef ENABLE_COOL_BASH\nreturn str;\n#else\n+ if (enable_bash_tools)\nreturn \"\\e[33m\" + str + \"\\e[39m\";\n+ else\n+ return str;\n#endif\n}\n@@ -104,7 +139,10 @@ std::string bold_yellow(std::string str)\n#ifndef ENABLE_COOL_BASH\nreturn str;\n#else\n+ if (enable_bash_tools)\nreturn \"\\e[1m\\e[33m\" + str + \"\\e[39m\\e[0m\";\n+ else\n+ return str;\n#endif\n}\n@@ -113,7 +151,10 @@ std::string blue(std::string str)\n#ifndef ENABLE_COOL_BASH\nreturn str;\n#else\n+ if (enable_bash_tools)\nreturn \"\\e[94m\" + str + \"\\e[39m\";\n+ else\n+ return str;\n#endif\n}\n@@ -122,7 +163,10 @@ std::string bold_blue(std::string str)\n#ifndef ENABLE_COOL_BASH\nreturn str;\n#else\n+ if (enable_bash_tools)\nreturn \"\\e[1m\\e[94m\" + str + \"\\e[39m\\e[0m\";\n+ else\n+ return str;\n#endif\n}\n@@ -131,7 +175,10 @@ std::string orange(std::string str)\n#ifndef ENABLE_COOL_BASH\nreturn str;\n#else\n+ if (enable_bash_tools)\nreturn \"\\e[38;5;208m\" + str + \"\\e[39m\";\n+ else\n+ return str;\n#endif\n}\n@@ -140,6 +187,9 @@ std::string bold_orange(std::string str)\n#ifndef ENABLE_COOL_BASH\nreturn str;\n#else\n+ if (enable_bash_tools)\nreturn \"\\e[1m\\e[38;5;208m\" + str + \"\\e[39m\\e[0m\";\n+ else\n+ return str;\n#endif\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Display/bash_tools.h", "new_path": "src/Tools/Display/bash_tools.h", "diff": "#include <string>\n+extern bool enable_bash_tools;\n+\nstd::string bold(std::string str);\nstd::string italic(std::string str);\n" } ]
C++
MIT License
aff3ct/aff3ct
Automatically disable the cool bash mode when the '--sim-pyber' option is used + improve the Terminal.
8,490
15.01.2017 18:23:36
-3,600
b8302a62b91bbf6034e98855a852b59858abdcb9
Fix some little bugs in the completion script.
[ { "change_type": "MODIFY", "old_path": "aff3ct_completion.sh", "new_path": "aff3ct_completion.sh", "diff": "@@ -203,7 +203,7 @@ _aff3ct() {\n--cde-size | -N | \\\n--mod-bps | --mod-ups | --mod-cpm-L | --mod-cpm-p | --mod-cpm-k | \\\n--qnt-int | --qnt-bits | --qnt-range | --qnt-type | \\\n- --dec-type | --dec-implem | --sim-benchs | -b | --sim-debug-limit | \\\n+ --sim-benchs | -b | --sim-debug-limit | \\\n--mnt-max-fe | -e | --term-type | \\\n--sim-siga-min | -a | --sim-siga-max | -A | --sim-siga-step | \\\n--dmod-ite | --cde-sigma | --dec-snr | --dec-ite |-i | --dec-lists | \\\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix some little bugs in the completion script.
8,490
15.01.2017 18:27:42
-3,600
f7234eb5c166e5eaa9164913721163a92921b469
Add the Gallager A decoder in the completion script.
[ { "change_type": "MODIFY", "old_path": "aff3ct_completion.sh", "new_path": "aff3ct_completion.sh", "diff": "@@ -275,7 +275,7 @@ _aff3ct() {\n--dec-implem)\nlocal params=\"GENERIC STD FAST VERY_FAST\"\nif [ \"${codetype}\" == 'LDPC' ]; then\n- params=\"ONMS SPA LSPA\"\n+ params=\"ONMS SPA LSPA GALA\"\nfi\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the Gallager A decoder in the completion script.
8,490
16.01.2017 11:03:23
-3,600
85760d180c5c7385618223b935c2f367f7dda2a4
Update 10GE curve.
[ { "change_type": "MODIFY", "old_path": "tests/data/BFER/ldpc/BP_LAYERED/SPA/ETH_SPA_1723_2048.txt", "new_path": "tests/data/BFER/ldpc/BP_LAYERED/SPA/ETH_SPA_1723_2048.txt", "diff": "@@ -75,5 +75,5 @@ Trace:\n3.80 | 153256 | 4609 | 100 | 1.75e-05 | 6.53e-04 || 0.05 | 0.04 | 39924.73 || 2.86 | 00h01'49\n4.00 | 3477966 | 4487 | 100 | 7.49e-07 | 2.88e-05 || 0.05 | 0.04 | 39473.35 || 2.90 | 00h40'58\n4.20 | 1.10e+08 | 3993 | 100 | 2.10e-08 | 9.08e-07 || 0.05 | 0.04 | 39271.59 || 2.91 | 21h31'30\n- 4.40 | 4.86e+08 | 420 | 26 | 5.02e-10 | 5.35e-08 || 0.05 | 0.04 | 39010.39 || 2.93 | 268h12'59\n+ 4.40 | 5.92e+08 | 497 | 30 | 4.87e-10 | 5.07e-08 || 0.05 | 0.04 | 39008.70 || 2.93 | 114h54'16\n# End of the simulation.\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Update 10GE curve.
8,490
16.01.2017 11:33:57
-3,600
05bedb74b07a8021c7df736cacee540a097b4232
Update the PyBER readme.
[ { "change_type": "RENAME", "old_path": "plotter/PyBER/readme.md", "new_path": "plotter/PyBER/README.md", "diff": "@@ -4,7 +4,7 @@ This project use python 3.x and some dependencies : PyQt 4.7+ or PyQt5, NumPy.\n## Installation (Ubuntu)\nsudo apt-get install python3 python3-pip\n- sudo pip install numpy pyqt5\n+ sudo pip3 install numpy pyqt5\n## Launch PyBER\n" } ]
C++
MIT License
aff3ct/aff3ct
Update the PyBER readme.
8,490
16.01.2017 15:44:20
-3,600
fab6927f5e03f6041c4ca6f9e250f12dc21bfa7a
Explicitly write the copies in order to make an accurate profiling.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -681,11 +681,17 @@ int Decoder_polar_SCL_fast_sys<B,R,API_polar>\n{\nconst auto new_path = paths[n_active_paths++];\n- std::copy(path_2_array[old_path].begin(), path_2_array[old_path].end(), path_2_array[new_path].begin());\n+// std::copy(path_2_array[old_path].begin(), path_2_array[old_path].end(), path_2_array[new_path].begin());\n+ const auto loop_size = path_2_array[old_path].size();\n+ for (auto i = 0; i < loop_size; i++)\n+ path_2_array[new_path][i] = path_2_array[old_path][i];\n+\nfor (auto i = 0; i < m; i++)\nn_array_ref[path_2_array[new_path][i]][i]++;\n- std::copy(s[old_path].begin(), s[old_path].begin() + off_s + n_elmts, s[new_path].begin());\n+// std::copy(s[old_path].begin(), s[old_path].begin() + off_s + n_elmts, s[new_path].begin());\n+ for (auto i = 0; i < off_s + n_elmts; i++)\n+ s[new_path][i] = s[old_path][i]; // TODO: this line takes a big part of the decoding time!\nreturn new_path;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Explicitly write the copies in order to make an accurate profiling.
8,490
16.01.2017 21:59:37
-3,600
8f3ddd0ed9a2f36e2a78454ac994c1c3cc1019f5
Working on SCL code generation.
[ { "change_type": "MODIFY", "old_path": "src/Generator/Polar/Generator_polar.cpp", "new_path": "src/Generator/Polar/Generator_polar.cpp", "diff": "@@ -53,6 +53,14 @@ Generator_polar\n{\n}\n+std::string Generator_polar\n+::get_class_name()\n+{\n+ return mother_class_name + \"_N\" + to_string(N) +\n+ \"_K\" + to_string(K) +\n+ \"_SNR\" + to_string((int)(snr*10));\n+}\n+\nvoid Generator_polar\n::generate()\n{\n@@ -61,10 +69,7 @@ void Generator_polar\nfor (unsigned i = 0; i < stats.size(); i++)\nstd::fill(stats[i].begin(), stats[i].end(), 0);\n- string class_name = mother_class_name + \"_N\" + to_string(N) +\n- \"_K\" + to_string(K) +\n- \"_SNR\" + to_string((int)(snr*10));\n-\n+ string class_name = get_class_name();\nstring pragma_name = MOTHER_CLASS_NAME + \"_N\" + to_string(N) +\n\"_K\" + to_string(K) +\n\"_SNR\" + to_string((int)(snr*10)) + \"_HPP_\";\n@@ -96,7 +101,7 @@ void Generator_polar\ndec_common1 << endl;\ndec_common1 << \"#include <cassert>\" << endl;\ndec_common1 << endl;\n- dec_common1 << \"#include \\\"../Decoder_polar_SC_fast_sys.hpp\\\"\" << endl;\n+ dec_common1 << \"#include \\\"../\" << mother_class_name << \".hpp\\\"\" << endl;\ndec_common1 << endl;\ndec_common1 << \"static const char \" << fbits_name << \"[\" << N << \"] = {\" << endl;\ndec_common1 << fbits.str() << \"};\" << endl;\n" }, { "change_type": "MODIFY", "old_path": "src/Generator/Polar/Generator_polar.hpp", "new_path": "src/Generator/Polar/Generator_polar.hpp", "diff": "@@ -61,6 +61,8 @@ public:\nvoid generate();\n+ std::string get_class_name();\n+\nunsigned long get_n_generated_nodes ( int graph_depth = -1) const;\nunsigned long get_n_generated_nodes_by_pattern(std::size_t pattern_hash, int graph_depth = -1) const;\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/GEN/Polar/Launcher_GEN_polar.cpp", "new_path": "src/Launcher/GEN/Polar/Launcher_GEN_polar.cpp", "diff": "@@ -63,6 +63,10 @@ void Launcher_GEN_polar<B,R,Q>\nthis->opt_args[{\"dec-gen-path\"}] =\n{\"string\",\n\"directory where are located the generated decoders.\"};\n+ this->opt_args[{\"dec-type\"}] =\n+ {\"string\",\n+ \"type of the decoder to generate.\",\n+ \"SC, SCL\"};\n// --------------------------------------------------------------------------------------------------------- other\n#ifdef MULTI_PREC\n@@ -100,6 +104,8 @@ void Launcher_GEN_polar<B,R,Q>\nif(this->ar.exist_arg({\"cde-fb-gen-method\"})) this->params.code.fb_gen_method = this->ar.get_arg({\"cde-fb-gen-method\"});\n// ------------------------------------------------------------------------------------------------------- decoder\n+ if(this->ar.exist_arg({\"dec-type\" })) this->params.decoder.type = this->ar.get_arg({\"dec-type\" });\n+ if(this->params.decoder.type == \"SCL\") this->params.decoder.gen_path = \"../src/Module/Decoder/Polar/SCL/CRC/Generated\";\nif(this->ar.exist_arg({\"dec-gen-path\"})) this->params.decoder.gen_path = this->ar.get_arg({\"dec-gen-path\"});\n}\n@@ -152,6 +158,7 @@ std::vector<std::pair<std::string,std::string>> Launcher_GEN_polar<B,R,Q>\nstd::vector<std::pair<std::string,std::string>> p;\np.push_back(std::make_pair(\"Generated decoder path\", this->params.decoder.gen_path));\n+ p.push_back(std::make_pair(\"Type\", this->params.decoder.type ));\nreturn p;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/GEN/Code/Polar/Generation_polar.cpp", "new_path": "src/Simulation/GEN/Code/Polar/Generation_polar.cpp", "diff": "#include \"Tools/Code/Polar/Patterns/Pattern_polar_spc.hpp\"\n#include \"Tools/Code/Polar/Patterns/Pattern_polar_std.hpp\"\n+#include \"Generator/Polar/SC/Generator_polar_SC_sys.hpp\"\n+#include \"Generator/Polar/SCL/Generator_polar_SCL_sys.hpp\"\n+\n#include \"Generation_polar.hpp\"\nGeneration_polar\n@@ -69,6 +72,11 @@ Generation_polar\nfb_generator->generate(frozen_bits);\n// work only for SC and systematic encoding...\n+ if (params.decoder.type == \"SCL\")\n+ fileName = \"Decoder_polar_SCL_fast_CA_sys_N\" + std::to_string(params.code.N) +\n+ \"_K\" + std::to_string(params.code.K) +\n+ \"_SNR\" + std::to_string((int)(snr*10));\n+ else if (params.decoder.type == \"SC\")\nfileName = \"Decoder_polar_SC_fast_sys_N\" + std::to_string(params.code.N) +\n\"_K\" + std::to_string(params.code.K) +\n\"_SNR\" + std::to_string((int)(snr*10));\n@@ -78,10 +86,24 @@ Generation_polar\ngraph_file .open((directory + \"/\" + fileName + \".dot\" ).c_str(), std::ios_base::out);\nshort_graph_file.open((directory + \"/\" + fileName + \".short.dot\").c_str(), std::ios_base::out);\n+ if (params.decoder.type == \"SCL\")\n+ {\n+ generator = new Generator_polar_SCL_sys(params.code.K, params.code.N, snr, frozen_bits,\n+ polar_patterns, *polar_pattern_rate0, *polar_pattern_rate1,\n+ dec_file, short_dec_file, graph_file, short_graph_file);\n+ }\n+ else if (params.decoder.type == \"SC\")\n+ {\ngenerator = new Generator_polar_SC_sys(params.code.K, params.code.N, snr, frozen_bits,\npolar_patterns, *polar_pattern_rate0, *polar_pattern_rate1,\ndec_file, short_dec_file, graph_file, short_graph_file);\n}\n+ else\n+ {\n+ std::cerr << bold_red(\"(EE) Unsupported type of decoder, exiting.\") << std::endl;\n+ std::exit(-1);\n+ }\n+}\nGeneration_polar\n::~Generation_polar()\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/GEN/Code/Polar/Generation_polar.hpp", "new_path": "src/Simulation/GEN/Code/Polar/Generation_polar.hpp", "diff": "#include \"Tools/Code/Polar/Patterns/Pattern_polar_i.hpp\"\n#include \"Tools/params.h\"\n-#include \"Generator/Polar/SC/Generator_polar_SC_sys.hpp\"\n+#include \"Generator/Polar/Generator_polar.hpp\"\n+\n#include \"Simulation/Simulation.hpp\"\nclass Generation_polar : public Simulation\n@@ -35,7 +36,7 @@ protected:\nFrozenbits_generator<int> *fb_generator;\n// generator\n- Generator_polar_SC_sys *generator;\n+ Generator_polar *generator;\n// file into generate the decoder\nstd::string directory;\n" } ]
C++
MIT License
aff3ct/aff3ct
Working on SCL code generation.
8,490
17.01.2017 15:48:18
-3,600
5a8cdcaca2389986d1d6b3825cae4adcf9aa8a54
Prepare a new generator to generate SCL decoders.
[ { "change_type": "ADD", "old_path": null, "new_path": "src/Generator/Polar/SCL/Generator_polar_SCL_sys.cpp", "diff": "+#include <cmath>\n+#include <cassert>\n+#include <algorithm>\n+#include <iostream>\n+#include <sstream>\n+#include <iomanip>\n+#include <string>\n+using namespace std;\n+\n+#include \"Generator_polar_SCL_sys.hpp\"\n+\n+Generator_polar_SCL_sys\n+::Generator_polar_SCL_sys(const int& K,\n+ const int& N,\n+ const float& snr,\n+ const mipp::vector<int>& frozen_bits,\n+ const std::vector<Pattern_polar_i*> &patterns,\n+ const Pattern_polar_i &pattern_rate0,\n+ const Pattern_polar_i &pattern_rate1,\n+ ostream &dec_stream,\n+ ostream &short_dec_stream,\n+ ostream &graph_stream,\n+ ostream &short_graph_stream)\n+: Generator_polar(K,\n+ N,\n+ snr,\n+ frozen_bits,\n+ patterns,\n+ pattern_rate0,\n+ pattern_rate1,\n+ \"Decoder_polar_SCL_fast_CA_sys\",\n+ \"DECODER_POLAR_SCL_FAST_SYS_CA\",\n+ dec_stream,\n+ short_dec_stream,\n+ graph_stream,\n+ short_graph_stream)\n+{\n+}\n+\n+Generator_polar_SCL_sys\n+::~Generator_polar_SCL_sys()\n+{\n+}\n+\n+void Generator_polar_SCL_sys\n+::generate_class_header(const std::string class_name,\n+ const std::string fbits_name,\n+ std::ostream &stream1,\n+ std::ostream &stream2)\n+{\n+ stream1 << \"template <typename B, typename R, class API_polar>\" << endl;\n+ stream1 << \"class \" << class_name << \" : public \" << this->mother_class_name << \"<B, R, API_polar>\" << endl;\n+ stream1 << \"{\" << endl;\n+ stream1 << \"public:\" << endl;\n+ stream1 << tab << class_name << \"(const int& K, const int& N, const int& L,\"\n+ << \" const mipp::vector<B>& frozen_bits, CRC<B>& crc,\"\n+ << \" const int n_frames = 1)\" << endl;\n+ stream1 << tab << \": \" << this->mother_class_name << \"<B, R, API_polar>(K, N, L, frozen_bits, crc,\"\n+ << \"n_frames)\" << endl;\n+ stream1 << tab << \"{\" << endl;\n+ stream1 << tab << tab << \"assert(N == \" << N << \");\" << endl;\n+ stream1 << tab << tab << \"assert(K == \" << K << \");\" << endl;\n+ stream1 << tab << tab << endl;\n+ stream1 << tab << tab << \"auto i = 0;\" << endl;\n+ stream1 << tab << tab << \"while (i < \" << N << \" && \" << fbits_name << \"[i] == frozen_bits[i]) i++;\" << endl;\n+ stream1 << tab << tab << \"assert(i == \" << N << \");\" << endl;\n+ stream1 << tab << \"}\" << endl;\n+ stream1 << endl;\n+ stream1 << tab << \"virtual ~\" << class_name << \"()\" << endl;\n+ stream1 << tab << \"{\" << endl;\n+ stream1 << tab << \"}\" << endl;\n+ stream1 << endl;\n+\n+ stream2 << tab << \"void decode()\" << endl;\n+ stream2 << tab << \"{\" << endl;\n+ stream2 << tab << tab << \"auto &y = this->Y_N;\" << endl;\n+ stream2 << tab << tab << \"auto &l = this->l;\" << endl;\n+ stream2 << tab << tab << \"auto &s = this->s;\" << endl;\n+ stream2 << endl;\n+}\n+\n+void Generator_polar_SCL_sys\n+::generate_class_footer(std::ostream &stream)\n+{\n+ stream << tab << \"}\" << endl;\n+ stream << \"};\" << \"\" << endl;\n+}\n+\n+void Generator_polar_SCL_sys\n+::recursive_generate_decoder(const Binary_node<Pattern_polar_i>* node_curr, ostream &stream)\n+{\n+ n_nodes_before_compression++;\n+\n+ if (!node_curr->is_leaf()) // stop condition\n+ {\n+ if (!node_curr->get_c()->apply_f().empty())\n+ stream << tab << tab << node_curr->get_c()->apply_f();\n+\n+ this->recursive_generate_decoder(node_curr->get_left(), stream); // recursive call\n+\n+ if (!node_curr->get_c()->apply_g().empty())\n+ stream << tab << tab << node_curr->get_c()->apply_g();\n+\n+ this->recursive_generate_decoder(node_curr->get_right(), stream); // recursive call\n+ }\n+\n+ if (!node_curr->get_c()->apply_h().empty())\n+ stream << tab << tab << node_curr->get_c()->apply_h();\n+}\n+\n+void Generator_polar_SCL_sys\n+::recursive_generate_short_decoder(const Binary_node<Pattern_polar_i>* node_curr, ostream &stream)\n+{\n+ if (subtree_occurences_cpy[node_curr->get_c()->get_key()] == 1)\n+ {\n+ if (!node_curr->is_leaf()) // stop condition\n+ {\n+ if (!node_curr->get_c()->apply_f().empty())\n+ stream << tab << tab << node_curr->get_c()->apply_f();\n+ this->recursive_generate_short_decoder(node_curr->get_left(), stream); // recursive call\n+ if (!node_curr->get_c()->apply_g().empty())\n+ stream << tab << tab << node_curr->get_c()->apply_g();\n+ this->recursive_generate_short_decoder(node_curr->get_right(), stream); // recursive call\n+ }\n+ if (!node_curr->get_c()->apply_h().empty())\n+ stream << tab << tab << node_curr->get_c()->apply_h();\n+ }\n+ else\n+ {\n+ stream << tab << tab;\n+ stream << node_curr->get_c()->get_key()\n+ << \"(\" << node_curr->get_c()->get_off_l() << \", \" << node_curr->get_c()->get_off_s() << \");\" << endl;\n+ }\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Generator/Polar/SCL/Generator_polar_SCL_sys.hpp", "diff": "+#ifndef GENERATOR_POLAR_SCL_SYS_\n+#define GENERATOR_POLAR_SCL_SYS_\n+\n+#include <map>\n+#include <vector>\n+\n+#include \"Tools/Perf/MIPP/mipp.h\"\n+#include \"Tools/Algo/Tree/Binary_tree.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_i.hpp\"\n+#include \"Tools/Code/Polar/Pattern_polar_parser.hpp\"\n+\n+#include \"../Generator_polar.hpp\"\n+\n+class Generator_polar_SCL_sys : public Generator_polar\n+{\n+public:\n+ Generator_polar_SCL_sys(const int& K,\n+ const int& N,\n+ const float& snr,\n+ const mipp::vector<int>& frozen_bits,\n+ const std::vector<Pattern_polar_i*> &patterns,\n+ const Pattern_polar_i &pattern_rate0,\n+ const Pattern_polar_i &pattern_rate1,\n+ std::ostream &dec_stream = std::cout,\n+ std::ostream &short_dec_stream = std::cout,\n+ std::ostream &graph_stream = std::cout,\n+ std::ostream &short_graph_stream = std::cout);\n+ virtual ~Generator_polar_SCL_sys();\n+\n+protected:\n+ void generate_class_header(const std::string class_name,\n+ const std::string fbits_name,\n+ std::ostream &stream1,\n+ std::ostream &stream2);\n+ void generate_class_footer( std::ostream &stream);\n+\n+ void recursive_generate_decoder (const Binary_node<Pattern_polar_i>* node_curr, std::ostream &stream);\n+ void recursive_generate_short_decoder(const Binary_node<Pattern_polar_i>* node_curr, std::ostream &stream);\n+};\n+\n+#endif /* GENERATOR_POLAR_SCL_SYS_ */\n" } ]
C++
MIT License
aff3ct/aff3ct
Prepare a new generator to generate SCL decoders.
8,490
17.01.2017 18:54:04
-3,600
e9abcb7022c82e3bd85d1fe54db098257f066d87
Add some new polar SCL pattern to generate the SCL decoders.
[ { "change_type": "MODIFY", "old_path": "src/Simulation/GEN/Code/Polar/Generation_polar.cpp", "new_path": "src/Simulation/GEN/Code/Polar/Generation_polar.cpp", "diff": "#include \"Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_spc.hpp\"\n#include \"Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_std.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_r0.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_r0_left.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_r1.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_rep.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_rep_left.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_spc.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_std.hpp\"\n+\n#include \"Generator/Polar/SC/Generator_polar_SC_sys.hpp\"\n#include \"Generator/Polar/SCL/Generator_polar_SCL_sys.hpp\"\n@@ -38,8 +46,8 @@ Generation_polar\ncode_rate (0.f ),\nsigma (0.f ),\npolar_patterns ( ),\n- polar_pattern_r0(new Pattern_polar_SC_r0),\n- polar_pattern_r1(new Pattern_polar_SC_r1),\n+ polar_pattern_r0(nullptr ),\n+ polar_pattern_r1(nullptr ),\nfb_generator (nullptr ),\ngenerator (nullptr ),\ndirectory (params.decoder.gen_path)\n@@ -50,6 +58,24 @@ Generation_polar\n#endif\n// pattern allocations\n+ if (params.decoder.type == \"SCL\")\n+ {\n+ polar_pattern_r0 = new Pattern_polar_SCL_r0;\n+ polar_pattern_r1 = new Pattern_polar_SCL_r1;\n+\n+ polar_patterns.push_back(new Pattern_polar_SCL_std );\n+ polar_patterns.push_back(new Pattern_polar_SCL_r0_left );\n+ polar_patterns.push_back( polar_pattern_r0 );\n+ polar_patterns.push_back( polar_pattern_r1 );\n+ polar_patterns.push_back(new Pattern_polar_SCL_rep_left);\n+ polar_patterns.push_back(new Pattern_polar_SCL_rep );\n+// polar_patterns.push_back(new Pattern_polar_SCL_spc );\n+ }\n+ else if (params.decoder.type == \"SC\")\n+ {\n+ polar_pattern_r0 = new Pattern_polar_SC_r0;\n+ polar_pattern_r1 = new Pattern_polar_SC_r1;\n+\npolar_patterns.push_back(new Pattern_polar_SC_std );\npolar_patterns.push_back(new Pattern_polar_SC_r0_left );\npolar_patterns.push_back( polar_pattern_r0 );\n@@ -57,6 +83,7 @@ Generation_polar\npolar_patterns.push_back(new Pattern_polar_SC_rep_left);\npolar_patterns.push_back(new Pattern_polar_SC_rep );\npolar_patterns.push_back(new Pattern_polar_SC_spc );\n+ }\nfloat snr = params.simulation.snr_min;\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_r0.hpp", "diff": "+#ifndef PATTERN_POLAR_SCL_RATE_0_HPP_\n+#define PATTERN_POLAR_SCL_RATE_0_HPP_\n+\n+#include \"../../Pattern_polar_r0.hpp\"\n+\n+class Pattern_polar_SCL_r0 : public Pattern_polar_r0\n+{\n+protected:\n+ Pattern_polar_SCL_r0(const int &N, const Binary_node<Pattern_polar_i>* node)\n+ : Pattern_polar_r0(N, node)\n+ {\n+ }\n+\n+public:\n+ Pattern_polar_SCL_r0() : Pattern_polar_r0() {}\n+\n+ virtual ~Pattern_polar_SCL_r0() {}\n+\n+ virtual Pattern_polar_i* alloc(const int &N, const Binary_node<Pattern_polar_i>* node) const\n+ {\n+ return new Pattern_polar_SCL_r0(N, node);\n+ }\n+\n+ virtual std::string apply_f(std::string str_off_l = \"\", std::string str_off_s = \"\") const\n+ {\n+ return \"\";\n+ }\n+\n+ virtual std::string apply_g(std::string str_off_l = \"\", std::string str_off_s = \"\") const\n+ {\n+ return \"\";\n+ }\n+\n+ virtual std::string apply_h(std::string str_off_l = \"\", std::string str_off_s = \"\") const\n+ {\n+ return \"\";\n+ }\n+};\n+\n+#endif /* PATTERN_POLAR_SCL_RATE_0_HPP_ */\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_r0_left.hpp", "diff": "+#ifndef PATTERN_POLAR_SCL_RATE_0_LEFT_HPP_\n+#define PATTERN_POLAR_SCL_RATE_0_LEFT_HPP_\n+\n+#include \"../../Pattern_polar_r0_left.hpp\"\n+\n+class Pattern_polar_SCL_r0_left : public Pattern_polar_r0_left\n+{\n+protected:\n+ Pattern_polar_SCL_r0_left(const int &N, const Binary_node<Pattern_polar_i>* node)\n+ : Pattern_polar_r0_left(N, node)\n+ {\n+ }\n+\n+public:\n+ Pattern_polar_SCL_r0_left() : Pattern_polar_r0_left() {}\n+\n+ virtual ~Pattern_polar_SCL_r0_left() {}\n+\n+ virtual Pattern_polar_i* alloc(const int &N, const Binary_node<Pattern_polar_i>* node) const\n+ {\n+ return new Pattern_polar_SCL_r0_left(N, node);\n+ }\n+\n+ virtual std::string apply_f(std::string str_off_l = \"\", std::string str_off_s = \"\") const\n+ {\n+ return \"\";\n+ }\n+\n+ virtual std::string apply_g(std::string str_off_l = \"\", std::string str_off_s = \"\") const\n+ {\n+ // using namespace std;\n+ if (str_off_l.empty()) str_off_l = std::to_string(this->off_l);\n+ if (str_off_s.empty()) str_off_s = std::to_string(this->off_s);\n+\n+ auto apply_g0 = g() + \" \";\n+ std::string spaces = \"\"; for (auto i = 0; i < 2*this->n_dig+1; i++) spaces += \" \";\n+\n+ std::stringstream stream;\n+ stream << \"API_polar::template \" << apply_g0 << \"<\" << std::setw(this->n2_dig) << this->si_2 << \">(\"\n+ << \" \"\n+ << \"l, \"\n+ << std::setw(this->n_dig ) << str_off_l << \"+\" << std::setw(this->n_dig ) << 0 << \", \"\n+ << std::setw(this->n_dig ) << str_off_l << \"+\" << std::setw(this->n_dig ) << this->si_2 << \", \"\n+ << spaces << \" \"\n+ << std::setw(this->n_dig ) << str_off_l << \"+\" << std::setw(this->n_dig ) << this->size << \", \"\n+ << std::setw(this->n2_dig) << this->si_2 << \");\" << std::endl;\n+\n+ return stream.str();\n+ }\n+\n+ virtual std::string apply_h(std::string str_off_l = \"\", std::string str_off_s = \"\") const\n+ {\n+ if (str_off_l.empty()) str_off_l = std::to_string(this->off_l);\n+ if (str_off_s.empty()) str_off_s = std::to_string(this->off_s);\n+\n+ auto apply_xo0 = h();\n+ std::string spaces = \"\"; for (auto i = 0; i < 2*this->n_dig+1; i++) spaces += \" \";\n+\n+ std::stringstream stream;\n+ stream << \"API_polar::template \" << apply_xo0 << \"<\" << std::setw(this->n2_dig) << this->si_2 << \">(\"\n+ << \"s, \"\n+ << \" \"\n+ << std::setw(this->n_dig ) << str_off_s << \"+\" << std::setw(this->n_dig ) << this->si_2 << \", \"\n+ << spaces << \" \"\n+ << spaces << \" \"\n+ << std::setw(this->n_dig ) << str_off_s << \"+\" << std::setw(this->n_dig ) << 0 << \", \"\n+ << std::setw(this->n2_dig) << this->si_2 << \");\" << std::endl;\n+\n+ return stream.str();\n+ }\n+};\n+\n+#endif /* PATTERN_POLAR_SCL_RATE_0_LEFT_HPP_ */\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_r1.hpp", "diff": "+#ifndef PATTERN_POLAR_SCL_RATE_1_HPP_\n+#define PATTERN_POLAR_SCL_RATE_1_HPP_\n+\n+#include \"../../Pattern_polar_r1.hpp\"\n+\n+class Pattern_polar_SCL_r1 : public Pattern_polar_r1\n+{\n+protected:\n+ Pattern_polar_SCL_r1(const int &N, const Binary_node<Pattern_polar_i>* node) : Pattern_polar_r1(N, node)\n+ {\n+ }\n+\n+public:\n+ Pattern_polar_SCL_r1() : Pattern_polar_r1() {}\n+\n+ virtual ~Pattern_polar_SCL_r1() {}\n+\n+ virtual Pattern_polar_i* alloc(const int &N, const Binary_node<Pattern_polar_i>* node) const\n+ {\n+ return new Pattern_polar_SCL_r1(N, node);\n+ }\n+\n+ virtual std::string apply_f(std::string str_off_l = \"\", std::string str_off_s = \"\") const\n+ {\n+ return \"\";\n+ }\n+\n+ virtual std::string apply_g(std::string str_off_l = \"\", std::string str_off_s = \"\") const\n+ {\n+ return \"\";\n+ }\n+\n+ virtual std::string apply_h(std::string str_off_l = \"\", std::string str_off_s = \"\") const\n+ {\n+ if (str_off_l.empty()) str_off_l = std::to_string(this->off_l);\n+ if (str_off_s.empty()) str_off_s = std::to_string(this->off_s);\n+\n+ auto apply_h = h() + \" \";\n+ std::string spaces = \"\"; for (auto i = 0; i < 2*this->n_dig+1; i++) spaces += \" \";\n+\n+ std::stringstream stream;\n+ stream << \"API_polar::template \" << apply_h << \"<\" << std::setw(this->n2_dig) << this->size << \">(\"\n+ << \"s, \"\n+ << \"l, \"\n+ << std::setw(this->n_dig ) << str_off_l << \"+\" << std::setw(this->n_dig ) << 0 << \", \"\n+ << spaces << \" \"\n+ << spaces << \" \"\n+ << std::setw(this->n_dig ) << str_off_s << \"+\" << std::setw(this->n_dig ) << 0 << \", \"\n+ << std::setw(this->n2_dig) << this->size << \");\" << std::endl;\n+\n+ return stream.str();\n+ }\n+};\n+\n+#endif /* PATTERN_POLAR_SCL_RATE_1_HPP_ */\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_rep.hpp", "diff": "+#ifndef PATTERN_POLAR_SCL_REP_HPP_\n+#define PATTERN_POLAR_SCL_REP_HPP_\n+\n+#include \"../../Pattern_polar_rep.hpp\"\n+\n+class Pattern_polar_SCL_rep : public Pattern_polar_rep\n+{\n+protected:\n+ Pattern_polar_SCL_rep(const int &N, const Binary_node<Pattern_polar_i>* node)\n+ : Pattern_polar_rep(N, node)\n+ {\n+ }\n+\n+public:\n+ Pattern_polar_SCL_rep() : Pattern_polar_rep() {}\n+\n+ virtual ~Pattern_polar_SCL_rep() {}\n+\n+ virtual Pattern_polar_i* alloc(const int &N, const Binary_node<Pattern_polar_i>* node) const\n+ {\n+ return new Pattern_polar_SCL_rep(N, node);\n+ }\n+\n+ virtual std::string apply_f(std::string str_off_l = \"\", std::string str_off_s = \"\") const {\n+ return \"\";\n+ }\n+\n+ virtual std::string apply_g(std::string str_off_l = \"\", std::string str_off_s = \"\") const\n+ {\n+ return \"\";\n+ }\n+\n+ virtual std::string apply_h(std::string str_off_l = \"\", std::string str_off_s = \"\") const\n+ {\n+ if (str_off_l.empty()) str_off_l = std::to_string(this->off_l);\n+ if (str_off_s.empty()) str_off_s = std::to_string(this->off_s);\n+\n+ auto apply_rep = h();\n+ std::string spaces = \"\"; for (auto i = 0; i < 2*this->n_dig+1; i++) spaces += \" \";\n+\n+ std::stringstream stream;\n+ stream << \"API_polar::template \" << apply_rep << \"<\" << std::setw(this->n2_dig) << this->size << \">(\"\n+ << \"s, \"\n+ << \"l, \"\n+ << std::setw(this->n_dig ) << str_off_l << \"+\" << std::setw(this->n_dig ) << 0 << \", \"\n+ << spaces << \" \"\n+ << spaces << \" \"\n+ << std::setw(this->n_dig ) << str_off_s << \"+\" << std::setw(this->n_dig ) << 0 << \", \"\n+ << std::setw(this->n2_dig) << this->size << \");\" << std::endl;\n+\n+ return stream.str();\n+ }\n+};\n+\n+#endif /* PATTERN_POLAR_SCL_REP_HPP_ */\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_rep_left.hpp", "diff": "+#ifndef PATTERN_POLAR_SCL_REP_LEFT_HPP_\n+#define PATTERN_POLAR_SCL_REP_LEFT_HPP_\n+\n+#include \"../../Pattern_polar_rep_left.hpp\"\n+\n+class Pattern_polar_SCL_rep_left : public Pattern_polar_rep_left\n+{\n+protected:\n+ Pattern_polar_SCL_rep_left(const int &N, const Binary_node<Pattern_polar_i>* node)\n+ : Pattern_polar_rep_left(N, node)\n+ {\n+ }\n+\n+public:\n+ Pattern_polar_SCL_rep_left() : Pattern_polar_rep_left() { }\n+\n+ virtual ~Pattern_polar_SCL_rep_left() {}\n+\n+ virtual Pattern_polar_i* alloc(const int &N, const Binary_node<Pattern_polar_i>* node) const\n+ {\n+ return new Pattern_polar_SCL_rep_left(N, node);\n+ }\n+\n+ virtual std::string apply_f(std::string str_off_l = \"\", std::string str_off_s = \"\") const\n+ {\n+ // using namespace std;\n+ if (str_off_l.empty()) str_off_l = std::to_string(this->off_l);\n+ if (str_off_s.empty()) str_off_s = std::to_string(this->off_s);\n+\n+ auto apply_f = f() + \" \";\n+ std::string spaces = \"\"; for (auto i = 0; i < 2*this->n_dig+1; i++) spaces += \" \";\n+\n+ std::stringstream stream;\n+ stream << \"API_polar::template \" << apply_f << \"<\" << std::setw(this->n2_dig) << this->si_2 << \">(\"\n+ << \" \"\n+ << \"l, \"\n+ << std::setw(this->n_dig ) << str_off_l << \"+\" << std::setw(this->n_dig ) << 0 << \", \"\n+ << std::setw(this->n_dig ) << str_off_l << \"+\" << std::setw(this->n_dig ) << this->si_2 << \", \"\n+ << spaces << \" \"\n+ << std::setw(this->n_dig ) << str_off_l << \"+\" << std::setw(this->n_dig ) << this->size << \", \"\n+ << std::setw(this->n2_dig) << this->si_2 << \");\" << std::endl;\n+\n+ return stream.str();\n+ }\n+\n+ virtual std::string apply_g(std::string str_off_l = \"\", std::string str_off_s = \"\") const\n+ {\n+ if (str_off_l.empty()) str_off_l = std::to_string(this->off_l);\n+ if (str_off_s.empty()) str_off_s = std::to_string(this->off_s);\n+\n+ auto apply_gr = g() + \" \";\n+\n+ std::stringstream stream;\n+ stream << \"API_polar::template \" << apply_gr << \"<\" << std::setw(this->n2_dig) << this->si_2 << \">(\"\n+ << \"s, \"\n+ << \"l, \"\n+ << std::setw(this->n_dig ) << str_off_l << \"+\" << std::setw(this->n_dig ) << 0 << \", \"\n+ << std::setw(this->n_dig ) << str_off_l << \"+\" << std::setw(this->n_dig ) << this->si_2 << \", \"\n+ << std::setw(this->n_dig ) << str_off_s << \"+\" << std::setw(this->n_dig ) << 0 << \", \"\n+ << std::setw(this->n_dig ) << str_off_l << \"+\" << std::setw(this->n_dig ) << this->size << \", \"\n+ << std::setw(this->n2_dig) << this->si_2 << \");\" << std::endl;\n+\n+ return stream.str();\n+ }\n+\n+ virtual std::string apply_h(std::string str_off_l = \"\", std::string str_off_s = \"\") const\n+ {\n+ if (str_off_l.empty()) str_off_l = std::to_string(this->off_l);\n+ if (str_off_s.empty()) str_off_s = std::to_string(this->off_s);\n+\n+ auto apply_xo = h() + \" \";\n+ std::string spaces = \"\"; for (auto i = 0; i < 2*this->n_dig+1; i++) spaces += \" \";\n+\n+ std::stringstream stream;\n+ stream << \"API_polar::template \" << apply_xo << \"<\" << std::setw(this->n2_dig) << this->si_2 << \">(\"\n+ << \"s, \"\n+ << \" \"\n+ << std::setw(this->n_dig ) << str_off_s << \"+\" << std::setw(this->n_dig ) << 0 << \", \"\n+ << std::setw(this->n_dig ) << str_off_s << \"+\" << std::setw(this->n_dig ) << this->si_2 << \", \"\n+ << spaces << \" \"\n+ << std::setw(this->n_dig ) << str_off_s << \"+\" << std::setw(this->n_dig ) << 0 << \", \"\n+ << std::setw(this->n2_dig) << this->si_2 << \");\" << std::endl;\n+\n+ return stream.str();\n+ }\n+};\n+\n+#endif /* PATTERN_POLAR_SCL_REP_LEFT_HPP_ */\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_spc.hpp", "diff": "+#ifndef PATTERN_POLAR_SCL_SPC_HPP_\n+#define PATTERN_POLAR_SCL_SPC_HPP_\n+\n+#include \"../../Pattern_polar_spc.hpp\"\n+\n+class Pattern_polar_SCL_spc : public Pattern_polar_spc\n+{\n+protected:\n+ Pattern_polar_SCL_spc(const int &N, const Binary_node<Pattern_polar_i>* node)\n+ : Pattern_polar_spc(N, node)\n+ {\n+ }\n+\n+public:\n+ Pattern_polar_SCL_spc() : Pattern_polar_spc() {}\n+\n+ virtual ~Pattern_polar_SCL_spc() {}\n+\n+ virtual Pattern_polar_i* alloc(const int &N, const Binary_node<Pattern_polar_i>* node) const\n+ {\n+ return new Pattern_polar_SCL_spc(N, node);\n+ }\n+\n+ virtual std::string apply_f(std::string str_off_l = \"\", std::string str_off_s = \"\") const\n+ {\n+ return \"\";\n+ }\n+\n+ virtual std::string apply_g(std::string str_off_l = \"\", std::string str_off_s = \"\") const\n+ {\n+ return \"\";\n+ }\n+\n+ virtual std::string apply_h(std::string str_off_l = \"\", std::string str_off_s = \"\") const\n+ {\n+ if (str_off_l.empty()) str_off_l = std::to_string(this->off_l);\n+ if (str_off_s.empty()) str_off_s = std::to_string(this->off_s);\n+\n+ auto apply_spc = h();\n+ std::string spaces = \"\"; for (auto i = 0; i < 2*this->n_dig+1; i++) spaces += \" \";\n+\n+ std::stringstream stream;\n+ stream << \"API_polar::template \" << apply_spc << \"<\" << std::setw(this->n2_dig) << this->size << \">(\"\n+ << \"s, \"\n+ << \"l, \"\n+ << std::setw(this->n_dig ) << str_off_l << \"+\" << std::setw(this->n_dig ) << 0 << \", \"\n+ << spaces << \" \"\n+ << spaces << \" \"\n+ << std::setw(this->n_dig ) << str_off_s << \"+\" << std::setw(this->n_dig ) << 0 << \", \"\n+ << std::setw(this->n2_dig) << this->size << \");\" << std::endl;\n+\n+ return stream.str();\n+ }\n+};\n+\n+#endif /* PATTERN_POLAR_SCL_SPC_HPP_ */\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_std.hpp", "diff": "+#ifndef PATTERN_POLAR_SCL_STANDARD_HPP_\n+#define PATTERN_POLAR_SCL_STANDARD_HPP_\n+\n+#include \"../../Pattern_polar_std.hpp\"\n+\n+class Pattern_polar_SCL_std : public Pattern_polar_std\n+{\n+protected:\n+ Pattern_polar_SCL_std(const int &N, const Binary_node<Pattern_polar_i>* node)\n+ : Pattern_polar_std(N, node)\n+ {\n+ }\n+\n+public:\n+ Pattern_polar_SCL_std() : Pattern_polar_std() {}\n+\n+ virtual ~Pattern_polar_SCL_std() {}\n+\n+ virtual Pattern_polar_i* alloc(const int &N, const Binary_node<Pattern_polar_i>* node) const\n+ {\n+ return new Pattern_polar_SCL_std(N, node);\n+ }\n+\n+ virtual std::string apply_f(std::string str_off_l = \"\", std::string str_off_s = \"\") const\n+ {\n+ if (str_off_l.empty()) str_off_l = std::to_string(this->off_l);\n+ if (str_off_s.empty()) str_off_s = std::to_string(this->off_s);\n+\n+ auto apply_f = f() + \" \";\n+ std::string spaces = \"\"; for (auto i = 0; i < 2*this->n_dig+1; i++) spaces += \" \";\n+\n+ std::stringstream stream;\n+ stream << \"API_polar::template \" << apply_f << \"<\" << std::setw(this->n2_dig) << this->si_2 << \">(\"\n+ << \" \"\n+ << \"l, \"\n+ << std::setw(this->n_dig ) << str_off_l << \"+\" << std::setw(this->n_dig ) << 0 << \", \"\n+ << std::setw(this->n_dig ) << str_off_l << \"+\" << std::setw(this->n_dig ) << this->si_2 << \", \"\n+ << spaces << \" \"\n+ << std::setw(this->n_dig ) << str_off_l << \"+\" << std::setw(this->n_dig ) << this->size << \", \"\n+ << std::setw(this->n2_dig) << this->si_2 << \");\" << std::endl;\n+\n+ return stream.str();\n+ }\n+\n+ virtual std::string apply_g(std::string str_off_l = \"\", std::string str_off_s = \"\") const\n+ {\n+ if (str_off_l.empty()) str_off_l = std::to_string(this->off_l);\n+ if (str_off_s.empty()) str_off_s = std::to_string(this->off_s);\n+\n+ auto apply_g = g() + \" \";\n+\n+ std::stringstream stream;\n+ stream << \"API_polar::template \" << apply_g << \"<\" << std::setw(this->n2_dig) << this->si_2 << \">(\"\n+ << \"s, \"\n+ << \"l, \"\n+ << std::setw(this->n_dig ) << str_off_l << \"+\" << std::setw(this->n_dig ) << 0 << \", \"\n+ << std::setw(this->n_dig ) << str_off_l << \"+\" << std::setw(this->n_dig ) << this->si_2 << \", \"\n+ << std::setw(this->n_dig ) << str_off_s << \"+\" << std::setw(this->n_dig ) << 0 << \", \"\n+ << std::setw(this->n_dig ) << str_off_l << \"+\" << std::setw(this->n_dig ) << this->size << \", \"\n+ << std::setw(this->n2_dig) << this->si_2 << \");\" << std::endl;\n+\n+ return stream.str();\n+ }\n+\n+ virtual std::string apply_h(std::string str_off_l = \"\", std::string str_off_s = \"\") const\n+ {\n+ if (str_off_l.empty()) str_off_l = std::to_string(this->off_l);\n+ if (str_off_s.empty()) str_off_s = std::to_string(this->off_s);\n+\n+ auto apply_xo = h() + \" \";\n+ std::string spaces = \"\"; for (auto i = 0; i < 2*this->n_dig+1; i++) spaces += \" \";\n+\n+ std::stringstream stream;\n+ stream << \"API_polar::template \" << apply_xo << \"<\" << std::setw(this->n2_dig) << this->si_2 << \">(\"\n+ << \"s, \"\n+ << \" \"\n+ << std::setw(this->n_dig ) << str_off_s << \"+\" << std::setw(this->n_dig ) << 0 << \", \"\n+ << std::setw(this->n_dig ) << str_off_s << \"+\" << std::setw(this->n_dig ) << this->si_2 << \", \"\n+ << spaces << \" \"\n+ << std::setw(this->n_dig ) << str_off_s << \"+\" << std::setw(this->n_dig ) << 0 << \", \"\n+ << std::setw(this->n2_dig) << this->si_2 << \");\" << std::endl;\n+\n+ return stream.str();\n+ }\n+};\n+\n+#endif /* PATTERN_POLAR_SCL_STANDARD_HPP_ */\n" } ]
C++
MIT License
aff3ct/aff3ct
Add some new polar SCL pattern to generate the SCL decoders.
8,490
20.01.2017 14:15:49
-3,600
a23b04c99427f5fef3f1db609570451d39356e2c
Try to fix SPC nodes in the SCL.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -710,7 +710,11 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nfor (auto i = 0; i < 4; i++)\nbit_flips[4 * path +i] = llr_indexes[r_d][i];\n- is_even[path] = !API_polar::spc(s[path], l[array], off_l, off_s, n_elmts);\n+// is_even[path] = !API_polar::spc(s[path], l[array], off_l, off_s, n_elmts);\n+ auto prod = 1.f;\n+ for (auto i = 0; i < n_elmts; i++)\n+ prod *= l[array][off_l +i];\n+ is_even[path] = prod > 0;\n{\nmetrics_vec[2][n_cands * path +0] = metrics[path] +\n@@ -776,9 +780,16 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst auto path = paths[i];\nif (dup_count[path])\n{\n+ const auto array = path_2_array[path][r_d];\n+ API_polar::h(s[path], l[array], off_l, off_s, n_elmts);\n+\nmetrics[path] = metrics_vec[2][n_cands * path];\nfor (auto dup = 2; dup <= dup_count[path]; dup++)\nflip_bits_spc(path, duplicate_tree(path, off_l, off_s, n_elmts), dup, off_s, n_elmts);\n+\n+ if (!is_even[path])\n+ s[path][off_s + bit_flips[4 * path +0]] = s[path][off_s + bit_flips[4 * path +0]] ? 0 : bit_init<B>();\n+\ndup_count[path] = 0;\n}\n}\n@@ -805,7 +816,11 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nfor (auto i = 0; i < 4; i++)\nbit_flips[4 * path +i] = llr_indexes[REV_D][i];\n- is_even[path] = !API_polar::template spc<N_ELMTS>(s[path], l[array], off_l, off_s, N_ELMTS);\n+// is_even[path] = !API_polar::template spc<N_ELMTS>(s[path], l[array], off_l, off_s, N_ELMTS);\n+ auto prod = 1.f;\n+ for (auto i = 0; i < N_ELMTS; i++)\n+ prod *= l[array][off_l +i];\n+ is_even[path] = prod > 0;\n{\nmetrics_vec[2][n_cands * path +0] = metrics[path] +\n@@ -871,9 +886,16 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst auto path = paths[i];\nif (dup_count[path])\n{\n+ const auto array = path_2_array[path][REV_D];\n+ API_polar::h<N_ELMTS>(s[path], l[array], off_l, off_s, N_ELMTS);\n+\nmetrics[path] = metrics_vec[2][n_cands * path];\nfor (auto dup = 2; dup <= dup_count[path]; dup++)\nflip_bits_spc(path, duplicate_tree(path, off_l, off_s, N_ELMTS), dup, off_s, N_ELMTS);\n+\n+ if (!is_even[path])\n+ s[path][off_s + bit_flips[4 * path +0]] = s[path][off_s + bit_flips[4 * path +0]] ? 0 : bit_init<B>();\n+\ndup_count[path] = 0;\n}\n}\n@@ -889,37 +911,48 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst auto n_cands = L <= 2 ? 4 : 8; // number of candidates\nmetrics[new_path] = metrics_vec[2][n_cands * old_path + dup -1];\n+\nswitch(dup)\n{\ncase 2 :\n- s[new_path][off_s + bit_flips[4 * old_path +0]] = !s[old_path][off_s + bit_flips[4 * old_path +0]] ? b : 0;\n- s[new_path][off_s + bit_flips[4 * old_path +1]] = !s[old_path][off_s + bit_flips[4 * old_path +1]] ? b : 0;\n+ if (is_even[old_path])\n+ s[new_path][off_s + bit_flips[4 * old_path +0]] = s[old_path][off_s + bit_flips[4 * old_path +0]] ? 0 : b;\n+ s[new_path][off_s + bit_flips[4 * old_path +1]] = s[old_path][off_s + bit_flips[4 * old_path +1]] ? 0 : b;\nbreak;\ncase 3 :\n- s[new_path][off_s + bit_flips[4 * old_path +0]] = !s[old_path][off_s + bit_flips[4 * old_path +0]] ? b : 0;\n- s[new_path][off_s + bit_flips[4 * old_path +2]] = !s[old_path][off_s + bit_flips[4 * old_path +2]] ? b : 0;\n+ if (is_even[old_path])\n+ s[new_path][off_s + bit_flips[4 * old_path +0]] = s[old_path][off_s + bit_flips[4 * old_path +0]] ? 0 : b;\n+ s[new_path][off_s + bit_flips[4 * old_path +2]] = s[old_path][off_s + bit_flips[4 * old_path +2]] ? 0 : b;\nbreak;\ncase 4 :\n- s[new_path][off_s + bit_flips[4 * old_path +0]] = !s[old_path][off_s + bit_flips[4 * old_path +0]] ? b : 0;\n- s[new_path][off_s + bit_flips[4 * old_path +3]] = !s[old_path][off_s + bit_flips[4 * old_path +3]] ? b : 0;\n+ if (is_even[old_path])\n+ s[new_path][off_s + bit_flips[4 * old_path +0]] = s[old_path][off_s + bit_flips[4 * old_path +0]] ? 0 : b;\n+ s[new_path][off_s + bit_flips[4 * old_path +3]] = s[old_path][off_s + bit_flips[4 * old_path +3]] ? 0 : b;\nbreak;\ncase 5 :\n- s[new_path][off_s + bit_flips[4 * old_path +1]] = !s[old_path][off_s + bit_flips[4 * old_path +1]] ? b : 0;\n- s[new_path][off_s + bit_flips[4 * old_path +2]] = !s[old_path][off_s + bit_flips[4 * old_path +2]] ? b : 0;\n+ if (!is_even[old_path])\n+ s[new_path][off_s + bit_flips[4 * old_path +0]] = s[old_path][off_s + bit_flips[4 * old_path +0]] ? 0 : b;\n+ s[new_path][off_s + bit_flips[4 * old_path +1]] = s[old_path][off_s + bit_flips[4 * old_path +1]] ? 0 : b;\n+ s[new_path][off_s + bit_flips[4 * old_path +2]] = s[old_path][off_s + bit_flips[4 * old_path +2]] ? 0 : b;\nbreak;\ncase 6 :\n- s[new_path][off_s + bit_flips[4 * old_path +1]] = !s[old_path][off_s + bit_flips[4 * old_path +1]] ? b : 0;\n- s[new_path][off_s + bit_flips[4 * old_path +3]] = !s[old_path][off_s + bit_flips[4 * old_path +3]] ? b : 0;\n+ if (!is_even[old_path])\n+ s[new_path][off_s + bit_flips[4 * old_path +0]] = s[old_path][off_s + bit_flips[4 * old_path +0]] ? 0 : b;\n+ s[new_path][off_s + bit_flips[4 * old_path +1]] = s[old_path][off_s + bit_flips[4 * old_path +1]] ? 0 : b;\n+ s[new_path][off_s + bit_flips[4 * old_path +3]] = s[old_path][off_s + bit_flips[4 * old_path +3]] ? 0 : b;\nbreak;\ncase 7 :\n- s[new_path][off_s + bit_flips[4 * old_path +2]] = !s[old_path][off_s + bit_flips[4 * old_path +2]] ? b : 0;\n- s[new_path][off_s + bit_flips[4 * old_path +3]] = !s[old_path][off_s + bit_flips[4 * old_path +3]] ? b : 0;\n+ if (!is_even[old_path])\n+ s[new_path][off_s + bit_flips[4 * old_path +0]] = s[old_path][off_s + bit_flips[4 * old_path +0]] ? 0 : b;\n+ s[new_path][off_s + bit_flips[4 * old_path +2]] = s[old_path][off_s + bit_flips[4 * old_path +2]] ? 0 : b;\n+ s[new_path][off_s + bit_flips[4 * old_path +3]] = s[old_path][off_s + bit_flips[4 * old_path +3]] ? 0 : b;\nbreak;\ncase 8 :\n- s[new_path][off_s + bit_flips[4 * old_path +0]] = !s[old_path][off_s + bit_flips[4 * old_path +0]] ? b : 0;\n- s[new_path][off_s + bit_flips[4 * old_path +1]] = !s[old_path][off_s + bit_flips[4 * old_path +1]] ? b : 0;\n- s[new_path][off_s + bit_flips[4 * old_path +2]] = !s[old_path][off_s + bit_flips[4 * old_path +2]] ? b : 0;\n- s[new_path][off_s + bit_flips[4 * old_path +3]] = !s[old_path][off_s + bit_flips[4 * old_path +3]] ? b : 0;\n+ if (is_even[old_path])\n+ s[new_path][off_s + bit_flips[4 * old_path +0]] = s[old_path][off_s + bit_flips[4 * old_path +0]] ? 0 : b;\n+ s[new_path][off_s + bit_flips[4 * old_path +1]] = s[old_path][off_s + bit_flips[4 * old_path +1]] ? 0 : b;\n+ s[new_path][off_s + bit_flips[4 * old_path +2]] = s[old_path][off_s + bit_flips[4 * old_path +2]] ? 0 : b;\n+ s[new_path][off_s + bit_flips[4 * old_path +3]] = s[old_path][off_s + bit_flips[4 * old_path +3]] ? 0 : b;\nbreak;\ndefault:\nstd::cout << bold_red(\"(EE) Flip bits error on SPC node.\") << std::endl;\n" } ]
C++
MIT License
aff3ct/aff3ct
Try to fix SPC nodes in the SCL.
8,490
20.01.2017 14:51:21
-3,600
33e3ef876105c7710b73b1643a4a97975f18299d
Fix the SCL SPC for good!
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -710,7 +710,6 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nfor (auto i = 0; i < 4; i++)\nbit_flips[4 * path +i] = llr_indexes[r_d][i];\n-// is_even[path] = !API_polar::spc(s[path], l[array], off_l, off_s, n_elmts);\nauto prod = 1.f;\nfor (auto i = 0; i < n_elmts; i++)\nprod *= l[array][off_l +i];\n@@ -720,33 +719,38 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nmetrics_vec[2][n_cands * path +0] = metrics[path] +\nstd::abs(l[array][off_l + bit_flips[4 * path +0]]) * (!is_even[path]);\n- metrics_vec[2][n_cands * path +1] = metrics_vec[2][n_cands * path +0] +\n+ metrics_vec[2][n_cands * path +1] = metrics[path] +\nstd::abs(l[array][off_l + bit_flips[4 * path +0]]) * is_even[path] +\nstd::abs(l[array][off_l + bit_flips[4 * path +1]]);\n- metrics_vec[2][n_cands * path +2] = metrics_vec[2][n_cands * path +0] +\n+ metrics_vec[2][n_cands * path +2] = metrics[path] +\nstd::abs(l[array][off_l + bit_flips[4 * path +0]]) * is_even[path] +\nstd::abs(l[array][off_l + bit_flips[4 * path +2]]);\n- metrics_vec[2][n_cands * path +3] = metrics_vec[2][n_cands * path +0] +\n+ metrics_vec[2][n_cands * path +3] = metrics[path] +\nstd::abs(l[array][off_l + bit_flips[4 * path +0]]) * is_even[path] +\nstd::abs(l[array][off_l + bit_flips[4 * path +3]]);\n}\nif (L > 2)\n{\n- metrics_vec[2][n_cands * path +4] = metrics_vec[2][n_cands * path +0] +\n+ metrics_vec[2][n_cands * path +4] = metrics[path] +\n+ std::abs(l[array][off_l + bit_flips[4 * path +0]]) * (!is_even[path]) +\nstd::abs(l[array][off_l + bit_flips[4 * path +1]]) +\nstd::abs(l[array][off_l + bit_flips[4 * path +2]]);\n- metrics_vec[2][n_cands * path +5] = metrics_vec[2][n_cands * path +0] +\n+ metrics_vec[2][n_cands * path +5] = metrics[path] +\n+ std::abs(l[array][off_l + bit_flips[4 * path +0]]) * (!is_even[path]) +\nstd::abs(l[array][off_l + bit_flips[4 * path +1]]) +\nstd::abs(l[array][off_l + bit_flips[4 * path +3]]);\n- metrics_vec[2][n_cands * path +6] = metrics_vec[2][n_cands * path +0] +\n+ metrics_vec[2][n_cands * path +6] = metrics[path] +\n+ std::abs(l[array][off_l + bit_flips[4 * path +0]]) * (!is_even[path]) +\nstd::abs(l[array][off_l + bit_flips[4 * path +2]]) +\nstd::abs(l[array][off_l + bit_flips[4 * path +3]]);\n- metrics_vec[2][n_cands * path +7] = metrics_vec[2][n_cands * path +1] +\n+ metrics_vec[2][n_cands * path +7] = metrics[path] +\n+ std::abs(l[array][off_l + bit_flips[4 * path +0]]) * is_even[path] +\n+ std::abs(l[array][off_l + bit_flips[4 * path +1]]) +\nstd::abs(l[array][off_l + bit_flips[4 * path +2]]) +\nstd::abs(l[array][off_l + bit_flips[4 * path +3]]);\n}\n@@ -816,7 +820,6 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nfor (auto i = 0; i < 4; i++)\nbit_flips[4 * path +i] = llr_indexes[REV_D][i];\n-// is_even[path] = !API_polar::template spc<N_ELMTS>(s[path], l[array], off_l, off_s, N_ELMTS);\nauto prod = 1.f;\nfor (auto i = 0; i < N_ELMTS; i++)\nprod *= l[array][off_l +i];\n@@ -826,33 +829,38 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nmetrics_vec[2][n_cands * path +0] = metrics[path] +\nstd::abs(l[array][off_l + bit_flips[4 * path +0]]) * (!is_even[path]);\n- metrics_vec[2][n_cands * path +1] = metrics_vec[2][n_cands * path +0] +\n+ metrics_vec[2][n_cands * path +1] = metrics[path] +\nstd::abs(l[array][off_l + bit_flips[4 * path +0]]) * is_even[path] +\nstd::abs(l[array][off_l + bit_flips[4 * path +1]]);\n- metrics_vec[2][n_cands * path +2] = metrics_vec[2][n_cands * path +0] +\n+ metrics_vec[2][n_cands * path +2] = metrics[path] +\nstd::abs(l[array][off_l + bit_flips[4 * path +0]]) * is_even[path] +\nstd::abs(l[array][off_l + bit_flips[4 * path +2]]);\n- metrics_vec[2][n_cands * path +3] = metrics_vec[2][n_cands * path +0] +\n+ metrics_vec[2][n_cands * path +3] = metrics[path] +\nstd::abs(l[array][off_l + bit_flips[4 * path +0]]) * is_even[path] +\nstd::abs(l[array][off_l + bit_flips[4 * path +3]]);\n}\nif (L > 2)\n{\n- metrics_vec[2][n_cands * path +4] = metrics_vec[2][n_cands * path +0] +\n+ metrics_vec[2][n_cands * path +4] = metrics[path] +\n+ std::abs(l[array][off_l + bit_flips[4 * path +0]]) * (!is_even[path]) +\nstd::abs(l[array][off_l + bit_flips[4 * path +1]]) +\nstd::abs(l[array][off_l + bit_flips[4 * path +2]]);\n- metrics_vec[2][n_cands * path +5] = metrics_vec[2][n_cands * path +0] +\n+ metrics_vec[2][n_cands * path +5] = metrics[path] +\n+ std::abs(l[array][off_l + bit_flips[4 * path +0]]) * (!is_even[path]) +\nstd::abs(l[array][off_l + bit_flips[4 * path +1]]) +\nstd::abs(l[array][off_l + bit_flips[4 * path +3]]);\n- metrics_vec[2][n_cands * path +6] = metrics_vec[2][n_cands * path +0] +\n+ metrics_vec[2][n_cands * path +6] = metrics[path] +\n+ std::abs(l[array][off_l + bit_flips[4 * path +0]]) * (!is_even[path]) +\nstd::abs(l[array][off_l + bit_flips[4 * path +2]]) +\nstd::abs(l[array][off_l + bit_flips[4 * path +3]]);\n- metrics_vec[2][n_cands * path +7] = metrics_vec[2][n_cands * path +1] +\n+ metrics_vec[2][n_cands * path +7] = metrics[path] +\n+ std::abs(l[array][off_l + bit_flips[4 * path +0]]) * is_even[path] +\n+ std::abs(l[array][off_l + bit_flips[4 * path +1]]) +\nstd::abs(l[array][off_l + bit_flips[4 * path +2]]) +\nstd::abs(l[array][off_l + bit_flips[4 * path +3]]);\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the SCL SPC for good!
8,490
20.01.2017 15:07:02
-3,600
763e31b26bae2000de8c4f414b537c909274edbf
Fix a compilation error in the SCL generated code.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -895,7 +895,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nif (dup_count[path])\n{\nconst auto array = path_2_array[path][REV_D];\n- API_polar::h<N_ELMTS>(s[path], l[array], off_l, off_s, N_ELMTS);\n+ API_polar::template h<N_ELMTS>(s[path], l[array], off_l, off_s, N_ELMTS);\nmetrics[path] = metrics_vec[2][n_cands * path];\nfor (auto dup = 2; dup <= dup_count[path]; dup++)\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix a compilation error in the SCL generated code.
8,490
20.01.2017 16:30:38
-3,600
11f3aa6f6272a483f729991b2403646447edfde3
Fix wrong indexes.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -707,12 +707,12 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nreturn std::abs(l[array][off_l + x]) < std::abs(l[array][off_l + y]);\n});\n- for (auto i = 0; i < 4; i++)\n- bit_flips[4 * path +i] = llr_indexes[r_d][i];\n+ for (auto j = 0; j < 4; j++)\n+ bit_flips[4 * path +j] = llr_indexes[r_d][j];\nauto prod = 1.f;\n- for (auto i = 0; i < n_elmts; i++)\n- prod *= l[array][off_l +i];\n+ for (auto j = 0; j < n_elmts; j++)\n+ prod *= l[array][off_l +j];\nis_even[path] = prod > 0;\n{\n@@ -817,12 +817,12 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nreturn std::abs(l[array][off_l + x]) < std::abs(l[array][off_l + y]);\n});\n- for (auto i = 0; i < 4; i++)\n- bit_flips[4 * path +i] = llr_indexes[REV_D][i];\n+ for (auto j = 0; j < 4; j++)\n+ bit_flips[4 * path +j] = llr_indexes[REV_D][j];\nauto prod = 1.f;\n- for (auto i = 0; i < N_ELMTS; i++)\n- prod *= l[array][off_l +i];\n+ for (auto j = 0; j < N_ELMTS; j++)\n+ prod *= l[array][off_l +j];\nis_even[path] = prod > 0;\n{\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix wrong indexes.
8,488
22.01.2017 16:08:31
18,000
abe5aba546559e503cd9cc2749235e3e73a3dab0
Fix copy_left with new s array to store copies.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "diff": "@@ -24,6 +24,7 @@ protected:\nstd::vector<mipp::vector<R >> l; // llrs\nstd::vector<mipp::vector<B >> s; // partial sums\nstd::vector<mipp::vector<B >> s2; // partial sums\n+ std::vector<mipp::vector<B >> s3; // partial sums\nstd::vector<std ::vector<float>> metrics_vec; // list of candidate metrics to be sorted\nstd::vector<std ::vector<int >> metrics_idx; // indexes tables used to sort the metrics\nstd ::vector<int > dup_count; // number of duplications of a path, at updating time\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -48,6 +48,7 @@ Decoder_polar_SCL_fast_sys<B,R,API_polar>\nl (L, mipp::vector<R>(N + mipp::nElReg<R>())),\ns (L, mipp::vector<B>(N + mipp::nElReg<B>())),\ns2 (L, mipp::vector<B>(N + mipp::nElReg<B>())),\n+ s3 (L, mipp::vector<B>(N + mipp::nElReg<B>())),\nmetrics_vec (3, std::vector<float>()),\nmetrics_idx (3, std::vector<int >()),\ndup_count (L, 0),\n@@ -195,14 +196,15 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nrecursive_decode(off_l, off_s + n_elm_2, rev_depth -1, ++node_id); // recursive call right\n// xor\n+ copy_left(rev_depth, off_s);\nswitch (node_type)\n{\n- copy_left(rev_depth, off_s);\ncase STANDARD:\nfor (auto i = 0; i < n_active_paths; i++)\n{\n+ const auto sleft = (path_2_array_s[paths[i]][rev_depth -1] == paths[i]) ? s2 : s3;\nAPI_polar::xo (s[paths[i]], off_s, off_s + n_elm_2, off_s, n_elm_2);\n- API_polar::xo (s2[paths[i]], off_s, off_s + n_elm_2, off_s, n_elm_2);\n+ API_polar::xo (sleft[paths[i]].data() + off_s, s2[paths[i]].data() + off_s + n_elm_2, s2[paths[i]].data() + off_s, n_elm_2);\n}\nbreak;\ncase RATE_0_LEFT:\n@@ -215,8 +217,9 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\ncase REP_LEFT:\nfor (auto i = 0; i < n_active_paths; i++)\n{\n+ const auto sleft = (path_2_array_s[paths[i]][rev_depth -1] == paths[i]) ? s2 : s3;\nAPI_polar::xo (s[paths[i]], off_s, off_s + n_elm_2, off_s, n_elm_2);\n- API_polar::xo (s2[paths[i]], off_s, off_s + n_elm_2, off_s, n_elm_2);\n+ API_polar::xo (sleft[paths[i]].data() + off_s, s2[paths[i]].data() + off_s + n_elm_2, s2[paths[i]].data() + off_s, n_elm_2);\n}\nbreak;\ndefault:\n@@ -299,7 +302,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nrecursive_decode(off_l + n_elmts, off_s + n_elm_2, rev_depth -1, ++node_id); // recursive call right\n- std::cout << \"xor, r_d = \" << rev_depth << std::endl;\n+ // std::cout << \"xor, r_d = \" << rev_depth << std::endl;\n// xor\nfor (auto i = 0; i < n_active_paths; i++)\n{\n@@ -307,9 +310,9 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nif(s[paths[i]][off_s +j] != s2[path_2_array_s[paths[i]][rev_depth -1]][off_s +j])\nstd::cout << \"ouais\" << std::endl;\n}\n- if(rev_depth == 9 && off_s == 0)\n- for (auto i = 0; i < n_active_paths; i++)\n- std::cout << paths[i] << \" \" << path_2_array_s[paths[i]][8] << std::endl;\n+ // if(rev_depth == 9 && off_s == 0)\n+ // for (auto i = 0; i < n_active_paths; i++)\n+ // std::cout << paths[i] << \" \" << path_2_array_s[paths[i]][8] << std::endl;\n//TODO : useless for rate_0_left\ncopy_left(rev_depth, off_s);\nfor (auto i = 0; i < n_active_paths; i++)\n@@ -323,8 +326,9 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\ncase STANDARD:\nfor (auto i = 0; i < n_active_paths; i++)\n{\n+ const auto sleft = (path_2_array_s[paths[i]][rev_depth -1] == paths[i]) ? s2 : s3;\nAPI_polar::xo (s [paths[i]], off_s, off_s + n_elm_2, off_s, n_elm_2);\n- API_polar::xo (s2[paths[i]], off_s, off_s + n_elm_2, off_s, n_elm_2);\n+ API_polar::xo (sleft[paths[i]].data() + off_s, s2[paths[i]].data() + off_s + n_elm_2, s2[paths[i]].data() + off_s, n_elm_2);\n}\nbreak;\ncase RATE_0_LEFT:\n@@ -337,8 +341,9 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\ncase REP_LEFT:\nfor (auto i = 0; i < n_active_paths; i++)\n{\n+ const auto sleft = (path_2_array_s[paths[i]][rev_depth -1] == paths[i]) ? s2 : s3;\nAPI_polar::xo (s [paths[i]], off_s, off_s + n_elm_2, off_s, n_elm_2);\n- API_polar::xo (s2[paths[i]], off_s, off_s + n_elm_2, off_s, n_elm_2);\n+ API_polar::xo (sleft[paths[i]].data() + off_s, s2[paths[i]].data() + off_s + n_elm_2, s2[paths[i]].data() + off_s, n_elm_2);\n}\nbreak;\ndefault:\n@@ -374,10 +379,10 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n// h\nswitch (node_type)\n{\n- case RATE_0: update_paths_r0 (rev_depth, off_l, off_s, n_elmts); std::cout << \"Update r0\" << std::endl;break;\n- case REP: update_paths_rep(rev_depth, off_l, off_s, n_elmts); std::cout << \"Update rep\" << std::endl;break;\n- case RATE_1: update_paths_r1 (rev_depth, off_l, off_s, n_elmts); std::cout << \"Update r1\" << std::endl;break;\n- case SPC: update_paths_spc(rev_depth, off_l, off_s, n_elmts); std::cout << \"Update spc\" << std::endl;break;\n+ case RATE_0: update_paths_r0 (rev_depth, off_l, off_s, n_elmts); /*std::cout << \"Update r0\" << std::endl;*/break;\n+ case REP: update_paths_rep(rev_depth, off_l, off_s, n_elmts); /*std::cout << \"Update rep\" << std::endl;*/break;\n+ case RATE_1: update_paths_r1 (rev_depth, off_l, off_s, n_elmts); /*std::cout << \"Update r1\" << std::endl;*/break;\n+ case SPC: update_paths_spc(rev_depth, off_l, off_s, n_elmts); /*std::cout << \"Update spc\" << std::endl;*/break;\ndefault:\nbreak;\n}\n@@ -1227,15 +1232,13 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nfor (auto i = 0; i < n_active_paths; i++)\n{\nconst auto child_left = path_2_array_s[paths[i]][r_d - 1];\n- std::copy(s2[child_left].begin() + off_s, s2[child_left].begin() + off_s + n_elm_2, s2[paths[i]].begin() + off_s);\n+ if(child_left != paths[i])\n+ std::copy(s2[child_left].begin() + off_s, s2[child_left].begin() + off_s + n_elm_2, s3[paths[i]].begin() + off_s);\n}\nfor (auto i = 0; i < n_active_paths; i++)\n- {\n- path_2_array_s[paths[i]][r_d - 1] = paths[i];\nif(is_left)\npath_2_array_s[paths[i]][r_d] = paths[i];\n}\n-}\ntemplate <typename B, typename R, class API_polar>\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix copy_left with new s array to store copies.
8,488
23.01.2017 11:25:19
18,000
c02d25116f28da41c6217676b34e2d43f132d60c
Add n_array_ref_s to prepare copy_left reduction.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hxx", "diff": "@@ -57,7 +57,7 @@ int Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>\n// delete the path if the CRC result is negative\nif (!decode_result)\n- this->delete_path(n_valid_paths);\n+ this->delete_path(n_valid_paths, this->m);\nelse\nn_valid_paths++;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "diff": "@@ -39,6 +39,7 @@ protected:\nstd::vector<std::vector<int>> path_2_array_l; // give array used by a path\n// each following 2D vector is of size L * m\n+ std::vector<std::vector<int>> n_array_ref_s; // give array used by a path\nstd::vector<std::vector<int>> path_2_array_s; // give array used by a path\npublic:\n@@ -71,7 +72,7 @@ protected:\ninline void copy_left (const int r_d, const int off_s ); // return the array\ninline void init_buffers ( );\n- inline void delete_path (int path_id);\n+ inline void delete_path (int path_id, const int r_d);\nvirtual inline int select_best_path( );\nprivate:\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -58,6 +58,7 @@ Decoder_polar_SCL_fast_sys<B,R,API_polar>\nn_active_paths(1),\nn_array_ref_l (L, std::vector<int>(m)),\npath_2_array_l (L, std::vector<int>(m)),\n+ n_array_ref_s (L, std::vector<int>(m)),\npath_2_array_s (L, std::vector<int>(m))\n{\nstatic_assert(API_polar::get_n_frames() == 1, \"The inter-frame API_polar is not supported.\");\n@@ -101,10 +102,14 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nstd::fill(n_array_ref_l [0].begin(), n_array_ref_l [0].end(), 1);\nstd::fill(path_2_array_l[0].begin(), path_2_array_l[0].end(), 0);\n+ std::fill(n_array_ref_s [0].begin(), n_array_ref_s [0].end(), 1);\nstd::fill(path_2_array_s[0].begin(), path_2_array_s[0].end(), 0);\nfor (auto i = 1; i < L; i++)\n+ {\n+ std::fill(n_array_ref_s[i].begin(), n_array_ref_s[i].end(), 1);\nstd::fill(n_array_ref_l[i].begin(), n_array_ref_l[i].end(), 0);\n+ }\nfor (auto i = 0 ; i < 2 * L ; i++) metrics_idx[0][i] = i;\nfor (auto i = 0 ; i < 4 * L ; i++) metrics_idx[1][i] = i;\n@@ -330,14 +335,14 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\ndefault:\nbreak;\n}\n+ const auto is_left = (((off_s / n_elmts) % 2) == 0);\n+ if(is_left)\n+ for (auto i = 0; i < n_active_paths; i++)\n+ n_array_ref_s[paths[i]][rev_depth] = 1;\n}\nelse // leaf node\n{\nconst auto is_left = (((off_s / n_elmts) % 2) == 0);\n- if (is_left)\n- for (auto i = 0; i < n_active_paths; i++)\n- path_2_array_s[paths[i]][rev_depth] = paths[i];\n-\n// h\nswitch (node_type)\n{\n@@ -348,6 +353,12 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\ndefault:\nbreak;\n}\n+ if (is_left)\n+ for (auto i = 0; i < n_active_paths; i++)\n+ {\n+ path_2_array_s[paths[i]][rev_depth] = paths[i];\n+ n_array_ref_s [paths[i]][rev_depth] = 1;\n+ }\n}\n}\n@@ -465,7 +476,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nauto n_active_paths_cpy = n_active_paths;\nfor (auto i = 0; i < n_active_paths_cpy; i++)\nif (dup_count[paths[k]] == 0)\n- delete_path(k);\n+ delete_path(k, r_d);\nelse\nk++;\n@@ -533,7 +544,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nauto n_active_paths_cpy = n_active_paths;\nfor (auto i = 0; i < n_active_paths_cpy; i++)\nif (dup_count[paths[k]] == 0)\n- delete_path(k);\n+ delete_path(k, REV_D);\nelse\nk++;\n@@ -625,7 +636,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nauto k = 0;\nfor (auto i = 0; i < L; i++)\nif (dup_count[paths[k]] == 0)\n- delete_path(k);\n+ delete_path(k, r_d);\nelse\nk++;\n@@ -692,7 +703,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nauto k = 0;\nfor (auto i = 0; i < L; i++)\nif (dup_count[paths[k]] == 0)\n- delete_path(k);\n+ delete_path(k, REV_D);\nelse\nk++;\n@@ -809,7 +820,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nauto n_active_paths_cpy = n_active_paths;\nfor (auto i = 0; i < n_active_paths_cpy; i++)\nif (dup_count[paths[k]] == 0)\n- delete_path(k);\n+ delete_path(k, r_d);\nelse\nk++;\n@@ -921,7 +932,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nauto n_active_paths_cpy = n_active_paths;\nfor (auto i = 0; i < n_active_paths_cpy; i++)\nif (dup_count[paths[k]] == 0)\n- delete_path(k);\n+ delete_path(k, REV_D);\nelse\nk++;\n@@ -1025,12 +1036,16 @@ int Decoder_polar_SCL_fast_sys<B,R,API_polar>\nn_array_ref_l[path_2_array_l[new_path][i]][i]++;\nfor (auto i = r_d + 1; i < m; i++)\n+ {\npath_2_array_s[new_path][i] = path_2_array_s[old_path][i];\n+ n_array_ref_s [path_2_array_s[old_path][i]][i] ++;\n+ }\n- if(is_left)\n- path_2_array_s[new_path][r_d] = new_path;\n- else\n+ if(!is_left)\n+ {\npath_2_array_s[new_path][r_d] = path_2_array_s[old_path][r_d];\n+ n_array_ref_s [path_2_array_s[old_path][r_d]][r_d] ++;\n+ }\nfor (auto i = off_s; i < off_s + n_elmts; i++)\n@@ -1041,12 +1056,15 @@ int Decoder_polar_SCL_fast_sys<B,R,API_polar>\ntemplate <typename B, typename R, class API_polar>\nvoid Decoder_polar_SCL_fast_sys<B,R,API_polar>\n-::delete_path(int path_id)\n+::delete_path(int path_id, const int r_d)\n{\nconst auto old_path = paths[path_id];\nfor (auto i = 0; i < m; i++)\nn_array_ref_l[path_2_array_l[old_path][i]][i]--;\n+ for (auto i = r_d +1; i < m; i++)\n+ n_array_ref_s[path_2_array_s[old_path][i]][i]--;\n+\npaths[path_id] = paths[--n_active_paths];\npaths[n_active_paths] = old_path;\n}\n@@ -1101,7 +1119,8 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n{\nconst auto child_left = path_2_array_s[paths[i]][r_d - 1];\nif(child_left != paths[i])\n- std::copy(s[child_left].begin() + off_s, s[child_left].begin() + off_s + n_elm_2, s2[paths[i]].begin() + off_s);\n+ for (auto j = 0; j < n_elm_2; j++)\n+ s2[paths[i]][off_s + j] = s[child_left][off_s + j];\n}\nfor (auto i = 0; i < n_active_paths; i++)\nif(is_left)\n" } ]
C++
MIT License
aff3ct/aff3ct
Add n_array_ref_s to prepare copy_left reduction.
8,488
23.01.2017 11:57:09
18,000
30ea51770f2c4ddc2ebee12ad27fb5322e309d82
Further reduced s copies.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -204,8 +204,18 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\ncopy_left(rev_depth, off_s);\nfor (auto i = 0; i < n_active_paths; i++)\n{\n- const auto& sleft = (path_2_array_s[paths[i]][rev_depth -1] == paths[i]) ? s : s2;\n- API_polar::xo (sleft[paths[i]].data() + off_s, s[paths[i]].data() + off_s + n_elm_2, s[paths[i]].data() + off_s, n_elm_2);\n+ const auto array_left = path_2_array_s[paths[i]][rev_depth -1];\n+ if(array_left != paths[i])\n+ {\n+ const auto& sleft = (path_2_array_s[array_left][rev_depth -1] == array_left) ? s : s2;\n+ API_polar::xo (sleft[array_left].data() + off_s, s[paths[i]].data() + off_s + n_elm_2, s[paths[i]].data() + off_s, n_elm_2);\n+ }\n+ }\n+ for (auto i = 0; i < n_active_paths; i++)\n+ {\n+ const auto array_left = path_2_array_s[paths[i]][rev_depth -1];\n+ if(array_left == paths[i])\n+ API_polar::xo (s[array_left].data() + off_s, s[paths[i]].data() + off_s + n_elm_2, s[paths[i]].data() + off_s, n_elm_2);\n}\nbreak;\ncase RATE_0_LEFT:\n@@ -221,8 +231,18 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\ncopy_left(rev_depth, off_s);\nfor (auto i = 0; i < n_active_paths; i++)\n{\n- const auto& sleft = (path_2_array_s[paths[i]][rev_depth -1] == paths[i]) ? s : s2;\n- API_polar::xo (sleft[paths[i]].data() + off_s, s[paths[i]].data() + off_s + n_elm_2, s[paths[i]].data() + off_s, n_elm_2);\n+ const auto array_left = path_2_array_s[paths[i]][rev_depth -1];\n+ if(array_left != paths[i])\n+ {\n+ const auto& sleft = (path_2_array_s[array_left][rev_depth -1] == array_left) ? s : s2;\n+ API_polar::xo (sleft[array_left].data() + off_s, s[paths[i]].data() + off_s + n_elm_2, s[paths[i]].data() + off_s, n_elm_2);\n+ }\n+ }\n+ for (auto i = 0; i < n_active_paths; i++)\n+ {\n+ const auto array_left = path_2_array_s[paths[i]][rev_depth -1];\n+ if(array_left == paths[i])\n+ API_polar::xo (s[array_left].data() + off_s, s[paths[i]].data() + off_s + n_elm_2, s[paths[i]].data() + off_s, n_elm_2);\n}\nbreak;\ndefault:\n@@ -311,8 +331,18 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\ncopy_left(rev_depth, off_s);\nfor (auto i = 0; i < n_active_paths; i++)\n{\n- const auto& sleft = (path_2_array_s[paths[i]][rev_depth -1] == paths[i]) ? s : s2;\n- API_polar::xo (sleft[paths[i]].data() + off_s, s[paths[i]].data() + off_s + n_elm_2, s[paths[i]].data() + off_s, n_elm_2);\n+ const auto array_left = path_2_array_s[paths[i]][rev_depth -1];\n+ if(array_left != paths[i])\n+ {\n+ const auto& sleft = (path_2_array_s[array_left][rev_depth -1] == array_left) ? s : s2;\n+ API_polar::xo (sleft[array_left].data() + off_s, s[paths[i]].data() + off_s + n_elm_2, s[paths[i]].data() + off_s, n_elm_2);\n+ }\n+ }\n+ for (auto i = 0; i < n_active_paths; i++)\n+ {\n+ const auto array_left = path_2_array_s[paths[i]][rev_depth -1];\n+ if(array_left == paths[i])\n+ API_polar::xo (s[array_left].data() + off_s, s[paths[i]].data() + off_s + n_elm_2, s[paths[i]].data() + off_s, n_elm_2);\n}\nbreak;\ncase RATE_0_LEFT:\n@@ -328,21 +358,34 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\ncopy_left(rev_depth, off_s);\nfor (auto i = 0; i < n_active_paths; i++)\n{\n- const auto& sleft = (path_2_array_s[paths[i]][rev_depth -1] == paths[i]) ? s : s2;\n- API_polar::xo (sleft[paths[i]].data() + off_s, s[paths[i]].data() + off_s + n_elm_2, s[paths[i]].data() + off_s, n_elm_2);\n+ const auto array_left = path_2_array_s[paths[i]][rev_depth -1];\n+ if(array_left != paths[i])\n+ {\n+ const auto& sleft = (path_2_array_s[array_left][rev_depth -1] == array_left) ? s : s2;\n+ API_polar::xo (sleft[array_left].data() + off_s, s[paths[i]].data() + off_s + n_elm_2, s[paths[i]].data() + off_s, n_elm_2);\n+ }\n+ }\n+ for (auto i = 0; i < n_active_paths; i++)\n+ {\n+ const auto array_left = path_2_array_s[paths[i]][rev_depth -1];\n+ if(array_left == paths[i])\n+ API_polar::xo (s[array_left].data() + off_s, s[paths[i]].data() + off_s + n_elm_2, s[paths[i]].data() + off_s, n_elm_2);\n}\nbreak;\ndefault:\nbreak;\n}\n+\nconst auto is_left = (((off_s / n_elmts) % 2) == 0);\nif(is_left)\nfor (auto i = 0; i < n_active_paths; i++)\n+ {\n+ path_2_array_s[paths[i]][rev_depth] = paths[i];\nn_array_ref_s [paths[i]][rev_depth] = 1;\n}\n+ }\nelse // leaf node\n{\n- const auto is_left = (((off_s / n_elmts) % 2) == 0);\n// h\nswitch (node_type)\n{\n@@ -353,6 +396,8 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\ndefault:\nbreak;\n}\n+\n+ const auto is_left = (((off_s / n_elmts) % 2) == 0);\nif (is_left)\nfor (auto i = 0; i < n_active_paths; i++)\n{\n@@ -1114,15 +1159,12 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n{\nconst auto n_elmts = 1 << r_d;\nconst auto n_elm_2 = n_elmts >> 1;\n- const auto is_left = (((off_s / n_elmts) % 2) == 0);\nfor (auto i = 0; i < n_active_paths; i++)\n{\nconst auto child_left = path_2_array_s[paths[i]][r_d - 1];\n- if(child_left != paths[i])\n+\n+ if((child_left != paths[i]) && (n_array_ref_s[paths[i]][r_d -1] > 0))\nfor (auto j = 0; j < n_elm_2; j++)\n- s2[paths[i]][off_s + j] = s[child_left][off_s + j];\n+ s2[paths[i]][off_s + j] = s[paths[i]][off_s + j];\n}\n- for (auto i = 0; i < n_active_paths; i++)\n- if(is_left)\n- path_2_array_s[paths[i]][r_d] = paths[i];\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Further reduced s copies.
8,488
23.01.2017 16:44:35
18,000
ceef6e3361ca5b311378399d07e09ebecede8829
Renamed SCL decoder with modified s management to SCL_MEM.
[ { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hpp", "diff": "+#ifndef DECODER_POLAR_SCL_MEM_FAST_SYS_CA\n+#define DECODER_POLAR_SCL_MEM_FAST_SYS_CA\n+\n+#include \"../Decoder_polar_SCL_MEM_fast_sys.hpp\"\n+#include \"Module/CRC/CRC.hpp\"\n+\n+template <typename B, typename R, class API_polar>\n+class Decoder_polar_SCL_MEM_fast_CA_sys : public Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n+{\n+protected:\n+ CRC<B>& crc;\n+ mipp::vector<B> U_test;\n+\n+public:\n+ Decoder_polar_SCL_MEM_fast_CA_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits, CRC<B>& crc,\n+ const int n_frames = 1, const std::string name = \"Decoder_polar_SCL_MEM_fast_CA_sys\");\n+ virtual ~Decoder_polar_SCL_MEM_fast_CA_sys(){};\n+\n+protected:\n+ bool crc_check (mipp::vector<B> &s);\n+ virtual int select_best_path( );\n+};\n+\n+#include \"Decoder_polar_SCL_MEM_fast_CA_sys.hxx\"\n+\n+#endif /* DECODER_POLAR_SCL_MEM_FAST_SYS_CA_CA */\n" }, { "change_type": "RENAME", "old_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hxx", "diff": "#include \"Tools/Algo/Bit_packer.hpp\"\n-#include \"Decoder_polar_SCL_fast_CA_sys.hpp\"\n+#include \"Decoder_polar_SCL_MEM_fast_CA_sys.hpp\"\ntemplate <typename B, typename R, class API_polar>\n-Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>\n-::Decoder_polar_SCL_fast_CA_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits, CRC<B>& crc,\n+Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>\n+::Decoder_polar_SCL_MEM_fast_CA_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits, CRC<B>& crc,\nconst int n_frames, const std::string name)\n-: Decoder_polar_SCL_fast_sys<B,R,API_polar>(K, N, L, frozen_bits, n_frames, name), crc(crc), U_test(K)\n+: Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>(K, N, L, frozen_bits, n_frames, name), crc(crc), U_test(K)\n{\n}\ntemplate <typename B, typename R, class API_polar>\n-bool Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>\n+bool Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>\n::crc_check(mipp::vector<B> &s)\n{\n// // extract the info bits from the codeword\n@@ -43,7 +43,7 @@ bool Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>\n}\ntemplate <typename B, typename R, class API_polar>\n-int Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>\n+int Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>\n::select_best_path()\n{\nauto n_valid_paths = 0;\n@@ -62,7 +62,7 @@ int Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>\nn_valid_paths++;\n}\n- this->Decoder_polar_SCL_fast_sys<B,R,API_polar>::select_best_path();\n+ this->Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>::select_best_path();\nreturn n_valid_paths;\n}\n" }, { "change_type": "DELETE", "old_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hpp", "new_path": null, "diff": "-#ifndef DECODER_POLAR_SCL_FAST_SYS_CA\n-#define DECODER_POLAR_SCL_FAST_SYS_CA\n-\n-#include \"../Decoder_polar_SCL_fast_sys.hpp\"\n-#include \"Module/CRC/CRC.hpp\"\n-\n-template <typename B, typename R, class API_polar>\n-class Decoder_polar_SCL_fast_CA_sys : public Decoder_polar_SCL_fast_sys<B,R,API_polar>\n-{\n-protected:\n- CRC<B>& crc;\n- mipp::vector<B> U_test;\n-\n-public:\n- Decoder_polar_SCL_fast_CA_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits, CRC<B>& crc,\n- const int n_frames = 1, const std::string name = \"Decoder_polar_SCL_fast_CA_sys\");\n- virtual ~Decoder_polar_SCL_fast_CA_sys(){};\n-\n-protected:\n- bool crc_check (mipp::vector<B> &s);\n- virtual int select_best_path( );\n-};\n-\n-#include \"Decoder_polar_SCL_fast_CA_sys.hxx\"\n-\n-#endif /* DECODER_POLAR_SCL_FAST_SYS_CA_CA */\n" }, { "change_type": "RENAME", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hpp", "diff": "-#ifndef DECODER_POLAR_SCL_FAST_SYS\n-#define DECODER_POLAR_SCL_FAST_SYS\n+#ifndef DECODER_POLAR_SCL_MEM_FAST_SYS\n+#define DECODER_POLAR_SCL_MEM_FAST_SYS\n#include <set>\n#include <vector>\n#include \"../decoder_polar_functions.h\"\ntemplate <typename B, typename R, class API_polar>\n-class Decoder_polar_SCL_fast_sys : public Decoder<B,R>\n+class Decoder_polar_SCL_MEM_fast_sys : public Decoder<B,R>\n{\nprotected:\nconst int m; // graph depth\n@@ -43,9 +43,9 @@ protected:\nstd::vector<std::vector<int>> path_2_array_s; // give array used by a path\npublic:\n- Decoder_polar_SCL_fast_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits,\n- const int n_frames = 1, const std::string name = \"Decoder_polar_SCL_fast_sys\");\n- virtual ~Decoder_polar_SCL_fast_sys();\n+ Decoder_polar_SCL_MEM_fast_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits,\n+ const int n_frames = 1, const std::string name = \"Decoder_polar_SCL_MEM_fast_sys\");\n+ virtual ~Decoder_polar_SCL_MEM_fast_sys();\nvirtual void load (const mipp::vector<R>& Y_N);\nvirtual void hard_decode( );\n@@ -81,6 +81,6 @@ private:\ninline void flip_bits_spc(const int old_path, const int new_path, const int dup, const int off_s, const int n_elmts);\n};\n-#include \"Decoder_polar_SCL_fast_sys.hxx\"\n+#include \"Decoder_polar_SCL_MEM_fast_sys.hxx\"\n-#endif /* DECODER_POLAR_SCL_FAST_SYS_ */\n+#endif /* DECODER_POLAR_SCL_MEM_FAST_SYS_ */\n" }, { "change_type": "RENAME", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx", "diff": "#include \"Tools/Code/Polar/Pattern_polar_parser.hpp\"\n-#include \"Decoder_polar_SCL_fast_sys.hpp\"\n+#include \"Decoder_polar_SCL_MEM_fast_sys.hpp\"\ntemplate <typename B, typename R, class API_polar>\n-Decoder_polar_SCL_fast_sys<B,R,API_polar>\n-::Decoder_polar_SCL_fast_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits,\n+Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n+::Decoder_polar_SCL_MEM_fast_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits,\nconst int n_frames, const std::string name)\n: Decoder<B,R> (K, N, n_frames, API_polar::get_n_frames(), name),\nm (std::log2(N)),\n@@ -84,14 +84,14 @@ Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\ntemplate <typename B, typename R, class API_polar>\n-Decoder_polar_SCL_fast_sys<B,R,API_polar>\n-::~Decoder_polar_SCL_fast_sys()\n+Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n+::~Decoder_polar_SCL_MEM_fast_sys()\n{\npolar_patterns.release_patterns();\n}\ntemplate <typename B, typename R, class API_polar>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::init_buffers()\n{\nstd::fill(metrics.begin(), metrics.begin() + L, std::numeric_limits<float>::min());\n@@ -117,7 +117,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\ntemplate <typename B, typename R, class API_polar>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::load(const mipp::vector<R>& Y_N)\n{\nstd::copy(Y_N.begin(), Y_N.begin() + this->N, this->Y_N.begin());\n@@ -125,7 +125,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\ntemplate <typename B, typename R, class API_polar>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::hard_decode()\n{\nint first_node_id = 0, off_l = 0, off_s = 0;\n@@ -134,7 +134,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\ntemplate <typename B, typename R, class API_polar>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::recursive_decode(const int off_l, const int off_s, const int rev_depth, int &node_id)\n{\nconst int n_elmts = 1 << rev_depth;\n@@ -408,7 +408,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\ntemplate <typename B, typename R, class API_polar>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::store(mipp::vector<B>& V_K) const\n{\nassert(V_K.size() >= (unsigned) this->K);\n@@ -420,7 +420,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\ntemplate <typename B, typename R, class API_polar>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::store_fast(mipp::vector<B>& V) const\n{\nassert(V.size() == (unsigned) this->N);\n@@ -428,7 +428,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\ntemplate <typename B, typename R, class API_polar>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::unpack(mipp::vector<B>& V_N) const\n{\nassert(V_N.size() == frozen_bits.size());\n@@ -438,7 +438,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\ntemplate <typename B, typename R, class API_polar>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::update_paths_r0(const int r_d, const int off_l, const int off_s, const int n_elmts)\n{\nfor (auto i = 0; i < n_active_paths; i++)\n@@ -458,7 +458,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\ntemplate <typename B, typename R, class API_polar>\ntemplate <int REV_D, int N_ELMTS>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::update_paths_r0(const int off_l, const int off_s)\n{\nfor (auto i = 0; i < n_active_paths; i++)\n@@ -477,7 +477,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\ntemplate <typename B, typename R, class API_polar>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::update_paths_r1(const int r_d, const int off_l, const int off_s, const int n_elmts)\n{\nif (r_d == 0)\n@@ -545,7 +545,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\ntemplate <typename B, typename R, class API_polar>\ntemplate <int REV_D, int N_ELMTS>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::update_paths_r1(const int off_l, const int off_s)\n{\nif (REV_D == 0)\n@@ -612,7 +612,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\ntemplate <typename B, typename R, class API_polar>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::flip_bits_r1(const int old_path, const int new_path, const int dup, const int off_s, const int n_elmts)\n{\nconstexpr B b = bit_init<B>();\n@@ -638,7 +638,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\ntemplate <typename B, typename R, class API_polar>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::update_paths_rep(const int r_d, const int off_l, const int off_s, const int n_elmts)\n{\nconstexpr B b = bit_init<B>();\n@@ -705,7 +705,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\ntemplate <typename B, typename R, class API_polar>\ntemplate <int REV_D, int N_ELMTS>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::update_paths_rep(const int off_l, const int off_s)\n{\nconstexpr B b = bit_init<B>();\n@@ -771,7 +771,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\ntemplate <typename B, typename R, class API_polar>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::flip_bits_rep(const int old_path, const int new_path, const int off_s, const int n_elmts)\n{\nconstexpr B b = bit_init<B>();\n@@ -784,7 +784,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\ntemplate <typename B, typename R, class API_polar>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::update_paths_spc(const int r_d, const int off_l, const int off_s, const int n_elmts)\n{\nconst auto n_cands = L <= 2 ? 4 : 8; // number of candidates\n@@ -896,7 +896,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\ntemplate <typename B, typename R, class API_polar>\ntemplate <int REV_D, int N_ELMTS>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::update_paths_spc(const int off_l, const int off_s)\n{\nconst auto n_cands = L <= 2 ? 4 : 8; // number of candidates\n@@ -1007,7 +1007,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\ntemplate <typename B, typename R, class API_polar>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::flip_bits_spc(const int old_path, const int new_path, const int dup, const int off_s, const int n_elmts)\n{\nconstexpr B b = bit_init<B>();\n@@ -1066,7 +1066,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\ntemplate <typename B, typename R, class API_polar>\n-int Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+int Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::duplicate_tree(const int old_path, const int off_l, const int off_s, const int r_d)\n{\nconst auto new_path = paths[n_active_paths++];\n@@ -1100,7 +1100,7 @@ int Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\ntemplate <typename B, typename R, class API_polar>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::delete_path(int path_id, const int r_d)\n{\nconst auto old_path = paths[path_id];\n@@ -1115,7 +1115,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\ntemplate <typename B, typename R, class API_polar>\n-int Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+int Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::select_best_path()\n{\nbest_path = -1;\n@@ -1130,7 +1130,7 @@ int Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\ntemplate <typename B, typename R, class API_polar>\n-int Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+int Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::up_ref_array_idx(const int path, const int r_d)\n{\nauto old_array = path_2_array_l[path][r_d];\n@@ -1154,7 +1154,7 @@ int Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\ntemplate <typename B, typename R, class API_polar>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::copy_left(const int r_d, const int off_s)\n{\nconst auto n_elmts = 1 << r_d;\n" } ]
C++
MIT License
aff3ct/aff3ct
Renamed SCL decoder with modified s management to SCL_MEM.
8,488
23.01.2017 17:38:42
18,000
ffd649bedf6d9eb8019ce88d3f165c5944c65c87
Add ASCL_MEM and integrate SCL_MEM
[ { "change_type": "MODIFY", "old_path": "src/Launcher/BFER/Polar/Launcher_BFER_polar.cpp", "new_path": "src/Launcher/BFER/Polar/Launcher_BFER_polar.cpp", "diff": "@@ -80,7 +80,7 @@ void Launcher_BFER_polar<B,R,Q>\n\"disable the systematic encoding.\"};\n// ------------------------------------------------------------------------------------------------------- decoder\n- this->opt_args[{\"dec-type\", \"D\"}].push_back(\"SC, SCL, ASCL, SCAN\");\n+ this->opt_args[{\"dec-type\", \"D\"}].push_back(\"SC, SCL, SCL_MEM, ASCL, ASCL_MEM, SCAN\");\nthis->opt_args[{\"dec-ite\", \"i\"}] =\n{\"positive_int\",\n\"maximal number of iterations in the SCAN decoder.\"};\n@@ -197,9 +197,15 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFER_polar<B,R,Q>\nif (this->params.decoder.type == \"SCL\")\np.push_back(std::make_pair(\"Num. of lists (L)\", std::to_string(this->params.decoder.L)));\n+ if (this->params.decoder.type == \"SCL_MEM\")\n+ p.push_back(std::make_pair(\"Num. of lists (L)\", std::to_string(this->params.decoder.L)));\n+\nif (this->params.decoder.type == \"ASCL\")\np.push_back(std::make_pair(\"Max num. of lists (L)\", std::to_string(this->params.decoder.L)));\n+ if (this->params.decoder.type == \"ASCL_MEM\")\n+ p.push_back(std::make_pair(\"Max num. of lists (L)\", std::to_string(this->params.decoder.L)));\n+\nreturn p;\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hpp", "diff": "+#ifndef DECODER_POLAR_ASCL_MEM_FAST_SYS_CA\n+#define DECODER_POLAR_ASCL_MEM_FAST_SYS_CA\n+\n+#include \"../SC/Decoder_polar_SC_fast_sys.hpp\"\n+#include \"../SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hpp\"\n+\n+#include \"Module/CRC/CRC.hpp\"\n+\n+template <typename B, typename R, class API_polar>\n+class Decoder_polar_ASCL_MEM_fast_CA_sys : public Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>\n+{\n+private:\n+ Decoder_polar_SC_fast_sys<B,R,API_polar> sc_decoder;\n+ const int L_max;\n+ const bool is_full_adaptive;\n+\n+public:\n+ Decoder_polar_ASCL_MEM_fast_CA_sys(const int& K, const int& N, const int& max_L, const mipp::vector<B>& frozen_bits,\n+ CRC<B>& crc, const int n_frames = 1,\n+ const std::string name = \"Decoder_polar_ASCL_MEM_fast_CA_sys\");\n+ virtual ~Decoder_polar_ASCL_MEM_fast_CA_sys(){};\n+\n+ void load (const mipp::vector<R>& Y_N);\n+ void hard_decode( );\n+ void store (mipp::vector<B>& V_N ) const;\n+ void unpack (mipp::vector<B>& V_N ) const;\n+ void store_fast (mipp::vector<B>& V ) const;\n+};\n+\n+#include \"Decoder_polar_ASCL_MEM_fast_CA_sys.hxx\"\n+\n+#endif /* DECODER_POLAR_ASCL_MEM_FAST_SYS_CA */\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hxx", "diff": "+#include \"Decoder_polar_ASCL_MEM_fast_CA_sys.hpp\"\n+#include \"Tools/Algo/Bit_packer.hpp\"\n+\n+template <typename B, typename R, class API_polar>\n+Decoder_polar_ASCL_MEM_fast_CA_sys<B,R,API_polar>\n+::Decoder_polar_ASCL_MEM_fast_CA_sys(const int& K, const int& N, const int& L_max, const mipp::vector<B>& frozen_bits,\n+ CRC<B>& crc, const int n_frames, const std::string name)\n+: Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>(K, N, L_max, frozen_bits, crc, n_frames, name),\n+ sc_decoder (K, N , frozen_bits, n_frames, name),\n+ L_max(L_max), is_full_adaptive(true)\n+{\n+ assert(L_max > 0);\n+}\n+\n+template <typename B, typename R, class API_polar>\n+void Decoder_polar_ASCL_MEM_fast_CA_sys<B,R,API_polar>\n+::load(const mipp::vector<R>& Y_N)\n+{\n+ sc_decoder.load(Y_N);\n+}\n+\n+template <typename B, typename R, class API_polar>\n+void Decoder_polar_ASCL_MEM_fast_CA_sys<B,R,API_polar>\n+::hard_decode()\n+{\n+ this->L = 1;\n+ sc_decoder.hard_decode();\n+\n+ // check the CRC\n+ auto crc_decode_result = this->crc_check(sc_decoder.s);\n+\n+ // delete the path if the CRC result is negative\n+ if (!crc_decode_result && L_max > 1)\n+ {\n+ if (is_full_adaptive)\n+ {\n+ std::copy(sc_decoder.l.begin(), sc_decoder.l.begin() + this->N, this->Y_N.begin());\n+ do\n+ {\n+ int first_node_id = 0, off_l = 0, off_s = 0;\n+\n+ this->L <<= 1;\n+ this->init_buffers();\n+ this->recursive_decode(off_l, off_s, this->m, first_node_id);\n+ }\n+ while (!this->select_best_path() && this->L < L_max);\n+ }\n+ else // pseudo adaptive mode\n+ {\n+ this->L = this->L_max;\n+ Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>::load(sc_decoder.l);\n+ Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>::hard_decode();\n+ }\n+ }\n+}\n+\n+template <typename B, typename R, class API_polar>\n+void Decoder_polar_ASCL_MEM_fast_CA_sys<B,R,API_polar>\n+::store(mipp::vector<B>& V_K) const\n+{\n+ if (this->L == 1) sc_decoder. store(V_K);\n+ else Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>::store(V_K);\n+}\n+\n+template <typename B, typename R, class API_polar>\n+void Decoder_polar_ASCL_MEM_fast_CA_sys<B,R,API_polar>\n+::store_fast(mipp::vector<B>& V) const\n+{\n+ if (this->L == 1) sc_decoder. store_fast(V);\n+ else Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>::store_fast(V);\n+}\n+\n+template <typename B, typename R, class API_polar>\n+void Decoder_polar_ASCL_MEM_fast_CA_sys<B,R,API_polar>\n+::unpack(mipp::vector<B>& V_N) const\n+{\n+ if (this->L == 1) sc_decoder. unpack(V_N);\n+ else Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>::unpack(V_N);\n+}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hpp", "new_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hpp", "diff": "template <typename B, typename R, class API_polar>\nclass Decoder_polar_ASCL_fast_CA_sys;\n+template <typename B, typename R, class API_polar>\n+class Decoder_polar_ASCL_MEM_fast_CA_sys;\n+\ntemplate <typename B, typename R, class API_polar>\nclass Decoder_polar_SC_fast_sys : public Decoder<B,R>\n{\nfriend Decoder_polar_ASCL_fast_CA_sys<B,R,API_polar>;\n+ friend Decoder_polar_ASCL_MEM_fast_CA_sys<B,R,API_polar>;\nprotected:\nconst int m; // graph depth\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Factory/Polar/Factory_decoder_polar.cpp", "new_path": "src/Tools/Factory/Polar/Factory_decoder_polar.cpp", "diff": "#include \"Module/Decoder/Polar/SCL/Decoder_polar_SCL_naive.hpp\"\n#include \"Module/Decoder/Polar/SCL/Decoder_polar_SCL_naive_sys.hpp\"\n#include \"Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp\"\n+#include \"Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hpp\"\n#include \"Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_naive_CA.hpp\"\n#include \"Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_naive_CA_sys.hpp\"\n#include \"Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hpp\"\n+#include \"Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hpp\"\n#include \"Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hpp\"\n+#include \"Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hpp\"\n// #define API_POLAR_DYNAMIC 1\n@@ -199,6 +202,29 @@ Decoder<B,R>* Factory_decoder_polar<B,R>\n}\n}\n+ if (params.decoder.type == \"SCL_MEM\" && params.decoder.implem == \"FAST\")\n+ {\n+ if (params.decoder.simd_strategy == \"INTRA\")\n+ {\n+ using API_polar = API_polar_dynamic_intra\n+ <B, R, f_LLR <R>, g_LLR <B,R>, g0_LLR <R>, h_LLR <B,R>, xo_STD <B>,\n+ f_LLR_i<R>, g_LLR_i<B,R>, g0_LLR_i<R>, h_LLR_i<B,R>, xo_STD_i<B>>;\n+ if (params.crc.poly.empty())\n+ decoder = new Decoder_polar_SCL_MEM_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, params.simulation.inter_frame_level);\n+ else\n+ decoder = new Decoder_polar_SCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n+ }\n+ else if (params.decoder.simd_strategy.empty())\n+ {\n+ using API_polar = API_polar_dynamic_seq\n+ <B, R, f_LLR<R>, g_LLR<B,R>, g0_LLR<R>, h_LLR<B,R>, xo_STD<B>>;\n+ if (params.crc.poly.empty())\n+ decoder = new Decoder_polar_SCL_MEM_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, params.simulation.inter_frame_level);\n+ else\n+ decoder = new Decoder_polar_SCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n+ }\n+ }\n+\nif (params.decoder.type == \"ASCL\")\n{\nif (params.decoder.simd_strategy == \"INTRA\")\n@@ -217,6 +243,24 @@ Decoder<B,R>* Factory_decoder_polar<B,R>\ndecoder = new Decoder_polar_ASCL_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n}\n}\n+ if (params.decoder.type == \"ASCL_MEM\")\n+ {\n+ if (params.decoder.simd_strategy == \"INTRA\")\n+ {\n+ using API_polar = API_polar_dynamic_intra\n+ <B, R, f_LLR <R>, g_LLR <B,R>, g0_LLR <R>, h_LLR <B,R>, xo_STD <B>,\n+ f_LLR_i<R>, g_LLR_i<B,R>, g0_LLR_i<R>, h_LLR_i<B,R>, xo_STD_i<B>>;\n+ if (!params.crc.poly.empty())\n+ decoder = new Decoder_polar_ASCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n+ }\n+ else if (params.decoder.simd_strategy.empty())\n+ {\n+ using API_polar = API_polar_dynamic_seq\n+ <B, R, f_LLR<R>, g_LLR<B,R>, g0_LLR<R>, h_LLR<B,R>, xo_STD<B>>;\n+ if (!params.crc.poly.empty())\n+ decoder = new Decoder_polar_ASCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n+ }\n+ }\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Add ASCL_MEM and integrate SCL_MEM
8,490
24.01.2017 18:13:59
-3,600
7591b2ce1618473d4fed7a32082a28ed1fa59d02
Working on little optims and priority queue to reduce the execution time.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "diff": "#ifndef DECODER_POLAR_SCL_FAST_SYS\n#define DECODER_POLAR_SCL_FAST_SYS\n-#include <set>\n+#include <queue>\n+#include <utility>\n#include <vector>\n#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"../../Decoder.hpp\"\n#include \"../decoder_polar_functions.h\"\n+auto my_comp = [](const std::pair<float,int>& e1, const std::pair<float,int>& e2) { return e1.first < e2.first; };\n+\n+//std::priority_queue<std::pair<float,int>, std::vector<std::pair<float,int>>, decltype(my_comp) > metrics_queue(my_comp);\n+\ntemplate <typename B, typename R, class API_polar>\nclass Decoder_polar_SCL_fast_sys : public Decoder<B,R>\n{\n@@ -37,6 +42,8 @@ protected:\nstd::vector<std::vector<int>> n_array_ref; // number of times an array is used\nstd::vector<std::vector<int>> path_2_array; // give array used by a path\n+ std::priority_queue<std::pair<float,int>, std::vector<std::pair<float,int>>, decltype(my_comp) > metrics_queue;\n+\npublic:\nDecoder_polar_SCL_fast_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits,\nconst int n_frames = 1, const std::string name = \"Decoder_polar_SCL_fast_sys\");\n@@ -67,6 +74,7 @@ protected:\ninline void init_buffers ( );\ninline void delete_path (int path_id);\n+ inline void delete_path2 (int path );\nvirtual inline int select_best_path( );\nprivate:\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "#include <algorithm>\n#include <iostream>\n#include <fstream>\n+#include <numeric>\n#include <limits>\n#include <cmath>\n#include <map>\n@@ -56,7 +57,8 @@ Decoder_polar_SCL_fast_sys<B,R,API_polar>\nbest_path (0),\nn_active_paths(1),\nn_array_ref (L, std::vector<int>(m)),\n- path_2_array (L, std::vector<int>(m))\n+ path_2_array (L, std::vector<int>(m)),\n+ metrics_queue (my_comp)\n{\nstatic_assert(API_polar::get_n_frames() == 1, \"The inter-frame API_polar is not supported.\");\nstatic_assert(sizeof(B) == sizeof(R), \"Sizes of the bits and reals have to be identical.\");\n@@ -76,7 +78,7 @@ Decoder_polar_SCL_fast_sys<B,R,API_polar>\n{\nllr_indexes.push_back(std::vector<int>(std::exp2(i)));\nfor (auto j = 0 ; j < (int)llr_indexes[i].size() ; j++)\n- llr_indexes[i][j] = j;\n+ std::iota(llr_indexes[i].begin(), llr_indexes[i].end(), 0); //0, 1, 2, 3...\n}\n}\n@@ -92,7 +94,8 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n::init_buffers()\n{\nstd::fill(metrics.begin(), metrics.begin() + L, std::numeric_limits<float>::min());\n- for (auto i = 0; i < L; i++) paths[i] = i;\n+ std::iota(paths.begin(), paths.begin() + L, 0);\n+\nn_active_paths = 1;\n// at the beginning, path 0 points to array 0\n@@ -102,9 +105,9 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nfor (auto i = 1; i < L; i++)\nstd::fill(n_array_ref[i].begin(), n_array_ref[i].end(), 0);\n- for (auto i = 0 ; i < 2 * L ; i++) metrics_idx[0][i] = i;\n- for (auto i = 0 ; i < 4 * L ; i++) metrics_idx[1][i] = i;\n- for (auto i = 0 ; i < (L <= 2 ? 4 : 8) * L ; i++) metrics_idx[2][i] = i;\n+ std::iota(metrics_idx[0].begin(), metrics_idx[0].begin() + 2 * L, 0);\n+ std::iota(metrics_idx[1].begin(), metrics_idx[1].begin() + 4 * L, 0);\n+ std::iota(metrics_idx[2].begin(), metrics_idx[2].begin() + (L <= 2 ? 4 : 8) * L, 0);\n}\ntemplate <typename B, typename R, class API_polar>\n@@ -405,11 +408,13 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nbit_flips[2 * path +0] = llr_indexes[r_d][0];\nbit_flips[2 * path +1] = llr_indexes[r_d][1];\n+ const auto abs0 = std::abs(l[array][off_l + bit_flips[2 * path +0]]);\n+ const auto abs1 = std::abs(l[array][off_l + bit_flips[2 * path +1]]);\n+\nmetrics_vec[1][4 * path +0] = metrics [ path ];\n- metrics_vec[1][4 * path +1] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path ]]);\n- metrics_vec[1][4 * path +2] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path +1]]);\n- metrics_vec[1][4 * path +3] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path +1]])\n- + std::abs(l[array][off_l + bit_flips[2 * path ]]);\n+ metrics_vec[1][4 * path +1] = metrics [ path ] + abs0;\n+ metrics_vec[1][4 * path +2] = metrics [ path ] + abs1;\n+ metrics_vec[1][4 * path +3] = metrics_vec[1][4 * path +1] + abs1;\n}\nfor (auto i = n_active_paths; i < L; i++)\nfor (auto j = 0; j < 4; j++)\n@@ -443,7 +448,11 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n{\nAPI_polar::h(s[path], l[array], off_l, off_s, n_elmts);\nfor (auto dup = 2; dup <= dup_count[path]; dup++)\n- flip_bits_r1(path, duplicate_tree(path, off_l, off_s, n_elmts), dup, off_s, n_elmts);\n+ {\n+ const auto new_path = duplicate_tree(path, off_l, off_s, n_elmts);\n+ flip_bits_r1(path, new_path, dup, off_s, n_elmts);\n+ metrics[new_path] = metrics_vec[1][4 * path + dup -1];\n+ }\ndup_count[path] = 0;\n}\n}\n@@ -451,6 +460,88 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\n}\n+//template <typename B, typename R, class API_polar>\n+//void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+//::update_paths_r1(const int r_d, const int off_l, const int off_s, const int n_elmts)\n+//{\n+// if (r_d == 0)\n+// update_paths_rep(r_d, off_l, off_s, n_elmts);\n+// else\n+// {\n+// float loc_metrics[4];\n+// for (auto i = 0; i < n_active_paths; i++)\n+// {\n+// const auto path = paths[i];\n+// const auto array = path_2_array[paths[i]][r_d];\n+//\n+// API_polar::h(s[path], l[array], off_l, off_s, n_elmts);\n+//\n+// std::partial_sort(llr_indexes[r_d].begin(), llr_indexes[r_d].begin() +2, llr_indexes[r_d].end(),\n+// [this, array, off_l](int x, int y){\n+// return std::abs(l[array][off_l + x]) < std::abs(l[array][off_l + y]);\n+// });\n+//\n+// bit_flips[2 * path +0] = llr_indexes[r_d][0];\n+// bit_flips[2 * path +1] = llr_indexes[r_d][1];\n+//\n+// loc_metrics[0] = metrics[path];\n+// loc_metrics[1] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path ]]);\n+// loc_metrics[2] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path +1]]);\n+// loc_metrics[3] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path +1]])\n+// + std::abs(l[array][off_l + bit_flips[2 * path ]]);\n+//\n+// auto j = 0;\n+// while ((int)metrics_queue.size() < L && j < 4)\n+// {\n+// metrics_queue.push(std::make_pair(loc_metrics[j], path));\n+// dup_count[path]++;\n+// j++;\n+// }\n+//\n+// if ((int)metrics_queue.size() == L)\n+// {\n+// auto m = metrics_queue.top();\n+// while (j < 4 && loc_metrics[j] < m.first)\n+// {\n+// dup_count[m.second]--;\n+// metrics_queue.pop();\n+// metrics_queue.push(std::make_pair(loc_metrics[j], path));\n+// dup_count[path]++;\n+// m = metrics_queue.top();\n+// j++;\n+// }\n+// }\n+// }\n+//\n+// // erase paths\n+// auto k = 0;\n+// auto n_active_paths_cpy = n_active_paths;\n+// for (auto i = 0; i < n_active_paths_cpy; i++)\n+// if (dup_count[paths[k]] == 0)\n+// delete_path(k);\n+// else\n+// k++;\n+//\n+// // duplicate paths and flip the bits\n+// while (!metrics_queue.empty())\n+// {\n+// const auto metric_val = metrics_queue.top().first;\n+// const auto old_path = metrics_queue.top().second;\n+//\n+// assert(dup_count[old_path] != 0);\n+//\n+// const auto cur_path = (dup_count[old_path] == 1) ? old_path : duplicate_tree(old_path, off_l, off_s, n_elmts);\n+//\n+// metrics[cur_path] = metric_val;\n+// if (dup_count[old_path] != 1)\n+// flip_bits_r1(old_path, cur_path, dup_count[old_path], off_s, n_elmts);\n+//\n+// dup_count[old_path]--;\n+// metrics_queue.pop();\n+// }\n+// }\n+//}\n+\ntemplate <typename B, typename R, class API_polar>\ntemplate <int REV_D, int N_ELMTS>\nvoid Decoder_polar_SCL_fast_sys<B,R,API_polar>\n@@ -473,11 +564,13 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nbit_flips[2 * path +0] = llr_indexes[REV_D][0];\nbit_flips[2 * path +1] = llr_indexes[REV_D][1];\n+ const auto abs0 = std::abs(l[array][off_l + bit_flips[2 * path +0]]);\n+ const auto abs1 = std::abs(l[array][off_l + bit_flips[2 * path +1]]);\n+\nmetrics_vec[1][4 * path +0] = metrics [ path ];\n- metrics_vec[1][4 * path +1] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path ]]);\n- metrics_vec[1][4 * path +2] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path +1]]);\n- metrics_vec[1][4 * path +3] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path +1]])\n- + std::abs(l[array][off_l + bit_flips[2 * path ]]);\n+ metrics_vec[1][4 * path +1] = metrics [ path ] + abs0;\n+ metrics_vec[1][4 * path +2] = metrics [ path ] + abs1;\n+ metrics_vec[1][4 * path +3] = metrics_vec[1][4 * path +1] + abs1;\n}\nfor (auto i = n_active_paths; i < L; i++)\nfor (auto j = 0; j < 4; j++)\n@@ -525,9 +618,10 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n{\nconstexpr B b = bit_init<B>();\n- metrics[new_path] = metrics_vec[1][4 * old_path + dup -1];\nswitch (dup)\n{\n+ case 1:\n+ break;\ncase 2:\ns[new_path][off_s + bit_flips[2 * old_path +0]] = !s[old_path][off_s + bit_flips[2 * old_path +0]] ? b : 0;\nbreak;\n@@ -715,44 +809,22 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nprod *= l[array][off_l +j];\nis_even[path] = prod > 0;\n- {\n- metrics_vec[2][n_cands * path +0] = metrics[path] +\n- std::abs(l[array][off_l + bit_flips[4 * path +0]]) * (!is_even[path]);\n-\n- metrics_vec[2][n_cands * path +1] = metrics[path] +\n- std::abs(l[array][off_l + bit_flips[4 * path +0]]) * is_even[path] +\n- std::abs(l[array][off_l + bit_flips[4 * path +1]]);\n+ const auto abs0 = std::abs(l[array][off_l + bit_flips[4 * path +0]]);\n+ const auto abs1 = std::abs(l[array][off_l + bit_flips[4 * path +1]]);\n+ const auto abs2 = std::abs(l[array][off_l + bit_flips[4 * path +2]]);\n+ const auto abs3 = std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n- metrics_vec[2][n_cands * path +2] = metrics[path] +\n- std::abs(l[array][off_l + bit_flips[4 * path +0]]) * is_even[path] +\n- std::abs(l[array][off_l + bit_flips[4 * path +2]]);\n+ metrics_vec[2][n_cands * path +0] = metrics[path] + (!is_even[path] ? abs0 : 0);\n+ metrics_vec[2][n_cands * path +1] = metrics[path] + ( is_even[path] ? abs0 : 0) + abs1;\n+ metrics_vec[2][n_cands * path +2] = metrics[path] + ( is_even[path] ? abs0 : 0) + abs2;\n+ metrics_vec[2][n_cands * path +3] = metrics[path] + ( is_even[path] ? abs0 : 0) + abs3;\n- metrics_vec[2][n_cands * path +3] = metrics[path] +\n- std::abs(l[array][off_l + bit_flips[4 * path +0]]) * is_even[path] +\n- std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n- }\nif (L > 2)\n{\n- metrics_vec[2][n_cands * path +4] = metrics[path] +\n- std::abs(l[array][off_l + bit_flips[4 * path +0]]) * (!is_even[path]) +\n- std::abs(l[array][off_l + bit_flips[4 * path +1]]) +\n- std::abs(l[array][off_l + bit_flips[4 * path +2]]);\n-\n- metrics_vec[2][n_cands * path +5] = metrics[path] +\n- std::abs(l[array][off_l + bit_flips[4 * path +0]]) * (!is_even[path]) +\n- std::abs(l[array][off_l + bit_flips[4 * path +1]]) +\n- std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n-\n- metrics_vec[2][n_cands * path +6] = metrics[path] +\n- std::abs(l[array][off_l + bit_flips[4 * path +0]]) * (!is_even[path]) +\n- std::abs(l[array][off_l + bit_flips[4 * path +2]]) +\n- std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n-\n- metrics_vec[2][n_cands * path +7] = metrics[path] +\n- std::abs(l[array][off_l + bit_flips[4 * path +0]]) * is_even[path] +\n- std::abs(l[array][off_l + bit_flips[4 * path +1]]) +\n- std::abs(l[array][off_l + bit_flips[4 * path +2]]) +\n- std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n+ metrics_vec[2][n_cands * path +4] = metrics_vec[2][n_cands * path +0] + abs1 + abs2;\n+ metrics_vec[2][n_cands * path +5] = metrics_vec[2][n_cands * path +0] + abs1 + abs3;\n+ metrics_vec[2][n_cands * path +6] = metrics_vec[2][n_cands * path +0] + abs2 + abs3;\n+ metrics_vec[2][n_cands * path +7] = metrics_vec[2][n_cands * path +1] + abs2 + abs3;\n}\n}\nfor (auto i = n_active_paths; i < L; i++)\n@@ -787,10 +859,14 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst auto array = path_2_array[path][r_d];\nAPI_polar::h(s[path], l[array], off_l, off_s, n_elmts);\n- metrics[path] = metrics_vec[2][n_cands * path];\nfor (auto dup = 2; dup <= dup_count[path]; dup++)\n- flip_bits_spc(path, duplicate_tree(path, off_l, off_s, n_elmts), dup, off_s, n_elmts);\n+ {\n+ const auto new_path = duplicate_tree(path, off_l, off_s, n_elmts);\n+ flip_bits_spc(path, new_path, dup, off_s, n_elmts);\n+ metrics[new_path] = metrics_vec[2][n_cands * path + dup -1];\n+ }\n+ metrics[path] = metrics_vec[2][n_cands * path];\nif (!is_even[path])\ns[path][off_s + bit_flips[4 * path +0]] = s[path][off_s + bit_flips[4 * path +0]] ? 0 : bit_init<B>();\n@@ -800,6 +876,110 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nstd::fill(dup_count.begin(), dup_count.begin() + L, 0);\n}\n+//template <typename B, typename R, class API_polar>\n+//void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+//::update_paths_spc(const int r_d, const int off_l, const int off_s, const int n_elmts)\n+//{\n+// const auto n_cands = L <= 2 ? 4 : 8; // number of candidates\n+//\n+// float loc_metrics[8];\n+// for (auto i = 0; i < n_active_paths; i++)\n+// {\n+// const auto path = paths[i];\n+// const auto array = path_2_array[paths[i]][r_d];\n+//\n+// API_polar::h(s[path], l[array], off_l, off_s, n_elmts);\n+// auto sum = s[path][off_s +0];\n+// for (auto j = 1; j < n_elmts; j++)\n+// sum ^= s[path][off_s +j];\n+// is_even[path] = (sum == 0);\n+//\n+// std::partial_sort(llr_indexes[r_d].begin(), llr_indexes[r_d].begin() +4, llr_indexes[r_d].end(),\n+// [this, array, off_l](int x, int y){\n+// return std::abs(l[array][off_l + x]) < std::abs(l[array][off_l + y]);\n+// });\n+//\n+// for (auto j = 0; j < 4; j++)\n+// bit_flips[4 * path +j] = llr_indexes[r_d][j];\n+//\n+// {\n+// loc_metrics[0] = metrics[path] + std::abs(l[array][off_l + bit_flips[4 * path +0]]) * !is_even[path];\n+//\n+// loc_metrics[1] = metrics[path] + std::abs(l[array][off_l + bit_flips[4 * path +0]]) * is_even[path] +\n+// std::abs(l[array][off_l + bit_flips[4 * path +1]]);\n+//\n+// loc_metrics[2] = metrics[path] + std::abs(l[array][off_l + bit_flips[4 * path +0]]) * is_even[path] +\n+// std::abs(l[array][off_l + bit_flips[4 * path +2]]);\n+//\n+// loc_metrics[3] = metrics[path] + std::abs(l[array][off_l + bit_flips[4 * path +0]]) * is_even[path] +\n+// std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n+// }\n+// if (L > 2)\n+// {\n+// loc_metrics[4] = loc_metrics[0] + std::abs(l[array][off_l + bit_flips[4 * path +1]]) +\n+// std::abs(l[array][off_l + bit_flips[4 * path +2]]);\n+//\n+// loc_metrics[5] = loc_metrics[0] + std::abs(l[array][off_l + bit_flips[4 * path +1]]) +\n+// std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n+//\n+// loc_metrics[6] = loc_metrics[0] + std::abs(l[array][off_l + bit_flips[4 * path +2]]) +\n+// std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n+//\n+// loc_metrics[7] = loc_metrics[1] + std::abs(l[array][off_l + bit_flips[4 * path +2]]) +\n+// std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n+// }\n+//\n+// auto j = 0;\n+// auto q_size = (int)metrics_queue.size();\n+//\n+// while (q_size < L && j < n_cands)\n+// {\n+// metrics_queue.push(std::make_pair(loc_metrics[j], path));\n+// dup_count[path]++;\n+// q_size++;\n+// j++;\n+// }\n+//\n+// if (q_size == L)\n+// {\n+// auto m = metrics_queue.top();\n+// while (j < n_cands && loc_metrics[j] < m.first)\n+// {\n+// dup_count[m.second]--;\n+// metrics_queue.pop();\n+// metrics_queue.push(std::make_pair(loc_metrics[j], path));\n+// dup_count[path]++;\n+// m = metrics_queue.top();\n+// j++;\n+// }\n+// }\n+// }\n+//\n+// // erase paths\n+// auto k = 0;\n+// auto n_active_paths_cpy = n_active_paths;\n+// for (auto i = 0; i < n_active_paths_cpy; i++)\n+// if (dup_count[paths[k]] == 0)\n+// delete_path(k);\n+// else\n+// k++;\n+//\n+// // duplicate paths and flip the bits\n+// while (!metrics_queue.empty())\n+// {\n+// const auto metric_val = metrics_queue.top().first;\n+// const auto old_path = metrics_queue.top().second;\n+//\n+// const auto cur_path = (dup_count[old_path] == 1) ? old_path : duplicate_tree(old_path, off_l, off_s, n_elmts);\n+//\n+// metrics[cur_path] = metric_val;\n+// flip_bits_spc(old_path, cur_path, dup_count[old_path], off_s, n_elmts);\n+//\n+// dup_count[old_path]--;\n+// metrics_queue.pop();\n+// }\n+//}\n+\ntemplate <typename B, typename R, class API_polar>\ntemplate <int REV_D, int N_ELMTS>\nvoid Decoder_polar_SCL_fast_sys<B,R,API_polar>\n@@ -827,7 +1007,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n{\nmetrics_vec[2][n_cands * path +0] = metrics[path] +\n- std::abs(l[array][off_l + bit_flips[4 * path +0]]) * (!is_even[path]);\n+ std::abs(l[array][off_l + bit_flips[4 * path +0]]) * !is_even[path];\nmetrics_vec[2][n_cands * path +1] = metrics[path] +\nstd::abs(l[array][off_l + bit_flips[4 * path +0]]) * is_even[path] +\n@@ -844,17 +1024,17 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nif (L > 2)\n{\nmetrics_vec[2][n_cands * path +4] = metrics[path] +\n- std::abs(l[array][off_l + bit_flips[4 * path +0]]) * (!is_even[path]) +\n+ std::abs(l[array][off_l + bit_flips[4 * path +0]]) * !is_even[path] +\nstd::abs(l[array][off_l + bit_flips[4 * path +1]]) +\nstd::abs(l[array][off_l + bit_flips[4 * path +2]]);\nmetrics_vec[2][n_cands * path +5] = metrics[path] +\n- std::abs(l[array][off_l + bit_flips[4 * path +0]]) * (!is_even[path]) +\n+ std::abs(l[array][off_l + bit_flips[4 * path +0]]) * !is_even[path] +\nstd::abs(l[array][off_l + bit_flips[4 * path +1]]) +\nstd::abs(l[array][off_l + bit_flips[4 * path +3]]);\nmetrics_vec[2][n_cands * path +6] = metrics[path] +\n- std::abs(l[array][off_l + bit_flips[4 * path +0]]) * (!is_even[path]) +\n+ std::abs(l[array][off_l + bit_flips[4 * path +0]]) * !is_even[path] +\nstd::abs(l[array][off_l + bit_flips[4 * path +2]]) +\nstd::abs(l[array][off_l + bit_flips[4 * path +3]]);\n@@ -897,10 +1077,10 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst auto array = path_2_array[path][REV_D];\nAPI_polar::template h<N_ELMTS>(s[path], l[array], off_l, off_s, N_ELMTS);\n- metrics[path] = metrics_vec[2][n_cands * path];\nfor (auto dup = 2; dup <= dup_count[path]; dup++)\nflip_bits_spc(path, duplicate_tree(path, off_l, off_s, N_ELMTS), dup, off_s, N_ELMTS);\n+ metrics[path] = metrics_vec[2][n_cands * path];\nif (!is_even[path])\ns[path][off_s + bit_flips[4 * path +0]] = s[path][off_s + bit_flips[4 * path +0]] ? 0 : bit_init<B>();\n@@ -916,12 +1096,12 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n{\nconstexpr B b = bit_init<B>();\n- const auto n_cands = L <= 2 ? 4 : 8; // number of candidates\n-\n- metrics[new_path] = metrics_vec[2][n_cands * old_path + dup -1];\n-\nswitch(dup)\n{\n+ case 1 :\n+ if (!is_even[old_path])\n+ s[new_path][off_s + bit_flips[4 * old_path +0]] = s[old_path][off_s + bit_flips[4 * old_path +0]] ? 0 : b;\n+ break;\ncase 2 :\nif (is_even[old_path])\ns[new_path][off_s + bit_flips[4 * old_path +0]] = s[old_path][off_s + bit_flips[4 * old_path +0]] ? 0 : b;\n@@ -1002,6 +1182,21 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\npaths[n_active_paths] = old_path;\n}\n+template <typename B, typename R, class API_polar>\n+void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+::delete_path2(int path)\n+{\n+ const auto old_path = path;\n+ for (auto i = 0; i < m; i++)\n+ n_array_ref[path_2_array[old_path][i]][i]--;\n+\n+ auto path_id = 0;\n+ while (paths[path_id] != path) path_id++;\n+\n+ paths[path_id] = paths[--n_active_paths];\n+ paths[n_active_paths] = old_path;\n+}\n+\ntemplate <typename B, typename R, class API_polar>\nint Decoder_polar_SCL_fast_sys<B,R,API_polar>\n::select_best_path()\n" } ]
C++
MIT License
aff3ct/aff3ct
Working on little optims and priority queue to reduce the execution time.
8,490
25.01.2017 14:03:39
-3,600
e412a0b96058d3fba684d17096f2daed0601dec3
Litte optims.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "diff": "@@ -74,7 +74,6 @@ protected:\ninline void init_buffers ( );\ninline void delete_path (int path_id);\n- inline void delete_path2 (int path );\nvirtual inline int select_best_path( );\nprivate:\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -387,81 +387,6 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\n}\n-//template <typename B, typename R, class API_polar>\n-//void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n-//::update_paths_r1(const int r_d, const int off_l, const int off_s, const int n_elmts)\n-//{\n-// if (r_d == 0)\n-// update_paths_rep(r_d, off_l, off_s, n_elmts);\n-// else\n-// {\n-// // generate the candidates with the Chase-II algorithm\n-// for (auto i = 0; i < n_active_paths; i++)\n-// {\n-// const auto path = paths[i];\n-// const auto array = path_2_array[path][r_d];\n-//\n-// std::partial_sort(llr_indexes[r_d].begin(), llr_indexes[r_d].begin() + 2, llr_indexes[r_d].end(),\n-// [this, array, off_l](int x, int y) {\n-// return std::abs(l[array][off_l + x]) < std::abs(l[array][off_l + y]);\n-// });\n-//\n-// bit_flips[2 * path +0] = llr_indexes[r_d][0];\n-// bit_flips[2 * path +1] = llr_indexes[r_d][1];\n-//\n-// const auto abs0 = std::abs(l[array][off_l + bit_flips[2 * path +0]]);\n-// const auto abs1 = std::abs(l[array][off_l + bit_flips[2 * path +1]]);\n-//\n-// metrics_vec[1][4 * path +0] = metrics [ path ];\n-// metrics_vec[1][4 * path +1] = metrics [ path ] + abs0;\n-// metrics_vec[1][4 * path +2] = metrics [ path ] + abs1;\n-// metrics_vec[1][4 * path +3] = metrics_vec[1][4 * path +1] + abs1;\n-// }\n-// for (auto i = n_active_paths; i < L; i++)\n-// for (auto j = 0; j < 4; j++)\n-// metrics_vec[1][4 * paths[i] +j] = std::numeric_limits<float>::max();\n-//\n-// // L first of the lists are the L best paths\n-// std::partial_sort(metrics_idx[1].begin(), metrics_idx[1].begin() + L, metrics_idx[1].begin() + L * 4,\n-// [this](int x, int y) {\n-// return metrics_vec[1][x] < metrics_vec[1][y];\n-// });\n-//\n-// // count the number of duplications per path\n-// for (auto i = 0; i < L; i++)\n-// dup_count[metrics_idx[1][i] / 4]++;\n-//\n-// // erase bad paths\n-// auto k = 0;\n-// auto n_active_paths_cpy = n_active_paths;\n-// for (auto i = 0; i < n_active_paths_cpy; i++)\n-// if (dup_count[paths[k]] == 0)\n-// delete_path(k);\n-// else\n-// k++;\n-//\n-// // duplicate paths and flip the bits\n-// n_active_paths_cpy = n_active_paths;\n-// for (auto i = 0; i < n_active_paths_cpy; i++)\n-// {\n-// const auto path = paths[i];\n-// const auto array = path_2_array[path][r_d];\n-// if (dup_count[path])\n-// {\n-// API_polar::h(s[path], l[array], off_l, off_s, n_elmts);\n-// for (auto dup = 2; dup <= dup_count[path]; dup++)\n-// {\n-// const auto new_path = duplicate_tree(path, off_l, off_s, n_elmts);\n-// flip_bits_r1(path, new_path, dup, off_s, n_elmts);\n-// metrics[new_path] = metrics_vec[1][4 * path + dup -1];\n-// }\n-// dup_count[path] = 0;\n-// }\n-// }\n-// std::fill(dup_count.begin(), dup_count.begin() + L, 0);\n-// }\n-//}\n-\ntemplate <typename B, typename R, class API_polar>\nvoid Decoder_polar_SCL_fast_sys<B,R,API_polar>\n::update_paths_r1(const int r_d, const int off_l, const int off_s, const int n_elmts)\n@@ -470,13 +395,11 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nupdate_paths_rep(r_d, off_l, off_s, n_elmts);\nelse\n{\n- float loc_metrics[4];\n+ // generate the candidates with the Chase-II algorithm\nfor (auto i = 0; i < n_active_paths; i++)\n{\nconst auto path = paths[i];\n- const auto array = path_2_array[paths[i]][r_d];\n-\n- API_polar::h(s[path], l[array], off_l, off_s, n_elmts);\n+ const auto array = path_2_array[path][r_d];\nstd::partial_sort(llr_indexes[r_d].begin(), llr_indexes[r_d].begin() +2, llr_indexes[r_d].end(),\n[this, array, off_l](int x, int y) {\n@@ -486,36 +409,30 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nbit_flips[2 * path +0] = llr_indexes[r_d][0];\nbit_flips[2 * path +1] = llr_indexes[r_d][1];\n- loc_metrics[0] = metrics[path];\n- loc_metrics[1] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path ]]);\n- loc_metrics[2] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path +1]]);\n- loc_metrics[3] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path +1]])\n- + std::abs(l[array][off_l + bit_flips[2 * path ]]);\n+ const auto abs0 = std::abs(l[array][off_l + bit_flips[2 * path +0]]);\n+ const auto abs1 = std::abs(l[array][off_l + bit_flips[2 * path +1]]);\n- auto j = 0;\n- while ((int)metrics_queue.size() < L && j < 4)\n- {\n- metrics_queue.push(std::make_pair(loc_metrics[j], path));\n- dup_count[path]++;\n- j++;\n+ metrics_vec[1][4 * path +0] = metrics [ path ];\n+ metrics_vec[1][4 * path +1] = metrics [ path ] + abs0;\n+ metrics_vec[1][4 * path +2] = metrics [ path ] + abs1;\n+ metrics_vec[1][4 * path +3] = metrics_vec[1][4 * path +1] + abs1;\n}\n+ for (auto i = n_active_paths; i < L; i++)\n+ for (auto j = 0; j < 4; j++)\n+ metrics_vec[1][4 * paths[i] +j] = std::numeric_limits<float>::max();\n- if ((int)metrics_queue.size() == L)\n- {\n- auto m = metrics_queue.top();\n- while (j < 4 && loc_metrics[j] < m.first)\n- {\n- dup_count[m.second]--;\n- metrics_queue.pop();\n- metrics_queue.push(std::make_pair(loc_metrics[j], path));\n- dup_count[path]++;\n- m = metrics_queue.top();\n- j++;\n- }\n- }\n- }\n+ // L first of the lists are the L best paths\n+ const auto n_list = (n_active_paths * 4 >= L) ? L : n_active_paths * 4;\n+ std::partial_sort(metrics_idx[1].begin(), metrics_idx[1].begin() + n_list, metrics_idx[1].begin() + L * 4,\n+ [this](int x, int y) {\n+ return metrics_vec[1][x] < metrics_vec[1][y];\n+ });\n- // erase paths\n+ // count the number of duplications per path\n+ for (auto i = 0; i < n_list; i++)\n+ dup_count[metrics_idx[1][i] / 4]++;\n+\n+ // erase bad paths\nauto k = 0;\nauto n_active_paths_cpy = n_active_paths;\nfor (auto i = 0; i < n_active_paths_cpy; i++)\n@@ -525,24 +442,107 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nk++;\n// duplicate paths and flip the bits\n- while (!metrics_queue.empty())\n+ n_active_paths_cpy = n_active_paths;\n+ for (auto i = 0; i < n_active_paths_cpy; i++)\n{\n- const auto metric_val = metrics_queue.top().first;\n- const auto old_path = metrics_queue.top().second;\n-\n- assert(dup_count[old_path] != 0);\n-\n- const auto cur_path = (dup_count[old_path] == 1) ? old_path : duplicate_tree(old_path, off_l, off_s, n_elmts);\n-\n- metrics[cur_path] = metric_val;\n- if (dup_count[old_path] != 1)\n- flip_bits_r1(old_path, cur_path, dup_count[old_path], off_s, n_elmts);\n-\n- dup_count[old_path]--;\n- metrics_queue.pop();\n+ const auto path = paths[i];\n+ const auto array = path_2_array[path][r_d];\n+ if (dup_count[path])\n+ {\n+ API_polar::h(s[path], l[array], off_l, off_s, n_elmts);\n+ for (auto dup = 2; dup <= dup_count[path]; dup++)\n+ {\n+ const auto new_path = duplicate_tree(path, off_l, off_s, n_elmts);\n+ flip_bits_r1(path, new_path, dup, off_s, n_elmts);\n+ metrics[new_path] = metrics_vec[1][4 * path + dup -1];\n}\n+ dup_count[path] = 0;\n}\n}\n+ }\n+}\n+\n+//template <typename B, typename R, class API_polar>\n+//void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+//::update_paths_r1(const int r_d, const int off_l, const int off_s, const int n_elmts)\n+//{\n+// if (r_d == 0)\n+// update_paths_rep(r_d, off_l, off_s, n_elmts);\n+// else\n+// {\n+// float loc_metrics[4];\n+// for (auto i = 0; i < n_active_paths; i++)\n+// {\n+// const auto path = paths[i];\n+// const auto array = path_2_array[paths[i]][r_d];\n+//\n+// API_polar::h(s[path], l[array], off_l, off_s, n_elmts);\n+//\n+// std::partial_sort(llr_indexes[r_d].begin(), llr_indexes[r_d].begin() +2, llr_indexes[r_d].end(),\n+// [this, array, off_l](int x, int y){\n+// return std::abs(l[array][off_l + x]) < std::abs(l[array][off_l + y]);\n+// });\n+//\n+// bit_flips[2 * path +0] = llr_indexes[r_d][0];\n+// bit_flips[2 * path +1] = llr_indexes[r_d][1];\n+//\n+// loc_metrics[0] = metrics[path];\n+// loc_metrics[1] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path ]]);\n+// loc_metrics[2] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path +1]]);\n+// loc_metrics[3] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path +1]])\n+// + std::abs(l[array][off_l + bit_flips[2 * path ]]);\n+//\n+// auto j = 0;\n+// while ((int)metrics_queue.size() < L && j < 4)\n+// {\n+// metrics_queue.push(std::make_pair(loc_metrics[j], path));\n+// dup_count[path]++;\n+// j++;\n+// }\n+//\n+// if ((int)metrics_queue.size() == L)\n+// {\n+// auto m = metrics_queue.top();\n+// while (j < 4 && loc_metrics[j] < m.first)\n+// {\n+// dup_count[m.second]--;\n+// metrics_queue.pop();\n+// metrics_queue.push(std::make_pair(loc_metrics[j], path));\n+// dup_count[path]++;\n+// m = metrics_queue.top();\n+// j++;\n+// }\n+// }\n+// }\n+//\n+// // erase paths\n+// auto k = 0;\n+// auto n_active_paths_cpy = n_active_paths;\n+// for (auto i = 0; i < n_active_paths_cpy; i++)\n+// if (dup_count[paths[k]] == 0)\n+// delete_path(k);\n+// else\n+// k++;\n+//\n+// // duplicate paths and flip the bits\n+// while (!metrics_queue.empty())\n+// {\n+// const auto metric_val = metrics_queue.top().first;\n+// const auto old_path = metrics_queue.top().second;\n+//\n+// assert(dup_count[old_path] != 0);\n+//\n+// const auto cur_path = (dup_count[old_path] == 1) ? old_path : duplicate_tree(old_path, off_l, off_s, n_elmts);\n+//\n+// metrics[cur_path] = metric_val;\n+// if (dup_count[old_path] != 1)\n+// flip_bits_r1(old_path, cur_path, dup_count[old_path], off_s, n_elmts);\n+//\n+// dup_count[old_path]--;\n+// metrics_queue.pop();\n+// }\n+// }\n+//}\ntemplate <typename B, typename R, class API_polar>\ntemplate <int REV_D, int N_ELMTS>\n@@ -812,18 +812,118 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\n}\n+template <typename B, typename R, class API_polar>\n+void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+::update_paths_spc(const int r_d, const int off_l, const int off_s, const int n_elmts)\n+{\n+ const auto n_cands = L <= 2 ? 4 : 8; // number of candidates\n+\n+ // generate the candidates with the Chase-II algorithm\n+ for (auto i = 0; i < n_active_paths; i++)\n+ {\n+ const auto path = paths[i];\n+ const auto array = path_2_array[paths[i]][r_d];\n+\n+ std::partial_sort(llr_indexes[r_d].begin(), llr_indexes[r_d].begin() +4, llr_indexes[r_d].end(),\n+ [this, array, off_l](int x, int y){\n+ return std::abs(l[array][off_l + x]) < std::abs(l[array][off_l + y]);\n+ });\n+\n+ for (auto j = 0; j < 4; j++)\n+ bit_flips[4 * path +j] = llr_indexes[r_d][j];\n+\n+ auto prod = 1.f;\n+ for (auto j = 0; j < n_elmts; j++)\n+ prod *= l[array][off_l +j];\n+ is_even[path] = prod > 0;\n+\n+ const auto abs0 = std::abs(l[array][off_l + bit_flips[4 * path +0]]);\n+ const auto abs1 = std::abs(l[array][off_l + bit_flips[4 * path +1]]);\n+ const auto abs2 = std::abs(l[array][off_l + bit_flips[4 * path +2]]);\n+ const auto abs3 = std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n+\n+ metrics_vec[2][n_cands * path +0] = metrics[path] + (!is_even[path] ? abs0 : 0);\n+ metrics_vec[2][n_cands * path +1] = metrics[path] + ( is_even[path] ? abs0 : 0) + abs1;\n+ metrics_vec[2][n_cands * path +2] = metrics[path] + ( is_even[path] ? abs0 : 0) + abs2;\n+ metrics_vec[2][n_cands * path +3] = metrics[path] + ( is_even[path] ? abs0 : 0) + abs3;\n+\n+ if (L > 2)\n+ {\n+ metrics_vec[2][n_cands * path +4] = metrics_vec[2][n_cands * path +0] + abs1 + abs2;\n+ metrics_vec[2][n_cands * path +5] = metrics_vec[2][n_cands * path +0] + abs1 + abs3;\n+ metrics_vec[2][n_cands * path +6] = metrics_vec[2][n_cands * path +0] + abs2 + abs3;\n+ metrics_vec[2][n_cands * path +7] = metrics_vec[2][n_cands * path +1] + abs2 + abs3;\n+ }\n+ }\n+ for (auto i = n_active_paths; i < L; i++)\n+ for (auto j = 0; j < n_cands; j++)\n+ metrics_vec[2][n_cands * paths[i] +j] = std::numeric_limits<float>::max();\n+\n+ // L first of the lists are the L best paths\n+ const auto n_list = (n_active_paths * n_cands >= L) ? L : n_active_paths * n_cands;\n+ std::partial_sort(metrics_idx[2].begin(), metrics_idx[2].begin() + n_list, metrics_idx[2].begin() + n_cands * L,\n+ [this](int x, int y){\n+ return metrics_vec[2][x] < metrics_vec[2][y];\n+ });\n+\n+ // count the number of duplications per path\n+ for (auto i = 0; i < n_list; i++)\n+ dup_count[metrics_idx[2][i] / n_cands]++;\n+\n+ // erase bad paths\n+ auto k = 0;\n+ auto n_active_paths_cpy = n_active_paths;\n+ for (auto i = 0; i < n_active_paths_cpy; i++)\n+ if (dup_count[paths[k]] == 0)\n+ delete_path(k);\n+ else\n+ k++;\n+\n+ // duplicate paths and flip the bits\n+ n_active_paths_cpy = n_active_paths;\n+ for (auto i = 0; i < n_active_paths_cpy; i++)\n+ {\n+ const auto path = paths[i];\n+ if (dup_count[path])\n+ {\n+ const auto array = path_2_array[path][r_d];\n+ API_polar::h(s[path], l[array], off_l, off_s, n_elmts);\n+\n+ for (auto dup = 2; dup <= dup_count[path]; dup++)\n+ {\n+ const auto new_path = duplicate_tree(path, off_l, off_s, n_elmts);\n+ flip_bits_spc(path, new_path, dup, off_s, n_elmts);\n+ metrics[new_path] = metrics_vec[2][n_cands * path + dup -1];\n+ }\n+\n+ metrics[path] = metrics_vec[2][n_cands * path];\n+ if (!is_even[path])\n+ s[path][off_s + bit_flips[4 * path +0]] = s[path][off_s + bit_flips[4 * path +0]] ? 0 : bit_init<B>();\n+\n+ dup_count[path] = 0;\n+ }\n+ }\n+// std::fill(dup_count.begin(), dup_count.begin() + L, 0);\n+}\n+\n//template <typename B, typename R, class API_polar>\n//void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n//::update_paths_spc(const int r_d, const int off_l, const int off_s, const int n_elmts)\n//{\n// const auto n_cands = L <= 2 ? 4 : 8; // number of candidates\n//\n-// // generate the candidates with the Chase-II algorithm\n+// float loc_metrics[8];\n// for (auto i = 0; i < n_active_paths; i++)\n// {\n// const auto path = paths[i];\n// const auto array = path_2_array[paths[i]][r_d];\n//\n+// API_polar::h(s[path], l[array], off_l, off_s, n_elmts);\n+// auto sum = s[path][off_s +0];\n+// for (auto j = 1; j < n_elmts; j++)\n+// sum ^= s[path][off_s +j];\n+// is_even[path] = (sum == 0);\n+//\n// std::partial_sort(llr_indexes[r_d].begin(), llr_indexes[r_d].begin() +4, llr_indexes[r_d].end(),\n// [this, array, off_l](int x, int y){\n// return std::abs(l[array][off_l + x]) < std::abs(l[array][off_l + y]);\n@@ -832,44 +932,51 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n// for (auto j = 0; j < 4; j++)\n// bit_flips[4 * path +j] = llr_indexes[r_d][j];\n//\n-// auto prod = 1.f;\n-// for (auto j = 0; j < n_elmts; j++)\n-// prod *= l[array][off_l +j];\n-// is_even[path] = prod > 0;\n-//\n// const auto abs0 = std::abs(l[array][off_l + bit_flips[4 * path +0]]);\n// const auto abs1 = std::abs(l[array][off_l + bit_flips[4 * path +1]]);\n// const auto abs2 = std::abs(l[array][off_l + bit_flips[4 * path +2]]);\n// const auto abs3 = std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n//\n-// metrics_vec[2][n_cands * path +0] = metrics[path] + (!is_even[path] ? abs0 : 0);\n-// metrics_vec[2][n_cands * path +1] = metrics[path] + ( is_even[path] ? abs0 : 0) + abs1;\n-// metrics_vec[2][n_cands * path +2] = metrics[path] + ( is_even[path] ? abs0 : 0) + abs2;\n-// metrics_vec[2][n_cands * path +3] = metrics[path] + ( is_even[path] ? abs0 : 0) + abs3;\n+// loc_metrics[0] = metrics[path] + (!is_even[path] ? abs0 : 0);\n+// loc_metrics[1] = metrics[path] + ( is_even[path] ? abs0 : 0) + abs1;\n+// loc_metrics[2] = metrics[path] + ( is_even[path] ? abs0 : 0) + abs2;\n+// loc_metrics[3] = metrics[path] + ( is_even[path] ? abs0 : 0) + abs3;\n//\n// if (L > 2)\n// {\n-// metrics_vec[2][n_cands * path +4] = metrics_vec[2][n_cands * path +0] + abs1 + abs2;\n-// metrics_vec[2][n_cands * path +5] = metrics_vec[2][n_cands * path +0] + abs1 + abs3;\n-// metrics_vec[2][n_cands * path +6] = metrics_vec[2][n_cands * path +0] + abs2 + abs3;\n-// metrics_vec[2][n_cands * path +7] = metrics_vec[2][n_cands * path +1] + abs2 + abs3;\n+// loc_metrics[4] = loc_metrics[0] + abs1 + abs2;\n+// loc_metrics[5] = loc_metrics[0] + abs1 + abs3;\n+// loc_metrics[6] = loc_metrics[0] + abs2 + abs3;\n+// loc_metrics[7] = loc_metrics[1] + abs2 + abs3;\n// }\n-// }\n-// for (auto i = n_active_paths; i < L; i++)\n-// for (auto j = 0; j < n_cands; j++)\n-// metrics_vec[2][n_cands * paths[i] +j] = std::numeric_limits<float>::max();\n//\n-// // L first of the lists are the L best paths\n-// std::partial_sort(metrics_idx[2].begin(), metrics_idx[2].begin() + L, metrics_idx[2].begin() + n_cands * L,\n-// [this](int x, int y){\n-// return metrics_vec[2][x] < metrics_vec[2][y];\n-// });\n+// auto j = 0;\n+// auto q_size = (int)metrics_queue.size();\n//\n-// // count the number of duplications per path\n-// for (auto i = 0; i < L; i++)\n-// dup_count[metrics_idx[2][i] / n_cands]++;\n+// while (q_size < L && j < n_cands)\n+// {\n+// metrics_queue.push(std::make_pair(loc_metrics[j], path));\n+// dup_count[path]++;\n+// q_size++;\n+// j++;\n+// }\n//\n-// // erase bad paths\n+// if (q_size == L)\n+// {\n+// auto m = metrics_queue.top();\n+// while (j < n_cands && loc_metrics[j] < m.first)\n+// {\n+// dup_count[m.second]--;\n+// metrics_queue.pop();\n+// metrics_queue.push(std::make_pair(loc_metrics[j], path));\n+// dup_count[path]++;\n+// m = metrics_queue.top();\n+// j++;\n+// }\n+// }\n+// }\n+//\n+// // erase paths\n// auto k = 0;\n// auto n_active_paths_cpy = n_active_paths;\n// for (auto i = 0; i < n_active_paths_cpy; i++)\n@@ -879,135 +986,20 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n// k++;\n//\n// // duplicate paths and flip the bits\n-// n_active_paths_cpy = n_active_paths;\n-// for (auto i = 0; i < n_active_paths_cpy; i++)\n-// {\n-// const auto path = paths[i];\n-// if (dup_count[path])\n+// while (!metrics_queue.empty())\n// {\n-// const auto array = path_2_array[path][r_d];\n-// API_polar::h(s[path], l[array], off_l, off_s, n_elmts);\n+// const auto metric_val = metrics_queue.top().first;\n+// const auto old_path = metrics_queue.top().second;\n//\n-// for (auto dup = 2; dup <= dup_count[path]; dup++)\n-// {\n-// const auto new_path = duplicate_tree(path, off_l, off_s, n_elmts);\n-// flip_bits_spc(path, new_path, dup, off_s, n_elmts);\n-// metrics[new_path] = metrics_vec[2][n_cands * path + dup -1];\n-// }\n+// const auto cur_path = (dup_count[old_path] == 1) ? old_path : duplicate_tree(old_path, off_l, off_s, n_elmts);\n//\n-// metrics[path] = metrics_vec[2][n_cands * path];\n-// if (!is_even[path])\n-// s[path][off_s + bit_flips[4 * path +0]] = s[path][off_s + bit_flips[4 * path +0]] ? 0 : bit_init<B>();\n+// metrics[cur_path] = metric_val;\n+// flip_bits_spc(old_path, cur_path, dup_count[old_path], off_s, n_elmts);\n//\n-// dup_count[path] = 0;\n+// dup_count[old_path]--;\n+// metrics_queue.pop();\n// }\n//}\n-// std::fill(dup_count.begin(), dup_count.begin() + L, 0);\n-//}\n-\n-template <typename B, typename R, class API_polar>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n-::update_paths_spc(const int r_d, const int off_l, const int off_s, const int n_elmts)\n-{\n- const auto n_cands = L <= 2 ? 4 : 8; // number of candidates\n-\n- float loc_metrics[8];\n- for (auto i = 0; i < n_active_paths; i++)\n- {\n- const auto path = paths[i];\n- const auto array = path_2_array[paths[i]][r_d];\n-\n- API_polar::h(s[path], l[array], off_l, off_s, n_elmts);\n- auto sum = s[path][off_s +0];\n- for (auto j = 1; j < n_elmts; j++)\n- sum ^= s[path][off_s +j];\n- is_even[path] = (sum == 0);\n-\n- std::partial_sort(llr_indexes[r_d].begin(), llr_indexes[r_d].begin() +4, llr_indexes[r_d].end(),\n- [this, array, off_l](int x, int y){\n- return std::abs(l[array][off_l + x]) < std::abs(l[array][off_l + y]);\n- });\n-\n- for (auto j = 0; j < 4; j++)\n- bit_flips[4 * path +j] = llr_indexes[r_d][j];\n-\n- {\n- loc_metrics[0] = metrics[path] + std::abs(l[array][off_l + bit_flips[4 * path +0]]) * !is_even[path];\n-\n- loc_metrics[1] = metrics[path] + std::abs(l[array][off_l + bit_flips[4 * path +0]]) * is_even[path] +\n- std::abs(l[array][off_l + bit_flips[4 * path +1]]);\n-\n- loc_metrics[2] = metrics[path] + std::abs(l[array][off_l + bit_flips[4 * path +0]]) * is_even[path] +\n- std::abs(l[array][off_l + bit_flips[4 * path +2]]);\n-\n- loc_metrics[3] = metrics[path] + std::abs(l[array][off_l + bit_flips[4 * path +0]]) * is_even[path] +\n- std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n- }\n- if (L > 2)\n- {\n- loc_metrics[4] = loc_metrics[0] + std::abs(l[array][off_l + bit_flips[4 * path +1]]) +\n- std::abs(l[array][off_l + bit_flips[4 * path +2]]);\n-\n- loc_metrics[5] = loc_metrics[0] + std::abs(l[array][off_l + bit_flips[4 * path +1]]) +\n- std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n-\n- loc_metrics[6] = loc_metrics[0] + std::abs(l[array][off_l + bit_flips[4 * path +2]]) +\n- std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n-\n- loc_metrics[7] = loc_metrics[1] + std::abs(l[array][off_l + bit_flips[4 * path +2]]) +\n- std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n- }\n-\n- auto j = 0;\n- auto q_size = (int)metrics_queue.size();\n-\n- while (q_size < L && j < n_cands)\n- {\n- metrics_queue.push(std::make_pair(loc_metrics[j], path));\n- dup_count[path]++;\n- q_size++;\n- j++;\n- }\n-\n- if (q_size == L)\n- {\n- auto m = metrics_queue.top();\n- while (j < n_cands && loc_metrics[j] < m.first)\n- {\n- dup_count[m.second]--;\n- metrics_queue.pop();\n- metrics_queue.push(std::make_pair(loc_metrics[j], path));\n- dup_count[path]++;\n- m = metrics_queue.top();\n- j++;\n- }\n- }\n- }\n-\n- // erase paths\n- auto k = 0;\n- auto n_active_paths_cpy = n_active_paths;\n- for (auto i = 0; i < n_active_paths_cpy; i++)\n- if (dup_count[paths[k]] == 0)\n- delete_path(k);\n- else\n- k++;\n-\n- // duplicate paths and flip the bits\n- while (!metrics_queue.empty())\n- {\n- const auto metric_val = metrics_queue.top().first;\n- const auto old_path = metrics_queue.top().second;\n-\n- const auto cur_path = (dup_count[old_path] == 1) ? old_path : duplicate_tree(old_path, off_l, off_s, n_elmts);\n-\n- metrics[cur_path] = metric_val;\n- flip_bits_spc(old_path, cur_path, dup_count[old_path], off_s, n_elmts);\n-\n- dup_count[old_path]--;\n- metrics_queue.pop();\n- }\n-}\ntemplate <typename B, typename R, class API_polar>\ntemplate <int REV_D, int N_ELMTS>\n@@ -1195,21 +1187,6 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\npaths[n_active_paths] = old_path;\n}\n-template <typename B, typename R, class API_polar>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n-::delete_path2(int path)\n-{\n- const auto old_path = path;\n- for (auto i = 0; i < m; i++)\n- n_array_ref[path_2_array[old_path][i]][i]--;\n-\n- auto path_id = 0;\n- while (paths[path_id] != path) path_id++;\n-\n- paths[path_id] = paths[--n_active_paths];\n- paths[n_active_paths] = old_path;\n-}\n-\ntemplate <typename B, typename R, class API_polar>\nint Decoder_polar_SCL_fast_sys<B,R,API_polar>\n::select_best_path()\n" } ]
C++
MIT License
aff3ct/aff3ct
Litte optims.
8,490
25.01.2017 15:17:48
-3,600
5f35374e71894a55ca619cc08f19d191ef7f265a
Improve the seeds management.
[ { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Code/RA/Simulation_BFER_RA.cpp", "new_path": "src/Simulation/BFER/Code/RA/Simulation_BFER_RA.cpp", "diff": "@@ -21,7 +21,7 @@ Simulation_BFER_RA<B,R,Q>\nassert(params.code.N % params.code.K == 0);\n// build the interleaver for the encoder and the decoder\n- interleaver = Factory_interleaver<int>::build(this->params, this->params.code.N, this->params.simulation.seed);\n+ interleaver = Factory_interleaver<int>::build(this->params, this->params.code.N, this->rd_engine_seed[0]());\n}\ntemplate <typename B, typename R, typename Q>\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Code/Turbo/Simulation_BFER_turbo.cpp", "new_path": "src/Simulation/BFER/Code/Turbo/Simulation_BFER_turbo.cpp", "diff": "@@ -31,7 +31,7 @@ Simulation_BFER_turbo<B,R,Q,QD>\nfor (auto tid = 0; tid < this->params.simulation.n_threads; tid++)\n{\n- auto seed = this->params.simulation.seed;\n+ auto seed = this->rd_engine_seed[0]();\nseed += (params.interleaver.type == \"UNIFORM\") ? tid : 0;\n// build the interleaver for the encoder and the decoder\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Simulation_BFER.cpp", "new_path": "src/Simulation/BFER/Simulation_BFER.cpp", "diff": "@@ -34,6 +34,8 @@ Simulation_BFER_i<B,R,Q>\ncode_rate(0.f),\nsigma (0.f),\n+ rd_engine_seed(params.simulation.n_threads),\n+\nsource (params.simulation.n_threads, nullptr),\ncrc (params.simulation.n_threads, nullptr),\nencoder (params.simulation.n_threads, nullptr),\n@@ -47,6 +49,9 @@ Simulation_BFER_i<B,R,Q>\nmonitor (params.simulation.n_threads, nullptr)\n{\nassert(params.simulation.n_threads >= 1);\n+\n+ for (auto tid = 0; tid < params.simulation.n_threads; tid++)\n+ rd_engine_seed[tid].seed(params.simulation.seed + tid);\n}\ntemplate <typename B, typename R, typename Q>\n@@ -168,7 +173,7 @@ template <typename B, typename R, typename Q>\nSource<B>* Simulation_BFER_i<B,R,Q>\n::build_source(const int tid)\n{\n- return Factory_source<B>::build(params, params.simulation.seed + tid);\n+ return Factory_source<B>::build(params, rd_engine_seed[tid]());\n}\ntemplate <typename B, typename R, typename Q>\n@@ -182,7 +187,7 @@ template <typename B, typename R, typename Q>\nEncoder<B>* Simulation_BFER_i<B,R,Q>\n::build_encoder(const int tid)\n{\n- return Factory_encoder_common<B>::build(params, params.simulation.seed + tid);\n+ return Factory_encoder_common<B>::build(params, rd_engine_seed[tid]());\n}\ntemplate <typename B, typename R, typename Q>\n@@ -203,7 +208,7 @@ template <typename B, typename R, typename Q>\nChannel<R>* Simulation_BFER_i<B,R,Q>\n::build_channel(const int size, const int tid)\n{\n- return Factory_channel<R>::build(params, sigma, size, params.simulation.seed + tid);\n+ return Factory_channel<R>::build(params, sigma, size, rd_engine_seed[tid]());\n}\ntemplate <typename B, typename R, typename Q>\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Simulation_BFER.hpp", "new_path": "src/Simulation/BFER/Simulation_BFER.hpp", "diff": "#include <chrono>\n#include <vector>\n+#include <random>\n#include \"Tools/params.h\"\n#include \"Tools/Threads/Barrier.hpp\"\n@@ -38,6 +39,9 @@ protected:\n// time points and durations\nstd::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> t_snr;\n+ // a vector of random generator to generate the seeds\n+ std::vector<std::mt19937> rd_engine_seed;\n+\n// communication chain\nstd::vector<Source <B >*> source;\nstd::vector<CRC <B >*> crc;\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFERI/Simulation_BFERI.cpp", "new_path": "src/Simulation/BFERI/Simulation_BFERI.cpp", "diff": "@@ -34,6 +34,8 @@ Simulation_BFERI_i<B,R,Q>\ncode_rate(0.f),\nsigma (0.f),\n+ rd_engine_seed(params.simulation.n_threads),\n+\nsource (params.simulation.n_threads, nullptr),\ncrc (params.simulation.n_threads, nullptr),\nencoder (params.simulation.n_threads, nullptr),\n@@ -48,6 +50,9 @@ Simulation_BFERI_i<B,R,Q>\nmonitor (params.simulation.n_threads, nullptr)\n{\nassert(params.simulation.n_threads >= 1);\n+\n+ for (auto tid = 0; tid < params.simulation.n_threads; tid++)\n+ rd_engine_seed[tid].seed(params.simulation.seed + tid);\n}\ntemplate <typename B, typename R, typename Q>\n@@ -180,7 +185,7 @@ template <typename B, typename R, typename Q>\nSource<B>* Simulation_BFERI_i<B,R,Q>\n::build_source(const int tid)\n{\n- return Factory_source<B>::build(params, params.simulation.seed + tid);\n+ return Factory_source<B>::build(params, rd_engine_seed[tid]());\n}\ntemplate <typename B, typename R, typename Q>\n@@ -194,14 +199,14 @@ template <typename B, typename R, typename Q>\nEncoder<B>* Simulation_BFERI_i<B,R,Q>\n::build_encoder(const int tid)\n{\n- return Factory_encoder_common<B>::build(params, params.simulation.seed + tid);\n+ return Factory_encoder_common<B>::build(params, rd_engine_seed[tid]());\n}\ntemplate <typename B, typename R, typename Q>\nInterleaver<int>* Simulation_BFERI_i<B,R,Q>\n::build_interleaver(const int tid)\n{\n- return Factory_interleaver<int>::build(params, params.code.N + params.code.tail_length, params.simulation.seed);\n+ return Factory_interleaver<int>::build(params, params.code.N + params.code.tail_length, rd_engine_seed[tid]());\n}\ntemplate <typename B, typename R, typename Q>\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFERI/Simulation_BFERI.hpp", "new_path": "src/Simulation/BFERI/Simulation_BFERI.hpp", "diff": "#include <chrono>\n#include <vector>\n+#include <random>\n#include \"Tools/params.h\"\n#include \"Tools/Threads/Barrier.hpp\"\n@@ -39,6 +40,9 @@ protected:\n// time points and durations\nstd::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> t_snr;\n+ // a vector of random generator to generate the seeds\n+ std::vector<std::mt19937> rd_engine_seed;\n+\n// communication chain\nstd::vector<Source <B >*> source;\nstd::vector<CRC <B >*> crc;\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve the seeds management.
8,490
25.01.2017 16:36:33
-3,600
2263f3f636dfc7e3abdb19c3a0b04f860109062d
Little optim on the rate 0 nodes when the rate 0 left nodes are enabled.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -361,11 +361,17 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nfor (auto j = 0; j < n_elmts; j++)\nmetric -= std::min((float)l[array][off_l +j], 0.f);\nmetrics[path] += metric; // add a penalty to the current path metric\n+ }\n- // TODO: Remove this fill when rate_0 left nodes are in the patterns\n+ if (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT))\n+ {\n+ for (auto i = 0; i < n_active_paths; i++)\n+ {\n+ const auto path = paths[i];\nstd::fill(s[path].begin() + off_s, s[path].begin() + off_s + n_elmts, 0);\n}\n}\n+}\ntemplate <typename B, typename R, class API_polar>\ntemplate <int REV_D, int N_ELMTS>\n@@ -381,11 +387,17 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nfor (auto j = 0; j < N_ELMTS; j++)\nmetric -= std::min((float)l[array][off_l +j], 0.f);\nmetrics[path] += metric; // add a penalty to the current path metric\n+ }\n- // TODO: Remove this fill when rate_0 left nodes are in the patterns\n+ if (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT))\n+ {\n+ for (auto i = 0; i < n_active_paths; i++)\n+ {\n+ const auto path = paths[i];\nstd::fill(s[path].begin() + off_s, s[path].begin() + off_s + N_ELMTS, 0);\n}\n}\n+}\ntemplate <typename B, typename R, class API_polar>\nvoid Decoder_polar_SCL_fast_sys<B,R,API_polar>\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Pattern_polar_parser.hpp", "new_path": "src/Tools/Code/Polar/Pattern_polar_parser.hpp", "diff": "@@ -97,6 +97,18 @@ public:\n*/\ninline polar_node_t get_node_type(const int node_id) const;\n+ /*!\n+ * \\brief Check if a node type exists in the the tree.\n+ *\n+ * \\param node_type: the type of the requested node\n+ *\n+ * \\return true if the node type exists, false otherwise.\n+ */\n+ inline bool exist_node_type(const polar_node_t node_type) const;\n+\n+ /*!\n+ * \\brief Release the polar patterns given in the constructor.\n+ */\nvoid release_patterns() const;\nprivate:\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Pattern_polar_parser.hxx", "new_path": "src/Tools/Code/Polar/Pattern_polar_parser.hxx", "diff": "@@ -149,6 +149,16 @@ polar_node_t Pattern_polar_parser<B>\nreturn (polar_node_t)pattern_types[node_id];\n}\n+template <typename B>\n+bool Pattern_polar_parser<B>\n+::exist_node_type(const polar_node_t node_type) const\n+{\n+ for (auto i = 0; i < (int)patterns.size(); i++)\n+ if (patterns[i]->type() == node_type)\n+ return true;\n+ return false;\n+}\n+\ntemplate <typename B>\nvoid Pattern_polar_parser<B>\n::release_patterns() const\n" } ]
C++
MIT License
aff3ct/aff3ct
Little optim on the rate 0 nodes when the rate 0 left nodes are enabled.
8,490
26.01.2017 11:56:41
-3,600
238e11ac0aa9d432a5e3527c923da9a6ebc1fd6a
Speedup the list selection when using a CRC.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hxx", "diff": "@@ -46,23 +46,15 @@ template <typename B, typename R, class API_polar>\nint Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>\n::select_best_path()\n{\n- auto n_valid_paths = 0;\n- auto n_active_paths_cpy = this->n_active_paths;\n- for (auto i = 0; i < n_active_paths_cpy; i++)\n- {\n- const auto path = this->paths[n_valid_paths];\n-\n- // check the CRC\n- auto decode_result = crc_check(this->s[path]);\n+ std::sort(this->paths.begin(), this->paths.begin() + this->n_active_paths,\n+ [this](int x, int y){\n+ return this->metrics[x] < this->metrics[y];\n+ });\n- // delete the path if the CRC result is negative\n- if (!decode_result)\n- this->delete_path(n_valid_paths);\n- else\n- n_valid_paths++;\n- }\n+ auto i = 0;\n+ while (i < this->n_active_paths && !crc_check(this->s[this->paths[i]])) i++;\n- this->Decoder_polar_SCL_fast_sys<B,R,API_polar>::select_best_path();\n+ this->best_path = (i == this->n_active_paths) ? this->paths[0] : this->paths[i];\n- return n_valid_paths;\n+ return this->n_active_paths -i;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Speedup the list selection when using a CRC.
8,490
26.01.2017 18:38:03
-3,600
e2ec38a405b9ebf6cff802aaab938cd9b3a18954
Fix an error in the completion script.
[ { "change_type": "MODIFY", "old_path": "aff3ct_completion.sh", "new_path": "aff3ct_completion.sh", "diff": "@@ -49,7 +49,7 @@ _aff3ct() {\n--src-path --enc-type --enc-path --mod-type --mod-bps --mod-ups \\\n--mod-cpm-ws --mod-cpm-map --mod-cpm-L --mod-cpm-p --mod-cpm-k \\\n--mod-cpm-std --mod-const-path --dmod-max --dmod-no-sig2 \\\n- --chn-type --chn-path --chn-blk-fad --qnt-type --qnt-int \\\n+ --chn-type --chn-path --chn-blk-fad --qnt-type --qnt-dec \\\n--qnt-bits --qnt-range --dec-type --dec-implem --term-no \\\n--term-freq --sim-seed --sim-mpi-comm --sim-pyber\"\nfi\n@@ -203,7 +203,7 @@ _aff3ct() {\n--sim-threads | -t | --sim-inter-lvl | --cde-info-bits | -K | \\\n--cde-size | -N | \\\n--mod-bps | --mod-ups | --mod-cpm-L | --mod-cpm-p | --mod-cpm-k | \\\n- --qnt-int | --qnt-bits | --qnt-range | --qnt-type | \\\n+ --qnt-dec | --qnt-bits | --qnt-range | --qnt-type | \\\n--sim-benchs | -b | --sim-debug-limit | \\\n--mnt-max-fe | -e | --term-type | \\\n--sim-siga-min | -a | --sim-siga-max | -A | --sim-siga-step | \\\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix an error in the completion script.
8,490
26.01.2017 18:41:09
-3,600
965998ce2707e8448e49b756ae0ebcc928df59c7
Put the metric in fixed point (add a normalization).
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "diff": "@@ -17,12 +17,11 @@ protected:\nconst Pattern_polar_parser<B> polar_patterns;\nstd ::vector<int > paths; // active paths\n- std ::vector<int > last_paths; // active paths cpy\n- std ::vector<float> metrics; // path metrics\n+ std ::vector<R > metrics; // path metrics\nmipp::vector<R > Y_N; // channel llrs\nstd::vector<mipp::vector<R >> l; // llrs\nstd::vector<mipp::vector<B >> s; // partial sums\n- std::vector<std ::vector<float>> metrics_vec; // list of candidate metrics to be sorted\n+ std::vector<std ::vector<R >> metrics_vec; // list of candidate metrics to be sorted\nstd::vector<std ::vector<int >> metrics_idx; // indexes tables used to sort the metrics\nstd ::vector<int > dup_count; // number of duplications of a path, at updating time\nstd::vector<std ::vector<int >> llr_indexes; // indexes used to sort a list of llrs (to be flipped)\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "#include \"Decoder_polar_SCL_fast_sys.hpp\"\n+template <typename R>\n+inline void normalize_scl_metrics(std::vector<R> &metrics, const int L)\n+{\n+}\n+\n+template <>\n+inline void normalize_scl_metrics(std::vector<short> &metrics, const int L)\n+{\n+ auto min = *std::min_element(metrics.begin(), metrics.begin() + L);\n+ if (min > 0) min = 0;\n+\n+ const auto norm = std::numeric_limits<short>::min() - min;\n+\n+ for (auto i = 0; i < L; i++)\n+ metrics[i] += norm;\n+}\n+\n+template <>\n+inline void normalize_scl_metrics(std::vector<signed char> &metrics, const int L)\n+{\n+ auto min = *std::min_element(metrics.begin(), metrics.begin() + L);\n+ if (min > 0) min = 0;\n+\n+ const auto norm = std::numeric_limits<signed char>::min() - min;\n+\n+ for (auto i = 0; i < L; i++)\n+ metrics[i] += norm;\n+}\n+\ntemplate <typename B, typename R, class API_polar>\nDecoder_polar_SCL_fast_sys<B,R,API_polar>\n::Decoder_polar_SCL_fast_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits,\n@@ -43,12 +72,11 @@ Decoder_polar_SCL_fast_sys<B,R,API_polar>\n1,\n2),\npaths (L),\n- last_paths (L),\nmetrics (L),\nY_N ( N + mipp::nElReg<R>() ),\nl (L, mipp::vector<R>(N + mipp::nElReg<R>())),\ns (L, mipp::vector<B>(N + mipp::nElReg<B>())),\n- metrics_vec (3, std::vector<float>()),\n+ metrics_vec (3, std::vector<R >()),\nmetrics_idx (3, std::vector<int>()),\ndup_count (L, 0),\nllr_indexes (),\n@@ -92,7 +120,7 @@ template <typename B, typename R, class API_polar>\nvoid Decoder_polar_SCL_fast_sys<B,R,API_polar>\n::init_buffers()\n{\n- metrics[0] = std::numeric_limits<float>::min();\n+ metrics[0] = std::numeric_limits<R>::min();\nstd::iota(paths.begin(), paths.begin() + L, 0);\nn_active_paths = 1;\n@@ -314,6 +342,8 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\ndefault:\nbreak;\n}\n+\n+ normalize_scl_metrics<R>(this->metrics, this->L);\n}\n}\n@@ -358,7 +388,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nauto metric = 0.f;\nfor (auto j = 0; j < n_elmts; j++)\n- metric -= std::min((float)l[array][off_l +j], 0.f);\n+ metric -= std::min((R)l[array][off_l +j], (R)0);\nmetrics[path] += metric; // add a penalty to the current path metric\n}\n@@ -379,7 +409,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nauto metric = 0.f;\nfor (auto j = 0; j < N_ELMTS; j++)\n- metric -= std::min((float)l[array][off_l +j], 0.f);\n+ metric -= std::min((R)l[array][off_l +j], (R)0);\nmetrics[path] += metric; // add a penalty to the current path metric\n}\n@@ -420,7 +450,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\nfor (auto i = n_active_paths; i < L; i++)\nfor (auto j = 0; j < 4; j++)\n- metrics_vec[1][4 * paths[i] +j] = std::numeric_limits<float>::max();\n+ metrics_vec[1][4 * paths[i] +j] = std::numeric_limits<R>::max();\n// L first of the lists are the L best paths\nconst auto n_list = (n_active_paths * 4 >= L) ? L : n_active_paths * 4;\n@@ -490,7 +520,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\nfor (auto i = n_active_paths; i < L; i++)\nfor (auto j = 0; j < 4; j++)\n- metrics_vec[1][4 * paths[i] +j] = std::numeric_limits<float>::max();\n+ metrics_vec[1][4 * paths[i] +j] = std::numeric_limits<R>::max();\n// L first of the lists are the L best paths\nconst auto n_list = (n_active_paths * 4 >= L) ? L : n_active_paths * 4;\n@@ -758,7 +788,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\nfor (auto i = n_active_paths; i < L; i++)\nfor (auto j = 0; j < n_cands; j++)\n- metrics_vec[2][n_cands * paths[i] +j] = std::numeric_limits<float>::max();\n+ metrics_vec[2][n_cands * paths[i] +j] = std::numeric_limits<R>::max();\n// L first of the lists are the L best paths\nconst auto n_list = (n_active_paths * n_cands >= L) ? L : n_active_paths * n_cands;\n@@ -845,7 +875,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\nfor (auto i = n_active_paths; i < L; i++)\nfor (auto j = 0; j < n_cands; j++)\n- metrics_vec[2][n_cands * paths[i] +j] = std::numeric_limits<float>::max();\n+ metrics_vec[2][n_cands * paths[i] +j] = std::numeric_limits<R>::max();\n// L first of the lists are the L best paths\nconst auto n_list = (n_active_paths * n_cands >= L) ? L : n_active_paths * n_cands;\n" } ]
C++
MIT License
aff3ct/aff3ct
Put the metric in fixed point (add a normalization).
8,490
26.01.2017 22:33:47
-3,600
f05fb9c4a912afc81056f953c6eefa6ecce48e54
Speedup the code: avoid to sort the LLRs when it is not mandatory. It seems to solve the SPC4 decoding perf...
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -427,6 +427,27 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nelse\n{\n// generate the candidates with the Chase-II algorithm\n+ if (n_elmts == 2)\n+ {\n+ for (auto i = 0; i < n_active_paths; i++)\n+ {\n+ const auto path = paths[i];\n+ const auto array = path_2_array[path][r_d];\n+\n+ bit_flips[2 * path +0] = 0;\n+ bit_flips[2 * path +1] = 1;\n+\n+ const auto abs0 = std::abs(l[array][off_l + bit_flips[2 * path +0]]);\n+ const auto abs1 = std::abs(l[array][off_l + bit_flips[2 * path +1]]);\n+\n+ metrics_vec[1][4 * path +0] = metrics [ path ];\n+ metrics_vec[1][4 * path +1] = metrics [ path ] + abs0;\n+ metrics_vec[1][4 * path +2] = metrics [ path ] + abs1;\n+ metrics_vec[1][4 * path +3] = metrics_vec[1][4 * path +1] + abs1;\n+ }\n+ }\n+ else\n+ {\nfor (auto i = 0; i < n_active_paths; i++)\n{\nconst auto path = paths[i];\n@@ -448,6 +469,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nmetrics_vec[1][4 * path +2] = metrics [ path ] + abs1;\nmetrics_vec[1][4 * path +3] = metrics_vec[1][4 * path +1] + abs1;\n}\n+ }\nfor (auto i = n_active_paths; i < L; i++)\nfor (auto j = 0; j < 4; j++)\nmetrics_vec[1][4 * paths[i] +j] = std::numeric_limits<R>::max();\n@@ -466,23 +488,19 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n// erase bad paths\nerase_bad_paths();\n- // duplicate paths and flip the bits\n- const auto n_active_paths_cpy = n_active_paths;\n- for (auto i = 0; i < n_active_paths_cpy; i++)\n+ for (auto i = 0; i < n_list; i++)\n{\n- const auto path = paths[i];\n+ const auto path = metrics_idx[1][i] / 4;\n+ const auto dup = metrics_idx[1][i] % 4;\nconst auto array = path_2_array[path][r_d];\nAPI_polar::h(s[path], l[array], off_l, off_s, n_elmts);\n- for (auto dup = 2; dup <= dup_count[path]; dup++)\n- {\n- const auto new_path = duplicate_tree(path, off_l, off_s, n_elmts);\n+ const auto new_path = (dup_count[path] > 1) ? duplicate_tree(path, off_l, off_s, n_elmts) : path;\nflip_bits_r1(path, new_path, dup, off_s, n_elmts);\n- metrics[new_path] = metrics_vec[1][4 * path + dup -1];\n- }\n+ metrics[new_path] = metrics_vec[1][metrics_idx[1][i]];\n- dup_count[path] = 0;\n+ dup_count[path]--;\n}\n}\n}\n@@ -497,6 +515,27 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nelse\n{\n// generate the candidates with the Chase-II algorithm\n+ if (N_ELMTS == 2)\n+ {\n+ for (auto i = 0; i < n_active_paths; i++)\n+ {\n+ const auto path = paths[i];\n+ const auto array = path_2_array[path][REV_D];\n+\n+ bit_flips[2 * path +0] = 0;\n+ bit_flips[2 * path +1] = 1;\n+\n+ const auto abs0 = std::abs(l[array][off_l + bit_flips[2 * path +0]]);\n+ const auto abs1 = std::abs(l[array][off_l + bit_flips[2 * path +1]]);\n+\n+ metrics_vec[1][4 * path +0] = metrics [ path ];\n+ metrics_vec[1][4 * path +1] = metrics [ path ] + abs0;\n+ metrics_vec[1][4 * path +2] = metrics [ path ] + abs1;\n+ metrics_vec[1][4 * path +3] = metrics_vec[1][4 * path +1] + abs1;\n+ }\n+ }\n+ else\n+ {\nfor (auto i = 0; i < n_active_paths; i++)\n{\nconst auto path = paths[i];\n@@ -518,6 +557,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nmetrics_vec[1][4 * path +2] = metrics [ path ] + abs1;\nmetrics_vec[1][4 * path +3] = metrics_vec[1][4 * path +1] + abs1;\n}\n+ }\nfor (auto i = n_active_paths; i < L; i++)\nfor (auto j = 0; j < 4; j++)\nmetrics_vec[1][4 * paths[i] +j] = std::numeric_limits<R>::max();\n@@ -536,23 +576,19 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n// erase bad paths\nerase_bad_paths();\n- // duplicate paths and flip the bits\n- const auto n_active_paths_cpy = n_active_paths;\n- for (auto i = 0; i < n_active_paths_cpy; i++)\n+ for (auto i = 0; i < n_list; i++)\n{\n- const auto path = paths[i];\n+ const auto path = metrics_idx[1][i] / 4;\n+ const auto dup = metrics_idx[1][i] % 4;\nconst auto array = path_2_array[path][REV_D];\n- API_polar::template h<N_ELMTS>(s[path], l[array], off_l, off_s, N_ELMTS);\n+ API_polar::h(s[path], l[array], off_l, off_s, N_ELMTS);\n- for (auto dup = 2; dup <= dup_count[path]; dup++)\n- {\n- const auto new_path = duplicate_tree(path, off_l, off_s, N_ELMTS);\n+ const auto new_path = (dup_count[path] > 1) ? duplicate_tree(path, off_l, off_s, N_ELMTS) : path;\nflip_bits_r1(path, new_path, dup, off_s, N_ELMTS);\n- metrics[new_path] = metrics_vec[1][4 * path + dup -1];\n- }\n+ metrics[new_path] = metrics_vec[1][metrics_idx[1][i]];\n- dup_count[path] = 0;\n+ dup_count[path]--;\n}\n}\n}\n@@ -565,16 +601,16 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nswitch (dup)\n{\n- case 1:\n+ case 0:\n// nothing to do\nbreak;\n- case 2:\n+ case 1:\ns[new_path][off_s + bit_flips[2 * old_path +0]] = !s[old_path][off_s + bit_flips[2 * old_path +0]] ? b : 0;\nbreak;\n- case 3:\n+ case 2:\ns[new_path][off_s + bit_flips[2 * old_path +1]] = !s[old_path][off_s + bit_flips[2 * old_path +1]] ? b : 0;\nbreak;\n- case 4:\n+ case 3:\ns[new_path][off_s + bit_flips[2 * old_path +0]] = !s[old_path][off_s + bit_flips[2 * old_path +0]] ? b : 0;\ns[new_path][off_s + bit_flips[2 * old_path +1]] = !s[old_path][off_s + bit_flips[2 * old_path +1]] ? b : 0;\nbreak;\n@@ -750,6 +786,42 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst auto n_cands = L <= 2 ? 4 : 8;\n// generate the candidates with the Chase-II algorithm\n+ if (n_elmts == 4)\n+ {\n+ for (auto i = 0; i < n_active_paths; i++)\n+ {\n+ const auto path = paths[i];\n+ const auto array = path_2_array[paths[i]][r_d];\n+\n+ for (auto j = 0; j < 4; j++)\n+ bit_flips[4 * path +j] = j;\n+\n+ auto sum = 0;\n+ for (auto j = 0; j < n_elmts; j++)\n+ sum ^= (l[array][off_l +j] < 0);\n+ is_even[path] = (sum == 0);\n+\n+ const auto abs0 = std::abs(l[array][off_l + bit_flips[4 * path +0]]);\n+ const auto abs1 = std::abs(l[array][off_l + bit_flips[4 * path +1]]);\n+ const auto abs2 = std::abs(l[array][off_l + bit_flips[4 * path +2]]);\n+ const auto abs3 = std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n+\n+ metrics_vec[2][n_cands * path +0] = metrics[path] + (!is_even[path] ? abs0 : 0);\n+ metrics_vec[2][n_cands * path +1] = metrics[path] + ( is_even[path] ? abs0 : 0) + abs1;\n+ metrics_vec[2][n_cands * path +2] = metrics[path] + ( is_even[path] ? abs0 : 0) + abs2;\n+ metrics_vec[2][n_cands * path +3] = metrics[path] + ( is_even[path] ? abs0 : 0) + abs3;\n+\n+ if (L > 2)\n+ {\n+ metrics_vec[2][n_cands * path +4] = metrics_vec[2][n_cands * path +0] + abs1 + abs2;\n+ metrics_vec[2][n_cands * path +5] = metrics_vec[2][n_cands * path +0] + abs1 + abs3;\n+ metrics_vec[2][n_cands * path +6] = metrics_vec[2][n_cands * path +0] + abs2 + abs3;\n+ metrics_vec[2][n_cands * path +7] = metrics_vec[2][n_cands * path +1] + abs2 + abs3;\n+ }\n+ }\n+ }\n+ else\n+ {\nfor (auto i = 0; i < n_active_paths; i++)\n{\nconst auto path = paths[i];\n@@ -786,6 +858,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nmetrics_vec[2][n_cands * path +7] = metrics_vec[2][n_cands * path +1] + abs2 + abs3;\n}\n}\n+ }\nfor (auto i = n_active_paths; i < L; i++)\nfor (auto j = 0; j < n_cands; j++)\nmetrics_vec[2][n_cands * paths[i] +j] = std::numeric_limits<R>::max();\n@@ -804,27 +877,19 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n// erase bad paths\nerase_bad_paths();\n- // duplicate paths and flip the bits\n- const auto n_active_paths_cpy = n_active_paths;\n- for (auto i = 0; i < n_active_paths_cpy; i++)\n+ for (auto i = 0; i < n_list; i++)\n{\n- const auto path = paths[i];\n+ const auto path = metrics_idx[2][i] / n_cands;\n+ const auto dup = metrics_idx[2][i] % n_cands;\nconst auto array = path_2_array[path][r_d];\nAPI_polar::h(s[path], l[array], off_l, off_s, n_elmts);\n- for (auto dup = 2; dup <= dup_count[path]; dup++)\n- {\n- const auto new_path = duplicate_tree(path, off_l, off_s, n_elmts);\n+ const auto new_path = (dup_count[path] > 1) ? duplicate_tree(path, off_l, off_s, n_elmts) : path;\nflip_bits_spc(path, new_path, dup, off_s, n_elmts);\n- metrics[new_path] = metrics_vec[2][n_cands * path + dup -1];\n- }\n-\n- metrics[path] = metrics_vec[2][n_cands * path];\n- if (!is_even[path])\n- s[path][off_s + bit_flips[4 * path +0]] = s[path][off_s + bit_flips[4 * path +0]] ? 0 : bit_init<B>();\n+ metrics[new_path] = metrics_vec[2][metrics_idx[2][i]];\n- dup_count[path] = 0;\n+ dup_count[path]--;\n}\n}\n@@ -837,6 +902,42 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst auto n_cands = L <= 2 ? 4 : 8;\n// generate the candidates with the Chase-II algorithm\n+ if (N_ELMTS == 4)\n+ {\n+ for (auto i = 0; i < n_active_paths; i++)\n+ {\n+ const auto path = paths[i];\n+ const auto array = path_2_array[paths[i]][REV_D];\n+\n+ for (auto j = 0; j < 4; j++)\n+ bit_flips[4 * path +j] = j;\n+\n+ auto sum = 0;\n+ for (auto j = 0; j < N_ELMTS; j++)\n+ sum ^= (l[array][off_l +j] < 0);\n+ is_even[path] = (sum == 0);\n+\n+ const auto abs0 = std::abs(l[array][off_l + bit_flips[4 * path +0]]);\n+ const auto abs1 = std::abs(l[array][off_l + bit_flips[4 * path +1]]);\n+ const auto abs2 = std::abs(l[array][off_l + bit_flips[4 * path +2]]);\n+ const auto abs3 = std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n+\n+ metrics_vec[2][n_cands * path +0] = metrics[path] + (!is_even[path] ? abs0 : 0);\n+ metrics_vec[2][n_cands * path +1] = metrics[path] + ( is_even[path] ? abs0 : 0) + abs1;\n+ metrics_vec[2][n_cands * path +2] = metrics[path] + ( is_even[path] ? abs0 : 0) + abs2;\n+ metrics_vec[2][n_cands * path +3] = metrics[path] + ( is_even[path] ? abs0 : 0) + abs3;\n+\n+ if (L > 2)\n+ {\n+ metrics_vec[2][n_cands * path +4] = metrics_vec[2][n_cands * path +0] + abs1 + abs2;\n+ metrics_vec[2][n_cands * path +5] = metrics_vec[2][n_cands * path +0] + abs1 + abs3;\n+ metrics_vec[2][n_cands * path +6] = metrics_vec[2][n_cands * path +0] + abs2 + abs3;\n+ metrics_vec[2][n_cands * path +7] = metrics_vec[2][n_cands * path +1] + abs2 + abs3;\n+ }\n+ }\n+ }\n+ else\n+ {\nfor (auto i = 0; i < n_active_paths; i++)\n{\nconst auto path = paths[i];\n@@ -873,6 +974,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nmetrics_vec[2][n_cands * path +7] = metrics_vec[2][n_cands * path +1] + abs2 + abs3;\n}\n}\n+ }\nfor (auto i = n_active_paths; i < L; i++)\nfor (auto j = 0; j < n_cands; j++)\nmetrics_vec[2][n_cands * paths[i] +j] = std::numeric_limits<R>::max();\n@@ -891,27 +993,19 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n// erase bad paths\nerase_bad_paths();\n- // duplicate paths and flip the bits\n- const auto n_active_paths_cpy = n_active_paths;\n- for (auto i = 0; i < n_active_paths_cpy; i++)\n+ for (auto i = 0; i < n_list; i++)\n{\n- const auto path = paths[i];\n+ const auto path = metrics_idx[2][i] / n_cands;\n+ const auto dup = metrics_idx[2][i] % n_cands;\nconst auto array = path_2_array[path][REV_D];\nAPI_polar::template h<N_ELMTS>(s[path], l[array], off_l, off_s, N_ELMTS);\n- for (auto dup = 2; dup <= dup_count[path]; dup++)\n- {\n- const auto new_path = duplicate_tree(path, off_l, off_s, N_ELMTS);\n+ const auto new_path = (dup_count[path] > 1) ? duplicate_tree(path, off_l, off_s, N_ELMTS) : path;\nflip_bits_spc(path, new_path, dup, off_s, N_ELMTS);\n- metrics[new_path] = metrics_vec[2][n_cands * path + dup -1];\n- }\n-\n- metrics[path] = metrics_vec[2][n_cands * path];\n- if (!is_even[path])\n- s[path][off_s + bit_flips[4 * path +0]] = s[path][off_s + bit_flips[4 * path +0]] ? 0 : bit_init<B>();\n+ metrics[new_path] = metrics_vec[2][metrics_idx[2][i]];\n- dup_count[path] = 0;\n+ dup_count[path]--;\n}\n}\n@@ -923,44 +1017,44 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nswitch(dup)\n{\n- case 1 :\n+ case 0 :\nif (!is_even[old_path])\ns[new_path][off_s + bit_flips[4 * old_path +0]] = s[old_path][off_s + bit_flips[4 * old_path +0]] ? 0 : b;\nbreak;\n- case 2 :\n+ case 1 :\nif (is_even[old_path])\ns[new_path][off_s + bit_flips[4 * old_path +0]] = s[old_path][off_s + bit_flips[4 * old_path +0]] ? 0 : b;\ns[new_path][off_s + bit_flips[4 * old_path +1]] = s[old_path][off_s + bit_flips[4 * old_path +1]] ? 0 : b;\nbreak;\n- case 3 :\n+ case 2 :\nif (is_even[old_path])\ns[new_path][off_s + bit_flips[4 * old_path +0]] = s[old_path][off_s + bit_flips[4 * old_path +0]] ? 0 : b;\ns[new_path][off_s + bit_flips[4 * old_path +2]] = s[old_path][off_s + bit_flips[4 * old_path +2]] ? 0 : b;\nbreak;\n- case 4 :\n+ case 3 :\nif (is_even[old_path])\ns[new_path][off_s + bit_flips[4 * old_path +0]] = s[old_path][off_s + bit_flips[4 * old_path +0]] ? 0 : b;\ns[new_path][off_s + bit_flips[4 * old_path +3]] = s[old_path][off_s + bit_flips[4 * old_path +3]] ? 0 : b;\nbreak;\n- case 5 :\n+ case 4 :\nif (!is_even[old_path])\ns[new_path][off_s + bit_flips[4 * old_path +0]] = s[old_path][off_s + bit_flips[4 * old_path +0]] ? 0 : b;\ns[new_path][off_s + bit_flips[4 * old_path +1]] = s[old_path][off_s + bit_flips[4 * old_path +1]] ? 0 : b;\ns[new_path][off_s + bit_flips[4 * old_path +2]] = s[old_path][off_s + bit_flips[4 * old_path +2]] ? 0 : b;\nbreak;\n- case 6 :\n+ case 5 :\nif (!is_even[old_path])\ns[new_path][off_s + bit_flips[4 * old_path +0]] = s[old_path][off_s + bit_flips[4 * old_path +0]] ? 0 : b;\ns[new_path][off_s + bit_flips[4 * old_path +1]] = s[old_path][off_s + bit_flips[4 * old_path +1]] ? 0 : b;\ns[new_path][off_s + bit_flips[4 * old_path +3]] = s[old_path][off_s + bit_flips[4 * old_path +3]] ? 0 : b;\nbreak;\n- case 7 :\n+ case 6 :\nif (!is_even[old_path])\ns[new_path][off_s + bit_flips[4 * old_path +0]] = s[old_path][off_s + bit_flips[4 * old_path +0]] ? 0 : b;\ns[new_path][off_s + bit_flips[4 * old_path +2]] = s[old_path][off_s + bit_flips[4 * old_path +2]] ? 0 : b;\ns[new_path][off_s + bit_flips[4 * old_path +3]] = s[old_path][off_s + bit_flips[4 * old_path +3]] ? 0 : b;\nbreak;\n- case 8 :\n+ case 7 :\nif (is_even[old_path])\ns[new_path][off_s + bit_flips[4 * old_path +0]] = s[old_path][off_s + bit_flips[4 * old_path +0]] ? 0 : b;\ns[new_path][off_s + bit_flips[4 * old_path +1]] = s[old_path][off_s + bit_flips[4 * old_path +1]] ? 0 : b;\n" } ]
C++
MIT License
aff3ct/aff3ct
Speedup the code: avoid to sort the LLRs when it is not mandatory. It seems to solve the SPC4 decoding perf...
8,490
27.01.2017 15:58:35
-3,600
a48dec61ae8a483375157b95dbc7eb944280aa33
Add a new SC curve and improve the SCL curves (start from 1dB instead of 0dB).
[ { "change_type": "ADD", "old_path": null, "new_path": "tests/data/BFER/polar/SC/polar_2048_1723_1.0_4.5_32_SC.txt", "diff": "+Run command:\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1723\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"SC\" --dec-simd \"INTRA\" -L \"32\" --sim-pyber \"Fast-SSC\"\n+Curve name:\n+SC 32-bit\n+# -------------------------------------------------\n+# ---- A FAST FORWARD ERROR CORRECTION TOOL >> ----\n+# -------------------------------------------------\n+# Parameters:\n+# * Simulation ------------------------------------\n+# ** Type = BFER\n+# ** SNR min (m) = 1.000000 dB\n+# ** SNR max (M) = 4.510000 dB\n+# ** SNR step (s) = 0.250000 dB\n+# ** Type of bits = int (32 bits)\n+# ** Type of reals = float (32 bits)\n+# ** Inter frame level = 1\n+# ** Seed = 0\n+# ** Multi-threading (t) = 56 thread(s)\n+# * Code ------------------------------------------\n+# ** Type = POLAR\n+# ** Info. bits (K) = 1723\n+# ** Codeword size (N) = 2048\n+# ** Coset approach (c) = off\n+# ** Sigma for code gen. = adaptative\n+# ** Frozen bits gen. method = TV\n+# ** Path to the best channels = ../conf/cde/awgn_polar_codes/TV\n+# * Source ----------------------------------------\n+# ** Type = AZCW\n+# * Encoder ---------------------------------------\n+# ** Type = AZCW\n+# ** Systematic encoding = on\n+# * Modulator -------------------------------------\n+# ** Type = BPSK\n+# ** Bits per symbol = 1\n+# ** Sampling factor = 1\n+# * Channel ---------------------------------------\n+# ** Type = AWGN_FAST\n+# ** Domain = LLR\n+# * Demodulator -----------------------------------\n+# ** Sigma square = on\n+# ** Max type = unused\n+# * Decoder ---------------------------------------\n+# ** Type (D) = SC\n+# ** Implementation = FAST\n+# ** SIMD strategy = INTRA\n+# * Monitor ---------------------------------------\n+# ** Frame error count (e) = 100\n+#\n+# The simulation is running...\n+# -------------------------------------------------------------||--------------------------------||---------------------\n+# Bit Error Rate (BER) and Frame Error Rate (FER) depending || Decoder throughput and || Global throughput\n+# on the Signal Noise Ratio (SNR) Eb/N0 || latency (per thread) || and elapsed time\n+# -------------------------------------------------------------||--------------------------------||---------------------\n+# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n+# SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n+# (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n+# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n+# 0.00 | 142 | 27511 | 142 | 1.12e-01 | 1.00e+00 || 76.79 | 64.61 | 26.67 || 9.98 | 00h00'00\n+# 0.25 | 146 | 27141 | 146 | 1.08e-01 | 1.00e+00 || 89.19 | 75.03 | 22.96 || 21.12 | 00h00'00\n+# 0.50 | 131 | 22970 | 131 | 1.02e-01 | 1.00e+00 || 83.52 | 70.27 | 24.52 || 24.32 | 00h00'00\n+# 0.75 | 116 | 19523 | 116 | 9.77e-02 | 1.00e+00 || 134.83 | 113.43 | 15.19 || 19.54 | 00h00'00\n+ 1.00 | 119 | 18816 | 119 | 9.18e-02 | 1.00e+00 || 98.72 | 83.05 | 20.75 || 21.29 | 00h00'00\n+ 1.25 | 117 | 17502 | 117 | 8.68e-02 | 1.00e+00 || 132.81 | 111.73 | 15.42 || 19.09 | 00h00'00\n+ 1.50 | 118 | 16703 | 118 | 8.22e-02 | 1.00e+00 || 135.98 | 114.40 | 15.06 || 20.61 | 00h00'00\n+ 1.75 | 116 | 15506 | 116 | 7.76e-02 | 1.00e+00 || 126.80 | 106.68 | 16.15 || 18.30 | 00h00'00\n+ 2.00 | 117 | 13988 | 117 | 6.94e-02 | 1.00e+00 || 118.52 | 99.71 | 17.28 || 20.62 | 00h00'00\n+ 2.25 | 115 | 12396 | 115 | 6.26e-02 | 1.00e+00 || 141.96 | 119.43 | 14.43 || 18.91 | 00h00'00\n+ 2.50 | 118 | 9711 | 118 | 4.78e-02 | 1.00e+00 || 128.26 | 107.91 | 15.97 || 21.35 | 00h00'00\n+ 2.75 | 126 | 8499 | 117 | 3.91e-02 | 9.29e-01 || 136.52 | 114.86 | 15.00 || 20.21 | 00h00'00\n+ 3.00 | 185 | 6592 | 136 | 2.07e-02 | 7.35e-01 || 89.10 | 74.96 | 22.99 || 35.09 | 00h00'00\n+ 3.25 | 305 | 5252 | 119 | 9.99e-03 | 3.90e-01 || 100.66 | 84.68 | 20.35 || 58.59 | 00h00'00\n+ 3.50 | 621 | 3267 | 109 | 3.05e-03 | 1.76e-01 || 107.78 | 90.67 | 19.00 || 97.22 | 00h00'00\n+ 3.75 | 1739 | 2677 | 104 | 8.93e-04 | 5.98e-02 || 95.06 | 79.97 | 21.55 || 278.72 | 00h00'00\n+ 4.00 | 4690 | 2258 | 101 | 2.79e-04 | 2.15e-02 || 95.07 | 79.99 | 21.54 || 570.83 | 00h00'00\n+ 4.25 | 21521 | 2118 | 100 | 5.71e-05 | 4.65e-03 || 90.57 | 76.19 | 22.61 || 1067.06 | 00h00'00\n+ 4.50 | 90299 | 1832 | 100 | 1.18e-05 | 1.11e-03 || 82.41 | 69.33 | 24.85 || 1783.41 | 00h00'00\n+# End of the simulation.\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_ASCL2_CRC32_SPC4.txt", "new_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_ASCL2_CRC32_SPC4.txt", "diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"0.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"ASCL\" --dec-simd \"INTRA\" -L \"2\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --sim-pyber \"Fast-ASCL2+CRC32+SPC4\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"ASCL\" --dec-simd \"INTRA\" -L \"2\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --sim-pyber \"Fast-ASCL2+CRC32+SPC4\"\nCurve name:\nFast-ASCL2+CRC32+SPC4\n# -------------------------------------------------\n@@ -8,7 +8,7 @@ Fast-ASCL2+CRC32+SPC4\n# Parameters:\n# * Simulation ------------------------------------\n# ** Type = BFER\n-# ** SNR min (m) = 0.000000 dB\n+# ** SNR min (m) = 1.000000 dB\n# ** SNR max (M) = 4.510000 dB\n# ** SNR step (s) = 0.250000 dB\n# ** Type of bits = int (32 bits)\n@@ -62,10 +62,10 @@ Fast-ASCL2+CRC32+SPC4\n# SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n# (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n- 0.00 | 149 | 28831 | 149 | 1.10e-01 | 1.00e+00 || 10.02 | 8.59 | 204.35 || 6.34 | 00h00'00\n- 0.25 | 125 | 23014 | 125 | 1.05e-01 | 1.00e+00 || 11.98 | 10.27 | 170.90 || 10.78 | 00h00'00\n- 0.50 | 155 | 26938 | 155 | 9.90e-02 | 1.00e+00 || 11.35 | 9.73 | 180.37 || 15.74 | 00h00'00\n- 0.75 | 155 | 25436 | 155 | 9.35e-02 | 1.00e+00 || 11.45 | 9.81 | 178.90 || 16.27 | 00h00'00\n+# 0.00 | 149 | 28831 | 149 | 1.10e-01 | 1.00e+00 || 10.02 | 8.59 | 204.35 || 6.34 | 00h00'00\n+# 0.25 | 125 | 23014 | 125 | 1.05e-01 | 1.00e+00 || 11.98 | 10.27 | 170.90 || 10.78 | 00h00'00\n+# 0.50 | 155 | 26938 | 155 | 9.90e-02 | 1.00e+00 || 11.35 | 9.73 | 180.37 || 15.74 | 00h00'00\n+# 0.75 | 155 | 25436 | 155 | 9.35e-02 | 1.00e+00 || 11.45 | 9.81 | 178.90 || 16.27 | 00h00'00\n1.00 | 154 | 23865 | 154 | 8.83e-02 | 1.00e+00 || 11.41 | 9.78 | 179.49 || 16.34 | 00h00'00\n1.25 | 142 | 20569 | 142 | 8.25e-02 | 1.00e+00 || 12.90 | 11.06 | 158.72 || 15.09 | 00h00'00\n1.50 | 147 | 20203 | 147 | 7.83e-02 | 1.00e+00 || 12.57 | 10.78 | 162.88 || 15.48 | 00h00'00\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_ASCL32_CRC32_SPC4+.txt", "new_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_ASCL32_CRC32_SPC4+.txt", "diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"0.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"ASCL\" --dec-simd \"INTRA\" -L \"32\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --sim-pyber \"Fast-ASCL32+CRC32+SPC4+\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"ASCL\" --dec-simd \"INTRA\" -L \"32\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --sim-pyber \"Fast-ASCL32+CRC32+SPC4+\"\nCurve name:\nFast-ASCL32+CRC32+SPC4+\n# -------------------------------------------------\n@@ -8,7 +8,7 @@ Fast-ASCL32+CRC32+SPC4+\n# Parameters:\n# * Simulation ------------------------------------\n# ** Type = BFER\n-# ** SNR min (m) = 0.000000 dB\n+# ** SNR min (m) = 1.000000 dB\n# ** SNR max (M) = 4.510000 dB\n# ** SNR step (s) = 0.250000 dB\n# ** Type of bits = int (32 bits)\n@@ -62,10 +62,10 @@ Fast-ASCL32+CRC32+SPC4+\n# SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n# (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n- 0.00 | 150 | 28541 | 150 | 1.08e-01 | 1.00e+00 || 0.42 | 0.36 | 4901.79 || 3.28 | 00h00'00\n- 0.25 | 155 | 28152 | 155 | 1.03e-01 | 1.00e+00 || 0.43 | 0.37 | 4798.02 || 8.97 | 00h00'00\n- 0.50 | 148 | 25391 | 148 | 9.78e-02 | 1.00e+00 || 0.47 | 0.40 | 4374.95 || 8.80 | 00h00'00\n- 0.75 | 155 | 24993 | 155 | 9.19e-02 | 1.00e+00 || 0.43 | 0.37 | 4728.67 || 9.12 | 00h00'00\n+# 0.00 | 150 | 28541 | 150 | 1.08e-01 | 1.00e+00 || 0.42 | 0.36 | 4901.79 || 3.28 | 00h00'00\n+# 0.25 | 155 | 28152 | 155 | 1.03e-01 | 1.00e+00 || 0.43 | 0.37 | 4798.02 || 8.97 | 00h00'00\n+# 0.50 | 148 | 25391 | 148 | 9.78e-02 | 1.00e+00 || 0.47 | 0.40 | 4374.95 || 8.80 | 00h00'00\n+# 0.75 | 155 | 24993 | 155 | 9.19e-02 | 1.00e+00 || 0.43 | 0.37 | 4728.67 || 9.12 | 00h00'00\n1.00 | 155 | 23593 | 155 | 8.67e-02 | 1.00e+00 || 0.45 | 0.38 | 4579.40 || 9.24 | 00h00'00\n1.25 | 155 | 22183 | 155 | 8.15e-02 | 1.00e+00 || 0.45 | 0.38 | 4579.77 || 9.28 | 00h00'00\n1.50 | 144 | 19398 | 144 | 7.68e-02 | 1.00e+00 || 0.51 | 0.43 | 4043.86 || 8.59 | 00h00'00\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_ASCL32_CRC32_SPC4.txt", "new_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_ASCL32_CRC32_SPC4.txt", "diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"0.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"ASCL\" --dec-simd \"INTRA\" -L \"32\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --sim-pyber \"Fast-ASCL32+CRC32+SPC4\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"ASCL\" --dec-simd \"INTRA\" -L \"32\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --sim-pyber \"Fast-ASCL32+CRC32+SPC4\"\nCurve name:\nFast-ASCL32+CRC32+SPC4\n# -------------------------------------------------\n@@ -8,7 +8,7 @@ Fast-ASCL32+CRC32+SPC4\n# Parameters:\n# * Simulation ------------------------------------\n# ** Type = BFER\n-# ** SNR min (m) = 0.000000 dB\n+# ** SNR min (m) = 1.000000 dB\n# ** SNR max (M) = 4.510000 dB\n# ** SNR step (s) = 0.250000 dB\n# ** Type of bits = int (32 bits)\n@@ -62,10 +62,10 @@ Fast-ASCL32+CRC32+SPC4\n# SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n# (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n- 0.00 | 155 | 29520 | 155 | 1.09e-01 | 1.00e+00 || 0.25 | 0.22 | 8038.13 || 2.97 | 00h00'00\n- 0.25 | 155 | 28117 | 155 | 1.03e-01 | 1.00e+00 || 0.39 | 0.33 | 5257.72 || 6.72 | 00h00'00\n- 0.50 | 154 | 26466 | 154 | 9.79e-02 | 1.00e+00 || 0.39 | 0.34 | 5223.62 || 8.69 | 00h00'00\n- 0.75 | 155 | 24951 | 155 | 9.17e-02 | 1.00e+00 || 0.38 | 0.33 | 5322.43 || 8.93 | 00h00'00\n+# 0.00 | 155 | 29520 | 155 | 1.09e-01 | 1.00e+00 || 0.25 | 0.22 | 8038.13 || 2.97 | 00h00'00\n+# 0.25 | 155 | 28117 | 155 | 1.03e-01 | 1.00e+00 || 0.39 | 0.33 | 5257.72 || 6.72 | 00h00'00\n+# 0.50 | 154 | 26466 | 154 | 9.79e-02 | 1.00e+00 || 0.39 | 0.34 | 5223.62 || 8.69 | 00h00'00\n+# 0.75 | 155 | 24951 | 155 | 9.17e-02 | 1.00e+00 || 0.38 | 0.33 | 5322.43 || 8.93 | 00h00'00\n1.00 | 155 | 23641 | 155 | 8.69e-02 | 1.00e+00 || 0.40 | 0.34 | 5181.64 || 8.65 | 00h00'00\n1.25 | 154 | 22105 | 154 | 8.18e-02 | 1.00e+00 || 0.40 | 0.34 | 5161.66 || 8.68 | 00h00'00\n1.50 | 154 | 20804 | 154 | 7.70e-02 | 1.00e+00 || 0.40 | 0.35 | 5068.19 || 8.67 | 00h00'00\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_ASCL8_CRC32_SPC4+.txt", "new_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_ASCL8_CRC32_SPC4+.txt", "diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"0.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"ASCL\" --dec-simd \"INTRA\" -L \"8\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --sim-pyber \"Fast-ASCL8+CRC32+SPC4+\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"ASCL\" --dec-simd \"INTRA\" -L \"8\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --sim-pyber \"Fast-ASCL8+CRC32+SPC4+\"\nCurve name:\nFast-ASCL8+CRC32+SPC4+\n# -------------------------------------------------\n@@ -8,7 +8,7 @@ Fast-ASCL8+CRC32+SPC4+\n# Parameters:\n# * Simulation ------------------------------------\n# ** Type = BFER\n-# ** SNR min (m) = 0.000000 dB\n+# ** SNR min (m) = 1.000000 dB\n# ** SNR max (M) = 4.510000 dB\n# ** SNR step (s) = 0.250000 dB\n# ** Type of bits = int (32 bits)\n@@ -62,10 +62,10 @@ Fast-ASCL8+CRC32+SPC4+\n# SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n# (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n- 0.00 | 131 | 24954 | 131 | 1.09e-01 | 1.00e+00 || 2.27 | 1.95 | 901.98 || 5.31 | 00h00'00\n- 0.25 | 152 | 27514 | 152 | 1.03e-01 | 1.00e+00 || 2.01 | 1.72 | 1021.32 || 12.49 | 00h00'00\n- 0.50 | 155 | 26643 | 155 | 9.79e-02 | 1.00e+00 || 2.00 | 1.71 | 1025.60 || 13.56 | 00h00'00\n- 0.75 | 154 | 25083 | 154 | 9.28e-02 | 1.00e+00 || 2.01 | 1.72 | 1020.70 || 13.55 | 00h00'00\n+# 0.00 | 131 | 24954 | 131 | 1.09e-01 | 1.00e+00 || 2.27 | 1.95 | 901.98 || 5.31 | 00h00'00\n+# 0.25 | 152 | 27514 | 152 | 1.03e-01 | 1.00e+00 || 2.01 | 1.72 | 1021.32 || 12.49 | 00h00'00\n+# 0.50 | 155 | 26643 | 155 | 9.79e-02 | 1.00e+00 || 2.00 | 1.71 | 1025.60 || 13.56 | 00h00'00\n+# 0.75 | 154 | 25083 | 154 | 9.28e-02 | 1.00e+00 || 2.01 | 1.72 | 1020.70 || 13.55 | 00h00'00\n1.00 | 136 | 20716 | 136 | 8.68e-02 | 1.00e+00 || 2.20 | 1.89 | 930.49 || 12.24 | 00h00'00\n1.25 | 154 | 22308 | 154 | 8.25e-02 | 1.00e+00 || 2.02 | 1.73 | 1013.11 || 13.59 | 00h00'00\n1.50 | 155 | 21122 | 155 | 7.76e-02 | 1.00e+00 || 2.05 | 1.76 | 997.20 || 13.74 | 00h00'00\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_ASCL8_CRC32_SPC4.txt", "new_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_ASCL8_CRC32_SPC4.txt", "diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"0.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"ASCL\" --dec-simd \"INTRA\" -L \"8\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --sim-pyber \"Fast-ASCL8+CRC32+SPC4\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"ASCL\" --dec-simd \"INTRA\" -L \"8\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --sim-pyber \"Fast-ASCL8+CRC32+SPC4\"\nCurve name:\nFast-ASCL8+CRC32+SPC4\n# -------------------------------------------------\n@@ -8,7 +8,7 @@ Fast-ASCL8+CRC32+SPC4\n# Parameters:\n# * Simulation ------------------------------------\n# ** Type = BFER\n-# ** SNR min (m) = 0.000000 dB\n+# ** SNR min (m) = 1.000000 dB\n# ** SNR max (M) = 4.510000 dB\n# ** SNR step (s) = 0.250000 dB\n# ** Type of bits = int (32 bits)\n@@ -62,10 +62,10 @@ Fast-ASCL8+CRC32+SPC4\n# SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n# (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n- 0.00 | 152 | 29041 | 152 | 1.09e-01 | 1.00e+00 || 1.78 | 1.53 | 1148.51 || 5.77 | 00h00'00\n- 0.25 | 129 | 23362 | 129 | 1.03e-01 | 1.00e+00 || 2.14 | 1.83 | 958.56 || 10.30 | 00h00'00\n- 0.50 | 155 | 26650 | 155 | 9.80e-02 | 1.00e+00 || 1.82 | 1.56 | 1127.58 || 13.60 | 00h00'00\n- 0.75 | 155 | 25319 | 155 | 9.31e-02 | 1.00e+00 || 1.86 | 1.59 | 1102.41 || 13.56 | 00h00'00\n+# 0.00 | 152 | 29041 | 152 | 1.09e-01 | 1.00e+00 || 1.78 | 1.53 | 1148.51 || 5.77 | 00h00'00\n+# 0.25 | 129 | 23362 | 129 | 1.03e-01 | 1.00e+00 || 2.14 | 1.83 | 958.56 || 10.30 | 00h00'00\n+# 0.50 | 155 | 26650 | 155 | 9.80e-02 | 1.00e+00 || 1.82 | 1.56 | 1127.58 || 13.60 | 00h00'00\n+# 0.75 | 155 | 25319 | 155 | 9.31e-02 | 1.00e+00 || 1.86 | 1.59 | 1102.41 || 13.56 | 00h00'00\n1.00 | 155 | 23720 | 155 | 8.72e-02 | 1.00e+00 || 1.88 | 1.62 | 1086.62 || 13.56 | 00h00'00\n1.25 | 154 | 22319 | 154 | 8.26e-02 | 1.00e+00 || 1.86 | 1.59 | 1101.95 || 14.20 | 00h00'00\n1.50 | 155 | 21067 | 155 | 7.74e-02 | 1.00e+00 || 1.90 | 1.62 | 1080.41 || 13.80 | 00h00'00\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_SCL32.txt", "new_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_SCL32.txt", "diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"0.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1723\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"SCL\" --dec-simd \"INTRA\" -L \"32\" --sim-pyber \"Fast-SCL32\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1723\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"SCL\" --dec-simd \"INTRA\" -L \"32\" --sim-pyber \"Fast-SCL32\"\nCurve name:\nFast-SCL32\n# -------------------------------------------------\n@@ -8,7 +8,7 @@ Fast-SCL32\n# Parameters:\n# * Simulation ------------------------------------\n# ** Type = BFER\n-# ** SNR min (m) = 0.000000 dB\n+# ** SNR min (m) = 1.000000 dB\n# ** SNR max (M) = 4.510000 dB\n# ** SNR step (s) = 0.250000 dB\n# ** Type of bits = int (32 bits)\n@@ -56,10 +56,10 @@ Fast-SCL32\n# SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n# (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n- 0.00 | 143 | 27140 | 143 | 1.10e-01 | 1.00e+00 || 0.85 | 0.71 | 2422.67 || 5.14 | 00h00'00\n- 0.25 | 123 | 22174 | 123 | 1.05e-01 | 1.00e+00 || 1.02 | 0.86 | 2012.69 || 10.80 | 00h00'00\n- 0.50 | 150 | 25805 | 150 | 9.98e-02 | 1.00e+00 || 0.85 | 0.72 | 2407.56 || 14.73 | 00h00'00\n- 0.75 | 155 | 25176 | 155 | 9.43e-02 | 1.00e+00 || 0.83 | 0.70 | 2470.63 || 15.20 | 00h00'00\n+# 0.00 | 143 | 27140 | 143 | 1.10e-01 | 1.00e+00 || 0.85 | 0.71 | 2422.67 || 5.14 | 00h00'00\n+# 0.25 | 123 | 22174 | 123 | 1.05e-01 | 1.00e+00 || 1.02 | 0.86 | 2012.69 || 10.80 | 00h00'00\n+# 0.50 | 150 | 25805 | 150 | 9.98e-02 | 1.00e+00 || 0.85 | 0.72 | 2407.56 || 14.73 | 00h00'00\n+# 0.75 | 155 | 25176 | 155 | 9.43e-02 | 1.00e+00 || 0.83 | 0.70 | 2470.63 || 15.20 | 00h00'00\n1.00 | 155 | 23838 | 155 | 8.93e-02 | 1.00e+00 || 0.83 | 0.70 | 2478.68 || 15.33 | 00h00'00\n1.25 | 155 | 22468 | 155 | 8.41e-02 | 1.00e+00 || 0.85 | 0.72 | 2396.16 || 16.18 | 00h00'00\n1.50 | 155 | 21174 | 155 | 7.93e-02 | 1.00e+00 || 0.88 | 0.74 | 2335.96 || 15.46 | 00h00'00\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_SCL32_CRC32.txt", "new_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_SCL32_CRC32.txt", "diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"0.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"SCL\" --dec-simd \"INTRA\" -L \"32\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --sim-pyber \"Fast-SCL32+CRC32\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"SCL\" --dec-simd \"INTRA\" -L \"32\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --sim-pyber \"Fast-SCL32+CRC32\"\nCurve name:\nFast-SCL32+CRC32\n# -------------------------------------------------\n@@ -8,7 +8,7 @@ Fast-SCL32+CRC32\n# Parameters:\n# * Simulation ------------------------------------\n# ** Type = BFER\n-# ** SNR min (m) = 0.000000 dB\n+# ** SNR min (m) = 1.000000 dB\n# ** SNR max (M) = 4.510000 dB\n# ** SNR step (s) = 0.250000 dB\n# ** Type of bits = int (32 bits)\n@@ -62,10 +62,10 @@ Fast-SCL32+CRC32\n# SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n# (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n- 0.00 | 126 | 23817 | 126 | 1.08e-01 | 1.00e+00 || 0.87 | 0.74 | 2362.19 || 1.76 | 00h00'00\n- 0.25 | 134 | 24350 | 134 | 1.04e-01 | 1.00e+00 || 0.93 | 0.80 | 2195.32 || 9.03 | 00h00'00\n- 0.50 | 130 | 22342 | 130 | 9.79e-02 | 1.00e+00 || 1.03 | 0.88 | 1992.68 || 11.34 | 00h00'00\n- 0.75 | 134 | 21596 | 134 | 9.18e-02 | 1.00e+00 || 0.98 | 0.84 | 2079.30 || 11.32 | 00h00'00\n+# 0.00 | 126 | 23817 | 126 | 1.08e-01 | 1.00e+00 || 0.87 | 0.74 | 2362.19 || 1.76 | 00h00'00\n+# 0.25 | 134 | 24350 | 134 | 1.04e-01 | 1.00e+00 || 0.93 | 0.80 | 2195.32 || 9.03 | 00h00'00\n+# 0.50 | 130 | 22342 | 130 | 9.79e-02 | 1.00e+00 || 1.03 | 0.88 | 1992.68 || 11.34 | 00h00'00\n+# 0.75 | 134 | 21596 | 134 | 9.18e-02 | 1.00e+00 || 0.98 | 0.84 | 2079.30 || 11.32 | 00h00'00\n1.00 | 136 | 20700 | 136 | 8.67e-02 | 1.00e+00 || 0.98 | 0.84 | 2084.36 || 11.78 | 00h00'00\n1.25 | 133 | 18939 | 133 | 8.11e-02 | 1.00e+00 || 0.98 | 0.84 | 2086.02 || 11.68 | 00h00'00\n1.50 | 128 | 17351 | 128 | 7.72e-02 | 1.00e+00 || 1.10 | 0.94 | 1862.32 || 10.93 | 00h00'00\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a new SC curve and improve the SCL curves (start from 1dB instead of 0dB).
8,490
05.02.2017 18:54:45
-3,600
8b7e7390a3ee8abe08876b6a664db468af150cb3
Update the SCL32+CRC32 curve.
[ { "change_type": "MODIFY", "old_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_SCL32_CRC32.txt", "new_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_SCL32_CRC32.txt", "diff": "@@ -80,5 +80,5 @@ Fast-SCL32+CRC32\n3.75 | 125123 | 2673 | 100 | 1.22e-05 | 7.99e-04 || 0.78 | 0.67 | 2621.52 || 43.05 | 00h00'05\n4.00 | 2691049 | 1883 | 100 | 3.99e-07 | 3.72e-05 || 0.76 | 0.65 | 2706.38 || 41.85 | 00h02'11\n4.25 | 78222888 | 2064 | 100 | 1.50e-08 | 1.28e-06 || 0.74 | 0.63 | 2772.41 || 40.88 | 01h05'19\n- 4.50 | 6.96e+08 | 486 | 29 | 3.98e-10 | 4.17e-08 || 0.63 | 0.54 | 3250.93 || 32.89 | 29h29'06\n+ 4.50 | 1.77e+09 | 1411 | 100 | 4.54e-10 | 5.65e-08 || 0.72 | 0.62 | 2832.26 || 40.02 | 25h09'33\n# End of the simulation.\n" } ]
C++
MIT License
aff3ct/aff3ct
Update the SCL32+CRC32 curve.
8,490
05.02.2017 23:35:09
-3,600
212024cb687e8281736381d95c5dd8faf48f8f6c
On double click, open file or folder in PyBER.
[ { "change_type": "MODIFY", "old_path": "plotter/PyBER/fileExplorer.py", "new_path": "plotter/PyBER/fileExplorer.py", "diff": "import os\nimport sys\nimport reader\n+import subprocess\nimport libs.pyqtgraph as pg\nfrom libs.pyqtgraph.Qt import QtCore, QtGui\nfrom libs.pyqtgraph.dockarea import *\n@@ -73,9 +74,20 @@ class AdvTreeView(QtGui.QTreeView):\nself.hideLegend()\n+ self.doubleClicked.connect(self.openFileOrDir)\nself.fsWatcher = QtCore.QFileSystemWatcher()\nself.fsWatcher.fileChanged.connect(self.updateDataAndCurve)\n+ def openFileOrDir(self, *args):\n+ paths = [ self.model().filePath(index) for index in args ]\n+ if len(paths):\n+ if sys.platform == \"linux\" or sys.platform == \"linux2\":\n+ subprocess.call([\"xdg-open\", paths[0]])\n+ elif sys.platform == \"darwin\":\n+ subprocess.call([\"open\", paths[0]])\n+ else:\n+ os.startfile(paths[0])\n+\ndef hideLegend(self):\n# hide the legend\nif self.lBER: self.lBER .anchor(itemPos=(0,1), parentPos=(0,1), offset=( -1000,-10))\n" } ]
C++
MIT License
aff3ct/aff3ct
On double click, open file or folder in PyBER.
8,483
07.02.2017 12:27:05
-3,600
a84761dbf546dc6f3c2881b446567850906c4321
sigma function of ups
[ { "change_type": "MODIFY", "old_path": "src/Simulation/BFERI/Simulation_BFERI.cpp", "new_path": "src/Simulation/BFERI/Simulation_BFERI.cpp", "diff": "@@ -120,7 +120,7 @@ void Simulation_BFERI_i<B,R,Q>\nsigma = std::sqrt((float)params.modulator.upsample_factor) /\nstd::sqrt(2.f * code_rate * (float)params.modulator.bits_per_symbol * std::pow(10.f, (snr / 10.f)));\nelse if(params.simulation.snr_type == \"es\")\n- sigma = 1/ //std::sqrt((float)params.modulator.upsample_factor) /\n+ sigma = std::sqrt((float)params.modulator.upsample_factor) /\nstd::sqrt(2.0f * std::pow(10.f, (snr / 10.f)));\nthis->snr_precompute ();\n" } ]
C++
MIT License
aff3ct/aff3ct
sigma function of ups
8,490
07.02.2017 13:54:10
-3,600
f9ad474f806304e862dad42d45926cf1a3044455
Improve the partial sort speed in r1 leaves.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "diff": "#include <vector>\n#include \"Tools/Perf/MIPP/mipp.h\"\n+#include \"Tools/Algo/Sort/LC_sorter.hpp\"\n#include \"../../Decoder.hpp\"\n#include \"../decoder_polar_functions.h\"\n@@ -35,6 +36,8 @@ protected:\nstd::vector<std::vector<int>> n_array_ref; // number of times an array is used\nstd::vector<std::vector<int>> path_2_array; // give array used by a path\n+ std::vector<LC_sorter*> sorters;\n+\npublic:\nDecoder_polar_SCL_fast_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits,\nconst int n_frames = 1, const std::string name = \"Decoder_polar_SCL_fast_sys\");\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -85,7 +85,8 @@ Decoder_polar_SCL_fast_sys<B,R,API_polar>\nbest_path (0),\nn_active_paths(1),\nn_array_ref (L, std::vector<int>(m)),\n- path_2_array (L, std::vector<int>(m))\n+ path_2_array (L, std::vector<int>(m)),\n+ sorters (std::log2(N) +1, nullptr)\n{\nstatic_assert(API_polar::get_n_frames() == 1, \"The inter-frame API_polar is not supported.\");\nstatic_assert(sizeof(B) == sizeof(R), \"Sizes of the bits and reals have to be identical.\");\n@@ -107,6 +108,13 @@ Decoder_polar_SCL_fast_sys<B,R,API_polar>\nfor (auto j = 0; j < (int)llr_indexes[i].size(); j++)\nstd::iota(llr_indexes[i].begin(), llr_indexes[i].end(), 0); // 0, 1, 2, 3...\n}\n+\n+ auto n_elmts = 1;\n+ for (auto i = 0; i <= std::log2(N); i++)\n+ {\n+ sorters[i] = new LC_sorter(n_elmts);\n+ n_elmts <<= 1;\n+ }\n}\ntemplate <typename B, typename R, class API_polar>\n@@ -114,6 +122,8 @@ Decoder_polar_SCL_fast_sys<B,R,API_polar>\n::~Decoder_polar_SCL_fast_sys()\n{\npolar_patterns.release_patterns();\n+ for (auto i = 0; i <= std::log2(this->N); i++)\n+ delete sorters[i];\n}\ntemplate <typename B, typename R, class API_polar>\n@@ -453,13 +463,18 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst auto path = paths[i];\nconst auto array = path_2_array[path][r_d];\n- std::partial_sort(llr_indexes[r_d].begin(), llr_indexes[r_d].begin() +2, llr_indexes[r_d].end(),\n- [this, array, off_l](int x, int y) {\n- return std::abs(l[array][off_l + x]) < std::abs(l[array][off_l + y]);\n- });\n+// std::partial_sort(llr_indexes[r_d].begin(), llr_indexes[r_d].begin() +2, llr_indexes[r_d].end(),\n+// [this, array, off_l](int x, int y) {\n+// return std::abs(l[array][off_l + x]) < std::abs(l[array][off_l + y]);\n+// });\n+//\n+// bit_flips[2 * path +0] = llr_indexes[r_d][0];\n+// bit_flips[2 * path +1] = llr_indexes[r_d][1];\n+\n+ auto bests_idx = sorters[r_d]->sort<R>(l[array].data() + off_l);\n- bit_flips[2 * path +0] = llr_indexes[r_d][0];\n- bit_flips[2 * path +1] = llr_indexes[r_d][1];\n+ bit_flips[2 * path +0] = bests_idx.first;\n+ bit_flips[2 * path +1] = bests_idx.second;\nconst auto abs0 = std::abs(l[array][off_l + bit_flips[2 * path +0]]);\nconst auto abs1 = std::abs(l[array][off_l + bit_flips[2 * path +1]]);\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve the partial sort speed in r1 leaves.
8,490
07.02.2017 13:54:24
-3,600
91cdaf800cef926fd991dd35def825972b8fdaf6
Add some colors.
[ { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -781,13 +781,13 @@ void Launcher<B,R,Q>\n{\n// launch the simulation\nif (params.simulation.mpi_rank == 0)\n- stream << \"# The simulation is running...\" << std::endl;\n+ stream << \"# \" << bold_blue(\"The simulation is running...\") << std::endl;\n// print the warnings\nif (params.simulation.mpi_rank == 0)\nstream << bold_yellow(cmd_warn);\nsimu->launch();\nif (params.simulation.mpi_rank == 0)\n- stream << \"# End of the simulation.\" << std::endl;\n+ stream << \"# \" << bold_blue(\"End of the simulation.\") << std::endl;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.cpp", "new_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.cpp", "diff": "@@ -206,10 +206,10 @@ void Terminal_BFER<B,R>\nstream << \" \";\nswitch (real_time_state)\n{\n- case 0: stream << bold(\"*\"); break;\n- case 1: stream << bold(\"*\"); break;\n- case 2: stream << bold(\" \"); break;\n- case 3: stream << bold(\" \"); break;\n+ case 0: stream << bold_green(\"*\"); break;\n+ case 1: stream << bold_green(\"*\"); break;\n+ case 2: stream << bold_green(\" \"); break;\n+ case 3: stream << bold_green(\" \"); break;\ndefault: break;\n}\nreal_time_state = (real_time_state +1) % 4;\n" } ]
C++
MIT License
aff3ct/aff3ct
Add some colors.
8,483
07.02.2017 14:56:10
-3,600
66638876610759174a005cbbd1256fe4a85e99ca
Return simulations with Es/N0 and Eb/N0 points. Take into arguments the type of SNR given (EB or ES)
[ { "change_type": "MODIFY", "old_path": "scripts/aff3ct_completion.sh", "new_path": "scripts/aff3ct_completion.sh", "diff": "@@ -44,14 +44,14 @@ _aff3ct() {\n]]\nthen\nopts=\"$opts --sim-snr-min -m --snr-min-max -M --sim-snr-step -s \\\n- --sim-stop-time --sim-threads -t --sim-domain --sim-prec -p \\\n- --sim-inter-lvl --cde-info-bits -K --cde-size -N --src-type \\\n- --src-path --enc-type --enc-path --mod-type --mod-bps --mod-ups \\\n- --mod-cpm-ws --mod-cpm-map --mod-cpm-L --mod-cpm-p --mod-cpm-k \\\n- --mod-cpm-std --mod-const-path --dmod-max --dmod-no-sig2 \\\n- --chn-type --chn-path --chn-blk-fad --qnt-type --qnt-int \\\n- --qnt-bits --qnt-range --dec-type --dec-implem --term-no \\\n- --term-freq --sim-seed --sim-mpi-comm --sim-pyber\"\n+ --sim-snr-type -E --sim-stop-time --sim-threads -t --sim-domain \\\n+ --sim-prec -p --sim-inter-lvl --cde-info-bits -K --cde-size -N \\\n+ --src-type --src-path --enc-type --enc-path --mod-type --mod-bps\\\n+ --mod-ups --mod-cpm-ws --mod-cpm-map --mod-cpm-L --mod-cpm-p \\\n+ --mod-cpm-k --mod-cpm-std --mod-const-path --dmod-max \\\n+ --dmod-no-sig2 --chn-type --chn-path --chn-blk-fad --qnt-type \\\n+ --qnt-int --qnt-bits --qnt-range --dec-type --dec-implem \\\n+ --term-no --term-freq --sim-seed --sim-mpi-comm --sim-pyber\"\nfi\n# add contents of Launcher_BFER.cpp\n@@ -225,6 +225,11 @@ _aff3ct() {\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n+ --sim-snr-type | -E)\n+ local params=\"EB ES\"\n+ COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n+ ;;\n+\n--cde-type)\nlocal params=\"POLAR TURBO LDPC REPETITION RA RSC UNCODED\"\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -50,7 +50,7 @@ Launcher<B,R,Q>\nparams.simulation .mpi_size = 1;\nparams.simulation .mpi_comm_freq = std::chrono::milliseconds(1000);\nparams.simulation .pyber = \"\";\n- params.simulation .snr_type = \"es\";\n+ params.simulation .snr_type = \"ES\";\nparams.code .tail_length = 0;\nparams.source .type = \"RAND\";\nparams.source .path = \"\";\n@@ -106,6 +106,10 @@ void Launcher<B,R,Q>\nopt_args[{\"sim-snr-step\", \"s\"}] =\n{\"positive_float\",\n\"signal/noise ratio step between each simulation.\"};\n+ opt_args[{\"sim-snr-type\", \"E\"}] =\n+ {\"string\",\n+ \"select the type of SNR: symbol energy or information bit energy.\",\n+ \"ES, EB\"};\nopt_args[{\"sim-type\"}] =\n{\"string\",\n\"select the type of simulation to launch (default is BFER).\",\n@@ -292,6 +296,7 @@ void Launcher<B,R,Q>\nif(ar.exist_arg({\"sim-type\" })) params.simulation.type = ar.get_arg ({\"sim-type\" });\nif(ar.exist_arg({\"sim-pyber\" })) params.simulation.pyber = ar.get_arg ({\"sim-pyber\" });\nif(ar.exist_arg({\"sim-snr-step\", \"s\" })) params.simulation.snr_step = ar.get_arg_float({\"sim-snr-step\", \"s\" });\n+ if(ar.exist_arg({\"sim-snr-type\", \"E\" })) params.simulation.snr_type = ar.get_arg ({\"sim-snr-type\", \"E\" });\nif(ar.exist_arg({\"sim-domain\" })) params.channel.domain = ar.get_arg ({\"sim-domain\" });\nif(ar.exist_arg({\"sim-inter-lvl\" })) params.simulation.inter_frame_level = ar.get_arg_int ({\"sim-inter-lvl\" });\nif(ar.exist_arg({\"sim-stop-time\" })) params.simulation.stop_time = seconds(ar.get_arg_int ({\"sim-stop-time\" }));\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Simulation_BFER.cpp", "new_path": "src/Simulation/BFER/Simulation_BFER.cpp", "diff": "@@ -31,6 +31,8 @@ Simulation_BFER_i<B,R,Q>\nbarrier(params.simulation.n_threads),\nsnr (0.f),\n+ snr_s (0.f),\n+ snr_b (0.f),\ncode_rate(0.f),\nsigma (0.f),\n@@ -112,12 +114,22 @@ void Simulation_BFER_i<B,R,Q>\ncode_rate = (float)(params.code.K / (float)(params.code.N + params.code.tail_length));\n- if(params.simulation.snr_type == \"eb\")\n+ if(params.simulation.snr_type == \"EB\")\n+ {\n+ snr_b = snr;\n+ snr_s = snr - 10.f * std::log10(code_rate * (float)params.modulator.bits_per_symbol);\n+\nsigma = std::sqrt((float)params.modulator.upsample_factor) /\n- std::sqrt(2.f * code_rate * (float)params.modulator.bits_per_symbol * std::pow(10.f, (snr / 10.f)));\n- else if(params.simulation.snr_type == \"es\")\n+ std::sqrt(2.f * code_rate * (float)params.modulator.bits_per_symbol * std::pow(10.f, (snr_b / 10.f)));\n+ }\n+ else if(params.simulation.snr_type == \"ES\")\n+ {\n+ snr_s = snr;\n+ snr_b = snr + 10.f * std::log10(code_rate * (float)params.modulator.bits_per_symbol);\n+\nsigma = std::sqrt((float)params.modulator.upsample_factor) /\n- std::sqrt(2.f * std::pow(10.f, (snr / 10.f)));\n+ std::sqrt(2.0f * std::pow(10.f, (snr_s / 10.f)));\n+ }\nthis->snr_precompute ();\nthis->_launch ();\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Simulation_BFER.hpp", "new_path": "src/Simulation/BFER/Simulation_BFER.hpp", "diff": "@@ -33,6 +33,8 @@ protected:\n// code specifications\nfloat snr;\n+ float snr_s;\n+ float snr_b;\nfloat code_rate;\nfloat sigma;\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp", "new_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp", "diff": "@@ -964,9 +964,9 @@ Terminal* Simulation_BFER<B,R,Q>\n::build_terminal()\n{\n#ifdef ENABLE_MPI\n- return Factory_terminal<B,R>::build(this->params, this->snr, monitor_red, this->t_snr);\n+ return Factory_terminal<B,R>::build(this->params, this->snr_s, this->snr_b, monitor_red, this->t_snr);\n#else\n- return Factory_terminal<B,R>::build(this->params, this->snr, monitor_red, this->t_snr, &d_decod_all_red);\n+ return Factory_terminal<B,R>::build(this->params, this->snr_s, this->snr_b, monitor_red, this->t_snr, &d_decod_all_red);\n#endif\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFERI/Simulation_BFERI.cpp", "new_path": "src/Simulation/BFERI/Simulation_BFERI.cpp", "diff": "@@ -31,6 +31,8 @@ Simulation_BFERI_i<B,R,Q>\nbarrier(params.simulation.n_threads),\nsnr (0.f),\n+ snr_s (0.f),\n+ snr_b (0.f),\ncode_rate(0.f),\nsigma (0.f),\n@@ -116,12 +118,22 @@ void Simulation_BFERI_i<B,R,Q>\ncode_rate = (float)(params.code.K / (float)(params.code.N + params.code.tail_length));\n- if(params.simulation.snr_type == \"eb\")\n+ if(params.simulation.snr_type == \"EB\")\n+ {\n+ snr_b = snr;\n+ snr_s = snr + 10.f * std::log10(code_rate * (float)params.modulator.bits_per_symbol);\n+\nsigma = std::sqrt((float)params.modulator.upsample_factor) /\n- std::sqrt(2.f * code_rate * (float)params.modulator.bits_per_symbol * std::pow(10.f, (snr / 10.f)));\n- else if(params.simulation.snr_type == \"es\")\n+ std::sqrt(2.f * code_rate * (float)params.modulator.bits_per_symbol * std::pow(10.f, (snr_b / 10.f)));\n+ }\n+ else if(params.simulation.snr_type == \"ES\")\n+ {\n+ snr_s = snr;\n+ snr_b = snr - 10.f * std::log10(code_rate * (float)params.modulator.bits_per_symbol);\n+\nsigma = std::sqrt((float)params.modulator.upsample_factor) /\n- std::sqrt(2.0f * std::pow(10.f, (snr / 10.f)));\n+ std::sqrt(2.0f * std::pow(10.f, (snr_s / 10.f)));\n+ }\nthis->snr_precompute ();\nthis->_launch ();\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFERI/Simulation_BFERI.hpp", "new_path": "src/Simulation/BFERI/Simulation_BFERI.hpp", "diff": "@@ -34,6 +34,8 @@ protected:\n// code specifications\nfloat snr;\n+ float snr_s;\n+ float snr_b;\nfloat code_rate;\nfloat sigma;\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp", "new_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp", "diff": "@@ -912,9 +912,9 @@ Terminal* Simulation_BFERI<B,R,Q>\n::build_terminal(const int tid)\n{\n#ifdef ENABLE_MPI\n- return Factory_terminal<B,R>::build(this->params, this->snr, monitor_red, this->t_snr);\n+ return Factory_terminal<B,R>::build(this->params, this->snr_s, this->snr_b, monitor_red, this->t_snr);\n#else\n- return Factory_terminal<B,R>::build(this->params, this->snr, monitor_red, this->t_snr, &d_decod_total_red);\n+ return Factory_terminal<B,R>::build(this->params, this->snr_s, this->snr_b, monitor_red, this->t_snr, &d_decod_total_red);\n#endif\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.cpp", "new_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.cpp", "diff": "template <typename B, typename R>\nTerminal_BFER<B,R>\n-::Terminal_BFER(const R& snr,\n+::Terminal_BFER(const R& snr_s,\n+ const R& snr_b,\nconst Monitor<B> &monitor,\nconst std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> &t_snr,\nconst std::chrono::nanoseconds *d_decod_total)\n-: snr(snr),\n+: snr_s (snr_s ),\n+ snr_b (snr_b ),\nmonitor (monitor ),\nt_snr (t_snr ),\nd_decod_total (d_decod_total),\n@@ -47,48 +49,48 @@ void Terminal_BFER<B,R>\n#ifdef _WIN32\nif (this->d_decod_total == nullptr)\n{\n- stream << \"# \" << bold(\"------------------------------------------------------------------||---------------------\") << std::endl;\n+ stream << \"# \" << bold(\"---------------------------------------------------------------------------||---------------------\") << std::endl;\nstream << \"# \" << bold(\" Bit Error Rate (BER) and Frame Error Rate (FER) depending || Global throughput \") << std::endl;\n- stream << \"# \" << bold(\" on the Signal Noise Ratio (SNR) Eb/N0 || and elapsed time \") << std::endl;\n- stream << \"# \" << bold(\"------------------------------------------------------------------||---------------------\") << std::endl;\n- stream << \"# \" << bold(\"------|-----------|-----------|-----------|-----------|-----------||----------|----------\") << std::endl;\n- stream << \"# \" << bold(\" SNR | FRA | BE | FE | BER | FER || SIM_CTHR | ET/RT \") << std::endl;\n- stream << \"# \" << bold(\" (dB) | | | | | || (Mb/s) | (hhmmss) \") << std::endl;\n- stream << \"# \" << bold(\"------|-----------|-----------|-----------|-----------|-----------||----------|----------\") << std::endl;\n+ stream << \"# \" << bold(\" on the Signal Noise Ratio (SNR) || and elapsed time \") << std::endl;\n+ stream << \"# \" << bold(\"---------------------------------------------------------------------------||---------------------\") << std::endl;\n+ stream << \"# \" << bold(\"-------|-------|-----------|-----------|-----------|-----------|-----------||----------|----------\") << std::endl;\n+ stream << \"# \" << bold(\" Es/N0 | Eb/N0 | FRA | BE | FE | BER | FER || SIM_CTHR | ET/RT \") << std::endl;\n+ stream << \"# \" << bold(\" (dB) | (dB) | | | | | || (Mb/s) | (hhmmss) \") << std::endl;\n+ stream << \"# \" << bold(\"-------|-------|-----------|-----------|-----------|-----------|-----------||----------|----------\") << std::endl;\n}\nelse\n{\n- stream << \"# \" << bold(\"------------------------------------------------------------------||---------------------------------||---------------------\") << std::endl;\n+ stream << \"# \" << bold(\"---------------------------------------------------------------------------||---------------------------------||---------------------\") << std::endl;\nstream << \"# \" << bold(\" Bit Error Rate (BER) and Frame Error Rate (FER) depending || Decoder throughput and || Global throughput \") << std::endl;\n- stream << \"# \" << bold(\" on the Signal Noise Ratio (SNR) Eb/N0 || latency (per thread) || and elapsed time \") << std::endl;\n- stream << \"# \" << bold(\"------------------------------------------------------------------||---------------------------------||---------------------\") << std::endl;\n- stream << \"# \" << bold(\"------|-----------|-----------|-----------|-----------|-----------||----------|----------|-----------||----------|----------\") << std::endl;\n- stream << \"# \" << bold(\" SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT \") << std::endl;\n- stream << \"# \" << bold(\" (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss) \") << std::endl;\n- stream << \"# \" << bold(\"------|-----------|-----------|-----------|-----------|-----------||----------|----------|-----------||----------|----------\") << std::endl;\n+ stream << \"# \" << bold(\" on the Signal Noise Ratio (SNR) || latency (per thread) || and elapsed time \") << std::endl;\n+ stream << \"# \" << bold(\"---------------------------------------------------------------------------||---------------------------------||---------------------\") << std::endl;\n+ stream << \"# \" << bold(\"-------|-------|-----------|-----------|-----------|-----------|-----------||----------|----------|-----------||----------|----------\") << std::endl;\n+ stream << \"# \" << bold(\" Es/N0 | Eb/N0 | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT \") << std::endl;\n+ stream << \"# \" << bold(\" (dB) | (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss) \") << std::endl;\n+ stream << \"# \" << bold(\"-------|-------|-----------|-----------|-----------|-----------|-----------||----------|----------|-----------||----------|----------\") << std::endl;\n}\n#else\nif (this->d_decod_total == nullptr)\n{\n- stream << \"# \" << bold(\"-------------------------------------------------------------||---------------------\") << std::endl;\n+ stream << \"# \" << bold(\"----------------------------------------------------------------------||---------------------\") << std::endl;\nstream << \"# \" << bold(\" Bit Error Rate (BER) and Frame Error Rate (FER) depending || Global throughput \") << std::endl;\n- stream << \"# \" << bold(\" on the Signal Noise Ratio (SNR) Eb/N0 || and elapsed time \") << std::endl;\n- stream << \"# \" << bold(\"-------------------------------------------------------------||---------------------\") << std::endl;\n- stream << \"# \" << bold(\"------|----------|----------|----------|----------|----------||----------|----------\") << std::endl;\n- stream << \"# \" << bold(\" SNR | FRA | BE | FE | BER | FER || SIM_CTHR | ET/RT \") << std::endl;\n- stream << \"# \" << bold(\" (dB) | | | | | || (Mb/s) | (hhmmss) \") << std::endl;\n- stream << \"# \" << bold(\"------|----------|----------|----------|----------|----------||----------|----------\") << std::endl;\n+ stream << \"# \" << bold(\" on the Signal Noise Ratio (SNR) || and elapsed time \") << std::endl;\n+ stream << \"# \" << bold(\"----------------------------------------------------------------------||---------------------\") << std::endl;\n+ stream << \"# \" << bold(\"-------|-------|----------|----------|----------|----------|----------||----------|----------\") << std::endl;\n+ stream << \"# \" << bold(\" Es/N0 | Eb/N0 | FRA | BE | FE | BER | FER || SIM_CTHR | ET/RT \") << std::endl;\n+ stream << \"# \" << bold(\" (dB) | (dB) | | | | | || (Mb/s) | (hhmmss) \") << std::endl;\n+ stream << \"# \" << bold(\"-------|-------|----------|----------|----------|----------|----------||----------|----------\") << std::endl;\n}\nelse\n{\n- stream << \"# \" << bold(\"-------------------------------------------------------------||--------------------------------||---------------------\") << std::endl;\n+ stream << \"# \" << bold(\"----------------------------------------------------------------------||--------------------------------||---------------------\") << std::endl;\nstream << \"# \" << bold(\" Bit Error Rate (BER) and Frame Error Rate (FER) depending || Decoder throughput and || Global throughput \") << std::endl;\n- stream << \"# \" << bold(\" on the Signal Noise Ratio (SNR) Eb/N0 || latency (per thread) || and elapsed time \") << std::endl;\n- stream << \"# \" << bold(\"-------------------------------------------------------------||--------------------------------||---------------------\") << std::endl;\n- stream << \"# \" << bold(\"------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\") << std::endl;\n- stream << \"# \" << bold(\" SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT \") << std::endl;\n- stream << \"# \" << bold(\" (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss) \") << std::endl;\n- stream << \"# \" << bold(\"------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\") << std::endl;\n+ stream << \"# \" << bold(\" on the Signal Noise Ratio (SNR) || latency (per thread) || and elapsed time \") << std::endl;\n+ stream << \"# \" << bold(\"----------------------------------------------------------------------||--------------------------------||---------------------\") << std::endl;\n+ stream << \"# \" << bold(\"-------|-------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\") << std::endl;\n+ stream << \"# \" << bold(\" Es/N0 | Eb/N0 | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT \") << std::endl;\n+ stream << \"# \" << bold(\" (dB) | (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss) \") << std::endl;\n+ stream << \"# \" << bold(\"-------|-------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\") << std::endl;\n}\n#endif\n}\n@@ -151,7 +153,8 @@ void Terminal_BFER<B,R>\nauto l1 = 99999999; // limit 1\nauto l2 = 99999.99f; // limit 2\nstream << \" \";\n- stream << setprecision( 2) << fixed << setw(5) << snr << bold(\" | \");\n+ stream << setprecision( 2) << fixed << setw(6) << snr_s << bold(\" |\");\n+ stream << setprecision( 2) << fixed << setw(6) << snr_b << bold(\" | \");\nstream << setprecision((fra > l0) ? 2 : 0) << ((fra > l0) ? scientific : fixed) << setw(9) << ((fra > l0) ? (float)fra : fra) << bold(\" | \");\nstream << setprecision(( be > l1) ? 2 : 0) << ((be > l1) ? scientific : fixed) << setw(9) << (( be > l1) ? (float) be : be) << bold(\" | \");\nstream << setprecision(( fe > l1) ? 2 : 0) << ((fe > l1) ? scientific : fixed) << setw(9) << (( fe > l1) ? (float) fe : fe) << bold(\" | \");\n@@ -173,7 +176,8 @@ void Terminal_BFER<B,R>\nauto l1 = 99999999; // limit 1\nauto l2 = 99999.99f; // limit 2\nstream << \" \";\n- stream << setprecision( 2) << fixed << setw(5) << snr << bold(\" | \");\n+ stream << setprecision( 2) << fixed << setw(6) << snr_s << bold(\" |\");\n+ stream << setprecision( 2) << fixed << setw(6) << snr_b << bold(\" | \");\nstream << setprecision((fra > l0) ? 2 : 0) << ((fra > l0) ? scientific : fixed) << setw(8) << ((fra > l0) ? (float)fra : fra) << bold(\" | \");\nstream << setprecision(( be > l1) ? 2 : 0) << ((be > l1) ? scientific : fixed) << setw(8) << (( be > l1) ? (float) be : be) << bold(\" | \");\nstream << setprecision(( fe > l1) ? 2 : 0) << ((fe > l1) ? scientific : fixed) << setw(8) << (( fe > l1) ? (float) fe : fe) << bold(\" | \");\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.hpp", "new_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.hpp", "diff": "@@ -11,14 +11,16 @@ template <typename B, typename R>\nclass Terminal_BFER : public Terminal\n{\nprotected:\n- const R snr;\n+ const R snr_s;\n+ const R snr_b;\nconst Monitor<B> &monitor;\nconst std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> &t_snr;\nconst std::chrono::nanoseconds *d_decod_total;\nunsigned short real_time_state;\npublic:\n- Terminal_BFER(const R& snr,\n+ Terminal_BFER(const R& snr_s,\n+ const R& snr_b,\nconst Monitor<B> &monitor,\nconst std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> &t_snr,\nconst std::chrono::nanoseconds *d_decod_total = nullptr);\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Factory/Factory_terminal.cpp", "new_path": "src/Tools/Factory/Factory_terminal.cpp", "diff": "template <typename B, typename R>\nTerminal* Factory_terminal<B,R>\n::build(const parameters &params,\n- const R snr,\n+ const R snr_s,\n+ const R snr_b,\nconst Monitor<B> *monitor,\nconst std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> &t_snr,\nconst std::chrono::nanoseconds *d_decod_total)\n@@ -15,9 +16,9 @@ Terminal* Factory_terminal<B,R>\n// build a terminal to display the BER/FER\nif(params.terminal.type == \"LEGACY\")\n- terminal = new Terminal_BFER_legacy<B,R>(snr, *monitor, t_snr);\n+ terminal = new Terminal_BFER_legacy<B,R>(snr_s, *monitor, t_snr);\nelse if (params.terminal.type == \"STD\")\n- terminal = new Terminal_BFER<B,R>(snr, *monitor, t_snr, d_decod_total);\n+ terminal = new Terminal_BFER<B,R>(snr_s, snr_b, *monitor, t_snr, d_decod_total);\nreturn terminal;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Factory/Factory_terminal.hpp", "new_path": "src/Tools/Factory/Factory_terminal.hpp", "diff": "@@ -11,7 +11,8 @@ template <typename B, typename R>\nstruct Factory_terminal : public Factory\n{\nstatic Terminal* build(const parameters &params,\n- const R snr,\n+ const R snr_s,\n+ const R snr_b,\nconst Monitor<B> *monitor,\nconst std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> &t_snr,\nconst std::chrono::nanoseconds *d_decod_total = nullptr);\n" } ]
C++
MIT License
aff3ct/aff3ct
Return simulations with Es/N0 and Eb/N0 points. Take into arguments the type of SNR given (EB or ES)
8,490
08.02.2017 18:06:17
-3,600
163268e0d63913d6dd91b63896606cf24ef24eaa
Add the blend instruction to mipp.
[ { "change_type": "MODIFY", "old_path": "src/Tools/Perf/MIPP/mipp.h", "new_path": "src/Tools/Perf/MIPP/mipp.h", "diff": "@@ -422,6 +422,7 @@ template <typename T> inline void sincos (const reg, reg&, reg&)\ntemplate <typename T> inline reg fmadd (const reg, const reg, const reg) { errorMessage<T>(\"fmadd\"); exit(-1); }\ntemplate <typename T> inline reg fnmadd (const reg, const reg, const reg) { errorMessage<T>(\"fnmadd\"); exit(-1); }\ntemplate <typename T> inline reg fmsub (const reg, const reg, const reg) { errorMessage<T>(\"fmsub\"); exit(-1); }\n+template <typename T> inline reg blend (const reg, const reg, const reg) { errorMessage<T>(\"blend\"); exit(-1); }\ntemplate <typename T> inline reg rot (const reg) { errorMessage<T>(\"rot\"); exit(-1); }\ntemplate <typename T> inline reg rotr (const reg) { errorMessage<T>(\"rotr\"); exit(-1); }\ntemplate <typename T> inline reg div2 (const reg) { errorMessage<T>(\"div2\"); exit(-1); }\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Perf/MIPP/mipp_impl_AVX.hxx", "new_path": "src/Tools/Perf/MIPP/mipp_impl_AVX.hxx", "diff": "}\n#endif\n+ // ---------------------------------------------------------------------------------------------------------- blend\n+ template <>\n+ inline reg blend<double>(const reg v1, const reg v2, const reg m) {\n+ return _mm256_castpd_ps(_mm256_blendv_pd(_mm256_castps_pd(v1), _mm256_castps_pd(v2), _mm256_castps_pd(m)));\n+ }\n+\n+ template <>\n+ inline reg blend<float>(const reg v1, const reg v2, const reg m) {\n+ return _mm256_blendv_ps(v1, v2, m);\n+ }\n+\n+ template <>\n+ inline reg blend<int>(const reg v1, const reg v2, const reg m) {\n+ return _mm256_blendv_ps(v1, v2, m);\n+ }\n+\n+#ifdef __AVX2__\n+ template <>\n+ inline reg blend<short>(const reg v1, const reg v2, const reg m) {\n+ return _mm256_castsi256_ps(_mm256_blendv_epi8(_mm256_castps_si256(v1),\n+ _mm256_castps_si256(v2),\n+ _mm256_castps_si256(m )));\n+ }\n+\n+ template <>\n+ inline reg blend<signed char>(const reg v1, const reg v2, const reg m) {\n+ return _mm256_castsi256_ps(_mm256_blendv_epi8(_mm256_castps_si256(v1),\n+ _mm256_castps_si256(v2),\n+ _mm256_castps_si256(m )));\n+ }\n+#endif\n+\n// ------------------------------------------------------------------------------------------------------------ rot\n#ifdef __AVX2__\ntemplate <>\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Perf/MIPP/mipp_impl_SSE.hxx", "new_path": "src/Tools/Perf/MIPP/mipp_impl_SSE.hxx", "diff": "return sub<double>(mul<double>(v1, v2), v3);\n}\n+ // ---------------------------------------------------------------------------------------------------------- blend\n+#ifdef __SSE4_1__\n+ template <>\n+ inline reg blend<double>(const reg v1, const reg v2, const reg m) {\n+ return _mm_castpd_ps(_mm_blendv_pd(_mm_castps_pd(v1), _mm_castps_pd(v2), _mm_castps_pd(m)));\n+ }\n+\n+ template <>\n+ inline reg blend<float>(const reg v1, const reg v2, const reg m) {\n+ return _mm_blendv_ps(v1, v2, m);\n+ }\n+\n+ template <>\n+ inline reg blend<int>(const reg v1, const reg v2, const reg m) {\n+ return _mm_blendv_ps(v1, v2, m);\n+ }\n+\n+ template <>\n+ inline reg blend<short>(const reg v1, const reg v2, const reg m) {\n+ return _mm_castsi128_ps(_mm_blendv_epi8(_mm_castps_si128(v1), _mm_castps_si128(v2), _mm_castps_si128(m)));\n+ }\n+\n+ template <>\n+ inline reg blend<signed char>(const reg v1, const reg v2, const reg m) {\n+ return _mm_castsi128_ps(_mm_blendv_epi8(_mm_castps_si128(v1), _mm_castps_si128(v2), _mm_castps_si128(m)));\n+ }\n+#endif\n+\n// ------------------------------------------------------------------------------------------------------------ rot\n#ifdef __SSE2__\ntemplate <>\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Perf/MIPP/mipp_object.hxx", "new_path": "src/Tools/Perf/MIPP/mipp_object.hxx", "diff": "@@ -184,6 +184,7 @@ public:\ninline Reg<T> fmadd (const Reg<T> v1, const Reg<T> v2) const { return mipp::fmadd <T>(r, v1.r, v2.r); }\ninline Reg<T> fnmadd (const Reg<T> v1, const Reg<T> v2) const { return mipp::fnmadd <T>(r, v1.r, v2.r); }\ninline Reg<T> fmsub (const Reg<T> v1, const Reg<T> v2) const { return mipp::fmsub <T>(r, v1.r, v2.r); }\n+ inline Reg<T> blend (const Reg<T> v1, const Reg<T> m ) const { return mipp::blend <T>(r, v1.r, m.r); }\ninline Reg<T> rot () const { return mipp::rot <T>(r); }\ninline Reg<T> rotr () const { return mipp::rotr <T>(r); }\ninline Reg<T> div2 () const { return mipp::div2 <T>(r); }\n@@ -238,6 +239,7 @@ public:\ninline Reg<T> fmadd (const Reg<T> v1, const Reg<T> v2) const { return r * v1.r + v2.r; }\ninline Reg<T> fnmadd (const Reg<T> v1, const Reg<T> v2) const { return -(r * v1.r + v2.r); }\ninline Reg<T> fmsub (const Reg<T> v1, const Reg<T> v2) const { return r * v1.r - v2.r; }\n+ inline Reg<T> blend (const Reg<T> v1, const Reg<T> m ) const { return (m.r) ? v1.r : r; }\ninline Reg<T> rot () const { return r; }\ninline Reg<T> rotr () const { return r; }\ninline Reg<T> div2 () const { return mipp_scop::div2<T>(r); }\n@@ -415,6 +417,7 @@ template <typename T> inline void sincos (const Reg<T> x, Reg<T\ntemplate <typename T> inline Reg<T> fmadd (const Reg<T> v1, const Reg<T> v2, const Reg<T> v3) { return v1.fmadd(v2, v3); }\ntemplate <typename T> inline Reg<T> fnmadd (const Reg<T> v1, const Reg<T> v2, const Reg<T> v3) { return v1.fnmadd(v2, v3); }\ntemplate <typename T> inline Reg<T> fmsub (const Reg<T> v1, const Reg<T> v2, const Reg<T> v3) { return v1.fmsub(v2, v3); }\n+template <typename T> inline Reg<T> blend (const Reg<T> v1, const Reg<T> v2, const Reg<T> m ) { return v1.blend(v2, m ); }\ntemplate <typename T> inline Reg<T> rot (const Reg<T> v) { return v.rot(); }\ntemplate <typename T> inline Reg<T> rotr (const Reg<T> v) { return v.rotr(); }\ntemplate <typename T> inline Reg<T> div2 (const Reg<T> v) { return v.div2(); }\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the blend instruction to mipp.
8,490
08.02.2017 18:06:54
-3,600
c55acbb38f758a3655e39a02f848906e0930f4ca
Improve the LC_sorter.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "diff": "@@ -36,7 +36,14 @@ protected:\nstd::vector<std::vector<int>> n_array_ref; // number of times an array is used\nstd::vector<std::vector<int>> path_2_array; // give array used by a path\n- std::vector<LC_sorter*> sorters;\n+ std::vector<LC_sorter<R>*> sorters_llr;\n+ LC_sorter<R> sorters_r1_m;\n+ LC_sorter<R> sorters_rep_m;\n+ LC_sorter<R> sorters_spc_m;\n+\n+ std::vector<int> best_idx_r1;\n+ std::vector<int> best_idx_spc;\n+ std::vector<int> best_idx_m;\npublic:\nDecoder_polar_SCL_fast_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits,\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -86,7 +86,13 @@ Decoder_polar_SCL_fast_sys<B,R,API_polar>\nn_active_paths(1),\nn_array_ref (L, std::vector<int>(m)),\npath_2_array (L, std::vector<int>(m)),\n- sorters (std::log2(N) +1, nullptr)\n+ sorters_llr (std::log2(N) +1, nullptr),\n+ sorters_r1_m (L * 4),\n+ sorters_rep_m (L * 2),\n+ sorters_spc_m (L * 8),\n+ best_idx_r1 (2),\n+ best_idx_spc (4),\n+ best_idx_m (L)\n{\nstatic_assert(API_polar::get_n_frames() == 1, \"The inter-frame API_polar is not supported.\");\nstatic_assert(sizeof(B) == sizeof(R), \"Sizes of the bits and reals have to be identical.\");\n@@ -112,7 +118,7 @@ Decoder_polar_SCL_fast_sys<B,R,API_polar>\nauto n_elmts = 1;\nfor (auto i = 0; i <= std::log2(N); i++)\n{\n- sorters[i] = new LC_sorter(n_elmts);\n+ sorters_llr[i] = new LC_sorter<R>(n_elmts);\nn_elmts <<= 1;\n}\n}\n@@ -123,7 +129,7 @@ Decoder_polar_SCL_fast_sys<B,R,API_polar>\n{\npolar_patterns.release_patterns();\nfor (auto i = 0; i <= std::log2(this->N); i++)\n- delete sorters[i];\n+ delete sorters_llr[i];\n}\ntemplate <typename B, typename R, class API_polar>\n@@ -471,10 +477,10 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n// bit_flips[2 * path +0] = llr_indexes[r_d][0];\n// bit_flips[2 * path +1] = llr_indexes[r_d][1];\n- auto bests_idx = sorters[r_d]->sort<R>(l[array].data() + off_l);\n+ sorters_llr[r_d]->sort_simd(l[array].data() + off_l, best_idx_r1);\n- bit_flips[2 * path +0] = bests_idx.first;\n- bit_flips[2 * path +1] = bests_idx.second;\n+ bit_flips[2 * path +0] = best_idx_r1[0];\n+ bit_flips[2 * path +1] = best_idx_r1[1];\nconst auto abs0 = std::abs(l[array][off_l + bit_flips[2 * path +0]]);\nconst auto abs1 = std::abs(l[array][off_l + bit_flips[2 * path +1]]);\n@@ -489,31 +495,57 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nfor (auto j = 0; j < 4; j++)\nmetrics_vec[1][4 * paths[i] +j] = std::numeric_limits<R>::max();\n+// // L first of the lists are the L best paths\n+// const auto n_list = (n_active_paths * 4 >= L) ? L : n_active_paths * 4;\n+// std::partial_sort(metrics_idx[1].begin(), metrics_idx[1].begin() + n_list, metrics_idx[1].begin() + L * 4,\n+// [this](int x, int y) {\n+// return metrics_vec[1][x] < metrics_vec[1][y];\n+// });\n+//\n+// // count the number of duplications per path\n+// for (auto i = 0; i < n_list; i++)\n+// dup_count[metrics_idx[1][i] / 4]++;\n+//\n+// // erase bad paths\n+// erase_bad_paths();\n+//\n+// for (auto i = 0; i < n_list; i++)\n+// {\n+// const auto path = metrics_idx[1][i] / 4;\n+// const auto dup = metrics_idx[1][i] % 4;\n+// const auto array = path_2_array[path][r_d];\n+//\n+// API_polar::h(s[path], l[array], off_l, off_s, n_elmts);\n+//\n+// const auto new_path = (dup_count[path] > 1) ? duplicate_tree(path, off_l, off_s, n_elmts) : path;\n+// flip_bits_r1(path, new_path, dup, off_s, n_elmts);\n+// metrics[new_path] = metrics_vec[1][metrics_idx[1][i]];\n+//\n+// dup_count[path]--;\n+// }\n+\n// L first of the lists are the L best paths\nconst auto n_list = (n_active_paths * 4 >= L) ? L : n_active_paths * 4;\n- std::partial_sort(metrics_idx[1].begin(), metrics_idx[1].begin() + n_list, metrics_idx[1].begin() + L * 4,\n- [this](int x, int y) {\n- return metrics_vec[1][x] < metrics_vec[1][y];\n- });\n+ sorters_r1_m.sort(metrics_vec[1].data(), best_idx_m, n_list);\n// count the number of duplications per path\nfor (auto i = 0; i < n_list; i++)\n- dup_count[metrics_idx[1][i] / 4]++;\n+ dup_count[best_idx_m[i] / 4]++;\n// erase bad paths\nerase_bad_paths();\nfor (auto i = 0; i < n_list; i++)\n{\n- const auto path = metrics_idx[1][i] / 4;\n- const auto dup = metrics_idx[1][i] % 4;\n+ const auto path = best_idx_m[i] / 4;\n+ const auto dup = best_idx_m[i] % 4;\nconst auto array = path_2_array[path][r_d];\nAPI_polar::h(s[path], l[array], off_l, off_s, n_elmts);\nconst auto new_path = (dup_count[path] > 1) ? duplicate_tree(path, off_l, off_s, n_elmts) : path;\nflip_bits_r1(path, new_path, dup, off_s, n_elmts);\n- metrics[new_path] = metrics_vec[1][metrics_idx[1][i]];\n+ metrics[new_path] = metrics_vec[1][best_idx_m[i]];\ndup_count[path]--;\n}\n@@ -676,15 +708,22 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n}\nelse // n_active_paths == L\n{\n+// // sort hypothetic metrics\n+// std::sort(metrics_idx[0].begin(), metrics_idx[0].begin() + L * 2,\n+// [this](int x, int y) {\n+// return metrics_vec[0][x] < metrics_vec[0][y];\n+// });\n+//\n+// // count the number of duplications per path\n+// for (auto i = 0; i < L; i++)\n+// dup_count[metrics_idx[0][i] / 2]++;\n+\n// sort hypothetic metrics\n- std::sort(metrics_idx[0].begin(), metrics_idx[0].begin() + L * 2,\n- [this](int x, int y) {\n- return metrics_vec[0][x] < metrics_vec[0][y];\n- });\n+ sorters_rep_m.sort(metrics_vec[0].data(), best_idx_m, L);\n// count the number of duplications per path\nfor (auto i = 0; i < L; i++)\n- dup_count[metrics_idx[0][i] / 2]++;\n+ dup_count[best_idx_m[i] / 2]++;\n// erase bad paths\nerase_bad_paths();\n@@ -842,13 +881,18 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst auto path = paths[i];\nconst auto array = path_2_array[paths[i]][r_d];\n- std::partial_sort(llr_indexes[r_d].begin(), llr_indexes[r_d].begin() +4, llr_indexes[r_d].end(),\n- [this, array, off_l](int x, int y){\n- return std::abs(l[array][off_l + x]) < std::abs(l[array][off_l + y]);\n- });\n+// std::partial_sort(llr_indexes[r_d].begin(), llr_indexes[r_d].begin() +4, llr_indexes[r_d].end(),\n+// [this, array, off_l](int x, int y){\n+// return std::abs(l[array][off_l + x]) < std::abs(l[array][off_l + y]);\n+// });\n+//\n+// for (auto j = 0; j < 4; j++)\n+// bit_flips[4 * path +j] = llr_indexes[r_d][j];\n+\n+ sorters_llr[r_d]->sort_simd(l[array].data() + off_l, best_idx_spc);\nfor (auto j = 0; j < 4; j++)\n- bit_flips[4 * path +j] = llr_indexes[r_d][j];\n+ bit_flips[4 * path +j] = best_idx_spc[j];\nauto sum = 0;\nfor (auto j = 0; j < n_elmts; j++)\n@@ -878,31 +922,57 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nfor (auto j = 0; j < n_cands; j++)\nmetrics_vec[2][n_cands * paths[i] +j] = std::numeric_limits<R>::max();\n+// // L first of the lists are the L best paths\n+// const auto n_list = (n_active_paths * n_cands >= L) ? L : n_active_paths * n_cands;\n+// std::partial_sort(metrics_idx[2].begin(), metrics_idx[2].begin() + n_list, metrics_idx[2].begin() + n_cands * L,\n+// [this](int x, int y){\n+// return metrics_vec[2][x] < metrics_vec[2][y];\n+// });\n+//\n+// // count the number of duplications per path\n+// for (auto i = 0; i < n_list; i++)\n+// dup_count[metrics_idx[2][i] / n_cands]++;\n+//\n+// // erase bad paths\n+// erase_bad_paths();\n+//\n+// for (auto i = 0; i < n_list; i++)\n+// {\n+// const auto path = metrics_idx[2][i] / n_cands;\n+// const auto dup = metrics_idx[2][i] % n_cands;\n+// const auto array = path_2_array[path][r_d];\n+//\n+// API_polar::h(s[path], l[array], off_l, off_s, n_elmts);\n+//\n+// const auto new_path = (dup_count[path] > 1) ? duplicate_tree(path, off_l, off_s, n_elmts) : path;\n+// flip_bits_spc(path, new_path, dup, off_s, n_elmts);\n+// metrics[new_path] = metrics_vec[2][metrics_idx[2][i]];\n+//\n+// dup_count[path]--;\n+// }\n+\n// L first of the lists are the L best paths\nconst auto n_list = (n_active_paths * n_cands >= L) ? L : n_active_paths * n_cands;\n- std::partial_sort(metrics_idx[2].begin(), metrics_idx[2].begin() + n_list, metrics_idx[2].begin() + n_cands * L,\n- [this](int x, int y){\n- return metrics_vec[2][x] < metrics_vec[2][y];\n- });\n+ sorters_spc_m.sort(metrics_vec[2].data(), best_idx_m, n_list);\n// count the number of duplications per path\nfor (auto i = 0; i < n_list; i++)\n- dup_count[metrics_idx[2][i] / n_cands]++;\n+ dup_count[best_idx_m[i] / n_cands]++;\n// erase bad paths\nerase_bad_paths();\nfor (auto i = 0; i < n_list; i++)\n{\n- const auto path = metrics_idx[2][i] / n_cands;\n- const auto dup = metrics_idx[2][i] % n_cands;\n+ const auto path = best_idx_m[i] / n_cands;\n+ const auto dup = best_idx_m[i] % n_cands;\nconst auto array = path_2_array[path][r_d];\nAPI_polar::h(s[path], l[array], off_l, off_s, n_elmts);\nconst auto new_path = (dup_count[path] > 1) ? duplicate_tree(path, off_l, off_s, n_elmts) : path;\nflip_bits_spc(path, new_path, dup, off_s, n_elmts);\n- metrics[new_path] = metrics_vec[2][metrics_idx[2][i]];\n+ metrics[new_path] = metrics_vec[2][best_idx_m[i]];\ndup_count[path]--;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve the LC_sorter.
8,490
09.02.2017 12:02:44
-3,600
24cec25b24c003ff89adc37cb86f9a629a410067
Add blend instr for NEON, reverse blend parameters order for SSE and AVX.
[ { "change_type": "MODIFY", "old_path": "src/Tools/Algo/Sort/LC_sorter.hpp", "new_path": "src/Tools/Algo/Sort/LC_sorter.hpp", "diff": "#include <vector>\n#include <algorithm>\n+//#include \"../mipp.h\"\n#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"Tools/Math/utils.h\"\n@@ -123,9 +124,9 @@ public:\nconst auto idx1 = mipp::Reg<int>(&tree_idx[offset + 2*j + 1*mipp::nElReg<T>()]); // load\nconst auto mask1 = val0 < val1;\n- const auto mask2 = mask1.template cvt<int>();\n+ const auto mask2 = mipp::Reg<int>(mask1.r);\nconst auto min = mipp::min(val0, val1);\n- const auto idx = mipp::blend(idx1, idx0, mask2);\n+ const auto idx = mipp::blend(idx0, idx1, mask2);\nmin.store(&vals [offset + n_elmts +j]); // store\nidx.store(&tree_idx[offset + n_elmts +j]); // store\n@@ -176,9 +177,9 @@ public:\nconst auto idx1 = mipp::Reg<int>(&tree_idx[offset + 2*j + 1*mipp::nElReg<T>()]); // load\nconst auto mask1 = val0 < val1;\n- const auto mask2 = mask1.template cvt<int>();\n+ const auto mask2 = mipp::Reg<int>(mask1.r);\nconst auto min = mipp::min(val0, val1);\n- const auto idx = mipp::blend(idx1, idx0, mask2);\n+ const auto idx = mipp::blend(idx0, idx1, mask2);\nmin.store(&vals [offset + n_elmts +j]); // store\nidx.store(&tree_idx[offset + n_elmts +j]); // store\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Perf/MIPP/mipp_impl_AVX.hxx", "new_path": "src/Tools/Perf/MIPP/mipp_impl_AVX.hxx", "diff": "// ---------------------------------------------------------------------------------------------------------- blend\ntemplate <>\ninline reg blend<double>(const reg v1, const reg v2, const reg m) {\n- return _mm256_castpd_ps(_mm256_blendv_pd(_mm256_castps_pd(v1), _mm256_castps_pd(v2), _mm256_castps_pd(m)));\n+ return _mm256_castpd_ps(_mm256_blendv_pd(_mm256_castps_pd(v2), _mm256_castps_pd(v1), _mm256_castps_pd(m)));\n}\ntemplate <>\ninline reg blend<float>(const reg v1, const reg v2, const reg m) {\n- return _mm256_blendv_ps(v1, v2, m);\n+ return _mm256_blendv_ps(v2, v1, m);\n}\ntemplate <>\ninline reg blend<int>(const reg v1, const reg v2, const reg m) {\n- return _mm256_blendv_ps(v1, v2, m);\n+ return _mm256_blendv_ps(v2, v1, m);\n}\n#ifdef __AVX2__\ntemplate <>\ninline reg blend<short>(const reg v1, const reg v2, const reg m) {\n- return _mm256_castsi256_ps(_mm256_blendv_epi8(_mm256_castps_si256(v1),\n- _mm256_castps_si256(v2),\n+ return _mm256_castsi256_ps(_mm256_blendv_epi8(_mm256_castps_si256(v2),\n+ _mm256_castps_si256(v1),\n_mm256_castps_si256(m )));\n}\ntemplate <>\ninline reg blend<signed char>(const reg v1, const reg v2, const reg m) {\n- return _mm256_castsi256_ps(_mm256_blendv_epi8(_mm256_castps_si256(v1),\n- _mm256_castps_si256(v2),\n+ return _mm256_castsi256_ps(_mm256_blendv_epi8(_mm256_castps_si256(v2),\n+ _mm256_castps_si256(v1),\n_mm256_castps_si256(m )));\n}\n#endif\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Perf/MIPP/mipp_impl_NEON.hxx", "new_path": "src/Tools/Perf/MIPP/mipp_impl_NEON.hxx", "diff": "return sub<float>(mul<float>(v1, v2), v3);\n}\n+ // ---------------------------------------------------------------------------------------------------------- blend\n+ template <>\n+ inline reg blend<float>(const reg v1, const reg v2, const reg m) {\n+ return (float32x4_t)vbslq_f32((uint32x4_t)m, (float32x4_t)v1, (float32x4_t)v2);\n+ }\n+\n+ template <>\n+ inline reg blend<int>(const reg v1, const reg v2, const reg m) {\n+ return (float32x4_t)vbslq_u32((uint32x4_t)m, (uint32x4_t)v1, (uint32x4_t)v2);\n+ }\n+\n+ template <>\n+ inline reg blend<short>(const reg v1, const reg v2, const reg m) {\n+ return (float32x4_t)vbslq_u16((uint16x8_t)m, (uint16x8_t)v1, (uint16x8_t)v2);\n+ }\n+\n+ template <>\n+ inline reg blend<signed char>(const reg v1, const reg v2, const reg m) {\n+ return (float32x4_t)vbslq_u8((uint8x16_t)m, (uint8x16_t)v1, (uint8x16_t)v2);\n+ }\n+\n// ------------------------------------------------------------------------------------------------------------ rot\ntemplate <>\ninline reg rot<float>(const reg v1) {\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Perf/MIPP/mipp_impl_SSE.hxx", "new_path": "src/Tools/Perf/MIPP/mipp_impl_SSE.hxx", "diff": "#ifdef __SSE4_1__\ntemplate <>\ninline reg blend<double>(const reg v1, const reg v2, const reg m) {\n- return _mm_castpd_ps(_mm_blendv_pd(_mm_castps_pd(v1), _mm_castps_pd(v2), _mm_castps_pd(m)));\n+ return _mm_castpd_ps(_mm_blendv_pd(_mm_castps_pd(v2), _mm_castps_pd(v1), _mm_castps_pd(m)));\n}\ntemplate <>\ninline reg blend<float>(const reg v1, const reg v2, const reg m) {\n- return _mm_blendv_ps(v1, v2, m);\n+ return _mm_blendv_ps(v2, v1, m);\n}\ntemplate <>\ninline reg blend<int>(const reg v1, const reg v2, const reg m) {\n- return _mm_blendv_ps(v1, v2, m);\n+ return _mm_blendv_ps(v2, v1, m);\n}\ntemplate <>\ninline reg blend<short>(const reg v1, const reg v2, const reg m) {\n- return _mm_castsi128_ps(_mm_blendv_epi8(_mm_castps_si128(v1), _mm_castps_si128(v2), _mm_castps_si128(m)));\n+ return _mm_castsi128_ps(_mm_blendv_epi8(_mm_castps_si128(v2), _mm_castps_si128(v1), _mm_castps_si128(m)));\n}\ntemplate <>\ninline reg blend<signed char>(const reg v1, const reg v2, const reg m) {\n- return _mm_castsi128_ps(_mm_blendv_epi8(_mm_castps_si128(v1), _mm_castps_si128(v2), _mm_castps_si128(m)));\n+ return _mm_castsi128_ps(_mm_blendv_epi8(_mm_castps_si128(v2), _mm_castps_si128(v1), _mm_castps_si128(m)));\n}\n#endif\n" } ]
C++
MIT License
aff3ct/aff3ct
Add blend instr for NEON, reverse blend parameters order for SSE and AVX.
8,490
09.02.2017 18:58:31
-3,600
885220b5bb4598c5b7a6a867c1d44dfe52341a91
Add/improve LC_sorter_simd.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "diff": "#include <vector>\n-#include \"../../../../Tools/Algo/Sort/LC_sorter.hpp\"\n+#include \"Tools/Algo/Sort/LC_sorter.hpp\"\n+#include \"Tools/Algo/Sort/LC_sorter_simd.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"../../Decoder.hpp\"\n#include \"../decoder_polar_functions.h\"\n@@ -35,6 +36,7 @@ protected:\nstd::vector<std::vector<int>> path_2_array; // give array used by a path\nLC_sorter<R> sorter;\n+ LC_sorter_simd<R> sorter_simd;\nstd::vector<int> best_idx;\nmipp::vector<R> l_tmp;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -85,6 +85,7 @@ Decoder_polar_SCL_fast_sys<B,R,API_polar>\nn_array_ref (L, std::vector<int>(m)),\npath_2_array (L, std::vector<int>(m)),\nsorter (N),\n+ sorter_simd (N),\nbest_idx (L),\nl_tmp (N)\n{\n@@ -438,8 +439,9 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst auto path = paths[i];\nconst auto array = path_2_array[path][r_d];\n- for (auto i = 0; i < n_elmts; i++) l_tmp[i] = std::abs(l[array][off_l +i]);\n- sorter.partial_sort_destructive(l_tmp.data(), best_idx, n_elmts, 2);\n+// for (auto i = 0; i < n_elmts; i++) l_tmp[i] = std::abs(l[array][off_l +i]);\n+// sorter.partial_sort_destructive(l_tmp.data(), best_idx, n_elmts, 2);\n+ sorter_simd.partial_sort_abs(l[array].data() + off_l, best_idx, n_elmts, 2);\nbit_flips[2 * path +0] = best_idx[0];\nbit_flips[2 * path +1] = best_idx[1];\n@@ -521,8 +523,9 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst auto path = paths[i];\nconst auto array = path_2_array[path][REV_D];\n- for (auto i = 0; i < N_ELMTS; i++) l_tmp[i] = std::abs(l[array][off_l +i]);\n- sorter.partial_sort_destructive(l_tmp.data(), best_idx, N_ELMTS, 2);\n+// for (auto i = 0; i < N_ELMTS; i++) l_tmp[i] = std::abs(l[array][off_l +i]);\n+// sorter.partial_sort_destructive(l_tmp.data(), best_idx, N_ELMTS, 2);\n+ sorter_simd.partial_sort_abs(l[array].data() + off_l, best_idx, N_ELMTS, 2);\nbit_flips[2 * path +0] = best_idx[0];\nbit_flips[2 * path +1] = best_idx[1];\n@@ -796,8 +799,9 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst auto path = paths[i];\nconst auto array = path_2_array[paths[i]][r_d];\n- for (auto i = 0; i < n_elmts; i++) l_tmp[i] = std::abs(l[array][off_l +i]);\n- sorter.partial_sort_destructive(l_tmp.data(), best_idx, n_elmts, 4);\n+// for (auto i = 0; i < n_elmts; i++) l_tmp[i] = std::abs(l[array][off_l +i]);\n+// sorter.partial_sort_destructive(l_tmp.data(), best_idx, n_elmts, 4);\n+ sorter_simd.partial_sort_abs(l[array].data() + off_l, best_idx, n_elmts, 4);\nfor (auto j = 0; j < 4; j++)\nbit_flips[4 * path +j] = best_idx[j];\n@@ -907,8 +911,9 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst auto path = paths[i];\nconst auto array = path_2_array[paths[i]][REV_D];\n- for (auto i = 0; i < N_ELMTS; i++) l_tmp[i] = std::abs(l[array][off_l +i]);\n- sorter.partial_sort_destructive(l_tmp.data(), best_idx, N_ELMTS, 4);\n+// for (auto i = 0; i < N_ELMTS; i++) l_tmp[i] = std::abs(l[array][off_l +i]);\n+// sorter.partial_sort_destructive(l_tmp.data(), best_idx, N_ELMTS, 4);\n+ sorter_simd.partial_sort_abs(l[array].data() + off_l, best_idx, N_ELMTS, 4);\nfor (auto j = 0; j < 4; j++)\nbit_flips[4 * path +j] = best_idx;\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Algo/Sort/LC_sorter.hpp", "new_path": "src/Tools/Algo/Sort/LC_sorter.hpp", "diff": "#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"Tools/Math/utils.h\"\n+template <typename T>\n+class LC_sorter_simd;\n+\ntemplate <typename T>\nclass LC_sorter\n{\n+ friend LC_sorter_simd<T>;\n+\nprivate:\nint max_elmts;\nmipp::vector<int> tree_idx;\n@@ -19,23 +24,18 @@ private:\npublic:\nLC_sorter(const int max_elmts) : max_elmts(max_elmts), vals(2 * max_elmts)\n{\n- assert(is_power_of_2(max_elmts));\n+ // assert(is_power_of_2(max_elmts));\ntree_idx.resize(2 * max_elmts -1);\nstd::iota(tree_idx.begin(), tree_idx.begin() + this->max_elmts, 0);\n}\n- int get_max_elmts()\n- {\n- return this->max_elmts;\n- }\n-\ninline void partial_sort_destructive(T* values, std::vector<int> &pos, int n_elmts = -1, int K = -1)\n{\nK = (K <= 0) ? (int)pos.size() : K;\nn_elmts = (n_elmts <= 0) ? max_elmts : n_elmts;\n- assert(is_power_of_2(n_elmts));\n+ // assert(is_power_of_2(n_elmts));\nauto depth = (int)std::log2(n_elmts);\n@@ -47,11 +47,11 @@ public:\nvals.resize(max_elmts);\n}\n- _partial_sort_step1(values, pos, n_elmts, K, depth);\n+ LC_sorter<T>::_partial_sort_step1(values, pos, n_elmts, K, depth, max_elmts, tree_idx);\nif (K == 2)\n- _partial_sort2_step2(values, pos, depth);\n+ LC_sorter<T>::_partial_sort2_step2(values, pos, depth, max_elmts, tree_idx);\nelse\n- _partial_sort_step2(values, pos, K, depth);\n+ LC_sorter<T>::_partial_sort_step2(values, pos, K, depth, max_elmts, tree_idx);\n}\n@@ -60,7 +60,7 @@ public:\nK = (K <= 0) ? (int)pos.size() : K;\nn_elmts = (n_elmts <= 0) ? max_elmts : n_elmts;\n- assert(is_power_of_2(n_elmts));\n+ // assert(is_power_of_2(n_elmts));\nauto depth = (int)std::log2(n_elmts);\n@@ -72,21 +72,27 @@ public:\nvals.resize(max_elmts);\n}\n- _partial_sort_step1(values, pos, n_elmts, K, depth);\n+ LC_sorter<T>::_partial_sort_step1(values, pos, n_elmts, K, depth, max_elmts, tree_idx);\nif (K == 2)\n- _partial_sort2_step2(values, pos, depth);\n+ LC_sorter<T>::_partial_sort2_step2(values, pos, depth, max_elmts, tree_idx);\nelse\n{\n// copy the \"values\" vector in \"vals\"\nfor (auto i = 0; i < n_elmts; i++)\nvals[i] = values[i];\n- _partial_sort_step2(vals.data(), pos, K, depth);\n+ LC_sorter<T>::_partial_sort_step2(vals.data(), pos, K, depth, max_elmts, tree_idx);\n}\n}\n-private:\n- inline void _partial_sort_step1(const T* values, std::vector<int> &pos, const int n_elmts, const int K, const int depth)\n+protected:\n+ static void _partial_sort_step1(const T *values,\n+ std::vector<int> &pos,\n+ const int n_elmts,\n+ const int K,\n+ const int depth,\n+ const int max_elmts,\n+ mipp::vector<int> &tree_idx)\n{\n// sort all the tree (1)\nconst auto n_2 = n_elmts >> 1;\n@@ -118,12 +124,17 @@ private:\npos[0] = tree_idx[offset];\n}\n- inline void _partial_sort_step2(T* values, std::vector<int> &pos, const int K, const int depth)\n+ static void _partial_sort_step2( T * values,\n+ std::vector<int> & pos,\n+ const int K,\n+ const int depth,\n+ const int max_elmts,\n+ mipp::vector<int> &tree_idx)\n{\nfor (auto k = 0; k < K -1; k++)\n{\n// replace the min val by +inf (+inf = max)\n- vals[pos[k]] = std::numeric_limits<T>::max();\n+ values[pos[k]] = std::numeric_limits<T>::max();\n// compute only 1 branch (1)\nconst auto j = pos[k] / 2;\n@@ -154,7 +165,11 @@ private:\n}\n}\n- inline void _partial_sort2_step2(const T* values, std::vector<int> &pos, const int depth)\n+ static void _partial_sort2_step2(const T *values,\n+ std::vector<int> &pos,\n+ const int depth,\n+ const int max_elmts,\n+ mipp::vector<int> &tree_idx)\n{\n// replace the min val by this opponent (rev depth of 1)\ntree_idx[max_elmts + (pos[0] / 2)] = (pos[0] % 2) ? pos[0] -1 : pos[0] +1;\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/Algo/Sort/LC_sorter_simd.hpp", "diff": "+#ifndef LC_SORTER_SIMD_HPP\n+#define LC_SORTER_SIMD_HPP\n+\n+#include <cmath>\n+#include <vector>\n+#include <algorithm>\n+\n+#include \"Tools/Perf/MIPP/mipp.h\"\n+#include \"Tools/Math/utils.h\"\n+\n+#include \"LC_sorter.hpp\"\n+\n+template <typename T>\n+class LC_sorter_simd\n+{\n+private:\n+ int max_elmts;\n+ mipp::vector<int> tree_idx;\n+ mipp::vector<T> vals;\n+\n+public:\n+ LC_sorter_simd(const int max_elmts) : max_elmts(max_elmts), vals(2 * max_elmts)\n+ {\n+ // assert(is_power_of_2(max_elmts));\n+\n+ tree_idx.resize(2 * max_elmts -1);\n+ std::iota(tree_idx.begin(), tree_idx.begin() + this->max_elmts, 0);\n+ }\n+\n+ void partial_sort_abs(const T* values, std::vector<int> &pos, int n_elmts = -1, int K = -1)\n+ {\n+ K = (K <= 0) ? (int)pos.size() : K;\n+ n_elmts = (n_elmts <= 0) ? max_elmts : n_elmts;\n+\n+ auto depth = (int)std::log2(n_elmts);\n+\n+ if (n_elmts > max_elmts)\n+ {\n+ max_elmts = n_elmts;\n+ tree_idx.resize(2 * max_elmts -1);\n+ std::iota(tree_idx.begin(), tree_idx.begin() + this->max_elmts, 0);\n+ vals.resize(max_elmts);\n+ }\n+\n+ // copy the \"values\" vector in \"vals\"\n+ for (auto i = 0; i < n_elmts; i++)\n+ vals[i] = std::abs(values[i]);\n+\n+ if (n_elmts >= 2 * mipp::nElReg<T>())\n+ {\n+ _partial_sort_step1(vals.data(), pos, n_elmts, K, depth);\n+\n+ if (K > 1)\n+ _partial_sort_step2(vals.data(), pos, K, depth);\n+ }\n+ else\n+ {\n+ LC_sorter<T>::_partial_sort_step1(vals.data(), pos, n_elmts, K, depth, max_elmts, tree_idx);\n+ if (K == 2)\n+ LC_sorter<T>::_partial_sort2_step2(vals.data(), pos, depth, max_elmts, tree_idx);\n+ else\n+ LC_sorter<T>::_partial_sort_step2(vals.data(), pos, K, depth, max_elmts, tree_idx);\n+ }\n+ }\n+\n+ void partial_sort(const T* values, std::vector<int> &pos, int n_elmts = -1, int K = -1)\n+ {\n+ K = (K <= 0) ? (int)pos.size() : K;\n+ n_elmts = (n_elmts <= 0) ? max_elmts : n_elmts;\n+\n+ auto depth = (int)std::log2(n_elmts);\n+\n+ if (n_elmts > max_elmts)\n+ {\n+ max_elmts = n_elmts;\n+ tree_idx.resize(2 * max_elmts -1);\n+ std::iota(tree_idx.begin(), tree_idx.begin() + this->max_elmts, 0);\n+ vals.resize(max_elmts);\n+ }\n+\n+ if (n_elmts >= 2 * mipp::nElReg<T>())\n+ {\n+ // copy the \"values\" vector in \"vals\"\n+ for (auto i = 0; i < n_elmts; i++)\n+ vals[i] = values[i];\n+\n+ _partial_sort_step1(vals.data(), pos, n_elmts, K, depth);\n+\n+ if (K > 1)\n+ _partial_sort_step2(vals.data(), pos, K, depth);\n+ }\n+ else\n+ {\n+ LC_sorter<T>::_partial_sort_step1(values, pos, n_elmts, K, depth, max_elmts, tree_idx);\n+ if (K == 2)\n+ LC_sorter<T>::_partial_sort2_step2(values, pos, depth, max_elmts, tree_idx);\n+ else\n+ {\n+ // copy the \"values\" vector in \"vals\"\n+ for (auto i = 0; i < n_elmts; i++)\n+ vals[i] = values[i];\n+\n+ LC_sorter<T>::_partial_sort_step2(vals.data(), pos, K, depth, max_elmts, tree_idx);\n+ }\n+ }\n+ }\n+\n+private:\n+ inline void _partial_sort_step1(T* values, std::vector<int> &pos, const int n_elmts, const int K, const int depth)\n+ {\n+ // sort all the tree (1)\n+ const auto n_elmts_2 = n_elmts >> 1;\n+ for (auto j = 0; j < n_elmts_2; j += mipp::nElReg<T>())\n+ {\n+ const auto val0 = mipp::Reg<T >(&values [2*j + 0*mipp::nElReg<T>()]); // load\n+ const auto val1 = mipp::Reg<T >(&values [2*j + 1*mipp::nElReg<T>()]); // load\n+ const auto idx0 = mipp::Reg<int>(&tree_idx[2*j + 0*mipp::nElReg<T>()]); // load\n+ const auto idx1 = mipp::Reg<int>(&tree_idx[2*j + 1*mipp::nElReg<T>()]); // load\n+\n+ const auto mask1 = val0 < val1;\n+ const auto mask2 = mipp::Reg<int>(mask1.r);\n+ const auto min = mipp::min(val0, val1);\n+ const auto idx = mipp::blend(idx0, idx1, mask2);\n+\n+ min.store(&values [max_elmts +j]); // store\n+ idx.store(&tree_idx[max_elmts +j]); // store\n+ }\n+\n+ // sort all the tree (2)\n+ auto offset = max_elmts;\n+ for (auto n = n_elmts_2; n > mipp::nElReg<T>(); n >>= 1)\n+ {\n+ const auto n_2 = (n >> 1);\n+ for (auto j = 0; j < n_2; j += mipp::nElReg<T>())\n+ {\n+ const auto val0 = mipp::Reg<T >(&values [offset + 2*j + 0*mipp::nElReg<T>()]); // load\n+ const auto val1 = mipp::Reg<T >(&values [offset + 2*j + 1*mipp::nElReg<T>()]); // load\n+ const auto idx0 = mipp::Reg<int>(&tree_idx[offset + 2*j + 0*mipp::nElReg<T>()]); // load\n+ const auto idx1 = mipp::Reg<int>(&tree_idx[offset + 2*j + 1*mipp::nElReg<T>()]); // load\n+\n+ const auto mask1 = val0 < val1;\n+ const auto mask2 = mipp::Reg<int>(mask1.r);\n+ const auto min = mipp::min(val0, val1);\n+ const auto idx = mipp::blend(idx0, idx1, mask2);\n+\n+ min.store(&values [offset + n +j]); // store\n+ idx.store(&tree_idx[offset + n +j]); // store\n+ }\n+\n+ offset += n;\n+ }\n+\n+ // sequential part (searching the min pos)\n+ auto min_pos = 0;\n+ auto min = std::numeric_limits<T>::max();\n+\n+ for (auto i = 0; i < mipp::nElReg<T>(); i++)\n+ {\n+ min_pos = values[tree_idx[offset +i]] < min ? tree_idx[offset +i] : min_pos;\n+ min = std::min(values[tree_idx[offset +i]], min);\n+ }\n+\n+ pos[0] = min_pos;\n+ }\n+\n+ inline void _partial_sort_step2(T* values, std::vector<int> &pos, const int K, const int depth)\n+ {\n+ for (auto k = 0; k < (int)K -1; k++)\n+ {\n+ // replace the min val by +inf (+inf = max)\n+ values[pos[k]] = std::numeric_limits<T>::max();\n+\n+ // compute only 1 branch (1)\n+ {\n+ const auto node = pos[k];\n+ const auto j = (node / (mipp::nElReg<T>() * 2)) * mipp::nElReg<T>();\n+\n+ const auto val0 = mipp::Reg<T >(&values [2*j + 0*mipp::nElReg<T>()]); // load\n+ const auto val1 = mipp::Reg<T >(&values [2*j + 1*mipp::nElReg<T>()]); // load\n+ const auto idx0 = mipp::Reg<int>(&tree_idx[2*j + 0*mipp::nElReg<T>()]); // load\n+ const auto idx1 = mipp::Reg<int>(&tree_idx[2*j + 1*mipp::nElReg<T>()]); // load\n+\n+ const auto mask1 = val0 < val1;\n+ const auto mask2 = mipp::Reg<int>(mask1.r);\n+ const auto min = mipp::min(val0, val1);\n+ const auto idx = mipp::blend(idx0, idx1, mask2);\n+\n+ min.store(&values [max_elmts +j]); // store\n+ idx.store(&tree_idx[max_elmts +j]); // store\n+ }\n+\n+ // compute only 1 branch (2)\n+ auto i = 1;\n+ auto offset = max_elmts;\n+ for (auto n = 1 << (depth -1); n > mipp::nElReg<T>(); n >>= 1)\n+ {\n+ const auto node = pos[k] / (1 << i);\n+ const auto j = (node / (mipp::nElReg<T>() * 2)) * mipp::nElReg<T>();\n+\n+ const auto val0 = mipp::Reg<T >(&values [offset + 2*j + 0*mipp::nElReg<T>()]); // load\n+ const auto val1 = mipp::Reg<T >(&values [offset + 2*j + 1*mipp::nElReg<T>()]); // load\n+ const auto idx0 = mipp::Reg<int>(&tree_idx[offset + 2*j + 0*mipp::nElReg<T>()]); // load\n+ const auto idx1 = mipp::Reg<int>(&tree_idx[offset + 2*j + 1*mipp::nElReg<T>()]); // load\n+\n+ const auto mask1 = val0 < val1;\n+ const auto mask2 = mipp::Reg<int>(mask1.r);\n+ const auto min = mipp::min(val0, val1);\n+ const auto idx = mipp::blend(idx0, idx1, mask2);\n+\n+ min.store(&values [offset + n +j]); // store\n+ idx.store(&tree_idx[offset + n +j]); // store\n+\n+ offset += n;\n+ i++;\n+ }\n+\n+ // sequential part (searching the min pos)\n+ auto min_pos = 0;\n+ auto min = std::numeric_limits<T>::max();\n+\n+ for (auto i = 0; i < mipp::nElReg<T>(); i++)\n+ {\n+ min_pos = values[tree_idx[offset +i]] < min ? tree_idx[offset +i] : min_pos;\n+ min = std::min(values[tree_idx[offset +i]], min);\n+ }\n+\n+ pos[k +1] = min_pos;\n+ }\n+ }\n+};\n+\n+#endif /* LC_SORTER_SIMD_HPP */\n" } ]
C++
MIT License
aff3ct/aff3ct
Add/improve LC_sorter_simd.
8,490
10.02.2017 11:47:17
-3,600
77612c5aa3aa938dac8c0e6105c2eda1a51d6fed
Comment LC_sorter_simd.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "diff": "#include <vector>\n#include \"Tools/Algo/Sort/LC_sorter.hpp\"\n-#include \"Tools/Algo/Sort/LC_sorter_simd.hpp\"\n+//#include \"Tools/Algo/Sort/LC_sorter_simd.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"../../Decoder.hpp\"\n#include \"../decoder_polar_functions.h\"\n@@ -36,7 +36,7 @@ protected:\nstd::vector<std::vector<int>> path_2_array; // give array used by a path\nLC_sorter<R> sorter;\n- LC_sorter_simd<R> sorter_simd;\n+// LC_sorter_simd<R> sorter_simd;\nstd::vector<int> best_idx;\nmipp::vector<R> l_tmp;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -85,7 +85,7 @@ Decoder_polar_SCL_fast_sys<B,R,API_polar>\nn_array_ref (L, std::vector<int>(m)),\npath_2_array (L, std::vector<int>(m)),\nsorter (N),\n- sorter_simd (N),\n+//sorter_simd (N),\nbest_idx (L),\nl_tmp (N)\n{\n@@ -439,9 +439,9 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst auto path = paths[i];\nconst auto array = path_2_array[path][r_d];\n-// for (auto i = 0; i < n_elmts; i++) l_tmp[i] = std::abs(l[array][off_l +i]);\n-// sorter.partial_sort_destructive(l_tmp.data(), best_idx, n_elmts, 2);\n- sorter_simd.partial_sort_abs(l[array].data() + off_l, best_idx, n_elmts, 2);\n+ for (auto i = 0; i < n_elmts; i++) l_tmp[i] = std::abs(l[array][off_l +i]);\n+ sorter.partial_sort_destructive(l_tmp.data(), best_idx, n_elmts, 2);\n+// sorter_simd.partial_sort_abs(l[array].data() + off_l, best_idx, n_elmts, 2);\nbit_flips[2 * path +0] = best_idx[0];\nbit_flips[2 * path +1] = best_idx[1];\n@@ -523,9 +523,9 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst auto path = paths[i];\nconst auto array = path_2_array[path][REV_D];\n-// for (auto i = 0; i < N_ELMTS; i++) l_tmp[i] = std::abs(l[array][off_l +i]);\n-// sorter.partial_sort_destructive(l_tmp.data(), best_idx, N_ELMTS, 2);\n- sorter_simd.partial_sort_abs(l[array].data() + off_l, best_idx, N_ELMTS, 2);\n+ for (auto i = 0; i < N_ELMTS; i++) l_tmp[i] = std::abs(l[array][off_l +i]);\n+ sorter.partial_sort_destructive(l_tmp.data(), best_idx, N_ELMTS, 2);\n+// sorter_simd.partial_sort_abs(l[array].data() + off_l, best_idx, N_ELMTS, 2);\nbit_flips[2 * path +0] = best_idx[0];\nbit_flips[2 * path +1] = best_idx[1];\n@@ -560,7 +560,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst auto dup = best_idx[i] % 4;\nconst auto array = path_2_array[path][REV_D];\n- API_polar::h(s[path], l[array], off_l, off_s, N_ELMTS);\n+ API_polar::template h<N_ELMTS>(s[path], l[array], off_l, off_s, N_ELMTS);\nconst auto new_path = (dup_count[path] > 1) ? duplicate_tree(path, off_l, off_s, N_ELMTS) : path;\nflip_bits_r1(path, new_path, dup, off_s, N_ELMTS);\n@@ -799,9 +799,9 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst auto path = paths[i];\nconst auto array = path_2_array[paths[i]][r_d];\n-// for (auto i = 0; i < n_elmts; i++) l_tmp[i] = std::abs(l[array][off_l +i]);\n-// sorter.partial_sort_destructive(l_tmp.data(), best_idx, n_elmts, 4);\n- sorter_simd.partial_sort_abs(l[array].data() + off_l, best_idx, n_elmts, 4);\n+ for (auto i = 0; i < n_elmts; i++) l_tmp[i] = std::abs(l[array][off_l +i]);\n+ sorter.partial_sort_destructive(l_tmp.data(), best_idx, n_elmts, 4);\n+// sorter_simd.partial_sort_abs(l[array].data() + off_l, best_idx, n_elmts, 4);\nfor (auto j = 0; j < 4; j++)\nbit_flips[4 * path +j] = best_idx[j];\n@@ -911,12 +911,12 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst auto path = paths[i];\nconst auto array = path_2_array[paths[i]][REV_D];\n-// for (auto i = 0; i < N_ELMTS; i++) l_tmp[i] = std::abs(l[array][off_l +i]);\n-// sorter.partial_sort_destructive(l_tmp.data(), best_idx, N_ELMTS, 4);\n- sorter_simd.partial_sort_abs(l[array].data() + off_l, best_idx, N_ELMTS, 4);\n+ for (auto i = 0; i < N_ELMTS; i++) l_tmp[i] = std::abs(l[array][off_l +i]);\n+ sorter.partial_sort_destructive(l_tmp.data(), best_idx, N_ELMTS, 4);\n+// sorter_simd.partial_sort_abs(l[array].data() + off_l, best_idx, N_ELMTS, 4);\nfor (auto j = 0; j < 4; j++)\n- bit_flips[4 * path +j] = best_idx;\n+ bit_flips[4 * path +j] = best_idx[j];\nauto sum = 0;\nfor (auto j = 0; j < N_ELMTS; j++)\n" } ]
C++
MIT License
aff3ct/aff3ct
Comment LC_sorter_simd.
8,490
13.02.2017 08:51:04
-3,600
ad08e25b2340fae04ea724d5e79a699246f4946c
Fix the completion script on zsh.
[ { "change_type": "MODIFY", "old_path": "scripts/aff3ct_completion.sh", "new_path": "scripts/aff3ct_completion.sh", "diff": "@@ -27,8 +27,7 @@ _aff3ct() {\nopts=\"--cde-type --sim-type -v --version -h --help\"\n# add contents of Launcher.cpp\n- if [[\n- ${codetype} == \"POLAR\" && ${simutype} == \"EXIT\" || \\\n+ if [[ ${codetype} == \"POLAR\" && ${simutype} == \"EXIT\" || \\\n${codetype} == \"RSC\" && ${simutype} == \"EXIT\" || \\\n${codetype} == \"POLAR\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"RSC\" && ${simutype} == \"BFER\" || \\\n@@ -40,8 +39,7 @@ _aff3ct() {\n${codetype} == \"RSC\" && ${simutype} == \"BFERI\" || \\\n${codetype} == \"LDPC\" && ${simutype} == \"BFERI\" || \\\n${codetype} == \"UNCODED\" && ${simutype} == \"BFERI\" || \\\n- ${codetype} == \"POLAR\" && ${simutype} == \"GEN\" \\\n- ]]\n+ ${codetype} == \"POLAR\" && ${simutype} == \"GEN\" ]]\nthen\nopts=\"$opts --sim-snr-min -m --snr-min-max -M --sim-snr-step -s \\\n--sim-snr-type -E --sim-stop-time --sim-threads -t --sim-domain \\\n@@ -55,15 +53,13 @@ _aff3ct() {\nfi\n# add contents of Launcher_BFER.cpp\n- if [[\n- ${codetype} == \"POLAR\" && ${simutype} == \"BFER\" || \\\n+ if [[ ${codetype} == \"POLAR\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"RSC\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"TURBO\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"REPETITION\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"RA\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"LDPC\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"UNCODED\" && ${simutype} == \"BFER\" \\\n- ]]\n+ ${codetype} == \"UNCODED\" && ${simutype} == \"BFER\" ]]\nthen\nopts=\"$opts --sim-benchs -b --sim-benchs-no-ldst -B --sim-debug -d \\\n--sim-debug-limit --snr-sim-trace-path --sim-time-report --cde-coset \\\n@@ -71,19 +67,15 @@ _aff3ct() {\nfi\n# add contents of Launcher_EXIT.cpp\n- if [[\n- ${codetype} == \"POLAR\" && ${simutype} == \"EXIT\" || \\\n- ${codetype} == \"RSC\" && ${simutype} == \"EXIT\" \\\n- ]]\n+ if [[ ${codetype} == \"POLAR\" && ${simutype} == \"EXIT\" || \\\n+ ${codetype} == \"RSC\" && ${simutype} == \"EXIT\" ]]\nthen\nopts=\"$opts --sim-siga-min -a --sim-siga-max -A --sim-siga-step\"\nfi\n# add contents of Launcher_BFERI.cpp\n- if [[\n- ${codetype} == \"LDPC\" && ${simutype} == \"BFERI\" || \\\n- ${codetype} == \"UNCODED\" && ${simutype} == \"BFERI\" \\\n- ]]\n+ if [[ ${codetype} == \"LDPC\" && ${simutype} == \"BFERI\" || \\\n+ ${codetype} == \"UNCODED\" && ${simutype} == \"BFERI\" ]]\nthen\nopts=\"$opts --sim-benchs -b --sim-debug -d --sim-debug-limit \\\n--snr-sim-trace-path --sim-time-report --cde-coset -c --itl-type \\\n@@ -91,36 +83,28 @@ _aff3ct() {\nfi\n# add contents of Launcher_GEN_polar.cpp\n- if [[\n- ${codetype} == \"POLAR\" && ${simutype} == \"GEN\" \\\n- ]]\n+ if [[ ${codetype} == \"POLAR\" && ${simutype} == \"GEN\" ]]\nthen\nopts=\"$opts --cde-awgn-fb-path --cde-fb-gen-method --dec-snr \\\n--dec-gen-path --sim-pb-path\"\nfi\n# add contents of Launcher_BFER_RA.cpp\n- if [[\n- ${codetype} == \"RA\" && ${simutype} == \"BFER\" \\\n- ]]\n+ if [[ ${codetype} == \"RA\" && ${simutype} == \"BFER\" ]]\nthen\nopts=\"$opts --dec-ite -i --itl-type --itl-path\"\nfi\n# add contents of Launcher_BFER_RSC.cpp\n- if [[\n- ${codetype} == \"RSC\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"RSC\" && ${simutype} == \"BFERI\" \\\n- ]]\n+ if [[ ${codetype} == \"RSC\" && ${simutype} == \"BFER\" || \\\n+ ${codetype} == \"RSC\" && ${simutype} == \"BFERI\" ]]\nthen\nopts=\"$opts --enc-no-buff --enc-poly --dec-type -D --dec-implem \\\n--dec-simd --dec-max\"\nfi\n# add contents of Launcher_BFER_polar.cpp\n- if [[\n- ${codetype} == \"POLAR\" && ${simutype} == \"BFER\" \\\n- ]]\n+ if [[ ${codetype} == \"POLAR\" && ${simutype} == \"BFER\" ]]\nthen\nopts=\"$opts --sim-pb-path --cde-awgn-fb-path --cde-fb-gen-method \\\n--cde-sigma --crc-type --enc-no-sys --dec-type -D --dec-ite \\\n@@ -128,17 +112,13 @@ _aff3ct() {\nfi\n# add contents of Launcher_BFER_repetition.cpp\n- if [[\n- ${codetype} == \"REPETITION\" && ${simutype} == \"BFER\" \\\n- ]]\n+ if [[ ${codetype} == \"REPETITION\" && ${simutype} == \"BFER\" ]]\nthen\nopts=\"$opts --enc-no-buff --dec-type -D --dec-implem\"\nfi\n# add contents of Launcher_BFER_turbo.cpp\n- if [[\n- ${codetype} == \"TURBO\" && ${simutype} == \"BFER\" \\\n- ]]\n+ if [[ ${codetype} == \"TURBO\" && ${simutype} == \"BFER\" ]]\nthen\nopts=\"$opts --sim-json-path --crc-type --enc-no-buff --enc-type \\\n--enc-poly --itl-type --itl-path --dec-type -D --dec-implem \\\n@@ -146,17 +126,13 @@ _aff3ct() {\nfi\n# add contents of Launcher_EXIT_RSC.cpp\n- if [[\n- ${codetype} == \"RSC\" && ${simutype} == \"EXIT\" \\\n- ]]\n+ if [[ ${codetype} == \"RSC\" && ${simutype} == \"EXIT\" ]]\nthen\nopts=\"$opts --dec-type -D --dec-implem --dec-max\"\nfi\n# add contents of Launcher_EXIT_polar.cpp\n- if [[\n- ${codetype} == \"POLAR\" && ${simutype} == \"EXIT\" \\\n- ]]\n+ if [[ ${codetype} == \"POLAR\" && ${simutype} == \"EXIT\" ]]\nthen\nopts=\"$opts --sim-pb-path --cde-sigma --cde-awgn-fb-path \\\n--cde-fb-gen-method --dec-type -D --dec-implem --dec-ite -i \\\n@@ -164,27 +140,21 @@ _aff3ct() {\nfi\n# add contents of Launcher_BFER_LDPC.cpp\n- if [[\n- ${codetype} == \"LDPC\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"LDPC\" && ${simutype} == \"BFERI\" \\\n- ]]\n+ if [[ ${codetype} == \"LDPC\" && ${simutype} == \"BFER\" || \\\n+ ${codetype} == \"LDPC\" && ${simutype} == \"BFERI\" ]]\nthen\nopts=\"$opts --dec-type -D --dec-implem --dec-ite -i --cde-alist-path \\\n--dec-no-synd --dec-off --dec-norm\"\nfi\n# add contents of Launcher_BFER_uncoded.cpp\n- if [[\n- ${codetype} == \"UNCODED\" && ${simutype} == \"BFER\" \\\n- ]]\n+ if [[ ${codetype} == \"UNCODED\" && ${simutype} == \"BFER\" ]]\nthen\nopts=\"$opts \"\nfi\n# add contents of Launcher_BFERI_uncoded.cpp\n- if [[\n- ${codetype} == \"UNCODED\" && ${simutype} == \"BFERI\" \\\n- ]]\n+ if [[ ${codetype} == \"UNCODED\" && ${simutype} == \"BFERI\" ]]\nthen\nopts=\"$opts \"\nfi\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the completion script on zsh.
8,490
13.02.2017 11:17:23
-3,600
5dfa2a8dddac16017b19d79290af5e9c91857779
PyBER is now compatible with the updated AFF3CT terminal (Es/N0 and Eb/N0 column).
[ { "change_type": "MODIFY", "old_path": "plotter/PyBER/reader.py", "new_path": "plotter/PyBER/reader.py", "diff": "@@ -28,6 +28,8 @@ def getVal(line, idColumn):\nconvert_to_v1 = [0, 4, 5, 12, 0, 3, 2]\nconvert_to_v2 = [0, 4, 5, 9 , 0, 3, 2]\nconvert_to_v3 = [0, 4, 5, 6 , 0, 3, 2]\n+ convert_to_v4 = [1, 5, 6, 10, 1, 4, 3]\n+ convert_to_v5 = [1, 5, 6, 7 , 1, 4, 3]\n# classic\nif line.startswith(\"SNR = \"):\n@@ -64,6 +66,10 @@ def getVal(line, idColumn):\nval = float(line[convert_to_v2[idColumn]])\nelif(len(line) == 8):\nval = float(line[convert_to_v3[idColumn]])\n+ elif(len(line) == 12):\n+ val = float(line[convert_to_v4[idColumn]])\n+ elif(len(line) == 9):\n+ val = float(line[convert_to_v5[idColumn]])\nif \"inf\" in str(val):\nval = float(0.0)\n" } ]
C++
MIT License
aff3ct/aff3ct
PyBER is now compatible with the updated AFF3CT terminal (Es/N0 and Eb/N0 column).
8,490
13.02.2017 11:18:02
-3,600
890f107119a098fefef546c36cf32d7e7fe07dab
Fix --term-type in the completion script.
[ { "change_type": "MODIFY", "old_path": "scripts/aff3ct_completion.sh", "new_path": "scripts/aff3ct_completion.sh", "diff": "@@ -174,7 +174,7 @@ _aff3ct() {\n--mod-bps | --mod-ups | --mod-cpm-L | --mod-cpm-p | --mod-cpm-k | \\\n--qnt-int | --qnt-bits | --qnt-range | --qnt-type | \\\n--sim-benchs | -b | --sim-debug-limit | \\\n- --mnt-max-fe | -e | --term-type | \\\n+ --mnt-max-fe | -e | \\\n--sim-siga-min | -a | --sim-siga-max | -A | --sim-siga-step | \\\n--dmod-ite | --cde-sigma | --dec-snr | --dec-ite |-i | --dec-lists | \\\n-L | --sim-json-path | --dec-off | --dec-norm | --term-freq | \\\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix --term-type in the completion script.
8,490
14.02.2017 21:11:12
-3,600
99b227e6c22a169f5cb3522ce8b5eb131435b434
Fix the tests scripts.
[ { "change_type": "MODIFY", "old_path": "scripts/aff3ct_completion.sh", "new_path": "scripts/aff3ct_completion.sh", "diff": "@@ -49,7 +49,8 @@ _aff3ct() {\n--mod-cpm-k --mod-cpm-std --mod-const-path --dmod-max \\\n--dmod-no-sig2 --chn-type --chn-path --chn-blk-fad --qnt-type \\\n--qnt-int --qnt-bits --qnt-range --dec-type --dec-implem \\\n- --term-no --term-freq --sim-seed --sim-mpi-comm --sim-pyber\"\n+ --term-no --term-freq --sim-seed --sim-mpi-comm --sim-pyber \\\n+ --sim-no-colors\"\nfi\n# add contents of Launcher_BFER.cpp\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -146,6 +146,11 @@ void Launcher<B,R,Q>\n{\"positive_int\",\n\"MPI communication frequency between the nodes (in millisec).\"};\n#endif\n+#ifdef ENABLE_COOL_BASH\n+ opt_args[{\"sim-no-colors\"}] =\n+ {\"\",\n+ \"disable the colors in the shell.\"};\n+#endif\n// ---------------------------------------------------------------------------------------------------------- code\nreq_args[{\"cde-type\"}] =\n@@ -297,6 +302,7 @@ void Launcher<B,R,Q>\nif(ar.exist_arg({\"sim-stop-time\" })) params.simulation.stop_time = seconds(ar.get_arg_int ({\"sim-stop-time\" }));\nif(ar.exist_arg({\"sim-seed\" })) params.simulation.seed = ar.get_arg_int ({\"sim-seed\" });\n#ifndef STARPU\n+ if (ar.get_arg_int({\"sim-threads\", \"t\"}) > 0)\nif(ar.exist_arg({\"sim-threads\", \"t\"})) params.simulation.n_threads = ar.get_arg_int ({\"sim-threads\", \"t\"});\n#else\nif(ar.exist_arg({\"sim-conc-tasks\", \"t\"})) params.simulation.n_threads = ar.get_arg_int ({\"sim-conc-tasks\", \"t\"});\n@@ -318,6 +324,9 @@ void Launcher<B,R,Q>\n// disable the cool bash mode for PyBER\nif (!params.simulation.pyber.empty())\nenable_bash_tools = false;\n+#ifdef ENABLE_COOL_BASH\n+ if (ar.exist_arg({\"sim-no-colors\"})) enable_bash_tools = false;\n+#endif\n// ---------------------------------------------------------------------------------------------------------- code\nparams.code.type = ar.get_arg ({\"cde-type\" }); // required\n" }, { "change_type": "MODIFY", "old_path": "tests/tests.py", "new_path": "tests/tests.py", "diff": "@@ -7,7 +7,7 @@ PathTests = \"data\" # can be overrided by arg1 from the cmd line\nPathResults = \"results\" # can be overrided by arg2 from the cmd line\nPathBuild = \"../build\"\nSensibility = 1.0\n-Nthreads = 8\n+Nthreads = 0 # if 0 then AFF3CT takes all the available threads\nRecursiveScan = True\nMaxFE = 100\nWeakRate = 0.8 # 0 < WeakRate < 1\n@@ -217,6 +217,7 @@ for fn in fileNames:\nargsAFFECT.append(str(MaxFE))\nargsAFFECT.append(\"--sim-threads\")\nargsAFFECT.append(str(Nthreads))\n+ argsAFFECT.append(\"--sim-no-colors\")\nos.chdir(PathBuild)\nprocessAFFECT = subprocess.Popen(argsAFFECT, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n@@ -235,9 +236,10 @@ for fn in fileNames:\noutputAFFECTLines = []\nsimuCur = []\nfor l in stdOutput:\n- if l != \"\" and l[0] != '#': # avoid the first lines and the comments\n+ if l != \"\" and l[0] != '#' and l[0] != \"(\": # avoid the first lines and the comments\noutputAFFECTLines.append(l)\n- simuCur.append(l.strip().replace(\"||\", \"|\").replace(\" \", \"\").split(\"|\"))\n+ array = l.strip().replace(\"||\", \"|\").replace(\" \", \"\").split(\"|\")\n+ simuCur.append(array)\nelif l != \"\" and l[0] == '#' and \"# End of the simulation.\" not in l:\nfRes.write(l + \"\\n\")\n@@ -247,11 +249,11 @@ for fn in fileNames:\nvalid = 0;\nidx = 0\nfor ref in simuRef:\n- numRef = float(ref[5][0:4])\n- powerRef = int(ref[5][6:8])\n+ numRef = float(ref[6][0:4])\n+ powerRef = int(ref[6][6:8])\ntry:\n- numCur = float(simuCur[idx][5][0:4])\n- powerCur = int(simuCur[idx][5][6:8])\n+ numCur = float(simuCur[idx][6][0:4])\n+ powerCur = int(simuCur[idx][6][6:8])\nexcept IndexError: # no such line\nbreak\n@@ -263,7 +265,7 @@ for fn in fileNames:\nabsoluteNumDiff = math.fabs(numRef - numCur)\nif absoluteNumDiff > Sensibility:\n- fRes.write(outputAFFECTLines[idx] + \"WRONG! FER=\" + ref[5][0:8] + \"\\n\")\n+ fRes.write(outputAFFECTLines[idx] + \"WRONG! FER=\" + ref[6][0:8] + \"\\n\")\nelse:\nvalid = valid + 1\nfRes.write(outputAFFECTLines[idx] + \"\\n\")\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the tests scripts.
8,490
15.02.2017 10:35:28
-3,600
79e18d72f4bd38751a7933993835388df83fcf18
Fix warnings on MSVC.
[ { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -302,7 +302,7 @@ void Launcher<B,R,Q>\nif(ar.exist_arg({\"sim-stop-time\" })) params.simulation.stop_time = seconds(ar.get_arg_int ({\"sim-stop-time\" }));\nif(ar.exist_arg({\"sim-seed\" })) params.simulation.seed = ar.get_arg_int ({\"sim-seed\" });\n#ifndef STARPU\n- if (ar.exist_arg({\"sim-threads\", \"t\"}) && ar.exist_arg({\"sim-threads\", \"t\"}) > 0)\n+ if (ar.exist_arg({\"sim-threads\", \"t\"}) && ar.get_arg_int({\"sim-threads\", \"t\"}) > 0)\nif(ar.exist_arg({\"sim-threads\", \"t\"})) params.simulation.n_threads = ar.get_arg_int ({\"sim-threads\", \"t\"});\n#else\nif(ar.exist_arg({\"sim-conc-tasks\", \"t\"})) params.simulation.n_threads = ar.get_arg_int ({\"sim-conc-tasks\", \"t\"});\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modulator/CPM/BCJR/CPM_BCJR.hxx", "new_path": "src/Module/Modulator/CPM/BCJR/CPM_BCJR.hxx", "diff": "@@ -108,8 +108,8 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\n{\nfor (int b = 0; b < cpm.n_b_per_s; b++)\n{\n- const int bit_state = cpm.transition_to_binary[tr * cpm.n_b_per_s + b]; // transition_to_binary what bit state we should have for the given transition and bit position\n- const int sign = (bit_state == 0) ? 1 : -1; //associated coeff\n+ const auto bit_state = cpm.transition_to_binary[tr * cpm.n_b_per_s + b]; // transition_to_binary what bit state we should have for the given transition and bit position\n+ const auto sign = (bit_state == 0) ? 1 : -1; //associated coeff\nsymb_apriori_prob[i * cpm.m_order + tr] += (Q)sign*Ldec_N[i * cpm.n_b_per_s + b]/(Q)2; //match -> add prob else remove\n}\n}\n@@ -189,7 +189,7 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\nfor (auto b = 0; b < cpm.n_b_per_s; b++)\nfor (auto tr = 0; tr < cpm.m_order; tr++)\n{\n- const int bit_state = cpm.transition_to_binary[tr * cpm.n_b_per_s + b]; // bit_state = 0 or 1 ; bit 0 is msb, bit cpm.n_b_per_s-1 is lsb\n+ const auto bit_state = cpm.transition_to_binary[tr * cpm.n_b_per_s + b]; // bit_state = 0 or 1 ; bit 0 is msb, bit cpm.n_b_per_s-1 is lsb\nproba_msg_bits[(i*cpm.n_b_per_s+b)*2 + bit_state] = MAX(proba_msg_bits[(i*cpm.n_b_per_s+b)*2 + bit_state],\nproba_msg_symb[i*cpm.m_order +tr]);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modulator/CPM/CPM_parameters.hxx", "new_path": "src/Module/Modulator/CPM/CPM_parameters.hxx", "diff": "@@ -25,11 +25,11 @@ CPM_parameters<SIN, SOUT>\ntl (L ),\n// TODO: warning: from here parameters are working for Rimoldi decomposition only!\n- n_wa (p * std::pow(m_order, L) ),\n+ n_wa ((int)(p * std::pow(m_order, L)) ),\nn_bits_wa ((int)std::ceil(std::log2(n_wa)) ),\nmax_wa_id (((int)1 << n_bits_wa) ),\n- n_st (p*std::pow(m_order, L-1) ),\n+ n_st ((int)(p * std::pow(m_order, L-1)) ),\nn_bits_st ((int)std::ceil(std::log2(n_st)) ),\nmax_st_id (((int)1 << n_bits_st) ),\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modulator/CPM/Modulator_CPM.hxx", "new_path": "src/Module/Modulator/CPM/Modulator_CPM.hxx", "diff": "@@ -304,7 +304,7 @@ void Modulator_CPM<B,R,Q,MAX>\nfor (auto s = 0; s < cpm.s_factor; s++)\n{\n- R tilted_phase = tilted_phase_part1 + M_PI * cpm_h * (4 * tilted_phase_part2[s] +\n+ R tilted_phase = tilted_phase_part1 + (R)M_PI * cpm_h * (4 * tilted_phase_part2[s] +\n(cpm.m_order -1) * (s * T_samp + (cpm.L -1) - 2 * tilted_phase_part3[s]));\nbaseband[allowed_wa * cpm.s_factor + s ] = std::cos(tilted_phase);\n@@ -326,7 +326,7 @@ public:\nR operator()(const R& t) const\n{\nR x = t + off;\n- R factor = (R)2.0 * M_PI * B / sqrt((R)2.0 * std::log((R)2.0));\n+ R factor = (R)2.0 * (R)M_PI * B / sqrt((R)2.0 * std::log((R)2.0));\nR minus = (x - (R)0.5) * factor;\nR plus = (x + (R)0.5) * factor;\n@@ -344,10 +344,10 @@ R Modulator_CPM<B,R,Q,MAX>\nreturn (R)0.0;\nGMSK<R> g((R)0.3, -(R)cpm.L / (R)2.0);\n- return integral(g, (R)0.0, t_stamp, t_stamp / (R)1e-4);\n+ return integral(g, (R)0.0, t_stamp, (int)(t_stamp / (R)1e-4));\n}\nelse if (cpm.wave_shape == \"RCOS\")\n- return t_stamp / ((R)2.0 * cpm.L) - sin((R)2.0 * M_PI * t_stamp / (R)cpm.L) / (R)4.0 / M_PI;\n+ return t_stamp / ((R)2.0 * cpm.L) - sin((R)2.0 * (R)M_PI * t_stamp / (R)cpm.L) / (R)4.0 / (R)M_PI;\nelse if (cpm.wave_shape == \"REC\")\nreturn t_stamp / ((R)2.0 * cpm.L);\nelse\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix warnings on MSVC.
8,490
15.02.2017 10:54:08
-3,600
e1aa60cc0fde735eed9ac5fd40fc9c4f3674c724
Fix bug when was not specified.
[ { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -302,7 +302,7 @@ void Launcher<B,R,Q>\nif(ar.exist_arg({\"sim-stop-time\" })) params.simulation.stop_time = seconds(ar.get_arg_int ({\"sim-stop-time\" }));\nif(ar.exist_arg({\"sim-seed\" })) params.simulation.seed = ar.get_arg_int ({\"sim-seed\" });\n#ifndef STARPU\n- if (ar.get_arg_int({\"sim-threads\", \"t\"}) > 0)\n+ if (ar.exist_arg({\"sim-threads\", \"t\"}) && ar.exist_arg({\"sim-threads\", \"t\"}) > 0)\nif(ar.exist_arg({\"sim-threads\", \"t\"})) params.simulation.n_threads = ar.get_arg_int ({\"sim-threads\", \"t\"});\n#else\nif(ar.exist_arg({\"sim-conc-tasks\", \"t\"})) params.simulation.n_threads = ar.get_arg_int ({\"sim-conc-tasks\", \"t\"});\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix bug when was not specified.
8,490
15.02.2017 10:58:38
-3,600
239fab9817e25bb60e4fe8dcb68a92db1c67675c
Fix the non-working exit with PyQt4 (in PyBER).
[ { "change_type": "MODIFY", "old_path": "plotter/PyBER/pyBER.py", "new_path": "plotter/PyBER/pyBER.py", "diff": "import libs.pyqtgraph.console\nimport libs.pyqtgraph as pg\n-from libs.pyqtgraph.Qt import QtCore, QtGui, QtWidgets\n+from libs.pyqtgraph.Qt import QtCore, QtGui\nfrom libs.pyqtgraph.dockarea import *\nimport numpy as np\nimport fileExplorer\n@@ -102,7 +102,7 @@ dFile.addWidget(wFile)\nexitAction = QtGui.QAction('&Exit', win)\nexitAction.setShortcut('Ctrl+Q')\nexitAction.setStatusTip('Exit application')\n-exitAction.triggered.connect(QtWidgets.qApp.quit)\n+exitAction.triggered.connect(lambda: sys.exit(0))\nswitchEbEsAction = QtGui.QAction('&Switch Es/Eb', win)\nswitchEbEsAction.setShortcut('Ctrl+E')\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the non-working exit with PyQt4 (in PyBER).
8,490
15.02.2017 11:44:13
-3,600
5bc2e5862e94d7a9ab4bc96dd97a553702d9430c
Update the SC curve with Es/N0.
[ { "change_type": "MODIFY", "old_path": "tests/data/BFER/polar/SC/polar_2048_1723_1.0_4.5_32_SC.txt", "new_path": "tests/data/BFER/polar/SC/polar_2048_1723_1.0_4.5_32_SC.txt", "diff": "@@ -47,31 +47,31 @@ SC 32-bit\n# ** Frame error count (e) = 100\n#\n# The simulation is running...\n-# -------------------------------------------------------------||--------------------------------||---------------------\n+# ----------------------------------------------------------------------||--------------------------------||---------------------\n# Bit Error Rate (BER) and Frame Error Rate (FER) depending || Decoder throughput and || Global throughput\n-# on the Signal Noise Ratio (SNR) Eb/N0 || latency (per thread) || and elapsed time\n-# -------------------------------------------------------------||--------------------------------||---------------------\n-# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n-# SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n-# (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n-# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n-# 0.00 | 142 | 27511 | 142 | 1.12e-01 | 1.00e+00 || 76.79 | 64.61 | 26.67 || 9.98 | 00h00'00\n-# 0.25 | 146 | 27141 | 146 | 1.08e-01 | 1.00e+00 || 89.19 | 75.03 | 22.96 || 21.12 | 00h00'00\n-# 0.50 | 131 | 22970 | 131 | 1.02e-01 | 1.00e+00 || 83.52 | 70.27 | 24.52 || 24.32 | 00h00'00\n-# 0.75 | 116 | 19523 | 116 | 9.77e-02 | 1.00e+00 || 134.83 | 113.43 | 15.19 || 19.54 | 00h00'00\n- 1.00 | 119 | 18816 | 119 | 9.18e-02 | 1.00e+00 || 98.72 | 83.05 | 20.75 || 21.29 | 00h00'00\n- 1.25 | 117 | 17502 | 117 | 8.68e-02 | 1.00e+00 || 132.81 | 111.73 | 15.42 || 19.09 | 00h00'00\n- 1.50 | 118 | 16703 | 118 | 8.22e-02 | 1.00e+00 || 135.98 | 114.40 | 15.06 || 20.61 | 00h00'00\n- 1.75 | 116 | 15506 | 116 | 7.76e-02 | 1.00e+00 || 126.80 | 106.68 | 16.15 || 18.30 | 00h00'00\n- 2.00 | 117 | 13988 | 117 | 6.94e-02 | 1.00e+00 || 118.52 | 99.71 | 17.28 || 20.62 | 00h00'00\n- 2.25 | 115 | 12396 | 115 | 6.26e-02 | 1.00e+00 || 141.96 | 119.43 | 14.43 || 18.91 | 00h00'00\n- 2.50 | 118 | 9711 | 118 | 4.78e-02 | 1.00e+00 || 128.26 | 107.91 | 15.97 || 21.35 | 00h00'00\n- 2.75 | 126 | 8499 | 117 | 3.91e-02 | 9.29e-01 || 136.52 | 114.86 | 15.00 || 20.21 | 00h00'00\n- 3.00 | 185 | 6592 | 136 | 2.07e-02 | 7.35e-01 || 89.10 | 74.96 | 22.99 || 35.09 | 00h00'00\n- 3.25 | 305 | 5252 | 119 | 9.99e-03 | 3.90e-01 || 100.66 | 84.68 | 20.35 || 58.59 | 00h00'00\n- 3.50 | 621 | 3267 | 109 | 3.05e-03 | 1.76e-01 || 107.78 | 90.67 | 19.00 || 97.22 | 00h00'00\n- 3.75 | 1739 | 2677 | 104 | 8.93e-04 | 5.98e-02 || 95.06 | 79.97 | 21.55 || 278.72 | 00h00'00\n- 4.00 | 4690 | 2258 | 101 | 2.79e-04 | 2.15e-02 || 95.07 | 79.99 | 21.54 || 570.83 | 00h00'00\n- 4.25 | 21521 | 2118 | 100 | 5.71e-05 | 4.65e-03 || 90.57 | 76.19 | 22.61 || 1067.06 | 00h00'00\n- 4.50 | 90299 | 1832 | 100 | 1.18e-05 | 1.11e-03 || 82.41 | 69.33 | 24.85 || 1783.41 | 00h00'00\n+# on the Signal Noise Ratio (SNR) || latency (per thread) || and elapsed time\n+# ----------------------------------------------------------------------||--------------------------------||---------------------\n+# -------|-------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n+# Es/N0 | Eb/N0 | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n+# (dB) | (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n+# -------|-------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n+# -0.75 | 0.00 | 142 | 27511 | 142 | 1.12e-01 | 1.00e+00 || 76.79 | 64.61 | 26.67 || 9.98 | 00h00'00\n+# -0.50 | 0.25 | 146 | 27141 | 146 | 1.08e-01 | 1.00e+00 || 89.19 | 75.03 | 22.96 || 21.12 | 00h00'00\n+# -0.25 | 0.50 | 131 | 22970 | 131 | 1.02e-01 | 1.00e+00 || 83.52 | 70.27 | 24.52 || 24.32 | 00h00'00\n+# -0.00 | 0.75 | 116 | 19523 | 116 | 9.77e-02 | 1.00e+00 || 134.83 | 113.43 | 15.19 || 19.54 | 00h00'00\n+ 0.25 | 1.00 | 119 | 18816 | 119 | 9.18e-02 | 1.00e+00 || 98.72 | 83.05 | 20.75 || 21.29 | 00h00'00\n+ 0.50 | 1.25 | 117 | 17502 | 117 | 8.68e-02 | 1.00e+00 || 132.81 | 111.73 | 15.42 || 19.09 | 00h00'00\n+ 0.75 | 1.50 | 118 | 16703 | 118 | 8.22e-02 | 1.00e+00 || 135.98 | 114.40 | 15.06 || 20.61 | 00h00'00\n+ 1.00 | 1.75 | 116 | 15506 | 116 | 7.76e-02 | 1.00e+00 || 126.80 | 106.68 | 16.15 || 18.30 | 00h00'00\n+ 1.25 | 2.00 | 117 | 13988 | 117 | 6.94e-02 | 1.00e+00 || 118.52 | 99.71 | 17.28 || 20.62 | 00h00'00\n+ 1.50 | 2.25 | 115 | 12396 | 115 | 6.26e-02 | 1.00e+00 || 141.96 | 119.43 | 14.43 || 18.91 | 00h00'00\n+ 1.75 | 2.50 | 118 | 9711 | 118 | 4.78e-02 | 1.00e+00 || 128.26 | 107.91 | 15.97 || 21.35 | 00h00'00\n+ 2.00 | 2.75 | 126 | 8499 | 117 | 3.91e-02 | 9.29e-01 || 136.52 | 114.86 | 15.00 || 20.21 | 00h00'00\n+ 2.25 | 3.00 | 185 | 6592 | 136 | 2.07e-02 | 7.35e-01 || 89.10 | 74.96 | 22.99 || 35.09 | 00h00'00\n+ 2.50 | 3.25 | 305 | 5252 | 119 | 9.99e-03 | 3.90e-01 || 100.66 | 84.68 | 20.35 || 58.59 | 00h00'00\n+ 2.75 | 3.50 | 621 | 3267 | 109 | 3.05e-03 | 1.76e-01 || 107.78 | 90.67 | 19.00 || 97.22 | 00h00'00\n+ 3.00 | 3.75 | 1739 | 2677 | 104 | 8.93e-04 | 5.98e-02 || 95.06 | 79.97 | 21.55 || 278.72 | 00h00'00\n+ 3.25 | 4.00 | 4690 | 2258 | 101 | 2.79e-04 | 2.15e-02 || 95.07 | 79.99 | 21.54 || 570.83 | 00h00'00\n+ 3.50 | 4.25 | 21521 | 2118 | 100 | 5.71e-05 | 4.65e-03 || 90.57 | 76.19 | 22.61 || 1067.06 | 00h00'00\n+ 3.75 | 4.50 | 90299 | 1832 | 100 | 1.18e-05 | 1.11e-03 || 82.41 | 69.33 | 24.85 || 1783.41 | 00h00'00\n# End of the simulation.\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Update the SC curve with Es/N0.
8,483
16.02.2017 12:09:30
-3,600
159424a084a428eb461cd46e5c75cde1a99ef646
standardize all warnings outputs to std::clog instead of std::cerr
[ { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/StarPU/SPU_Simulation_BFER.cpp", "new_path": "src/Simulation/BFER/StarPU/SPU_Simulation_BFER.cpp", "diff": "@@ -64,7 +64,7 @@ Simulation_BFER<B,R,Q>\n}\nif (params.simulation.time_report)\n- std::cerr << bold_yellow(\"(WW) The time report is not available in the SystemC simulation.\") << std::endl;\n+ std::clog << bold_yellow(\"(WW) The time report is not available in the SystemC simulation.\") << std::endl;\n#ifdef ENABLE_MPI\nstd::clog << bold_yellow(\"(WW) This simulation is not MPI ready, the same computations will be launched \")\n@@ -398,7 +398,7 @@ void Simulation_BFER<B,R,Q>\n}\n}\nelse\n- std::cerr << bold_yellow(\"(WW) Terminal is not allocated: you can't call the temporal report.\") << std::endl;\n+ std::clog << bold_yellow(\"(WW) Terminal is not allocated: you can't call the temporal report.\") << std::endl;\n}\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/SystemC/SC_Simulation_BFER.cpp", "new_path": "src/Simulation/BFER/SystemC/SC_Simulation_BFER.cpp", "diff": "@@ -354,7 +354,7 @@ void Simulation_BFER<B,R,Q>\n}\n}\nelse\n- std::cerr << bold_yellow(\"(WW) Terminal is not allocated: you can't call the temporal report.\") << std::endl;\n+ std::clog << bold_yellow(\"(WW) Terminal is not allocated: you can't call the temporal report.\") << std::endl;\n}\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFERI/SystemC/SC_Simulation_BFERI.cpp", "new_path": "src/Simulation/BFERI/SystemC/SC_Simulation_BFERI.cpp", "diff": "@@ -41,7 +41,7 @@ Simulation_BFERI<B,R,Q>\n}\nif (params.simulation.time_report)\n- std::cerr << bold_yellow(\"(WW) The time report is not available in the SystemC simulation.\") << std::endl;\n+ std::clog << bold_yellow(\"(WW) The time report is not available in the SystemC simulation.\") << std::endl;\n#ifdef ENABLE_MPI\nstd::clog << bold_yellow(\"(WW) This simulation is not MPI ready, the same computations will be launched \")\n@@ -427,7 +427,7 @@ void Simulation_BFERI<B,R,Q>\n}\n}\nelse\n- std::cerr << bold_yellow(\"(WW) Terminal is not allocated: you can't call the temporal report.\") << std::endl;\n+ std::clog << bold_yellow(\"(WW) Terminal is not allocated: you can't call the temporal report.\") << std::endl;\n}\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/EXIT/Simulation_EXIT.cpp", "new_path": "src/Simulation/EXIT/Simulation_EXIT.cpp", "diff": "@@ -57,7 +57,7 @@ Simulation_EXIT<B,R,Q>\nterminal (nullptr)\n{\nif (typeid(R) != typeid(Q))\n- std::cerr << bold_yellow(\"(WW) EXIT simulation does not use fixed-point representation!\") << std::endl;\n+ std::clog << bold_yellow(\"(WW) EXIT simulation does not use fixed-point representation!\") << std::endl;\n#ifdef ENABLE_MPI\nstd::clog << bold_yellow(\"(WW) This simulation is not MPI ready, the same computations will be launched \")\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments_reader.cpp", "new_path": "src/Tools/Arguments_reader.cpp", "diff": "@@ -34,7 +34,7 @@ bool Arguments_reader\nconst bool result = parse_arguments(required_args, optional_args, warns);\nif (display_warnings)\n- std::cout << bold_yellow(warns);\n+ std::clog << bold_yellow(warns);\nreturn result;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
standardize all warnings outputs to std::clog instead of std::cerr
8,490
20.02.2017 15:11:23
-3,600
de635cde6ab54e8843991120190790fb6b7b4c5c
Fix the 8-bit fixed-point SCL fast decoder.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "#include \"Decoder_polar_SCL_fast_sys.hpp\"\n+template <typename R> inline R sat_m(const R m) { return m ; }\n+template < > inline signed char sat_m(const signed char m) { return saturate<signed char>(m, -128, 63); }\n+\ntemplate <typename R>\ninline void normalize_scl_metrics(std::vector<R> &metrics, const int L)\n{\n@@ -32,7 +35,6 @@ template <>\ninline void normalize_scl_metrics(std::vector<short> &metrics, const int L)\n{\nauto min = *std::min_element(metrics.begin(), metrics.begin() + L);\n- if (min > 0) min = 0;\nconst auto norm = std::numeric_limits<short>::min() - min;\n@@ -44,7 +46,6 @@ template <>\ninline void normalize_scl_metrics(std::vector<signed char> &metrics, const int L)\n{\nauto min = *std::min_element(metrics.begin(), metrics.begin() + L);\n- if (min > 0) min = 0;\nconst auto norm = std::numeric_limits<signed char>::min() - min;\n@@ -367,15 +368,16 @@ template <typename B, typename R, class API_polar>\nvoid Decoder_polar_SCL_fast_sys<B,R,API_polar>\n::update_paths_r0(const int r_d, const int off_l, const int off_s, const int n_elmts)\n{\n+ if (n_active_paths > 1)\nfor (auto i = 0; i < n_active_paths; i++)\n{\nconst auto path = paths[i];\nconst auto array = path_2_array[path][r_d];\n- auto pen = 0.f;\n+ auto pen = (R)0;\nfor (auto j = 0; j < n_elmts; j++)\n- pen -= std::min((R)l[array][off_l +j], (R)0);\n- metrics[path] += pen; // add a penalty to the current path metric\n+ pen = sat_m<R>(pen + sat_m<R>(-std::min((R)l[array][off_l +j], (R)0)));\n+ metrics[path] = sat_m<R>(metrics[path] + pen); // add a penalty to the current path metric\n}\nif (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT))\n@@ -388,15 +390,16 @@ template <int REV_D, int N_ELMTS>\nvoid Decoder_polar_SCL_fast_sys<B,R,API_polar>\n::update_paths_r0(const int off_l, const int off_s)\n{\n+ if (n_active_paths > 1)\nfor (auto i = 0; i < n_active_paths; i++)\n{\nconst auto path = paths[i];\nconst auto array = path_2_array[path][REV_D];\n- auto pen = 0.f;\n+ auto pen = (R)0;\nfor (auto j = 0; j < N_ELMTS; j++)\n- pen -= std::min((R)l[array][off_l +j], (R)0);\n- metrics[path] += pen; // add a penalty to the current path metric\n+ pen = sat_m<R>(pen + sat_m<R>(-std::min((R)l[array][off_l +j], (R)0)));\n+ metrics[path] = sat_m<R>(metrics[path] + pen); // add a penalty to the current path metric\n}\nif (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT))\n@@ -423,13 +426,13 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nbit_flips[2 * path +0] = 0;\nbit_flips[2 * path +1] = 1;\n- const auto pen0 = std::abs(l[array][off_l + bit_flips[2 * path +0]]);\n- const auto pen1 = std::abs(l[array][off_l + bit_flips[2 * path +1]]);\n+ const auto pen0 = sat_m<R>(std::abs(l[array][off_l + bit_flips[2 * path +0]]));\n+ const auto pen1 = sat_m<R>(std::abs(l[array][off_l + bit_flips[2 * path +1]]));\nmetrics_vec[1][4 * path +0] = metrics [ path ];\n- metrics_vec[1][4 * path +1] = metrics [ path ] + pen0;\n- metrics_vec[1][4 * path +2] = metrics [ path ] + pen1;\n- metrics_vec[1][4 * path +3] = metrics_vec[1][4 * path +1] + pen1;\n+ metrics_vec[1][4 * path +1] = sat_m<R>(metrics [ path ] + pen0);\n+ metrics_vec[1][4 * path +2] = sat_m<R>(metrics [ path ] + pen1);\n+ metrics_vec[1][4 * path +3] = sat_m<R>(metrics_vec[1][4 * path +1] + pen1);\n}\n}\nelse\n@@ -446,13 +449,13 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nbit_flips[2 * path +0] = best_idx[0];\nbit_flips[2 * path +1] = best_idx[1];\n- const auto pen0 = std::abs(l[array][off_l + bit_flips[2 * path +0]]);\n- const auto pen1 = std::abs(l[array][off_l + bit_flips[2 * path +1]]);\n+ const auto pen0 = sat_m<R>(std::abs(l[array][off_l + bit_flips[2 * path +0]]));\n+ const auto pen1 = sat_m<R>(std::abs(l[array][off_l + bit_flips[2 * path +1]]));\nmetrics_vec[1][4 * path +0] = metrics [ path ];\n- metrics_vec[1][4 * path +1] = metrics [ path ] + pen0;\n- metrics_vec[1][4 * path +2] = metrics [ path ] + pen1;\n- metrics_vec[1][4 * path +3] = metrics_vec[1][4 * path +1] + pen1;\n+ metrics_vec[1][4 * path +1] = sat_m<R>(metrics [ path ] + pen0);\n+ metrics_vec[1][4 * path +2] = sat_m<R>(metrics [ path ] + pen1);\n+ metrics_vec[1][4 * path +3] = sat_m<R>(metrics_vec[1][4 * path +1] + pen1);\n}\n}\nfor (auto i = n_active_paths; i < L; i++)\n@@ -507,13 +510,13 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nbit_flips[2 * path +0] = 0;\nbit_flips[2 * path +1] = 1;\n- const auto pen0 = std::abs(l[array][off_l + bit_flips[2 * path +0]]);\n- const auto pen1 = std::abs(l[array][off_l + bit_flips[2 * path +1]]);\n+ const auto pen0 = sat_m<R>(std::abs(l[array][off_l + bit_flips[2 * path +0]]));\n+ const auto pen1 = sat_m<R>(std::abs(l[array][off_l + bit_flips[2 * path +1]]));\nmetrics_vec[1][4 * path +0] = metrics [ path ];\n- metrics_vec[1][4 * path +1] = metrics [ path ] + pen0;\n- metrics_vec[1][4 * path +2] = metrics [ path ] + pen1;\n- metrics_vec[1][4 * path +3] = metrics_vec[1][4 * path +1] + pen1;\n+ metrics_vec[1][4 * path +1] = sat_m<R>(metrics [ path ] + pen0);\n+ metrics_vec[1][4 * path +2] = sat_m<R>(metrics [ path ] + pen1);\n+ metrics_vec[1][4 * path +3] = sat_m<R>(metrics_vec[1][4 * path +1] + pen1);\n}\n}\nelse\n@@ -530,13 +533,13 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nbit_flips[2 * path +0] = best_idx[0];\nbit_flips[2 * path +1] = best_idx[1];\n- const auto pen0 = std::abs(l[array][off_l + bit_flips[2 * path +0]]);\n- const auto pen1 = std::abs(l[array][off_l + bit_flips[2 * path +1]]);\n+ const auto pen0 = sat_m<R>(std::abs(l[array][off_l + bit_flips[2 * path +0]]));\n+ const auto pen1 = sat_m<R>(std::abs(l[array][off_l + bit_flips[2 * path +1]]));\nmetrics_vec[1][4 * path +0] = metrics [ path ];\n- metrics_vec[1][4 * path +1] = metrics [ path ] + pen0;\n- metrics_vec[1][4 * path +2] = metrics [ path ] + pen1;\n- metrics_vec[1][4 * path +3] = metrics_vec[1][4 * path +1] + pen1;\n+ metrics_vec[1][4 * path +1] = sat_m<R>(metrics [ path ] + pen0);\n+ metrics_vec[1][4 * path +2] = sat_m<R>(metrics [ path ] + pen1);\n+ metrics_vec[1][4 * path +3] = sat_m<R>(metrics_vec[1][4 * path +1] + pen1);\n}\n}\nfor (auto i = n_active_paths; i < L; i++)\n@@ -611,15 +614,15 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst auto path = paths[i];\nconst auto array = path_2_array[path][r_d];\n- auto pen0 = 0;\n- auto pen1 = 0;\n+ auto pen0 = (R)0;\n+ auto pen1 = (R)0;\nfor (auto j = 0; j < n_elmts; j++)\n{\n- pen0 -= std::min(l[array][off_l +j], (R)0);\n- pen1 += std::max(l[array][off_l +j], (R)0);\n+ pen0 = sat_m<R>(pen0 + sat_m<R>(-std::min(l[array][off_l +j], (R)0)));\n+ pen1 = sat_m<R>(pen1 + sat_m<R>(+std::max(l[array][off_l +j], (R)0)));\n}\n- metrics_vec[0][2 * path +0] = metrics[path] + pen0;\n- metrics_vec[0][2 * path +1] = metrics[path] + pen1;\n+ metrics_vec[0][2 * path +0] = sat_m<R>(metrics[path] + pen0);\n+ metrics_vec[0][2 * path +1] = sat_m<R>(metrics[path] + pen1);\n}\nif (n_active_paths <= L / 2)\n@@ -687,15 +690,15 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst auto path = paths[i];\nconst auto array = path_2_array[path][REV_D];\n- auto pen0 = 0;\n- auto pen1 = 0;\n+ auto pen0 = (R)0;\n+ auto pen1 = (R)0;\nfor (auto j = 0; j < N_ELMTS; j++)\n{\n- pen0 -= std::min(l[array][off_l +j], (R)0);\n- pen1 += std::max(l[array][off_l +j], (R)0);\n+ pen0 = sat_m<R>(pen0 + sat_m<R>(-std::min(l[array][off_l +j], (R)0)));\n+ pen1 = sat_m<R>(pen1 + sat_m<R>(+std::max(l[array][off_l +j], (R)0)));\n}\n- metrics_vec[0][2 * path +0] = metrics[path] + pen0;\n- metrics_vec[0][2 * path +1] = metrics[path] + pen1;\n+ metrics_vec[0][2 * path +0] = sat_m<R>(metrics[path] + pen0);\n+ metrics_vec[0][2 * path +1] = sat_m<R>(metrics[path] + pen1);\n}\nif (n_active_paths <= L / 2)\n@@ -773,22 +776,22 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nsum ^= (l[array][off_l +j] < 0);\nis_even[path] = (sum == 0);\n- const auto pen0 = std::abs(l[array][off_l + bit_flips[4 * path +0]]);\n- const auto pen1 = std::abs(l[array][off_l + bit_flips[4 * path +1]]);\n- const auto pen2 = std::abs(l[array][off_l + bit_flips[4 * path +2]]);\n- const auto pen3 = std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n+ const auto pen0 = sat_m<R>(std::abs(l[array][off_l + bit_flips[4 * path +0]]));\n+ const auto pen1 = sat_m<R>(std::abs(l[array][off_l + bit_flips[4 * path +1]]));\n+ const auto pen2 = sat_m<R>(std::abs(l[array][off_l + bit_flips[4 * path +2]]));\n+ const auto pen3 = sat_m<R>(std::abs(l[array][off_l + bit_flips[4 * path +3]]));\n- metrics_vec[2][n_cands * path +0] = metrics[path] + (!is_even[path] ? pen0 : 0);\n- metrics_vec[2][n_cands * path +1] = metrics[path] + ( is_even[path] ? pen0 : 0) + pen1;\n- metrics_vec[2][n_cands * path +2] = metrics[path] + ( is_even[path] ? pen0 : 0) + pen2;\n- metrics_vec[2][n_cands * path +3] = metrics[path] + ( is_even[path] ? pen0 : 0) + pen3;\n+ metrics_vec[2][n_cands * path +0] = sat_m<R>(metrics[path] + (!is_even[path] ? pen0 : 0));\n+ metrics_vec[2][n_cands * path +1] = sat_m<R>(sat_m<R>(metrics[path] + ( is_even[path] ? pen0 : 0)) + pen1);\n+ metrics_vec[2][n_cands * path +2] = sat_m<R>(sat_m<R>(metrics[path] + ( is_even[path] ? pen0 : 0)) + pen2);\n+ metrics_vec[2][n_cands * path +3] = sat_m<R>(sat_m<R>(metrics[path] + ( is_even[path] ? pen0 : 0)) + pen3);\nif (L > 2)\n{\n- metrics_vec[2][n_cands * path +4] = metrics_vec[2][n_cands * path +0] + pen1 + pen2;\n- metrics_vec[2][n_cands * path +5] = metrics_vec[2][n_cands * path +0] + pen1 + pen3;\n- metrics_vec[2][n_cands * path +6] = metrics_vec[2][n_cands * path +0] + pen2 + pen3;\n- metrics_vec[2][n_cands * path +7] = metrics_vec[2][n_cands * path +1] + pen2 + pen3;\n+ metrics_vec[2][n_cands * path +4] = sat_m<R>(sat_m<R>(metrics_vec[2][n_cands * path +0] + pen1) + pen2);\n+ metrics_vec[2][n_cands * path +5] = sat_m<R>(sat_m<R>(metrics_vec[2][n_cands * path +0] + pen1) + pen3);\n+ metrics_vec[2][n_cands * path +6] = sat_m<R>(sat_m<R>(metrics_vec[2][n_cands * path +0] + pen2) + pen3);\n+ metrics_vec[2][n_cands * path +7] = sat_m<R>(sat_m<R>(metrics_vec[2][n_cands * path +1] + pen2) + pen3);\n}\n}\n}\n@@ -811,22 +814,22 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nsum ^= (l[array][off_l +j] < 0);\nis_even[path] = (sum == 0);\n- const auto pen0 = std::abs(l[array][off_l + bit_flips[4 * path +0]]);\n- const auto pen1 = std::abs(l[array][off_l + bit_flips[4 * path +1]]);\n- const auto pen2 = std::abs(l[array][off_l + bit_flips[4 * path +2]]);\n- const auto pen3 = std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n+ const auto pen0 = sat_m<R>(std::abs(l[array][off_l + bit_flips[4 * path +0]]));\n+ const auto pen1 = sat_m<R>(std::abs(l[array][off_l + bit_flips[4 * path +1]]));\n+ const auto pen2 = sat_m<R>(std::abs(l[array][off_l + bit_flips[4 * path +2]]));\n+ const auto pen3 = sat_m<R>(std::abs(l[array][off_l + bit_flips[4 * path +3]]));\n- metrics_vec[2][n_cands * path +0] = metrics[path] + (!is_even[path] ? pen0 : 0);\n- metrics_vec[2][n_cands * path +1] = metrics[path] + ( is_even[path] ? pen0 : 0) + pen1;\n- metrics_vec[2][n_cands * path +2] = metrics[path] + ( is_even[path] ? pen0 : 0) + pen2;\n- metrics_vec[2][n_cands * path +3] = metrics[path] + ( is_even[path] ? pen0 : 0) + pen3;\n+ metrics_vec[2][n_cands * path +0] = sat_m<R>(metrics[path] + (!is_even[path] ? pen0 : 0));\n+ metrics_vec[2][n_cands * path +1] = sat_m<R>(sat_m<R>(metrics[path] + ( is_even[path] ? pen0 : 0)) + pen1);\n+ metrics_vec[2][n_cands * path +2] = sat_m<R>(sat_m<R>(metrics[path] + ( is_even[path] ? pen0 : 0)) + pen2);\n+ metrics_vec[2][n_cands * path +3] = sat_m<R>(sat_m<R>(metrics[path] + ( is_even[path] ? pen0 : 0)) + pen3);\nif (L > 2)\n{\n- metrics_vec[2][n_cands * path +4] = metrics_vec[2][n_cands * path +0] + pen1 + pen2;\n- metrics_vec[2][n_cands * path +5] = metrics_vec[2][n_cands * path +0] + pen1 + pen3;\n- metrics_vec[2][n_cands * path +6] = metrics_vec[2][n_cands * path +0] + pen2 + pen3;\n- metrics_vec[2][n_cands * path +7] = metrics_vec[2][n_cands * path +1] + pen2 + pen3;\n+ metrics_vec[2][n_cands * path +4] = sat_m<R>(sat_m<R>(metrics_vec[2][n_cands * path +0] + pen1) + pen2);\n+ metrics_vec[2][n_cands * path +5] = sat_m<R>(sat_m<R>(metrics_vec[2][n_cands * path +0] + pen1) + pen3);\n+ metrics_vec[2][n_cands * path +6] = sat_m<R>(sat_m<R>(metrics_vec[2][n_cands * path +0] + pen2) + pen3);\n+ metrics_vec[2][n_cands * path +7] = sat_m<R>(sat_m<R>(metrics_vec[2][n_cands * path +1] + pen2) + pen3);\n}\n}\n}\n@@ -885,22 +888,22 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nsum ^= (l[array][off_l +j] < 0);\nis_even[path] = (sum == 0);\n- const auto pen0 = std::abs(l[array][off_l + bit_flips[4 * path +0]]);\n- const auto pen1 = std::abs(l[array][off_l + bit_flips[4 * path +1]]);\n- const auto pen2 = std::abs(l[array][off_l + bit_flips[4 * path +2]]);\n- const auto pen3 = std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n+ const auto pen0 = sat_m<R>(std::abs(l[array][off_l + bit_flips[4 * path +0]]));\n+ const auto pen1 = sat_m<R>(std::abs(l[array][off_l + bit_flips[4 * path +1]]));\n+ const auto pen2 = sat_m<R>(std::abs(l[array][off_l + bit_flips[4 * path +2]]));\n+ const auto pen3 = sat_m<R>(std::abs(l[array][off_l + bit_flips[4 * path +3]]));\n- metrics_vec[2][n_cands * path +0] = metrics[path] + (!is_even[path] ? pen0 : 0);\n- metrics_vec[2][n_cands * path +1] = metrics[path] + ( is_even[path] ? pen0 : 0) + pen1;\n- metrics_vec[2][n_cands * path +2] = metrics[path] + ( is_even[path] ? pen0 : 0) + pen2;\n- metrics_vec[2][n_cands * path +3] = metrics[path] + ( is_even[path] ? pen0 : 0) + pen3;\n+ metrics_vec[2][n_cands * path +0] = sat_m<R>(metrics[path] + (!is_even[path] ? pen0 : 0));\n+ metrics_vec[2][n_cands * path +1] = sat_m<R>(sat_m<R>(metrics[path] + ( is_even[path] ? pen0 : 0)) + pen1);\n+ metrics_vec[2][n_cands * path +2] = sat_m<R>(sat_m<R>(metrics[path] + ( is_even[path] ? pen0 : 0)) + pen2);\n+ metrics_vec[2][n_cands * path +3] = sat_m<R>(sat_m<R>(metrics[path] + ( is_even[path] ? pen0 : 0)) + pen3);\nif (L > 2)\n{\n- metrics_vec[2][n_cands * path +4] = metrics_vec[2][n_cands * path +0] + pen1 + pen2;\n- metrics_vec[2][n_cands * path +5] = metrics_vec[2][n_cands * path +0] + pen1 + pen3;\n- metrics_vec[2][n_cands * path +6] = metrics_vec[2][n_cands * path +0] + pen2 + pen3;\n- metrics_vec[2][n_cands * path +7] = metrics_vec[2][n_cands * path +1] + pen2 + pen3;\n+ metrics_vec[2][n_cands * path +4] = sat_m<R>(sat_m<R>(metrics_vec[2][n_cands * path +0] + pen1) + pen2);\n+ metrics_vec[2][n_cands * path +5] = sat_m<R>(sat_m<R>(metrics_vec[2][n_cands * path +0] + pen1) + pen3);\n+ metrics_vec[2][n_cands * path +6] = sat_m<R>(sat_m<R>(metrics_vec[2][n_cands * path +0] + pen2) + pen3);\n+ metrics_vec[2][n_cands * path +7] = sat_m<R>(sat_m<R>(metrics_vec[2][n_cands * path +1] + pen2) + pen3);\n}\n}\n}\n@@ -923,22 +926,22 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nsum ^= (l[array][off_l +j] < 0);\nis_even[path] = (sum == 0);\n- const auto pen0 = std::abs(l[array][off_l + bit_flips[4 * path +0]]);\n- const auto pen1 = std::abs(l[array][off_l + bit_flips[4 * path +1]]);\n- const auto pen2 = std::abs(l[array][off_l + bit_flips[4 * path +2]]);\n- const auto pen3 = std::abs(l[array][off_l + bit_flips[4 * path +3]]);\n+ const auto pen0 = sat_m<R>(std::abs(l[array][off_l + bit_flips[4 * path +0]]));\n+ const auto pen1 = sat_m<R>(std::abs(l[array][off_l + bit_flips[4 * path +1]]));\n+ const auto pen2 = sat_m<R>(std::abs(l[array][off_l + bit_flips[4 * path +2]]));\n+ const auto pen3 = sat_m<R>(std::abs(l[array][off_l + bit_flips[4 * path +3]]));\n- metrics_vec[2][n_cands * path +0] = metrics[path] + (!is_even[path] ? pen0 : 0);\n- metrics_vec[2][n_cands * path +1] = metrics[path] + ( is_even[path] ? pen0 : 0) + pen1;\n- metrics_vec[2][n_cands * path +2] = metrics[path] + ( is_even[path] ? pen0 : 0) + pen2;\n- metrics_vec[2][n_cands * path +3] = metrics[path] + ( is_even[path] ? pen0 : 0) + pen3;\n+ metrics_vec[2][n_cands * path +0] = sat_m<R>(metrics[path] + (!is_even[path] ? pen0 : 0));\n+ metrics_vec[2][n_cands * path +1] = sat_m<R>(sat_m<R>(metrics[path] + ( is_even[path] ? pen0 : 0)) + pen1);\n+ metrics_vec[2][n_cands * path +2] = sat_m<R>(sat_m<R>(metrics[path] + ( is_even[path] ? pen0 : 0)) + pen2);\n+ metrics_vec[2][n_cands * path +3] = sat_m<R>(sat_m<R>(metrics[path] + ( is_even[path] ? pen0 : 0)) + pen3);\nif (L > 2)\n{\n- metrics_vec[2][n_cands * path +4] = metrics_vec[2][n_cands * path +0] + pen1 + pen2;\n- metrics_vec[2][n_cands * path +5] = metrics_vec[2][n_cands * path +0] + pen1 + pen3;\n- metrics_vec[2][n_cands * path +6] = metrics_vec[2][n_cands * path +0] + pen2 + pen3;\n- metrics_vec[2][n_cands * path +7] = metrics_vec[2][n_cands * path +1] + pen2 + pen3;\n+ metrics_vec[2][n_cands * path +4] = sat_m<R>(sat_m<R>(metrics_vec[2][n_cands * path +0] + pen1) + pen2);\n+ metrics_vec[2][n_cands * path +5] = sat_m<R>(sat_m<R>(metrics_vec[2][n_cands * path +0] + pen1) + pen3);\n+ metrics_vec[2][n_cands * path +6] = sat_m<R>(sat_m<R>(metrics_vec[2][n_cands * path +0] + pen2) + pen3);\n+ metrics_vec[2][n_cands * path +7] = sat_m<R>(sat_m<R>(metrics_vec[2][n_cands * path +1] + pen2) + pen3);\n}\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the 8-bit fixed-point SCL fast decoder.
8,490
20.02.2017 17:37:17
-3,600
c7c4e35c0d6a928e149feb1fd4d61845f211d370
Fix the perf degradation on 8-bit with REP nodes: limit the REP nodes in the tree because the accumulation is unstable.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -68,7 +68,7 @@ Decoder_polar_SCL_fast_sys<B,R,API_polar>\nnew Pattern_polar_r1,\nnew Pattern_polar_r0_left,\nnew Pattern_polar_rep_left,\n- new Pattern_polar_rep,\n+ new Pattern_polar_rep/*(2,3)*/, // perf. degradation with REP nodes with fixed-point arithmetic\nnew Pattern_polar_spc(2,2)}, // perf. degradation with SPC nodes length > 4\n1,\n2),\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_rep.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_rep.hpp", "diff": "class Pattern_polar_SC_rep : public Pattern_polar_rep\n{\nprotected:\n- Pattern_polar_SC_rep(const int &N, const Binary_node<Pattern_polar_i>* node)\n- : Pattern_polar_rep(N, node)\n+ Pattern_polar_SC_rep(const int &N, const Binary_node<Pattern_polar_i>* node,\n+ const int min_level = -1, const int max_level = -1)\n+ : Pattern_polar_rep(N, node, min_level, max_level)\n{\n}\npublic:\n- Pattern_polar_SC_rep() : Pattern_polar_rep() {}\n+ Pattern_polar_SC_rep(const int min_level = -1, const int max_level = -1)\n+ : Pattern_polar_rep(min_level, max_level) {}\nvirtual ~Pattern_polar_SC_rep() {}\nvirtual Pattern_polar_i* alloc(const int &N, const Binary_node<Pattern_polar_i>* node) const\n{\n- return new Pattern_polar_SC_rep(N, node);\n+ return new Pattern_polar_SC_rep(N, node, this->min_level, this->max_level);\n}\nvirtual std::string apply_f(std::string start_indent = \"\", std::string str_off_l = \"\", std::string str_off_s = \"\") const {\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_rep.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_rep.hpp", "diff": "class Pattern_polar_SCL_rep : public Pattern_polar_rep\n{\nprotected:\n- Pattern_polar_SCL_rep(const int &N, const Binary_node<Pattern_polar_i>* node)\n- : Pattern_polar_rep(N, node)\n+ Pattern_polar_SCL_rep(const int &N, const Binary_node<Pattern_polar_i>* node,\n+ const int min_level = -1, const int max_level = -1)\n+ : Pattern_polar_rep(N, node, min_level, max_level)\n{\n}\npublic:\n- Pattern_polar_SCL_rep() : Pattern_polar_rep() {}\n+ Pattern_polar_SCL_rep(const int min_level = -1, const int max_level = -1)\n+ : Pattern_polar_rep(min_level, max_level) {}\nvirtual ~Pattern_polar_SCL_rep() {}\nvirtual Pattern_polar_i* alloc(const int &N, const Binary_node<Pattern_polar_i>* node) const\n{\n- return new Pattern_polar_SCL_rep(N, node);\n+ return new Pattern_polar_SCL_rep(N, node, this->min_level, this->max_level);\n}\nvirtual std::string apply_f(std::string start_indent = \"\", std::string str_off_l = \"\", std::string str_off_s = \"\") const\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_rep.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_rep.hpp", "diff": "class Pattern_polar_rep : public Pattern_polar_i\n{\nprotected:\n- Pattern_polar_rep(const int &N, const Binary_node<Pattern_polar_i>* node) : Pattern_polar_i(N, node)\n+ int min_level;\n+ int max_level;\n+\n+ Pattern_polar_rep(const int &N, const Binary_node<Pattern_polar_i>* node,\n+ const int min_level = -1, const int max_level = -1)\n+ : Pattern_polar_i(N, node), min_level(min_level), max_level(max_level)\n{\n+ assert(min_level == -1 || min_level >= 2);\n+ assert(max_level == -1 || (max_level >= 2 && max_level >= min_level));\n}\npublic:\n- Pattern_polar_rep() : Pattern_polar_i() { }\n+ Pattern_polar_rep(const int min_level = -1, const int max_level = -1)\n+ : Pattern_polar_i(), min_level(min_level), max_level(max_level)\n+ {\n+ assert(min_level == -1 || min_level >= 2);\n+ assert(max_level == -1 || (max_level >= 2 && max_level >= min_level));\n+ }\nvirtual Pattern_polar_i* alloc(const int &N, const Binary_node<Pattern_polar_i>* node) const\n{\n- return new Pattern_polar_rep(N, node);\n+ return new Pattern_polar_rep(N, node, min_level, max_level);\n}\nvirtual ~Pattern_polar_rep() {}\n@@ -40,6 +52,36 @@ public:\nvirtual std::string g() const { return \"\"; }\nvirtual std::string h() const { return \"rep\"; }\n+ bool recursive_check_rep(const int reverse_graph_depth, const Binary_node<Pattern_polar_i>* node_curr) const\n+ {\n+ if (max_level != -1 && reverse_graph_depth > max_level)\n+ return false;\n+\n+ if (!node_curr->is_leaf())\n+ {\n+ const Pattern_polar_i *pattern_left = node_curr->get_left ()->get_contents();\n+ const Pattern_polar_i *pattern_right = node_curr->get_right()->get_contents();\n+\n+ if (pattern_left->type() != polar_node_t::RATE_0)\n+ {\n+ return false;\n+ }\n+ else\n+ {\n+ if (pattern_right->type() == polar_node_t::REP)\n+ return true;\n+ else if (pattern_right->type() == polar_node_t::RATE_1 && reverse_graph_depth == 1)\n+ return true;\n+ else\n+ return this->recursive_check_rep(reverse_graph_depth -1, node_curr->get_right());\n+ }\n+ }\n+ else\n+ {\n+ return false;\n+ }\n+ }\n+\nvirtual int match(const int &reverse_graph_depth, const Binary_node<Pattern_polar_i>* node_curr) const\n{\nassert(reverse_graph_depth > 0);\n@@ -52,19 +94,13 @@ public:\nint match_val = 0;\n- if (reverse_graph_depth == 1)\n+ if (min_level == -1 || reverse_graph_depth >= min_level)\n{\n- if (pattern_left ->type() == polar_node_t::RATE_0 &&\n- pattern_right->type() == polar_node_t::RATE_1)\n+ if (this->recursive_check_rep(reverse_graph_depth, node_curr))\n{\nmatch_val = 50;\n}\n}\n- else if (pattern_left ->type() == polar_node_t::RATE_0 &&\n- pattern_right->type() == polar_node_t::REP)\n- {\n- match_val = 50;\n- }\nreturn match_val;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_spc.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_spc.hpp", "diff": "@@ -81,6 +81,8 @@ public:\nreturn true;\nelse if (pattern_left->type() == polar_node_t::REP && reverse_graph_depth == 2)\nreturn true;\n+ else if (pattern_left->type() == polar_node_t::RATE_0 && reverse_graph_depth == 1)\n+ return true;\nelse\nreturn this->recursive_check_spc(reverse_graph_depth -1, node_curr->get_left());\n}\n@@ -105,21 +107,7 @@ public:\nif (min_level == -1 || reverse_graph_depth >= min_level)\n{\n-// if (reverse_graph_depth == 2)\n-// {\n-// if (pattern_left ->type() == polar_node_t::REP &&\n-// pattern_right->type() == polar_node_t::RATE_1)\n-// {\n-// match_val = 49;\n-// }\n-// }\n-// else if ((max_level == -1 || reverse_graph_depth <= max_level) &&\n-// pattern_left ->type() == polar_node_t::SPC &&\n-// pattern_right->type() == polar_node_t::RATE_1)\n-// {\n-// match_val = 49;\n-// }\n- /*else*/ if (this->recursive_check_spc(reverse_graph_depth, node_curr))\n+ if (this->recursive_check_spc(reverse_graph_depth, node_curr))\n{\nmatch_val = 49;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the perf degradation on 8-bit with REP nodes: limit the REP nodes in the tree because the accumulation is unstable.
8,490
21.02.2017 10:12:40
-3,600
d46bbcf28366c0bee7e0db31c3b52a9ff992484e
Update the polar pattern matching core: now all the nodes can autodetect themselves and it is possible to specify a start/end depth to apply tree cuts for each node types.
[ { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_r0.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_r0.hpp", "diff": "class Pattern_polar_SC_r0 : public Pattern_polar_r0\n{\nprotected:\n- Pattern_polar_SC_r0(const int &N, const Binary_node<Pattern_polar_i>* node)\n- : Pattern_polar_r0(N, node)\n+ Pattern_polar_SC_r0(const int &N, const Binary_node<Pattern_polar_i>* node,\n+ const int min_level = -1, const int max_level = -1)\n+ : Pattern_polar_r0(N, node, min_level, max_level)\n{\n}\npublic:\n- Pattern_polar_SC_r0() : Pattern_polar_r0() {}\n+ Pattern_polar_SC_r0(const int min_level = -1, const int max_level = -1)\n+ : Pattern_polar_r0(min_level, max_level) {}\nvirtual ~Pattern_polar_SC_r0() {}\nvirtual Pattern_polar_i* alloc(const int &N, const Binary_node<Pattern_polar_i>* node) const\n{\n- return new Pattern_polar_SC_r0(N, node);\n+ return new Pattern_polar_SC_r0(N, node, this->min_level, this->max_level);\n}\nvirtual std::string apply_f(std::string start_indent = \"\", std::string str_off_l = \"\", std::string str_off_s = \"\") const\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_r1.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_r1.hpp", "diff": "class Pattern_polar_SC_r1 : public Pattern_polar_r1\n{\nprotected:\n- Pattern_polar_SC_r1(const int &N, const Binary_node<Pattern_polar_i>* node) : Pattern_polar_r1(N, node)\n+ Pattern_polar_SC_r1(const int &N, const Binary_node<Pattern_polar_i>* node,\n+ const int min_level = -1, const int max_level = -1)\n+ : Pattern_polar_r1(N, node, min_level, max_level)\n{\n}\npublic:\n- Pattern_polar_SC_r1() : Pattern_polar_r1() {}\n+ Pattern_polar_SC_r1(const int min_level = -1, const int max_level = -1)\n+ : Pattern_polar_r1(min_level, max_level) {}\nvirtual ~Pattern_polar_SC_r1() {}\nvirtual Pattern_polar_i* alloc(const int &N, const Binary_node<Pattern_polar_i>* node) const\n{\n- return new Pattern_polar_SC_r1(N, node);\n+ return new Pattern_polar_SC_r1(N, node, this->min_level, this->max_level);\n}\nvirtual std::string apply_f(std::string start_indent = \"\", std::string str_off_l = \"\", std::string str_off_s = \"\") const\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_r0.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_r0.hpp", "diff": "class Pattern_polar_SCL_r0 : public Pattern_polar_r0\n{\nprotected:\n- Pattern_polar_SCL_r0(const int &N, const Binary_node<Pattern_polar_i>* node)\n- : Pattern_polar_r0(N, node)\n+ Pattern_polar_SCL_r0(const int &N, const Binary_node<Pattern_polar_i>* node,\n+ const int min_level = -1, const int max_level = -1)\n+ : Pattern_polar_r0(N, node, min_level, max_level)\n{\n}\npublic:\n- Pattern_polar_SCL_r0() : Pattern_polar_r0() {}\n+ Pattern_polar_SCL_r0(const int min_level = -1, const int max_level = -1)\n+ : Pattern_polar_r0(min_level, max_level) {}\nvirtual ~Pattern_polar_SCL_r0() {}\nvirtual Pattern_polar_i* alloc(const int &N, const Binary_node<Pattern_polar_i>* node) const\n{\n- return new Pattern_polar_SCL_r0(N, node);\n+ return new Pattern_polar_SCL_r0(N, node, this->min_level, this->max_level);\n}\nvirtual std::string apply_f(std::string start_indent = \"\", std::string str_off_l = \"\", std::string str_off_s = \"\") const\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_r1.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_r1.hpp", "diff": "class Pattern_polar_SCL_r1 : public Pattern_polar_r1\n{\nprotected:\n- Pattern_polar_SCL_r1(const int &N, const Binary_node<Pattern_polar_i>* node)\n- : Pattern_polar_r1(N, node)\n+ Pattern_polar_SCL_r1(const int &N, const Binary_node<Pattern_polar_i>* node,\n+ const int min_level = -1, const int max_level = -1)\n+ : Pattern_polar_r1(N, node, min_level, max_level)\n{\n}\npublic:\n- Pattern_polar_SCL_r1() : Pattern_polar_r1() {}\n+ Pattern_polar_SCL_r1(const int min_level = -1, const int max_level = -1)\n+ : Pattern_polar_r1(min_level, max_level) {}\nvirtual ~Pattern_polar_SCL_r1() {}\nvirtual Pattern_polar_i* alloc(const int &N, const Binary_node<Pattern_polar_i>* node) const\n{\n- return new Pattern_polar_SCL_r1(N, node);\n+ return new Pattern_polar_SCL_r1(N, node, this->min_level, this->max_level);\n}\nvirtual std::string apply_f(std::string start_indent = \"\", std::string str_off_l = \"\", std::string str_off_s = \"\") const\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_r0.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_r0.hpp", "diff": "class Pattern_polar_r0 : public Pattern_polar_i\n{\nprotected:\n- Pattern_polar_r0(const int &N, const Binary_node<Pattern_polar_i>* node) : Pattern_polar_i(N, node)\n+ int min_level;\n+ int max_level;\n+\n+ Pattern_polar_r0(const int &N, const Binary_node<Pattern_polar_i>* node,\n+ const int min_level = -1, const int max_level = -1)\n+ : Pattern_polar_i(N, node), min_level(min_level), max_level(max_level)\n{\n+ assert(min_level == -1 || min_level >= 0);\n+ assert(max_level == -1 || (max_level >= 0 && max_level >= min_level));\n}\n+\npublic:\n- Pattern_polar_r0() : Pattern_polar_i() { }\n+ Pattern_polar_r0(const int min_level = -1, const int max_level = -1)\n+ : Pattern_polar_i(), min_level(min_level), max_level(max_level)\n+ {\n+ assert(min_level == -1 || min_level >= 0);\n+ assert(max_level == -1 || (max_level >= 0 && max_level >= min_level));\n+ }\nvirtual Pattern_polar_i* alloc(const int &N, const Binary_node<Pattern_polar_i>* node) const\n{\n- return new Pattern_polar_r0(N, node);\n+ return new Pattern_polar_r0(N, node, min_level, max_level);\n}\nvirtual ~Pattern_polar_r0() {}\n@@ -37,23 +50,47 @@ public:\nvirtual std::string g() const { return \"\"; }\nvirtual std::string h() const { return \"\"; }\n+ static bool recursive_check(const int reverse_graph_depth, const Binary_node<Pattern_polar_i>* node_curr)\n+ {\n+ if (!node_curr->is_leaf())\n+ {\n+ const auto pattern_left = node_curr->get_left ()->get_contents();\n+ const auto pattern_right = node_curr->get_right()->get_contents();\n+\n+ if (pattern_left ->type() == polar_node_t::RATE_0 &&\n+ pattern_right->type() == polar_node_t::RATE_0)\n+ {\n+ return true;\n+ }\n+ else\n+ {\n+ return Pattern_polar_r0::recursive_check(reverse_graph_depth -1, node_curr->get_left ()) &&\n+ Pattern_polar_r0::recursive_check(reverse_graph_depth -1, node_curr->get_right());\n+ }\n+ }\n+ else\n+ {\n+ const auto pattern_leaf = node_curr->get_contents();\n+ return pattern_leaf->type() == polar_node_t::RATE_0;\n+ }\n+ }\n+\nvirtual int match(const int &reverse_graph_depth, const Binary_node<Pattern_polar_i>* node_curr) const\n{\nassert(reverse_graph_depth > 0);\n- const Pattern_polar_i *pattern_left = node_curr->get_left ()->get_contents();\n- const Pattern_polar_i *pattern_right = node_curr->get_right()->get_contents();\n+ const auto pattern_left = node_curr->get_left ()->get_contents();\n+ const auto pattern_right = node_curr->get_right()->get_contents();\nassert(pattern_left != nullptr);\nassert(pattern_right != nullptr);\nint match_val = 0;\n- if (pattern_left ->type() == polar_node_t::RATE_0 &&\n- pattern_right->type() == polar_node_t::RATE_0)\n- {\n+ if ((min_level == -1 || reverse_graph_depth >= min_level) &&\n+ (max_level == -1 || reverse_graph_depth <= max_level))\n+ if (Pattern_polar_r0::recursive_check(reverse_graph_depth, node_curr))\nmatch_val = 100;\n- }\nreturn match_val;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_r1.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_r1.hpp", "diff": "class Pattern_polar_r1 : public Pattern_polar_i\n{\nprotected:\n- Pattern_polar_r1(const int &N, const Binary_node<Pattern_polar_i>* node) : Pattern_polar_i(N, node)\n+ int min_level;\n+ int max_level;\n+\n+ Pattern_polar_r1(const int &N, const Binary_node<Pattern_polar_i>* node,\n+ const int min_level = -1, const int max_level = -1)\n+ : Pattern_polar_i(N, node), min_level(min_level), max_level(max_level)\n{\n+ assert(min_level == -1 || min_level >= 0);\n+ assert(max_level == -1 || (max_level >= 0 && max_level >= min_level));\n}\n+\npublic:\n- Pattern_polar_r1() : Pattern_polar_i() { }\n+ Pattern_polar_r1(const int min_level = -1, const int max_level = -1)\n+ : Pattern_polar_i(), min_level(min_level), max_level(max_level)\n+ {\n+ assert(min_level == -1 || min_level >= 0);\n+ assert(max_level == -1 || (max_level >= 0 && max_level >= min_level));\n+ }\nvirtual Pattern_polar_i* alloc(const int &N, const Binary_node<Pattern_polar_i>* node) const\n{\n- return new Pattern_polar_r1(N, node);\n+ return new Pattern_polar_r1(N, node, min_level, max_level);\n}\nvirtual ~Pattern_polar_r1() {}\n@@ -37,23 +50,47 @@ public:\nvirtual std::string g() const { return \"\"; }\nvirtual std::string h() const { return \"h\"; }\n+ static bool recursive_check(const int reverse_graph_depth, const Binary_node<Pattern_polar_i>* node_curr)\n+ {\n+ if (!node_curr->is_leaf())\n+ {\n+ const auto pattern_left = node_curr->get_left ()->get_contents();\n+ const auto pattern_right = node_curr->get_right()->get_contents();\n+\n+ if (pattern_left ->type() == polar_node_t::RATE_1 &&\n+ pattern_right->type() == polar_node_t::RATE_1)\n+ {\n+ return true;\n+ }\n+ else\n+ {\n+ return Pattern_polar_r1::recursive_check(reverse_graph_depth -1, node_curr->get_left ()) &&\n+ Pattern_polar_r1::recursive_check(reverse_graph_depth -1, node_curr->get_right());\n+ }\n+ }\n+ else\n+ {\n+ const auto pattern_leaf = node_curr->get_contents();\n+ return pattern_leaf->type() == polar_node_t::RATE_1;\n+ }\n+ }\n+\nvirtual int match(const int &reverse_graph_depth, const Binary_node<Pattern_polar_i>* node_curr) const\n{\nassert(reverse_graph_depth > 0);\n- const Pattern_polar_i *pattern_left = node_curr->get_left ()->get_contents();\n- const Pattern_polar_i *pattern_right = node_curr->get_right()->get_contents();\n+ const auto pattern_left = node_curr->get_left ()->get_contents();\n+ const auto pattern_right = node_curr->get_right()->get_contents();\nassert(pattern_left != nullptr);\nassert(pattern_right != nullptr);\nint match_val = 0;\n- if (pattern_left ->type() == polar_node_t::RATE_1 &&\n- pattern_right->type() == polar_node_t::RATE_1)\n- {\n+ if ((min_level == -1 || reverse_graph_depth >= min_level) &&\n+ (max_level == -1 || reverse_graph_depth <= max_level))\n+ if (Pattern_polar_r1::recursive_check(reverse_graph_depth, node_curr))\nmatch_val = 99;\n- }\nreturn match_val;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_rep.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_rep.hpp", "diff": "@@ -23,16 +23,16 @@ protected:\nconst int min_level = -1, const int max_level = -1)\n: Pattern_polar_i(N, node), min_level(min_level), max_level(max_level)\n{\n- assert(min_level == -1 || min_level >= 2);\n- assert(max_level == -1 || (max_level >= 2 && max_level >= min_level));\n+ assert(min_level == -1 || min_level >= 1);\n+ assert(max_level == -1 || (max_level >= 1 && max_level >= min_level));\n}\npublic:\nPattern_polar_rep(const int min_level = -1, const int max_level = -1)\n: Pattern_polar_i(), min_level(min_level), max_level(max_level)\n{\n- assert(min_level == -1 || min_level >= 2);\n- assert(max_level == -1 || (max_level >= 2 && max_level >= min_level));\n+ assert(min_level == -1 || min_level >= 1);\n+ assert(max_level == -1 || (max_level >= 1 && max_level >= min_level));\n}\nvirtual Pattern_polar_i* alloc(const int &N, const Binary_node<Pattern_polar_i>* node) const\n@@ -52,28 +52,26 @@ public:\nvirtual std::string g() const { return \"\"; }\nvirtual std::string h() const { return \"rep\"; }\n- bool recursive_check_rep(const int reverse_graph_depth, const Binary_node<Pattern_polar_i>* node_curr) const\n+ static bool recursive_check(const int reverse_graph_depth, const Binary_node<Pattern_polar_i>* node_curr)\n{\n- if (max_level != -1 && reverse_graph_depth > max_level)\n- return false;\n-\nif (!node_curr->is_leaf())\n{\n- const Pattern_polar_i *pattern_left = node_curr->get_left ()->get_contents();\n- const Pattern_polar_i *pattern_right = node_curr->get_right()->get_contents();\n+ const auto pattern_left = node_curr->get_left ()->get_contents();\n+ const auto pattern_right = node_curr->get_right()->get_contents();\n- if (pattern_left->type() != polar_node_t::RATE_0)\n- {\n- return false;\n- }\n- else\n+ if (pattern_left->type() == polar_node_t::RATE_0 ||\n+ Pattern_polar_r0::recursive_check(reverse_graph_depth -1, node_curr->get_left()))\n{\nif (pattern_right->type() == polar_node_t::REP)\nreturn true;\nelse if (pattern_right->type() == polar_node_t::RATE_1 && reverse_graph_depth == 1)\nreturn true;\nelse\n- return this->recursive_check_rep(reverse_graph_depth -1, node_curr->get_right());\n+ return Pattern_polar_rep::recursive_check(reverse_graph_depth -1, node_curr->get_right());\n+ }\n+ else\n+ {\n+ return false;\n}\n}\nelse\n@@ -86,21 +84,18 @@ public:\n{\nassert(reverse_graph_depth > 0);\n- const Pattern_polar_i *pattern_left = node_curr->get_left ()->get_contents();\n- const Pattern_polar_i *pattern_right = node_curr->get_right()->get_contents();\n+ const auto pattern_left = node_curr->get_left ()->get_contents();\n+ const auto pattern_right = node_curr->get_right()->get_contents();\nassert(pattern_left != nullptr);\nassert(pattern_right != nullptr);\nint match_val = 0;\n- if (min_level == -1 || reverse_graph_depth >= min_level)\n- {\n- if (this->recursive_check_rep(reverse_graph_depth, node_curr))\n- {\n+ if ((min_level == -1 || reverse_graph_depth >= min_level) &&\n+ (max_level == -1 || reverse_graph_depth <= max_level))\n+ if (Pattern_polar_rep::recursive_check(reverse_graph_depth, node_curr))\nmatch_val = 50;\n- }\n- }\nreturn match_val;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_spc.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_spc.hpp", "diff": "@@ -61,21 +61,15 @@ public:\nvirtual std::string g() const { return \"\"; }\nvirtual std::string h() const { return \"spc\"; }\n- bool recursive_check_spc(const int reverse_graph_depth, const Binary_node<Pattern_polar_i>* node_curr) const\n+ static bool recursive_check(const int reverse_graph_depth, const Binary_node<Pattern_polar_i>* node_curr)\n{\n- if (max_level != -1 && reverse_graph_depth > max_level)\n- return false;\n-\nif (!node_curr->is_leaf())\n{\n- const Pattern_polar_i *pattern_left = node_curr->get_left ()->get_contents();\n- const Pattern_polar_i *pattern_right = node_curr->get_right()->get_contents();\n+ const auto pattern_left = node_curr->get_left ()->get_contents();\n+ const auto pattern_right = node_curr->get_right()->get_contents();\n- if (pattern_right->type() != polar_node_t::RATE_1)\n- {\n- return false;\n- }\n- else\n+ if (pattern_right->type() == polar_node_t::RATE_1 ||\n+ Pattern_polar_r1::recursive_check(reverse_graph_depth -1, node_curr->get_right()))\n{\nif (pattern_left->type() == polar_node_t::SPC)\nreturn true;\n@@ -84,7 +78,11 @@ public:\nelse if (pattern_left->type() == polar_node_t::RATE_0 && reverse_graph_depth == 1)\nreturn true;\nelse\n- return this->recursive_check_spc(reverse_graph_depth -1, node_curr->get_left());\n+ return Pattern_polar_spc::recursive_check(reverse_graph_depth -1, node_curr->get_left());\n+ }\n+ else\n+ {\n+ return false;\n}\n}\nelse\n@@ -97,21 +95,18 @@ public:\n{\nassert(reverse_graph_depth > 0);\n- const Pattern_polar_i *pattern_left = node_curr->get_left ()->get_contents();\n- const Pattern_polar_i *pattern_right = node_curr->get_right()->get_contents();\n+ const auto pattern_left = node_curr->get_left ()->get_contents();\n+ const auto pattern_right = node_curr->get_right()->get_contents();\nassert(pattern_left != nullptr);\nassert(pattern_right != nullptr);\nint match_val = 0;\n- if (min_level == -1 || reverse_graph_depth >= min_level)\n- {\n- if (this->recursive_check_spc(reverse_graph_depth, node_curr))\n- {\n+ if ((min_level == -1 || reverse_graph_depth >= min_level) &&\n+ (max_level == -1 || reverse_graph_depth <= max_level))\n+ if (Pattern_polar_spc::recursive_check(reverse_graph_depth, node_curr))\nmatch_val = 49;\n- }\n- }\nreturn match_val;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Update the polar pattern matching core: now all the nodes can autodetect themselves and it is possible to specify a start/end depth to apply tree cuts for each node types.
8,490
21.02.2017 15:09:51
-3,600
3e8ae22d49eaee48744a4bce524e78165afe702d
Add a new cmd line arg to select the Polar node types dynamically.
[ { "change_type": "MODIFY", "old_path": "src/Launcher/BFER/Polar/Launcher_BFER_polar.cpp", "new_path": "src/Launcher/BFER/Polar/Launcher_BFER_polar.cpp", "diff": "@@ -28,6 +28,7 @@ Launcher_BFER_polar<B,R,Q>\nthis->params.decoder .n_ite = 1;\nthis->params.decoder .L = 1;\nthis->params.decoder .simd_strategy = \"\";\n+ this->params.decoder .polar_nodes = \"{R0,R1,R0L,REP,REPL,SPC4}\";\n}\ntemplate <typename B, typename R, typename Q>\n@@ -91,6 +92,9 @@ void Launcher_BFER_polar<B,R,Q>\n{\"string\",\n\"the SIMD strategy you want to use.\",\n\"INTRA, INTER\"};\n+ this->opt_args[{\"dec-polar-nodes\"}] =\n+ {\"string\",\n+ \"the type of nodes you want to detect in the Polar tree (ex: {R0,R1,R0L,REP,REPL,SPC4+}).\"};\n}\ntemplate <typename B, typename R, typename Q>\n@@ -125,6 +129,7 @@ void Launcher_BFER_polar<B,R,Q>\nif(this->ar.exist_arg({\"dec-ite\", \"i\"})) this->params.decoder.n_ite = this->ar.get_arg_int({\"dec-ite\", \"i\"});\nif(this->ar.exist_arg({\"dec-lists\", \"L\"})) this->params.decoder.L = this->ar.get_arg_int({\"dec-lists\", \"L\"});\nif(this->ar.exist_arg({\"dec-simd\" })) this->params.decoder.simd_strategy = this->ar.get_arg ({\"dec-simd\" });\n+ if(this->ar.exist_arg({\"dec-polar-nodes\"})) this->params.decoder.polar_nodes = this->ar.get_arg ({\"dec-polar-nodes\"});\nif (this->params.decoder.simd_strategy == \"INTER\" && !this->ar.exist_arg({\"sim-inter-lvl\"}))\nthis->params.simulation.inter_frame_level = mipp::nElReg<Q>();\n@@ -195,7 +200,10 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFER_polar<B,R,Q>\np.push_back(std::make_pair(\"Num. of iterations (i)\", std::to_string(this->params.decoder.n_ite)));\nif (this->params.decoder.type == \"SCL\")\n+ {\np.push_back(std::make_pair(\"Num. of lists (L)\", std::to_string(this->params.decoder.L)));\n+ p.push_back(std::make_pair(\"Polar node types\", this->params.decoder.polar_nodes));\n+ }\nif (this->params.decoder.type == \"SCL_MEM\")\np.push_back(std::make_pair(\"Num. of lists (L)\", std::to_string(this->params.decoder.L)));\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/EXIT/Polar/Launcher_EXIT_polar.cpp", "new_path": "src/Launcher/EXIT/Polar/Launcher_EXIT_polar.cpp", "diff": "@@ -22,6 +22,7 @@ Launcher_EXIT_polar<B,R,Q>\nthis->params.decoder .implem = \"NAIVE\";\nthis->params.decoder .n_ite = 1;\nthis->params.decoder .L = 1;\n+ this->params.decoder .polar_nodes = \"{R0,R1,R0L,REP,REPL,SPC4}\";\n}\ntemplate <typename B, typename R, typename Q>\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hpp", "new_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hpp", "diff": "@@ -14,6 +14,11 @@ protected:\npublic:\nDecoder_polar_SCL_fast_CA_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits, CRC<B>& crc,\nconst int n_frames = 1, const std::string name = \"Decoder_polar_SCL_fast_CA_sys\");\n+\n+ Decoder_polar_SCL_fast_CA_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits,\n+ const std::vector<Pattern_polar_i*> polar_patterns, const int idx_r0, const int idx_r1,\n+ CRC<B>& crc, const int n_frames = 1, const std::string name = \"Decoder_polar_SCL_fast_CA_sys\");\n+\nvirtual ~Decoder_polar_SCL_fast_CA_sys(){};\nprotected:\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hxx", "diff": "@@ -10,6 +10,16 @@ Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>\n{\n}\n+template <typename B, typename R, class API_polar>\n+Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>\n+::Decoder_polar_SCL_fast_CA_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits,\n+ const std::vector<Pattern_polar_i*> polar_patterns, const int idx_r0, const int idx_r1,\n+ CRC<B>& crc, const int n_frames, const std::string name)\n+: Decoder_polar_SCL_fast_sys<B,R,API_polar>(K, N, L, frozen_bits, polar_patterns, idx_r0, idx_r1, n_frames, name),\n+ crc(crc), U_test(K)\n+{\n+}\n+\ntemplate <typename B, typename R, class API_polar>\nbool Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>\n::crc_check(mipp::vector<B> &s)\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "diff": "@@ -43,6 +43,11 @@ protected:\npublic:\nDecoder_polar_SCL_fast_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits,\nconst int n_frames = 1, const std::string name = \"Decoder_polar_SCL_fast_sys\");\n+\n+ Decoder_polar_SCL_fast_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits,\n+ const std::vector<Pattern_polar_i*> polar_patterns, const int idx_r0, const int idx_r1,\n+ const int n_frames = 1, const std::string name = \"Decoder_polar_SCL_fast_sys\");\n+\nvirtual ~Decoder_polar_SCL_fast_sys();\nvirtual void load (const mipp::vector<R>& Y_N);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -100,6 +100,44 @@ Decoder_polar_SCL_fast_sys<B,R,API_polar>\nmetrics_vec[2].resize((L <= 2 ? 4 : 8) * L);\n}\n+template <typename B, typename R, class API_polar>\n+Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+::Decoder_polar_SCL_fast_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits,\n+ const std::vector<Pattern_polar_i*> polar_patterns, const int idx_r0, const int idx_r1,\n+ const int n_frames, const std::string name)\n+: Decoder<B,R> (K, N, n_frames, API_polar::get_n_frames(), name),\n+ m (std::log2(N)),\n+ L (L),\n+ frozen_bits (frozen_bits),\n+ polar_patterns(N, frozen_bits, polar_patterns, idx_r0, idx_r1),\n+ paths (L),\n+ metrics (L),\n+ Y_N ( N + mipp::nElReg<R>() ),\n+ l (L, mipp::vector<R>(N + mipp::nElReg<R>())),\n+ s (L, mipp::vector<B>(N + mipp::nElReg<B>())),\n+ metrics_vec (3, std::vector<R>()),\n+ dup_count (L, 0),\n+ bit_flips (4 * L),\n+ is_even (L),\n+ best_path (0),\n+ n_active_paths(1),\n+ n_array_ref (L, std::vector<int>(m)),\n+ path_2_array (L, std::vector<int>(m)),\n+ sorter (N),\n+//sorter_simd (N),\n+ best_idx (L),\n+ l_tmp (N)\n+{\n+ static_assert(API_polar::get_n_frames() == 1, \"The inter-frame API_polar is not supported.\");\n+ static_assert(sizeof(B) == sizeof(R), \"Sizes of the bits and reals have to be identical.\");\n+\n+ assert(is_power_of_2(L));\n+\n+ metrics_vec[0].resize(L * 2);\n+ metrics_vec[1].resize(L * 4);\n+ metrics_vec[2].resize((L <= 2 ? 4 : 8) * L);\n+}\n+\ntemplate <typename B, typename R, class API_polar>\nDecoder_polar_SCL_fast_sys<B,R,API_polar>\n::~Decoder_polar_SCL_fast_sys()\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Factory/Polar/Factory_decoder_polar.cpp", "new_path": "src/Tools/Factory/Polar/Factory_decoder_polar.cpp", "diff": "#include \"Tools/Code/Polar/API/API_polar_static_intra_32bit.hpp\"\n#endif\n+#include \"Tools/Code/Polar/nodes_parser.h\"\n+\n#include \"Factory_decoder_polar.hpp\"\ntemplate <typename B, typename R>\n@@ -181,24 +183,27 @@ Decoder<B,R>* Factory_decoder_polar<B,R>\nif (params.decoder.type == \"SCL\" && params.decoder.implem == \"FAST\")\n{\n+ int idx_r0, idx_r1;\n+ auto polar_patterns = nodes_parser(params.decoder.polar_nodes, idx_r0, idx_r1);\n+\nif (params.decoder.simd_strategy == \"INTRA\")\n{\nusing API_polar = API_polar_dynamic_intra\n<B, R, f_LLR <R>, g_LLR <B,R>, g0_LLR <R>, h_LLR <B,R>, xo_STD <B>,\nf_LLR_i<R>, g_LLR_i<B,R>, g0_LLR_i<R>, h_LLR_i<B,R>, xo_STD_i<B>>;\nif (params.crc.poly.empty())\n- decoder = new Decoder_polar_SCL_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_SCL_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, polar_patterns, idx_r0, idx_r1, params.simulation.inter_frame_level);\nelse\n- decoder = new Decoder_polar_SCL_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_SCL_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, polar_patterns, idx_r0, idx_r1, *crc, params.simulation.inter_frame_level);\n}\nelse if (params.decoder.simd_strategy.empty())\n{\nusing API_polar = API_polar_dynamic_seq\n<B, R, f_LLR<R>, g_LLR<B,R>, g0_LLR<R>, h_LLR<B,R>, xo_STD<B>>;\nif (params.crc.poly.empty())\n- decoder = new Decoder_polar_SCL_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_SCL_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, polar_patterns, idx_r0, idx_r1, params.simulation.inter_frame_level);\nelse\n- decoder = new Decoder_polar_SCL_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_SCL_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, polar_patterns, idx_r0, idx_r1, *crc, params.simulation.inter_frame_level);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/params.h", "new_path": "src/Tools/params.h", "diff": "@@ -125,6 +125,7 @@ struct decoder_parameters\nstd::string scaling_factor;\nstd::string max;\nstd::string gen_path;\n+ std::string polar_nodes;\nbool enable_syndrome;\nfloat normalize_factor;\nfloat offset;\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a new cmd line arg to select the Polar node types dynamically.
8,490
21.02.2017 17:11:50
-3,600
558113c440e98805759759b29434ff186d551576
Forgot a file for the previous commit.
[ { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/Code/Polar/nodes_parser.h", "diff": "+#ifndef NODES_PARSER_HPP\n+#define NODES_PARSER_HPP\n+\n+#include <string>\n+#include <sstream>\n+#include <vector>\n+\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_r0.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_r0_left.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_r1.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_rep.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_rep_left.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_spc.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_std.hpp\"\n+\n+#include \"Tools/Display/bash_tools.h\"\n+\n+std::vector<std::string> string_split(const std::string &s, char delim)\n+{\n+ std::stringstream ss(s);\n+ std::string item;\n+ std::vector<std::string> elems;\n+ while (std::getline(ss, item, delim))\n+ elems.push_back(std::move(item)); // if C++11 (based on comment from @mchiasson)\n+\n+ return elems;\n+}\n+\n+std::string string_replace(std::string subject, const std::string& search, const std::string& replace)\n+{\n+ if (search.empty()) return subject;\n+\n+ size_t pos = 0;\n+ while((pos = subject.find(search, pos)) != std::string::npos)\n+ {\n+ subject.replace(pos, search.length(), replace);\n+ pos += replace.length();\n+ }\n+\n+ return subject;\n+}\n+\n+std::vector<Pattern_polar_i*> nodes_parser(const std::string &str_polar, int &idx_r0, int &idx_r1)\n+{\n+ idx_r0 = -1;\n+ idx_r1 = -1;\n+\n+ auto str_polar_bis = str_polar;\n+\n+ str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), ' '), str_polar_bis.end());\n+ str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), '{'), str_polar_bis.end());\n+ str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), '}'), str_polar_bis.end());\n+ str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), '('), str_polar_bis.end());\n+ str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), ')'), str_polar_bis.end());\n+\n+ std::vector<Pattern_polar_i*> polar_patterns;\n+ polar_patterns.push_back(new Pattern_polar_std);\n+\n+ auto v_polar = string_split(str_polar_bis, ',');\n+ for (auto i = 0; i < (int)v_polar.size(); i++)\n+ {\n+ if (v_polar[i].find(\"R0L\") != std::string::npos)\n+ {\n+ polar_patterns.push_back(new Pattern_polar_r0_left);\n+ }\n+ else if (v_polar[i].find(\"R0\") != std::string::npos)\n+ {\n+ idx_r0 = (int)polar_patterns.size();\n+\n+ auto search = \"R0\";\n+ auto replace = \"\";\n+ auto str = string_replace(v_polar[i], search, replace);\n+\n+ if (str.empty())\n+ {\n+ polar_patterns.push_back(new Pattern_polar_r0);\n+ }\n+ else\n+ {\n+ auto v_str = string_split(str, '-');\n+\n+ if (v_str.size() > 1)\n+ {\n+ auto min = (int)std::log2(std::stoi(v_str[0]));\n+ auto max = (int)std::log2(std::stoi(v_str[1]));\n+\n+ polar_patterns.push_back(new Pattern_polar_r0(min, max));\n+ }\n+ else\n+ {\n+ bool plus = v_str[0].find(\"+\") != std::string::npos;\n+\n+ auto min = (int)std::log2(std::stoi(v_str[0]));\n+\n+ if (plus)\n+ polar_patterns.push_back(new Pattern_polar_r0(min));\n+ else\n+ polar_patterns.push_back(new Pattern_polar_r0(min, min));\n+ }\n+ }\n+ }\n+ else if (v_polar[i].find(\"R1\") != std::string::npos)\n+ {\n+ idx_r1 = (int)polar_patterns.size();\n+\n+ auto search = \"R1\";\n+ auto replace = \"\";\n+ auto str = string_replace(v_polar[i], search, replace);\n+\n+ if (str.empty())\n+ {\n+ polar_patterns.push_back(new Pattern_polar_r1);\n+ }\n+ else\n+ {\n+ auto v_str = string_split(str, '-');\n+\n+ if (v_str.size() > 1)\n+ {\n+ auto min = (int)std::log2(std::stoi(v_str[0]));\n+ auto max = (int)std::log2(std::stoi(v_str[1]));\n+\n+ polar_patterns.push_back(new Pattern_polar_r1(min, max));\n+ }\n+ else\n+ {\n+ bool plus = v_str[0].find(\"+\") != std::string::npos;\n+\n+ auto min = (int)std::log2(std::stoi(v_str[0]));\n+\n+ if (plus)\n+ polar_patterns.push_back(new Pattern_polar_r1(min));\n+ else\n+ polar_patterns.push_back(new Pattern_polar_r1(min, min));\n+ }\n+ }\n+ }\n+ else if (v_polar[i].find(\"REPL\") != std::string::npos)\n+ {\n+ polar_patterns.push_back(new Pattern_polar_rep_left);\n+ }\n+ else if (v_polar[i].find(\"REP\") != std::string::npos)\n+ {\n+ auto search = \"REP\";\n+ auto replace = \"\";\n+ auto str = string_replace(v_polar[i], search, replace);\n+\n+ if (str.empty())\n+ {\n+ polar_patterns.push_back(new Pattern_polar_rep);\n+ }\n+ else\n+ {\n+ auto v_str = string_split(str, '-');\n+\n+ if (v_str.size() > 1)\n+ {\n+ auto min = (int)std::log2(std::stoi(v_str[0]));\n+ auto max = (int)std::log2(std::stoi(v_str[1]));\n+\n+ polar_patterns.push_back(new Pattern_polar_rep(min, max));\n+ }\n+ else\n+ {\n+ bool plus = v_str[0].find(\"+\") != std::string::npos;\n+\n+ auto min = (int)std::log2(std::stoi(v_str[0]));\n+\n+ if (plus)\n+ polar_patterns.push_back(new Pattern_polar_rep(min));\n+ else\n+ polar_patterns.push_back(new Pattern_polar_rep(min, min));\n+ }\n+ }\n+ }\n+ else if (v_polar[i].find(\"SPC\") != std::string::npos)\n+ {\n+ auto search = \"SPC\";\n+ auto replace = \"\";\n+ auto str = string_replace(v_polar[i], search, replace);\n+\n+ if (str.empty())\n+ {\n+ polar_patterns.push_back(new Pattern_polar_spc);\n+ }\n+ else\n+ {\n+ auto v_str = string_split(str, '-');\n+\n+ if (v_str.size() > 1)\n+ {\n+ auto min = (int)std::log2(std::stoi(v_str[0]));\n+ auto max = (int)std::log2(std::stoi(v_str[1]));\n+\n+ polar_patterns.push_back(new Pattern_polar_spc(min, max));\n+ }\n+ else\n+ {\n+ bool plus = v_str[0].find(\"+\") != std::string::npos;\n+\n+ auto min = (int)std::log2(std::stoi(v_str[0]));\n+\n+ if (plus)\n+ polar_patterns.push_back(new Pattern_polar_spc(min));\n+ else\n+ polar_patterns.push_back(new Pattern_polar_spc(min, min));\n+ }\n+ }\n+ }\n+ else\n+ {\n+ std::clog << bold_yellow(\"(WW) Unrecognized Polar node type (\")\n+ << bold_yellow(v_polar[i])\n+ << bold_yellow(\")\")\n+ << std::endl;\n+ }\n+ }\n+\n+ if (idx_r0 == -1)\n+ {\n+ idx_r0 = (int)polar_patterns.size();\n+ polar_patterns.push_back(new Pattern_polar_r0(0,0));\n+ }\n+\n+ if (idx_r1 == -1)\n+ {\n+ idx_r1 = (int)polar_patterns.size();\n+ polar_patterns.push_back(new Pattern_polar_r1(0,0));\n+ }\n+\n+ return polar_patterns;\n+}\n+\n+#endif /* PATTERN_POLAR_PARSER_HPP */\n" } ]
C++
MIT License
aff3ct/aff3ct
Forgot a file for the previous commit.
8,490
21.02.2017 17:52:36
-3,600
5425e73c1a140c5e190de92105b3fbebbe7fdc22
Fix the slow down issue in 8-bit mode.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -1144,17 +1144,12 @@ int Decoder_polar_SCL_fast_sys<B,R,API_polar>\n{\nconst auto new_path = paths[n_active_paths++];\n-// std::copy(path_2_array[old_path].begin(), path_2_array[old_path].end(), path_2_array[new_path].begin());\n- const auto loop_size = (int)path_2_array[old_path].size();\n- for (auto i = 0; i < loop_size; i++)\n- path_2_array[new_path][i] = path_2_array[old_path][i];\n+ std::copy(path_2_array[old_path].begin(), path_2_array[old_path].end(), path_2_array[new_path].begin());\nfor (auto i = 0; i < m; i++)\nn_array_ref[path_2_array[new_path][i]][i]++;\n-// std::copy(s[old_path].begin(), s[old_path].begin() + off_s + n_elmts, s[new_path].begin());\n- for (auto i = 0; i < off_s + n_elmts; i++)\n- s[new_path][i] = s[old_path][i]; // TODO: this line takes a big part of the decoding time!\n+ std::copy(s[old_path].begin(), s[old_path].begin() + off_s + n_elmts, s[new_path].begin());\nreturn new_path;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the slow down issue in 8-bit mode.
8,490
21.02.2017 18:11:41
-3,600
06137c17be4414163d0d75808783742c3a5c7548
Add the new parameter to the completion script.
[ { "change_type": "MODIFY", "old_path": "scripts/aff3ct_completion.sh", "new_path": "scripts/aff3ct_completion.sh", "diff": "@@ -109,7 +109,8 @@ _aff3ct() {\nthen\nopts=\"$opts --sim-pb-path --cde-awgn-fb-path --cde-fb-gen-method \\\n--cde-sigma --crc-type --crc-poly --crc-rate --enc-no-sys \\\n- --dec-type -D --dec-ite -i --dec-lists -L --dec-simd\"\n+ --dec-type -D --dec-ite -i --dec-lists -L --dec-simd \\\n+ --dec-polar-nodes\"\nfi\n# add contents of Launcher_BFER_repetition.cpp\n@@ -180,7 +181,7 @@ _aff3ct() {\n--sim-siga-min | -a | --sim-siga-max | -A | --sim-siga-step | \\\n--dmod-ite | --cde-sigma | --dec-snr | --dec-ite |-i | --dec-lists | \\\n-L | --sim-json-path | --dec-off | --dec-norm | --term-freq | \\\n- --sim-seed | --sim-mpi-comm | --sim-pyber)\n+ --sim-seed | --sim-mpi-comm | --sim-pyber | --dec-polar-nodes)\nCOMPREPLY=()\n;;\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the new parameter to the completion script.
8,488
21.02.2017 16:05:43
18,000
1df22b322fa8a873d0b7d5c24a15a10a1411ebca
Add erase_bad_paths function to SCL_MEM.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hpp", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hpp", "diff": "@@ -19,12 +19,12 @@ protected:\nstd ::vector<int > paths; // active paths\nstd ::vector<int > last_paths; // active paths cpy\n- std ::vector<float> metrics; // path metrics\n+ std ::vector<R > metrics; // path metrics\nmipp::vector<R > Y_N; // channel llrs\nstd::vector<mipp::vector<R >> l; // llrs\nstd::vector<mipp::vector<B >> s; // partial sums\nstd::vector<mipp::vector<B >> s2; // partial sums\n- std::vector<std ::vector<float>> metrics_vec; // list of candidate metrics to be sorted\n+ std::vector<std ::vector<R >> metrics_vec; // list of candidate metrics to be sorted\nstd::vector<std ::vector<int >> metrics_idx; // indexes tables used to sort the metrics\nstd ::vector<int > dup_count; // number of duplications of a path, at updating time\nstd::vector<std ::vector<int >> llr_indexes; // indexes used to sort a list of llrs (to be flipped)\n@@ -42,6 +42,11 @@ protected:\nstd::vector<std::vector<int>> n_array_ref_s; // give array used by a path\nstd::vector<std::vector<int>> path_2_array_s; // give array used by a path\n+ LC_sorter<R> sorter;\n+// LC_sorter_simd<R> sorter_simd;\n+ std::vector<int> best_idx;\n+ mipp::vector<R> l_tmp;\n+\npublic:\nDecoder_polar_SCL_MEM_fast_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits,\nconst int n_frames = 1, const std::string name = \"Decoder_polar_SCL_MEM_fast_sys\");\n@@ -76,6 +81,8 @@ protected:\nvirtual inline int select_best_path( );\nprivate:\n+ inline void erase_bad_paths (const int r_d );\n+\ninline void flip_bits_r1 (const int old_path, const int new_path, const int dup, const int off_s, const int n_elmts);\ninline void flip_bits_rep(const int old_path, const int new_path, const int off_s, const int n_elmts);\ninline void flip_bits_spc(const int old_path, const int new_path, const int dup, const int off_s, const int n_elmts);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx", "diff": "@@ -48,7 +48,7 @@ Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\nl (L, mipp::vector<R>(N + mipp::nElReg<R>())),\ns (L, mipp::vector<B>(N + mipp::nElReg<B>())),\ns2 (L, mipp::vector<B>(N + mipp::nElReg<B>())),\n- metrics_vec (3, std::vector<float>()),\n+ metrics_vec (3, std::vector<R>()),\nmetrics_idx (3, std::vector<int >()),\ndup_count (L, 0),\nllr_indexes (),\n@@ -59,7 +59,11 @@ Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\nn_array_ref_l (L, std::vector<int>(m)),\npath_2_array_l (L, std::vector<int>(m)),\nn_array_ref_s (L, std::vector<int>(m)),\n- path_2_array_s (L, std::vector<int>(m))\n+ path_2_array_s (L, std::vector<int>(m)),\n+ sorter (N),\n+//sorter_simd (N),\n+ best_idx (L),\n+ l_tmp (N)\n{\nstatic_assert(API_polar::get_n_frames() == 1, \"The inter-frame API_polar is not supported.\");\nstatic_assert(sizeof(B) == sizeof(R), \"Sizes of the bits and reals have to be identical.\");\n@@ -94,7 +98,7 @@ template <typename B, typename R, class API_polar>\nvoid Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::init_buffers()\n{\n- std::fill(metrics.begin(), metrics.begin() + L, std::numeric_limits<float>::min());\n+ std::fill(metrics.begin(), metrics.begin() + L, std::numeric_limits<R>::min());\nfor (auto i = 0; i < L; i++) paths[i] = i;\nn_active_paths = 1;\n@@ -505,7 +509,7 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n}\nfor (auto i = n_active_paths; i < L; i++)\nfor (auto j = 0; j < 4; j++)\n- metrics_vec[1][4 * paths[i] +j] = std::numeric_limits<float>::max();\n+ metrics_vec[1][4 * paths[i] +j] = std::numeric_limits<R>::max();\nstd::partial_sort(metrics_idx[1].begin(), metrics_idx[1].begin() + L, metrics_idx[1].begin() + L * 4,\n[this](int x, int y) {\n@@ -517,16 +521,10 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\ndup_count[metrics_idx[1][i] / 4]++;\n// erase paths\n- auto k = 0;\n- auto n_active_paths_cpy = n_active_paths;\n- for (auto i = 0; i < n_active_paths_cpy; i++)\n- if (dup_count[paths[k]] == 0)\n- delete_path(k, r_d);\n- else\n- k++;\n+ erase_bad_paths(r_d);\n// duplicate paths\n- n_active_paths_cpy = n_active_paths;\n+ auto n_active_paths_cpy = n_active_paths;\nfor (auto i = 0; i < n_active_paths_cpy; i++)\n{\nconst auto path = paths[i];\n@@ -573,7 +571,7 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n}\nfor (auto i = n_active_paths; i < L; i++)\nfor (auto j = 0; j < 4; j++)\n- metrics_vec[1][4 * paths[i] +j] = std::numeric_limits<float>::max();\n+ metrics_vec[1][4 * paths[i] +j] = std::numeric_limits<R>::max();\nstd::partial_sort(metrics_idx[1].begin(), metrics_idx[1].begin() + L, metrics_idx[1].begin() + L * 4,\n[this](int x, int y) {\n@@ -585,16 +583,10 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\ndup_count[metrics_idx[1][i] / 4]++;\n// erase paths\n- auto k = 0;\n- auto n_active_paths_cpy = n_active_paths;\n- for (auto i = 0; i < n_active_paths_cpy; i++)\n- if (dup_count[paths[k]] == 0)\n- delete_path(k, REV_D);\n- else\n- k++;\n+ erase_bad_paths(REV_D);\n// duplicate paths\n- n_active_paths_cpy = n_active_paths;\n+ auto n_active_paths_cpy = n_active_paths;\nfor (auto i = 0; i < n_active_paths_cpy; i++)\n{\nconst auto path = paths[i];\n@@ -678,12 +670,8 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\ndup_count[metrics_idx[0][i] / 2]++;\n// erase paths\n- auto k = 0;\n- for (auto i = 0; i < L; i++)\n- if (dup_count[paths[k]] == 0)\n- delete_path(k, r_d);\n- else\n- k++;\n+ erase_bad_paths(r_d);\n+\nfor (auto path = 0; path < L; path++)\n{\n@@ -745,12 +733,7 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\ndup_count[metrics_idx[0][i] / 2]++;\n// erase paths\n- auto k = 0;\n- for (auto i = 0; i < L; i++)\n- if (dup_count[paths[k]] == 0)\n- delete_path(k, REV_D);\n- else\n- k++;\n+ erase_bad_paths(REV_D);\nfor (auto path = 0; path < L; path++)\n{\n@@ -849,7 +832,7 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n}\nfor (auto i = n_active_paths; i < L; i++)\nfor (auto j = 0; j < n_cands; j++)\n- metrics_vec[2][n_cands * paths[i] +j] = std::numeric_limits<float>::max();\n+ metrics_vec[2][n_cands * paths[i] +j] = std::numeric_limits<R>::max();\nstd::partial_sort(metrics_idx[2].begin(), metrics_idx[2].begin() + L, metrics_idx[2].begin() + n_cands * L,\n[this](int x, int y){\n@@ -861,16 +844,10 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\ndup_count[metrics_idx[2][i] / n_cands]++;\n// erase paths\n- auto k = 0;\n- auto n_active_paths_cpy = n_active_paths;\n- for (auto i = 0; i < n_active_paths_cpy; i++)\n- if (dup_count[paths[k]] == 0)\n- delete_path(k, r_d);\n- else\n- k++;\n+ erase_bad_paths(r_d);\n// duplicate paths\n- n_active_paths_cpy = n_active_paths;\n+ auto n_active_paths_cpy = n_active_paths;\nfor (auto i = 0; i < n_active_paths_cpy; i++)\n{\nconst auto path = paths[i];\n@@ -961,7 +938,7 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n}\nfor (auto i = n_active_paths; i < L; i++)\nfor (auto j = 0; j < n_cands; j++)\n- metrics_vec[2][n_cands * paths[i] +j] = std::numeric_limits<float>::max();\n+ metrics_vec[2][n_cands * paths[i] +j] = std::numeric_limits<R>::max();\nstd::partial_sort(metrics_idx[2].begin(), metrics_idx[2].begin() + L, metrics_idx[2].begin() + n_cands * L,\n[this](int x, int y){\n@@ -973,16 +950,10 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\ndup_count[metrics_idx[2][i] / n_cands]++;\n// erase paths\n- auto k = 0;\n- auto n_active_paths_cpy = n_active_paths;\n- for (auto i = 0; i < n_active_paths_cpy; i++)\n- if (dup_count[paths[k]] == 0)\n- delete_path(k, REV_D);\n- else\n- k++;\n+ erase_bad_paths(REV_D);\n// duplicate paths\n- n_active_paths_cpy = n_active_paths;\n+ auto n_active_paths_cpy = n_active_paths;\nfor (auto i = 0; i < n_active_paths_cpy; i++)\n{\nconst auto path = paths[i];\n@@ -1168,3 +1139,16 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\ns2[paths[i]][off_s + j] = s[paths[i]][off_s + j];\n}\n}\n+template <typename B, typename R, class API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n+::erase_bad_paths(const int r_d)\n+{\n+ // erase bad paths\n+ auto k = 0;\n+ auto n_active_paths_cpy = n_active_paths;\n+ for (auto i = 0; i < n_active_paths_cpy; i++)\n+ if (dup_count[paths[k]] == 0)\n+ delete_path(k, r_d);\n+ else\n+ k++;\n+}\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Add erase_bad_paths function to SCL_MEM.
8,488
21.02.2017 16:13:46
18,000
4dab9e6839cd91ebee4a7220e09eac52d6bbd08e
Add metrics saturation in r0 nodes, SCL_MEM.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx", "diff": "@@ -408,6 +408,8 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\npath_2_array_s[paths[i]][rev_depth] = paths[i];\nn_array_ref_s [paths[i]][rev_depth] = 1;\n}\n+\n+ normalize_scl_metrics<R>(this->metrics, this->L);\n}\n}\n@@ -445,19 +447,21 @@ template <typename B, typename R, class API_polar>\nvoid Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::update_paths_r0(const int r_d, const int off_l, const int off_s, const int n_elmts)\n{\n+ if (n_active_paths > 1)\nfor (auto i = 0; i < n_active_paths; i++)\n{\nconst auto path = paths[i];\nconst auto array = path_2_array_l[path][r_d];\n- auto metric = 0.f;\n+ auto pen = (R)0;\nfor (auto j = 0; j < n_elmts; j++)\n- metric -= std::min((float)l[array][off_l +j], 0.f);\n- metrics[path] += metric; // add a penalty to the current path metric\n-\n- // TODO: Remove this fill when rate_0 left nodes are in the patterns\n- std::fill(s[path].begin() + off_s, s[path].begin() + off_s + n_elmts, 0);\n+ pen = sat_m<R>(pen + sat_m<R>(-std::min((R)l[array][off_l +j], (R)0)));\n+ metrics[path] = sat_m<R>(metrics[path] + pen); // add a penalty to the current path metric\n}\n+\n+ if (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT))\n+ for (auto i = 0; i < n_active_paths; i++)\n+ std::fill(s[paths[i]].begin() + off_s, s[paths[i]].begin() + off_s + n_elmts, 0);\n}\ntemplate <typename B, typename R, class API_polar>\n@@ -465,19 +469,21 @@ template <int REV_D, int N_ELMTS>\nvoid Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::update_paths_r0(const int off_l, const int off_s)\n{\n+ if (n_active_paths > 1)\nfor (auto i = 0; i < n_active_paths; i++)\n{\nconst auto path = paths[i];\nconst auto array = path_2_array_l[path][REV_D];\n- auto metric = 0.f;\n+ auto pen = (R)0;\nfor (auto j = 0; j < N_ELMTS; j++)\n- metric -= std::min((float)l[array][off_l +j], 0.f);\n- metrics[path] += metric; // add a penalty to the current path metric\n-\n- // TODO: Remove this fill when rate_0 left nodes are in the patterns\n- std::fill(s[path].begin() + off_s, s[path].begin() + off_s + N_ELMTS, 0);\n+ pen = sat_m<R>(pen + sat_m<R>(-std::min((R)l[array][off_l +j], (R)0)));\n+ metrics[path] = sat_m<R>(metrics[path] + pen); // add a penalty to the current path metric\n}\n+\n+ if (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT))\n+ for (auto i = 0; i < n_active_paths; i++)\n+ std::fill(s[paths[i]].begin() + off_s, s[paths[i]].begin() + off_s + N_ELMTS, 0);\n}\ntemplate <typename B, typename R, class API_polar>\n" } ]
C++
MIT License
aff3ct/aff3ct
Add metrics saturation in r0 nodes, SCL_MEM.
8,488
21.02.2017 16:42:35
18,000
12ba1773ce102e14838c276c190e5ef4ab818ca5
Add metrics saturation and new sorter in r1 nodes, SCL_MEM.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx", "diff": "@@ -493,57 +493,79 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\nif (r_d == 0)\nupdate_paths_rep(r_d, off_l, off_s, n_elmts);\nelse\n+ {\n+ // generate the candidates with the Chase-II algorithm\n+ if (n_elmts == 2)\n{\nfor (auto i = 0; i < n_active_paths; i++)\n{\nconst auto path = paths[i];\nconst auto array = path_2_array_l[path][r_d];\n- std::partial_sort(llr_indexes[r_d].begin(), llr_indexes[r_d].begin() + 2, llr_indexes[r_d].end(),\n- [this, array, off_l](int x, int y) {\n- return std::abs(l[array][off_l + x]) < std::abs(l[array][off_l + y]);\n- });\n+ bit_flips[2 * path +0] = 0;\n+ bit_flips[2 * path +1] = 1;\n- bit_flips[2 * path +0] = llr_indexes[r_d][0];\n- bit_flips[2 * path +1] = llr_indexes[r_d][1];\n+ const auto pen0 = sat_m<R>(std::abs(l[array][off_l + bit_flips[2 * path +0]]));\n+ const auto pen1 = sat_m<R>(std::abs(l[array][off_l + bit_flips[2 * path +1]]));\nmetrics_vec[1][4 * path +0] = metrics [ path ];\n- metrics_vec[1][4 * path +1] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path ]]);\n- metrics_vec[1][4 * path +2] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path +1]]);\n- metrics_vec[1][4 * path +3] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path +1]])\n- + std::abs(l[array][off_l + bit_flips[2 * path ]]);\n+ metrics_vec[1][4 * path +1] = sat_m<R>(metrics [ path ] + pen0);\n+ metrics_vec[1][4 * path +2] = sat_m<R>(metrics [ path ] + pen1);\n+ metrics_vec[1][4 * path +3] = sat_m<R>(metrics_vec[1][4 * path +1] + pen1);\n+ }\n+ }\n+ else\n+ {\n+ for (auto i = 0; i < n_active_paths; i++)\n+ {\n+ const auto path = paths[i];\n+ const auto array = path_2_array_l[path][r_d];\n+\n+ for (auto i = 0; i < n_elmts; i++) l_tmp[i] = std::abs(l[array][off_l +i]);\n+ sorter.partial_sort_destructive(l_tmp.data(), best_idx, n_elmts, 2);\n+// sorter_simd.partial_sort_abs(l[array].data() + off_l, best_idx, n_elmts, 2);\n+\n+ bit_flips[2 * path +0] = best_idx[0];\n+ bit_flips[2 * path +1] = best_idx[1];\n+\n+ const auto pen0 = sat_m<R>(std::abs(l[array][off_l + bit_flips[2 * path +0]]));\n+ const auto pen1 = sat_m<R>(std::abs(l[array][off_l + bit_flips[2 * path +1]]));\n+\n+ metrics_vec[1][4 * path +0] = metrics [ path ];\n+ metrics_vec[1][4 * path +1] = sat_m<R>(metrics [ path ] + pen0);\n+ metrics_vec[1][4 * path +2] = sat_m<R>(metrics [ path ] + pen1);\n+ metrics_vec[1][4 * path +3] = sat_m<R>(metrics_vec[1][4 * path +1] + pen1);\n+ }\n}\nfor (auto i = n_active_paths; i < L; i++)\nfor (auto j = 0; j < 4; j++)\nmetrics_vec[1][4 * paths[i] +j] = std::numeric_limits<R>::max();\n- std::partial_sort(metrics_idx[1].begin(), metrics_idx[1].begin() + L, metrics_idx[1].begin() + L * 4,\n- [this](int x, int y) {\n- return metrics_vec[1][x] < metrics_vec[1][y];\n- });\n-\n// L first of the lists are the L best paths\n- for (auto i = 0; i < L; i++)\n- dup_count[metrics_idx[1][i] / 4]++;\n+ const auto n_list = (n_active_paths * 4 >= L) ? L : n_active_paths * 4;\n+ sorter.partial_sort(metrics_vec[1].data(), best_idx, L * 4, n_list);\n+\n+ // count the number of duplications per path\n+ for (auto i = 0; i < n_list; i++)\n+ dup_count[best_idx[i] / 4]++;\n// erase paths\nerase_bad_paths(r_d);\n- // duplicate paths\n- auto n_active_paths_cpy = n_active_paths;\n- for (auto i = 0; i < n_active_paths_cpy; i++)\n+ for (auto i = 0; i < n_list; i++)\n{\n- const auto path = paths[i];\n+ const auto path = best_idx[i] / 4;\n+ const auto dup = best_idx[i] % 4;\nconst auto array = path_2_array_l[path][r_d];\n- if (dup_count[path])\n- {\n+\nAPI_polar::h(s[path], l[array], off_l, off_s, n_elmts);\n- for (auto dup = 2; dup <= dup_count[path]; dup++)\n- flip_bits_r1(path, duplicate_tree(path, off_l, off_s, r_d), dup, off_s, n_elmts);\n- dup_count[path] = 0;\n- }\n+\n+ const auto new_path = (dup_count[path] > 1) ? duplicate_tree(path, off_l, off_s, r_d) : path;\n+ flip_bits_r1(path, new_path, dup, off_s, n_elmts);\n+ metrics[new_path] = metrics_vec[1][best_idx[i]];\n+\n+ dup_count[path]--;\n}\n- std::fill(dup_count.begin(), dup_count.begin() + L, 0);\n}\n}\n@@ -555,57 +577,79 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\nif (REV_D == 0)\nupdate_paths_rep<REV_D, N_ELMTS>(off_l, off_s);\nelse\n+ {\n+ // generate the candidates with the Chase-II algorithm\n+ if (N_ELMTS == 2)\n{\nfor (auto i = 0; i < n_active_paths; i++)\n{\nconst auto path = paths[i];\nconst auto array = path_2_array_l[path][REV_D];\n- std::partial_sort(llr_indexes[REV_D].begin(), llr_indexes[REV_D].begin() + 2, llr_indexes[REV_D].end(),\n- [this, array, off_l](int x, int y) {\n- return std::abs(l[array][off_l + x]) < std::abs(l[array][off_l + y]);\n- });\n+ bit_flips[2 * path +0] = 0;\n+ bit_flips[2 * path +1] = 1;\n+\n+ const auto pen0 = sat_m<R>(std::abs(l[array][off_l + bit_flips[2 * path +0]]));\n+ const auto pen1 = sat_m<R>(std::abs(l[array][off_l + bit_flips[2 * path +1]]));\n- bit_flips[2 * path +0] = llr_indexes[REV_D][0];\n- bit_flips[2 * path +1] = llr_indexes[REV_D][1];\n+ metrics_vec[1][4 * path +0] = metrics [ path ];\n+ metrics_vec[1][4 * path +1] = sat_m<R>(metrics [ path ] + pen0);\n+ metrics_vec[1][4 * path +2] = sat_m<R>(metrics [ path ] + pen1);\n+ metrics_vec[1][4 * path +3] = sat_m<R>(metrics_vec[1][4 * path +1] + pen1);\n+ }\n+ }\n+ else\n+ {\n+ for (auto i = 0; i < n_active_paths; i++)\n+ {\n+ const auto path = paths[i];\n+ const auto array = path_2_array_l[path][REV_D];\n+\n+ for (auto i = 0; i < N_ELMTS; i++) l_tmp[i] = std::abs(l[array][off_l +i]);\n+ sorter.partial_sort_destructive(l_tmp.data(), best_idx, N_ELMTS, 2);\n+// sorter_simd.partial_sort_abs(l[array].data() + off_l, best_idx, N_ELMTS, 2);\n+\n+ bit_flips[2 * path +0] = best_idx[0];\n+ bit_flips[2 * path +1] = best_idx[1];\n+\n+ const auto pen0 = sat_m<R>(std::abs(l[array][off_l + bit_flips[2 * path +0]]));\n+ const auto pen1 = sat_m<R>(std::abs(l[array][off_l + bit_flips[2 * path +1]]));\nmetrics_vec[1][4 * path +0] = metrics [ path ];\n- metrics_vec[1][4 * path +1] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path ]]);\n- metrics_vec[1][4 * path +2] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path +1]]);\n- metrics_vec[1][4 * path +3] = metrics[path] + std::abs(l[array][off_l + bit_flips[2 * path +1]])\n- + std::abs(l[array][off_l + bit_flips[2 * path ]]);\n+ metrics_vec[1][4 * path +1] = sat_m<R>(metrics [ path ] + pen0);\n+ metrics_vec[1][4 * path +2] = sat_m<R>(metrics [ path ] + pen1);\n+ metrics_vec[1][4 * path +3] = sat_m<R>(metrics_vec[1][4 * path +1] + pen1);\n+ }\n}\nfor (auto i = n_active_paths; i < L; i++)\nfor (auto j = 0; j < 4; j++)\nmetrics_vec[1][4 * paths[i] +j] = std::numeric_limits<R>::max();\n- std::partial_sort(metrics_idx[1].begin(), metrics_idx[1].begin() + L, metrics_idx[1].begin() + L * 4,\n- [this](int x, int y) {\n- return metrics_vec[1][x] < metrics_vec[1][y];\n- });\n-\n// L first of the lists are the L best paths\n- for (auto i = 0; i < L; i++)\n- dup_count[metrics_idx[1][i] / 4]++;\n+ const auto n_list = (n_active_paths * 4 >= L) ? L : n_active_paths * 4;\n+ sorter.partial_sort(metrics_vec[1].data(), best_idx, L * 4, n_list);\n- // erase paths\n- erase_bad_paths(REV_D);\n+ // count the number of duplications per path\n+ for (auto i = 0; i < n_list; i++)\n+ dup_count[best_idx[i] / 4]++;\n- // duplicate paths\n- auto n_active_paths_cpy = n_active_paths;\n- for (auto i = 0; i < n_active_paths_cpy; i++)\n+ // erase bad paths\n+ erase_bad_paths();\n+\n+ for (auto i = 0; i < n_list; i++)\n{\n- const auto path = paths[i];\n+ const auto path = best_idx[i] / 4;\n+ const auto dup = best_idx[i] % 4;\nconst auto array = path_2_array_l[path][REV_D];\n- if (dup_count[path])\n- {\n+\nAPI_polar::template h<N_ELMTS>(s[path], l[array], off_l, off_s, N_ELMTS);\n- for (auto dup = 2; dup <= dup_count[path]; dup++)\n- flip_bits_r1(path, duplicate_tree(path, off_l, off_s, REV_D), dup, off_s, N_ELMTS);\n- dup_count[path] = 0;\n- }\n+\n+ const auto new_path = (dup_count[path] > 1) ? duplicate_tree(path, off_l, off_s, REV_D) : path;\n+ flip_bits_r1(path, new_path, dup, off_s, N_ELMTS);\n+ metrics[new_path] = metrics_vec[1][best_idx[i]];\n+\n+ dup_count[path]--;\n}\n- std::fill(dup_count.begin(), dup_count.begin() + L, 0);\n}\n}\n@@ -615,16 +659,18 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n{\nconstexpr B b = bit_init<B>();\n- metrics[new_path] = metrics_vec[1][4 * old_path + dup -1];\nswitch (dup)\n{\n- case 2:\n+ case 0:\n+ // nothing to do\n+ break;\n+ case 1:\ns[new_path][off_s + bit_flips[2 * old_path +0]] = !s[old_path][off_s + bit_flips[2 * old_path +0]] ? b : 0;\nbreak;\n- case 3:\n+ case 2:\ns[new_path][off_s + bit_flips[2 * old_path +1]] = !s[old_path][off_s + bit_flips[2 * old_path +1]] ? b : 0;\nbreak;\n- case 4:\n+ case 3:\ns[new_path][off_s + bit_flips[2 * old_path +0]] = !s[old_path][off_s + bit_flips[2 * old_path +0]] ? b : 0;\ns[new_path][off_s + bit_flips[2 * old_path +1]] = !s[old_path][off_s + bit_flips[2 * old_path +1]] ? b : 0;\nbreak;\n@@ -1069,7 +1115,6 @@ int Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\nn_array_ref_s [path_2_array_s[old_path][r_d]][r_d] ++;\n}\n-\nfor (auto i = off_s; i < off_s + n_elmts; i++)\ns[new_path][i] = s[old_path][i];\n" } ]
C++
MIT License
aff3ct/aff3ct
Add metrics saturation and new sorter in r1 nodes, SCL_MEM.
8,490
22.02.2017 11:20:31
-3,600
507c675a62818415d3e50300528c648b29cb3363
Update the Polar API to support h0 operation + plug the SC_FAST to the cmd line Polar nodes selection.
[ { "change_type": "MODIFY", "old_path": "src/Launcher/BFER/Polar/Launcher_BFER_polar.cpp", "new_path": "src/Launcher/BFER/Polar/Launcher_BFER_polar.cpp", "diff": "@@ -28,7 +28,7 @@ Launcher_BFER_polar<B,R,Q>\nthis->params.decoder .n_ite = 1;\nthis->params.decoder .L = 1;\nthis->params.decoder .simd_strategy = \"\";\n- this->params.decoder .polar_nodes = \"{R0,R1,R0L,REP,REPL,SPC4}\";\n+ this->params.decoder .polar_nodes = \"{R0,R0L,R1,REP,REPL,SPC4+}\";\n}\ntemplate <typename B, typename R, typename Q>\n@@ -199,20 +199,15 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFER_polar<B,R,Q>\nif (this->params.decoder.type == \"SCAN\")\np.push_back(std::make_pair(\"Num. of iterations (i)\", std::to_string(this->params.decoder.n_ite)));\n- if (this->params.decoder.type == \"SCL\")\n- {\n+ if (this->params.decoder.type == \"SCL\" || this->params.decoder.type == \"SCL_MEM\")\np.push_back(std::make_pair(\"Num. of lists (L)\", std::to_string(this->params.decoder.L)));\n- p.push_back(std::make_pair(\"Polar node types\", this->params.decoder.polar_nodes));\n- }\n- if (this->params.decoder.type == \"SCL_MEM\")\n- p.push_back(std::make_pair(\"Num. of lists (L)\", std::to_string(this->params.decoder.L)));\n-\n- if (this->params.decoder.type == \"ASCL\")\n+ if (this->params.decoder.type == \"ASCL\" || this->params.decoder.type == \"ASCL_MEM\")\np.push_back(std::make_pair(\"Max num. of lists (L)\", std::to_string(this->params.decoder.L)));\n- if (this->params.decoder.type == \"ASCL_MEM\")\n- p.push_back(std::make_pair(\"Max num. of lists (L)\", std::to_string(this->params.decoder.L)));\n+ if ((this->params.decoder.type == \"SC\" || this->params.decoder.type == \"SCL\" || this->params.decoder.type == \"ASCL\")\n+ && this->params.decoder.implem == \"FAST\")\n+ p.push_back(std::make_pair(\"Polar node types\", this->params.decoder.polar_nodes));\nreturn p;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hpp", "new_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hpp", "diff": "@@ -34,6 +34,11 @@ protected:\npublic:\nDecoder_polar_SC_fast_sys(const int& K, const int& N, const mipp::vector<B>& frozen_bits,\nconst int n_frames = 1, const std::string name = \"Decoder_polar_SC_fast_sys\");\n+\n+ Decoder_polar_SC_fast_sys(const int& K, const int& N, const mipp::vector<B>& frozen_bits,\n+ const std::vector<Pattern_polar_i*> polar_patterns, const int idx_r0, const int idx_r1,\n+ const int n_frames = 1, const std::string name = \"Decoder_polar_SC_fast_sys\");\n+\nvirtual ~Decoder_polar_SC_fast_sys();\nprotected:\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx", "diff": "@@ -77,6 +77,8 @@ struct Decoder_polar_SC_fast_sys_static\n// h\nswitch (node_type)\n{\n+ case RATE_0: if (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT))\n+ API_polar::template h0 <n_elmts>(s, off_s, n_elmts); break;\ncase RATE_1: API_polar::template h <n_elmts>(s, l, off_l, off_s, n_elmts); break;\ncase REP: API_polar::template rep<n_elmts>(s, l, off_l, off_s, n_elmts); break;\ncase SPC: API_polar::template spc<n_elmts>(s, l, off_l, off_s, n_elmts); break;\n@@ -100,6 +102,8 @@ struct Decoder_polar_SC_fast_sys_static<B,R,API_polar,0>\nswitch (node_t)\n{\n+ case RATE_0: if (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT))\n+ API_polar::template h0<n_elmts>(s, off_s, n_elmts); break;\ncase RATE_1: API_polar::template h <n_elmts>(s, l, off_l, off_s, n_elmts); break;\ndefault:\nbreak;\n@@ -133,6 +137,23 @@ Decoder_polar_SC_fast_sys<B,R,API_polar>\nstd::fill(s.begin(), s.end(), (B)0);\n}\n+template <typename B, typename R, class API_polar>\n+Decoder_polar_SC_fast_sys<B,R,API_polar>\n+::Decoder_polar_SC_fast_sys(const int& K, const int& N, const mipp::vector<B>& frozen_bits,\n+ const std::vector<Pattern_polar_i*> polar_patterns, const int idx_r0, const int idx_r1,\n+ const int n_frames, const std::string name)\n+: Decoder<B,R> (K, N, n_frames, API_polar::get_n_frames(), name),\n+ m ((int)std::log2(N)),\n+ l (2 * N * this->simd_inter_frame_level + mipp::nElmtsPerRegister<R>()),\n+ s (1 * N * this->simd_inter_frame_level + mipp::nElmtsPerRegister<B>()),\n+ s_bis (1 * N * this->simd_inter_frame_level + mipp::nElmtsPerRegister<B>()),\n+ frozen_bits (frozen_bits),\n+ polar_patterns(N, frozen_bits, polar_patterns, idx_r0, idx_r1)\n+{\n+ static_assert(sizeof(B) == sizeof(R), \"\");\n+ std::fill(s.begin(), s.end(), (B)0);\n+}\n+\ntemplate <typename B, typename R, class API_polar>\nDecoder_polar_SC_fast_sys<B,R,API_polar>\n::~Decoder_polar_SC_fast_sys()\n@@ -237,6 +258,8 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\n// h\nswitch (node_type)\n{\n+ case RATE_0: if (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT))\n+ API_polar::h0 (s, off_s, n_elmts); break;\ncase RATE_1: API_polar::h (s, l, off_l, off_s, n_elmts); break;\ncase REP: API_polar::rep(s, l, off_l, off_s, n_elmts); break;\ncase SPC: API_polar::spc(s, l, off_l, off_s, n_elmts); break;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -68,8 +68,8 @@ Decoder_polar_SCL_fast_sys<B,R,API_polar>\nnew Pattern_polar_r1,\nnew Pattern_polar_r0_left,\nnew Pattern_polar_rep_left,\n- new Pattern_polar_rep/*(2,3)*/, // perf. degradation with REP nodes with fixed-point arithmetic\n- new Pattern_polar_spc(2,2)}, // perf. degradation with SPC nodes length > 4\n+ new Pattern_polar_rep, // /!\\ perf. degradation with REP nodes in fixed-point\n+ new Pattern_polar_spc(2,2)}, // /!\\ perf. degradation with SPC nodes length > 4 (when L is big)\n1,\n2),\npaths (L),\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/API/API_polar_dynamic_inter_8bit_bitpacking.hpp", "new_path": "src/Tools/Code/Polar/API/API_polar_dynamic_inter_8bit_bitpacking.hpp", "diff": "@@ -148,27 +148,27 @@ public:\n// ------------------------------------------------------------------------------------------------------------- h0\n- // template <int N_ELMTS = 0>\n- // static void h0(B *__restrict s_a, const int init_shift, const int n_elmts = 0)\n- // {\n- // if (n_elmts >= 8) h0_inter_8bit_bitpacking<B >::apply(s_a, init_shift, n_elmts);\n- // else if (n_elmts == 4) h0_inter_8bit_bitpacking<B, 4>::apply(s_a, init_shift, n_elmts);\n- // else if (n_elmts == 2) h0_inter_8bit_bitpacking<B, 2>::apply(s_a, init_shift, n_elmts);\n- // else if (n_elmts == 1) h0_inter_8bit_bitpacking<B, 1>::apply(s_a, init_shift, n_elmts);\n- // }\n-\n- // template <int N_ELMTS = 0>\n- // static void h0(mipp::vector<B> &s, const int off_s_a, const int n_elmts = 0)\n- // {\n- // B *__restrict s_a = s.data() + os(off_s_a);\n-\n- // const int init_shift = ishift(off_s_a);\n-\n- // if (n_elmts >= 8) h0_inter_8bit_bitpacking<B >::apply(s_a, init_shift, n_elmts);\n- // else if (n_elmts == 4) h0_inter_8bit_bitpacking<B, 4>::apply(s_a, init_shift, n_elmts);\n- // else if (n_elmts == 2) h0_inter_8bit_bitpacking<B, 2>::apply(s_a, init_shift, n_elmts);\n- // else if (n_elmts == 1) h0_inter_8bit_bitpacking<B, 1>::apply(s_a, init_shift, n_elmts);\n- // }\n+ template <int N_ELMTS = 0>\n+ static void h0(B *__restrict s_a, const int init_shift, const int n_elmts = 0)\n+ {\n+ if (n_elmts >= 8) h0_inter_8bit_bitpacking<B >::apply(s_a, init_shift, n_elmts);\n+ else if (n_elmts == 4) h0_inter_8bit_bitpacking<B, 4>::apply(s_a, init_shift, n_elmts);\n+ else if (n_elmts == 2) h0_inter_8bit_bitpacking<B, 2>::apply(s_a, init_shift, n_elmts);\n+ else if (n_elmts == 1) h0_inter_8bit_bitpacking<B, 1>::apply(s_a, init_shift, n_elmts);\n+ }\n+\n+ template <int N_ELMTS = 0>\n+ static void h0(mipp::vector<B> &s, const int off_s_a, const int n_elmts = 0)\n+ {\n+ B *__restrict s_a = s.data() + os(off_s_a);\n+\n+ const int init_shift = ishift(off_s_a);\n+\n+ if (n_elmts >= 8) h0_inter_8bit_bitpacking<B >::apply(s_a, init_shift, n_elmts);\n+ else if (n_elmts == 4) h0_inter_8bit_bitpacking<B, 4>::apply(s_a, init_shift, n_elmts);\n+ else if (n_elmts == 2) h0_inter_8bit_bitpacking<B, 2>::apply(s_a, init_shift, n_elmts);\n+ else if (n_elmts == 1) h0_inter_8bit_bitpacking<B, 1>::apply(s_a, init_shift, n_elmts);\n+ }\n// ------------------------------------------------------------------------------------------------------------ rep\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/API/API_polar_dynamic_intra.hpp", "new_path": "src/Tools/Code/Polar/API/API_polar_dynamic_intra.hpp", "diff": "@@ -131,21 +131,19 @@ public:\n// ------------------------------------------------------------------------------------------------------------- h0\n- // template <int N_ELMTS = 0>\n- // static void h0(B *__restrict s_a, const int n_elmts)\n- // {\n- // if (n_elmts >= mipp::nElReg<B>()) h0_inter_intra <B>::apply(s_a, n_elmts);\n- // else h0_intra_unaligned<B>::apply(s_a, n_elmts);\n- // }\n-\n- // template <int N_ELMTS = 0>\n- // static void h0(mipp::vector<B> &s, const int off_s_a, const int n_elmts)\n- // {\n- // B *__restrict s_a = s.data() + off_s_a;\n-\n- // if (n_elmts >= mipp::nElReg<B>()) h0_inter_intra <B>::apply(s_a, n_elmts);\n- // else h0_intra_unaligned<B>::apply(s_a, n_elmts);\n- // }\n+ template <int N_ELMTS = 0>\n+ static void h0(B *__restrict s_a, const int n_elmts = 0)\n+ {\n+ h0_inter_intra<B, N_ELMTS>::apply(s_a, n_elmts);\n+ }\n+\n+ template <int N_ELMTS = 0>\n+ static void h0(mipp::vector<B> &s, const int off_s_a, const int n_elmts = 0)\n+ {\n+ B *__restrict s_a = s.data() + off_s_a;\n+\n+ h0_inter_intra<B, N_ELMTS>::apply(s_a, n_elmts);\n+ }\n// ------------------------------------------------------------------------------------------------------------ rep\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/API/API_polar_static_inter.hpp", "new_path": "src/Tools/Code/Polar/API/API_polar_static_inter.hpp", "diff": "@@ -120,7 +120,7 @@ public:\nh_inter_intra<B, R, HI, N_ELMTS, get_n_frames()>::apply(l_a, s_a, n_elmts);\n}\n- // -------------------------------------------------------------------------------------------------------------- h0\n+ // ------------------------------------------------------------------------------------------------------------- h0\ntemplate <int N_ELMTS = 0>\nstatic void h0(B *__restrict s_a, const int n_elmts = 0)\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/API/API_polar_static_inter_8bit_bitpacking.hpp", "new_path": "src/Tools/Code/Polar/API/API_polar_static_inter_8bit_bitpacking.hpp", "diff": "@@ -130,21 +130,21 @@ public:\n// ------------------------------------------------------------------------------------------------------------- h0\n- // template <int N_ELMTS = 0>\n- // static void h0(B *__restrict s_a, const int init_shift, const int n_elmts = 0)\n- // {\n- // h0_inter_8bit_bitpacking<B, N_ELMTS>::apply(s_a, init_shift, n_elmts);\n- // }\n+ template <int N_ELMTS = 0>\n+ static void h0(B *__restrict s_a, const int init_shift, const int n_elmts = 0)\n+ {\n+ h0_inter_8bit_bitpacking<B, N_ELMTS>::apply(s_a, init_shift, n_elmts);\n+ }\n- // template <int N_ELMTS = 0>\n- // static void h0(mipp::vector<B> &s, const int off_s_a, const int n_elmts = 0)\n- // {\n- // B *__restrict s_a = s.data() + os(off_s_a);\n+ template <int N_ELMTS = 0>\n+ static void h0(mipp::vector<B> &s, const int off_s_a, const int n_elmts = 0)\n+ {\n+ B *__restrict s_a = s.data() + os(off_s_a);\n- // const int init_shift = ishift(off_s_a);\n+ const int init_shift = ishift(off_s_a);\n- // h0_inter_8bit_bitpacking<B, N_ELMTS>::apply(s_a, init_shift, n_elmts);\n- // }\n+ h0_inter_8bit_bitpacking<B, N_ELMTS>::apply(s_a, init_shift, n_elmts);\n+ }\n// ------------------------------------------------------------------------------------------------------------ rep\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/API/API_polar_static_intra_16bit.hpp", "new_path": "src/Tools/Code/Polar/API/API_polar_static_intra_16bit.hpp", "diff": "@@ -120,19 +120,19 @@ public:\n// ------------------------------------------------------------------------------------------------------------- h0\n- // template <int N_ELMTS = 0>\n- // static void h0(B *__restrict s_a, const int n_elmts = 0)\n- // {\n- // h0_intra_16bit<B, N_ELMTS>::apply(s_a, n_elmts);\n- // }\n-\n- // template <int N_ELMTS = 0>\n- // static void h0(mipp::vector<B> &s, const int off_s_a, const int n_elmts = 0)\n- // {\n- // B *__restrict s_a = s.data() + off_s_a;\n-\n- // h0_intra_16bit<B, N_ELMTS>::apply(s_a, n_elmts);\n- // }\n+ template <int N_ELMTS = 0>\n+ static void h0(B *__restrict s_a, const int n_elmts = 0)\n+ {\n+ h0_inter_intra<B, N_ELMTS>::apply(s_a, n_elmts);\n+ }\n+\n+ template <int N_ELMTS = 0>\n+ static void h0(mipp::vector<B> &s, const int off_s_a, const int n_elmts = 0)\n+ {\n+ B *__restrict s_a = s.data() + off_s_a;\n+\n+ h0_inter_intra<B, N_ELMTS>::apply(s_a, n_elmts);\n+ }\n// ------------------------------------------------------------------------------------------------------------ rep\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/API/API_polar_static_intra_32bit.hpp", "new_path": "src/Tools/Code/Polar/API/API_polar_static_intra_32bit.hpp", "diff": "@@ -120,19 +120,19 @@ public:\n// ------------------------------------------------------------------------------------------------------------- h0\n- // template <int N_ELMTS = 0>\n- // static void h0(B *__restrict s_a, const int n_elmts = 0)\n- // {\n- // h0_intra_32bit<B, N_ELMTS>::apply(s_a, n_elmts);\n- // }\n-\n- // template <int N_ELMTS = 0>\n- // static void h0(mipp::vector<B> &s, const int off_s_a, const int n_elmts = 0)\n- // {\n- // B *__restrict s_a = s.data() + off_s_a;\n-\n- // h0_intra_32bit<B, N_ELMTS>::apply(s_a, n_elmts);\n- // }\n+ template <int N_ELMTS = 0>\n+ static void h0(B *__restrict s_a, const int n_elmts = 0)\n+ {\n+ h0_inter_intra<B, N_ELMTS>::apply(s_a, n_elmts);\n+ }\n+\n+ template <int N_ELMTS = 0>\n+ static void h0(mipp::vector<B> &s, const int off_s_a, const int n_elmts = 0)\n+ {\n+ B *__restrict s_a = s.data() + off_s_a;\n+\n+ h0_inter_intra<B, N_ELMTS>::apply(s_a, n_elmts);\n+ }\n// ------------------------------------------------------------------------------------------------------------ rep\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/API/API_polar_static_intra_8bit.hpp", "new_path": "src/Tools/Code/Polar/API/API_polar_static_intra_8bit.hpp", "diff": "@@ -120,19 +120,19 @@ public:\n// ------------------------------------------------------------------------------------------------------------- h0\n- // template <int N_ELMTS = 0>\n- // static void h0(B *__restrict s_a, const int n_elmts = 0)\n- // {\n- // h0_intra_8bit<B, N_ELMTS>::apply(s_a, n_elmts);\n- // }\n-\n- // template <int N_ELMTS = 0>\n- // static void h0(mipp::vector<B> &s, const int off_s_a, const int n_elmts = 0)\n- // {\n- // B *__restrict s_a = s.data() + off_s_a;\n-\n- // h0_intra_8bit<B, N_ELMTS>::apply(s_a, n_elmts);\n- // }\n+ template <int N_ELMTS = 0>\n+ static void h0(B *__restrict s_a, const int n_elmts = 0)\n+ {\n+ h0_inter_intra<B, N_ELMTS>::apply(s_a, n_elmts);\n+ }\n+\n+ template <int N_ELMTS = 0>\n+ static void h0(mipp::vector<B> &s, const int off_s_a, const int n_elmts = 0)\n+ {\n+ B *__restrict s_a = s.data() + off_s_a;\n+\n+ h0_inter_intra<B, N_ELMTS>::apply(s_a, n_elmts);\n+ }\n// ------------------------------------------------------------------------------------------------------------ rep\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/API/functions_polar_inter_8bit_bitpacking.h", "new_path": "src/Tools/Code/Polar/API/functions_polar_inter_8bit_bitpacking.h", "diff": "@@ -321,6 +321,72 @@ struct h_inter_8bit_bitpacking <B, R, HI, 1>\n}\n};\n+// =============================================================================================================== h0()\n+// ====================================================================================================================\n+// ====================================================================================================================\n+\n+template <typename B, int N_ELMTS = 0>\n+struct h0_inter_8bit_bitpacking\n+{\n+ static void apply(B *__restrict s_a, const int init_shift, const int n_elmts = 0)\n+ {\n+ constexpr auto _n_elmts = (N_ELMTS * mipp::nElmtsPerRegister<B>()) / (sizeof(B) * 8);\n+ std::fill(s_a, s_a + _n_elmts, 0);\n+ }\n+};\n+\n+template <typename B>\n+struct h0_inter_8bit_bitpacking <B, 0>\n+{\n+ static void apply(B *__restrict s_a, const int init_shift, const int n_elmts = 0)\n+ {\n+ const auto _n_elmts = (n_elmts * mipp::nElmtsPerRegister<B>()) / (sizeof(B) * 8);\n+ std::fill(s_a, s_a + _n_elmts, 0);\n+ }\n+};\n+\n+template <typename B>\n+struct h0_inter_8bit_bitpacking <B, 4>\n+{\n+ static void apply(B *__restrict s_a, const int init_shift, const int n_elmts = 0)\n+ {\n+ const auto r_init = mipp::set1 <B>(0x0F);\n+ const auto r_mask = mipp::lshift<B>(r_init, init_shift);\n+ auto r_u_packed = mipp::load <B>(s_a);\n+ r_u_packed = mipp::andnb <B>(r_mask, r_u_packed);\n+\n+ mipp::store<B>(s_a, r_u_packed);\n+ }\n+};\n+\n+template <typename B>\n+struct h0_inter_8bit_bitpacking <B, 2>\n+{\n+ static void apply(B *__restrict s_a, const int init_shift, const int n_elmts = 0)\n+ {\n+ const auto r_init = mipp::set1 <B>(0x03);\n+ const auto r_mask = mipp::lshift<B>(r_init, init_shift);\n+ auto r_u_packed = mipp::load <B>(s_a);\n+ r_u_packed = mipp::andnb <B>(r_mask, r_u_packed);\n+\n+ mipp::store<B>(s_a, r_u_packed);\n+ }\n+};\n+\n+template <typename B>\n+struct h0_inter_8bit_bitpacking <B, 1>\n+{\n+ static void apply(B *__restrict s_a, const int init_shift, const int n_elmts = 0)\n+ {\n+ const auto r_init = mipp::set1 <B>(0x01);\n+ const auto r_mask = mipp::lshift<B>(r_init, init_shift);\n+ auto r_u_packed = mipp::load <B>(s_a);\n+ r_u_packed = mipp::andnb <B>(r_mask, r_u_packed);\n+\n+ mipp::store<B>(s_a, r_u_packed);\n+ }\n+};\n+\n// ============================================================================================================== rep()\n// ====================================================================================================================\n// ====================================================================================================================\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/API/functions_polar_inter_intra.h", "new_path": "src/Tools/Code/Polar/API/functions_polar_inter_intra.h", "diff": "@@ -274,7 +274,6 @@ struct h0_inter_intra\n{\nstatic void apply(B *__restrict s_a, const int n_elmts = 0)\n{\n- constexpr auto stride = mipp::nElmtsPerRegister<B>();\nconstexpr auto _n_elmts = N_ELMTS * N_FRAMES;\nstd::fill(s_a, s_a + _n_elmts, 0);\n}\n@@ -285,7 +284,6 @@ struct h0_inter_intra <B,0,N_FRAMES>\n{\nstatic void apply(B *__restrict s_a, const int n_elmts = 0)\n{\n- constexpr auto stride = mipp::nElmtsPerRegister<B>();\nconst auto _n_elmts = n_elmts * N_FRAMES;\nstd::fill(s_a, s_a + _n_elmts, 0);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Factory/Polar/Factory_decoder_polar.cpp", "new_path": "src/Tools/Factory/Polar/Factory_decoder_polar.cpp", "diff": "@@ -99,6 +99,9 @@ Decoder<B,R>* Factory_decoder_polar<B,R>\nif (params.decoder.type == \"SC\" && params.decoder.implem == \"FAST\")\n{\n+ int idx_r0, idx_r1;\n+ auto polar_patterns = nodes_parser(params.decoder.polar_nodes, idx_r0, idx_r1);\n+\nif (params.decoder.simd_strategy == \"INTER\")\n{\n#if defined(ENABLE_BIT_PACKING)\n@@ -111,7 +114,7 @@ Decoder<B,R>* Factory_decoder_polar<B,R>\nusing API_polar = API_polar_static_inter_8bit_bitpacking\n<B, R, f_LLR_i<R>, g_LLR_i<B,R>, g0_LLR_i<R>, h_LLR_i<B,R>, xo_STD_i<B>>;\n#endif\n- decoder = new Decoder_polar_SC_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code,frozen_bits, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_SC_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code, frozen_bits, polar_patterns, idx_r0, idx_r1, params.simulation.inter_frame_level);\n}\n#endif\nif (decoder == nullptr)\n@@ -123,7 +126,7 @@ Decoder<B,R>* Factory_decoder_polar<B,R>\nusing API_polar = API_polar_static_inter\n<B, R, f_LLR_i<R>, g_LLR_i<B,R>, g0_LLR_i<R>, h_LLR_i<B,R>, xo_STD_i<B>>;\n#endif\n- decoder = new Decoder_polar_SC_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code,frozen_bits, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_SC_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code,frozen_bits, polar_patterns, idx_r0, idx_r1, params.simulation.inter_frame_level);\n}\n}\nelse if (params.decoder.simd_strategy == \"INTRA\")\n@@ -139,7 +142,7 @@ Decoder<B,R>* Factory_decoder_polar<B,R>\n<B, R, f_LLR <R>, g_LLR <B,R>, g0_LLR <R>, h_LLR <B,R>, xo_STD <B>,\nf_LLR_i<R>, g_LLR_i<B,R>, g0_LLR_i<R>, h_LLR_i<B,R>, xo_STD_i<B>>;\n#endif\n- decoder = new Decoder_polar_SC_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code,frozen_bits, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_SC_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code,frozen_bits, polar_patterns, idx_r0, idx_r1, params.simulation.inter_frame_level);\n}\nelse if (typeid(B) == typeid(short))\n{\n@@ -152,7 +155,7 @@ Decoder<B,R>* Factory_decoder_polar<B,R>\n<B, R, f_LLR <R>, g_LLR <B,R>, g0_LLR <R>, h_LLR <B,R>, xo_STD <B>,\nf_LLR_i<R>, g_LLR_i<B,R>, g0_LLR_i<R>, h_LLR_i<B,R>, xo_STD_i<B>>;\n#endif\n- decoder = new Decoder_polar_SC_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code,frozen_bits, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_SC_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code,frozen_bits, polar_patterns, idx_r0, idx_r1, params.simulation.inter_frame_level);\n}\nelse if (typeid(B) == typeid(int))\n{\n@@ -165,7 +168,7 @@ Decoder<B,R>* Factory_decoder_polar<B,R>\n<B, R, f_LLR <R>, g_LLR <B,R>, g0_LLR <R>, h_LLR <B,R>, xo_STD <B>,\nf_LLR_i<R>, g_LLR_i<B,R>, g0_LLR_i<R>, h_LLR_i<B,R>, xo_STD_i<B>>;\n#endif\n- decoder = new Decoder_polar_SC_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code,frozen_bits, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_SC_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code,frozen_bits, polar_patterns, idx_r0, idx_r1, params.simulation.inter_frame_level);\n}\n}\nelse if (params.decoder.simd_strategy.empty())\n@@ -177,7 +180,7 @@ Decoder<B,R>* Factory_decoder_polar<B,R>\nusing API_polar = API_polar_static_seq\n<B, R, f_LLR<R>, g_LLR<B,R>, g0_LLR<R>, h_LLR<B,R>, xo_STD<B>>;\n#endif\n- decoder = new Decoder_polar_SC_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code,frozen_bits, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_SC_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code,frozen_bits, polar_patterns, idx_r0, idx_r1, params.simulation.inter_frame_level);\n}\n}\n@@ -230,8 +233,11 @@ Decoder<B,R>* Factory_decoder_polar<B,R>\n}\n}\n- if (params.decoder.type == \"ASCL\")\n+ if (params.decoder.type == \"ASCL\" && params.decoder.implem == \"FAST\")\n{\n+ int idx_r0, idx_r1;\n+ auto polar_patterns = nodes_parser(params.decoder.polar_nodes, idx_r0, idx_r1);\n+\nif (params.decoder.simd_strategy == \"INTRA\")\n{\nusing API_polar = API_polar_dynamic_intra\n" } ]
C++
MIT License
aff3ct/aff3ct
Update the Polar API to support h0 operation + plug the SC_FAST to the cmd line Polar nodes selection.
8,490
22.02.2017 11:49:00
-3,600
5ab8a52d59bb9abf2d61374758f7bf5a9b95ff15
Plug the ASCL_FAST to the cmd line Polar nodes selection.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hpp", "new_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hpp", "diff": "@@ -18,6 +18,12 @@ public:\nDecoder_polar_ASCL_fast_CA_sys(const int& K, const int& N, const int& max_L, const mipp::vector<B>& frozen_bits,\nCRC<B>& crc, const int n_frames = 1,\nconst std::string name = \"Decoder_polar_ASCL_fast_CA_sys\");\n+\n+ Decoder_polar_ASCL_fast_CA_sys(const int& K, const int& N, const int& max_L, const mipp::vector<B>& frozen_bits,\n+ const std::vector<Pattern_polar_i*> polar_patterns, const int idx_r0, const int idx_r1,\n+ CRC<B>& crc, const int n_frames = 1,\n+ const std::string name = \"Decoder_polar_ASCL_fast_CA_sys\");\n+\nvirtual ~Decoder_polar_ASCL_fast_CA_sys(){};\nvoid load (const mipp::vector<R>& Y_N);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hxx", "new_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hxx", "diff": "@@ -12,6 +12,18 @@ Decoder_polar_ASCL_fast_CA_sys<B,R,API_polar>\nassert(L_max > 0);\n}\n+template <typename B, typename R, class API_polar>\n+Decoder_polar_ASCL_fast_CA_sys<B,R,API_polar>\n+::Decoder_polar_ASCL_fast_CA_sys(const int& K, const int& N, const int& L_max, const mipp::vector<B>& frozen_bits,\n+ const std::vector<Pattern_polar_i*> polar_patterns, const int idx_r0, const int idx_r1,\n+ CRC<B>& crc, const int n_frames, const std::string name)\n+: Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>(K, N, L_max, frozen_bits, polar_patterns, idx_r0, idx_r1, crc, n_frames, name),\n+ sc_decoder (K, N , frozen_bits, n_frames, name),\n+ L_max(L_max), is_full_adaptive(true)\n+{\n+ assert(L_max > 0);\n+}\n+\ntemplate <typename B, typename R, class API_polar>\nvoid Decoder_polar_ASCL_fast_CA_sys<B,R,API_polar>\n::load(const mipp::vector<R>& Y_N)\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/nodes_parser.h", "new_path": "src/Tools/Code/Polar/nodes_parser.h", "diff": "@@ -21,7 +21,7 @@ std::vector<std::string> string_split(const std::string &s, char delim)\nstd::string item;\nstd::vector<std::string> elems;\nwhile (std::getline(ss, item, delim))\n- elems.push_back(std::move(item)); // if C++11 (based on comment from @mchiasson)\n+ elems.push_back(std::move(item));\nreturn elems;\n}\n@@ -211,7 +211,7 @@ std::vector<Pattern_polar_i*> nodes_parser(const std::string &str_polar, int &id\n{\nstd::clog << bold_yellow(\"(WW) Unrecognized Polar node type (\")\n<< bold_yellow(v_polar[i])\n- << bold_yellow(\")\")\n+ << bold_yellow(\").\")\n<< std::endl;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Factory/Polar/Factory_decoder_polar.cpp", "new_path": "src/Tools/Factory/Polar/Factory_decoder_polar.cpp", "diff": "@@ -244,14 +244,14 @@ Decoder<B,R>* Factory_decoder_polar<B,R>\n<B, R, f_LLR <R>, g_LLR <B,R>, g0_LLR <R>, h_LLR <B,R>, xo_STD <B>,\nf_LLR_i<R>, g_LLR_i<B,R>, g0_LLR_i<R>, h_LLR_i<B,R>, xo_STD_i<B>>;\nif (!params.crc.poly.empty())\n- decoder = new Decoder_polar_ASCL_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_ASCL_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, polar_patterns, idx_r0, idx_r1, *crc, params.simulation.inter_frame_level);\n}\nelse if (params.decoder.simd_strategy.empty())\n{\nusing API_polar = API_polar_dynamic_seq\n<B, R, f_LLR<R>, g_LLR<B,R>, g0_LLR<R>, h_LLR<B,R>, xo_STD<B>>;\nif (!params.crc.poly.empty())\n- decoder = new Decoder_polar_ASCL_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_ASCL_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, polar_patterns, idx_r0, idx_r1, *crc, params.simulation.inter_frame_level);\n}\n}\nif (params.decoder.type == \"ASCL_MEM\")\n" } ]
C++
MIT License
aff3ct/aff3ct
Plug the ASCL_FAST to the cmd line Polar nodes selection.
8,490
22.02.2017 11:49:28
-3,600
bafefe951caaae540aff45f6663a9454f67d91f2
Update the SCL curves.
[ { "change_type": "MODIFY", "old_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_ASCL2_CRC32_SPC4.txt", "new_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_ASCL2_CRC32_SPC4.txt", "diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"ASCL\" --dec-simd \"INTRA\" -L \"2\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --sim-pyber \"Fast-ASCL2+CRC32+SPC4\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"ASCL\" --dec-simd \"INTRA\" -L \"2\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --dec-polar-nodes \"{R0,R0L,R1,REP,REPL,SPC4}\" --sim-pyber \"Fast-ASCL2+CRC32+SPC4\"\nCurve name:\nFast-ASCL2+CRC32+SPC4\n# -------------------------------------------------\n@@ -50,6 +50,7 @@ Fast-ASCL2+CRC32+SPC4\n# ** Implementation = FAST\n# ** SIMD strategy = INTRA\n# ** Max num. of lists (L) = 2\n+# ** Polar node types = {R0,R0L,R1,REP,REPL,SPC4}\n# * Monitor ---------------------------------------\n# ** Frame error count (e) = 100\n#\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_ASCL32_CRC32_SPC4+.txt", "new_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_ASCL32_CRC32_SPC4+.txt", "diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"ASCL\" --dec-simd \"INTRA\" -L \"32\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --sim-pyber \"Fast-ASCL32+CRC32+SPC4+\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"ASCL\" --dec-simd \"INTRA\" -L \"32\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --dec-polar-nodes \"{R0,R0L,R1,REP,REPL,SPC4+}\" --sim-pyber \"Fast-ASCL32+CRC32+SPC4+\"\nCurve name:\nFast-ASCL32+CRC32+SPC4+\n# -------------------------------------------------\n@@ -50,6 +50,7 @@ Fast-ASCL32+CRC32+SPC4+\n# ** Implementation = FAST\n# ** SIMD strategy = INTRA\n# ** Max num. of lists (L) = 32\n+# ** Polar node types = {R0,R0L,R1,REP,REPL,SPC4+}\n# * Monitor ---------------------------------------\n# ** Frame error count (e) = 100\n#\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_ASCL32_CRC32_SPC4.txt", "new_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_ASCL32_CRC32_SPC4.txt", "diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"ASCL\" --dec-simd \"INTRA\" -L \"32\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --sim-pyber \"Fast-ASCL32+CRC32+SPC4\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"ASCL\" --dec-simd \"INTRA\" -L \"32\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --dec-polar-nodes \"{R0,R0L,R1,REP,REPL,SPC4}\" --sim-pyber \"Fast-ASCL32+CRC32+SPC4\"\nCurve name:\nFast-ASCL32+CRC32+SPC4\n# -------------------------------------------------\n@@ -50,6 +50,7 @@ Fast-ASCL32+CRC32+SPC4\n# ** Implementation = FAST\n# ** SIMD strategy = INTRA\n# ** Max num. of lists (L) = 32\n+# ** Polar node types = {R0,R0L,R1,REP,REPL,SPC4}\n# * Monitor ---------------------------------------\n# ** Frame error count (e) = 100\n#\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_ASCL8_CRC32_SPC4+.txt", "new_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_ASCL8_CRC32_SPC4+.txt", "diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"ASCL\" --dec-simd \"INTRA\" -L \"8\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --sim-pyber \"Fast-ASCL8+CRC32+SPC4+\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"ASCL\" --dec-simd \"INTRA\" -L \"8\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --dec-polar-nodes \"{R0,R0L,R1,REP,REPL,SPC4+}\" --sim-pyber \"Fast-ASCL8+CRC32+SPC4+\"\nCurve name:\nFast-ASCL8+CRC32+SPC4+\n# -------------------------------------------------\n@@ -50,6 +50,7 @@ Fast-ASCL8+CRC32+SPC4+\n# ** Implementation = FAST\n# ** SIMD strategy = INTRA\n# ** Max num. of lists (L) = 8\n+# ** Polar node types = {R0,R0L,R1,REP,REPL,SPC4+}\n# * Monitor ---------------------------------------\n# ** Frame error count (e) = 100\n#\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_ASCL8_CRC32_SPC4.txt", "new_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_ASCL8_CRC32_SPC4.txt", "diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"ASCL\" --dec-simd \"INTRA\" -L \"8\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --sim-pyber \"Fast-ASCL8+CRC32+SPC4\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"ASCL\" --dec-simd \"INTRA\" -L \"8\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --dec-polar-nodes \"{R0,R0L,R1,REP,REPL,SPC4}\" --sim-pyber \"Fast-ASCL8+CRC32+SPC4\"\nCurve name:\nFast-ASCL8+CRC32+SPC4\n# -------------------------------------------------\n@@ -50,6 +50,7 @@ Fast-ASCL8+CRC32+SPC4\n# ** Implementation = FAST\n# ** SIMD strategy = INTRA\n# ** Max num. of lists (L) = 8\n+# ** Polar node types = {R0,R0L,R1,REP,REPL,SPC4}\n# * Monitor ---------------------------------------\n# ** Frame error count (e) = 100\n#\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_SCL32.txt", "new_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_SCL32.txt", "diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1723\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"SCL\" --dec-simd \"INTRA\" -L \"32\" --sim-pyber \"Fast-SCL32\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1723\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"SCL\" --dec-simd \"INTRA\" -L \"32\" --dec-polar-nodes \"{R0,R0L,R1,REP,REPL}\" --sim-pyber \"Fast-SCL32\"\nCurve name:\nFast-SCL32\n# -------------------------------------------------\n@@ -44,6 +44,7 @@ Fast-SCL32\n# ** Implementation = FAST\n# ** SIMD strategy = INTRA\n# ** Num. of lists (L) = 32\n+# ** Polar node types = {R0,R0L,R1,REP,REPL}\n# * Monitor ---------------------------------------\n# ** Frame error count (e) = 100\n#\n" }, { "change_type": "MODIFY", "old_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_SCL32_CRC32.txt", "new_path": "tests/data/BFER/polar/SCL/polar_2048_1723_1.0_4.5_SCL32_CRC32.txt", "diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"SCL\" --dec-simd \"INTRA\" -L \"32\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --sim-pyber \"Fast-SCL32+CRC32\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"POLAR\" -m \"1.0\" -M \"4.51\" --sim-snr-step \"0.25\" -K \"1755\" -N \"2048\" --src-type \"AZCW\" --chn-type \"AWGN_FAST\" --dec-type \"SCL\" --dec-simd \"INTRA\" -L \"32\" --crc-type \"FAST\" --crc-poly \"32-GZIP\" --dec-polar-nodes \"{R0,R0L,R1,REP,REPL}\" --sim-pyber \"Fast-SCL32+CRC32\"\nCurve name:\nFast-SCL32+CRC32\n# -------------------------------------------------\n@@ -50,6 +50,7 @@ Fast-SCL32+CRC32\n# ** Implementation = FAST\n# ** SIMD strategy = INTRA\n# ** Num. of lists (L) = 32\n+# ** Polar node types = {R0,R0L,R1,REP,REPL}\n# * Monitor ---------------------------------------\n# ** Frame error count (e) = 100\n#\n" } ]
C++
MIT License
aff3ct/aff3ct
Update the SCL curves.
8,483
22.02.2017 18:34:36
-3,600
6c5648b115763b5f1e90661a0c8412ad59de69a3
working implementation of the error tracker; correction of memory least in Argument reader
[ { "change_type": "MODIFY", "old_path": "src/Launcher/BFER/Launcher_BFER.cpp", "new_path": "src/Launcher/BFER/Launcher_BFER.cpp", "diff": "@@ -109,10 +109,12 @@ void Launcher_BFER<B,R,Q>\n// ---------------------------------------------------------------------------------------------------------- code\nif(this->ar.exist_arg({\"cde-coset\", \"c\"})) this->params.code.coset = true;\n- if (this->params.code.coset)\n+ if (this->params.code.coset && !this->params.monitor.err_track_inverted) // if err_track_inverted == true then encoder.type = \"USER\"\nthis->params.encoder.type = \"COSET\";\n// ------------------------------------------------------------------------------------------------------- encoder\n+ if (!this->params.monitor.err_track_inverted) // if err_track_inverted == true then encoder.type = \"USER\" and encoder.path is set automatically\n+ {\nif(this->ar.exist_arg({\"enc-type\"})) this->params.encoder.type = this->ar.get_arg({\"enc-type\"});\nif (this->params.encoder.type == \"COSET\")\nthis->params.code.coset = true;\n@@ -121,6 +123,7 @@ void Launcher_BFER<B,R,Q>\nif (this->params.encoder.type == \"USER\")\nthis->params.source.type = \"USER\";\nif(this->ar.exist_arg({\"enc-path\"})) this->params.encoder.path = this->ar.get_arg({\"enc-path\"});\n+ }\n// ------------------------------------------------------------------------------------------------------- monitor\nif(this->ar.exist_arg({\"mnt-max-fe\", \"e\"})) this->params.monitor.n_frame_errors = this->ar.get_arg_int({\"mnt-max-fe\", \"e\"});\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/BFERI/Launcher_BFERI.cpp", "new_path": "src/Launcher/BFERI/Launcher_BFERI.cpp", "diff": "@@ -124,10 +124,12 @@ void Launcher_BFERI<B,R,Q>\n// ---------------------------------------------------------------------------------------------------------- code\nif(this->ar.exist_arg({\"cde-coset\", \"c\"})) this->params.code.coset = true;\n- if (this->params.code.coset)\n+ if (this->params.code.coset && !this->params.monitor.err_track_inverted) // if err_track_inverted == true then encoder.type = \"USER\"\nthis->params.encoder.type = \"COSET\";\n// ------------------------------------------------------------------------------------------------------- encoder\n+ if (!this->params.monitor.err_track_inverted) // if err_track_inverted == true then encoder.type = \"USER\" and encoder.path is set automatically\n+ {\nif(this->ar.exist_arg({\"enc-type\"})) this->params.encoder.type = this->ar.get_arg({\"enc-type\"});\nif (this->params.encoder.type == \"COSET\")\nthis->params.code.coset = true;\n@@ -136,6 +138,7 @@ void Launcher_BFERI<B,R,Q>\nif (this->params.encoder.type == \"USER\")\nthis->params.source.type = \"USER\";\nif(this->ar.exist_arg({\"enc-path\"})) this->params.encoder.path = this->ar.get_arg({\"enc-path\"});\n+ }\n// --------------------------------------------------------------------------------------------------- interleaver\nif(this->ar.exist_arg({\"itl-type\"})) this->params.interleaver.type = this->ar.get_arg({\"itl-type\"});\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -77,6 +77,8 @@ Launcher<B,R,Q>\n#endif\nparams.quantizer .range = 0.f;\nparams.monitor .err_track_enable = false;\n+ params.monitor .err_track_inverted= false;\n+ params.monitor .err_track_filename= \"error_tracker\";\nparams.terminal .disabled = false;\nparams.terminal .frequency = std::chrono::milliseconds(500);\n@@ -122,7 +124,7 @@ void Launcher<B,R,Q>\n{\"positive_int\",\n\"enable multi-threaded mode and specify the number of threads.\"};\n#else\n- this->opt_args[{\"sim-conc-tasks\", \"t\"}] =\n+ opt_args[{\"sim-conc-tasks\", \"t\"}] =\n{\"positive_int\",\n\"set the task concurrency level (default is 1, no concurrency).\"};\n#endif\n@@ -136,10 +138,10 @@ void Launcher<B,R,Q>\n\"the simulation precision in bit.\",\n\"8, 16, 32, 64\"};\n#endif\n- this->opt_args[{\"sim-inter-lvl\"}] =\n+ opt_args[{\"sim-inter-lvl\"}] =\n{\"positive_int\",\n\"set the number of inter frame level to process in each modules.\"};\n- this->opt_args[{\"sim-seed\"}] =\n+ opt_args[{\"sim-seed\"}] =\n{\"positive_int\",\n\"seed used in the simulation to initialize the pseudo random generators in general.\"};\n#ifdef ENABLE_MPI\n@@ -269,12 +271,17 @@ void Launcher<B,R,Q>\n\"select the implementation of the algorithm to decode.\"};\n// ------------------------------------------------------------------------------------------------------- monitor\n- this->opt_args[{\"mnt-err-tracker-enable\"}] =\n+ opt_args[{\"mnt-err-tracker-enable\"}] =\n{\"\",\n- \"enable the tracking of the wrong frames.\"};\n- this->opt_args[{\"mnt-err-tracker-filename\"}] =\n+ \"enable the tracking of the wrong frames. Automatically disabled by mnt-err-tracker-inverted.\"};\n+ opt_args[{\"mnt-err-tracker-inverted\"}] =\n+ {\"\",\n+ std::string(\"automatically reply the saved frames in error tracker files for the source, the encoder and the channel noise.\") +\n+ std::string(\" Warning! This feature does not set automatically the configuration of all the other modules.\")};\n+ opt_args[{\"mnt-err-tracker-filename\"}] =\n{\"string\",\n- \"header of filenames where will be returned the wrong frames.\"};\n+ std::string(\"header of filenames where will be returned/read the wrong source, encoder and channel noise frames.\") +\n+ std::string(\" To this name will be automatically added the run SNR and the extension (.src .enc .cha).\")};\n// ------------------------------------------------------------------------------------------------------ terminal\nopt_args[{\"term-no\"}] =\n@@ -285,12 +292,12 @@ void Launcher<B,R,Q>\n\"display frequency in ms (refresh time step for each iteration, 0 = disable display refresh).\"};\n// --------------------------------------------------------------------------------------------------------- other\n- opt_args[{\"version\", \"v\"}] =\n- {\"\",\n- \"print informations about the version of the code.\"};\nopt_args[{\"help\", \"h\"}] =\n{\"\",\n\"print this help.\"};\n+ opt_args[{\"version\", \"v\"}] =\n+ {\"\",\n+ \"print informations about the version of the code.\"};\n}\ntemplate <typename B, typename R, typename Q>\n@@ -427,23 +434,36 @@ void Launcher<B,R,Q>\nif(ar.exist_arg({\"dec-implem\" })) params.decoder.implem = ar.get_arg({\"dec-implem\" });\n// ------------------------------------------------------------------------------------------------------- monitor\n+ if(this->ar.exist_arg({\"mnt-err-tracker-inverted\"})) this->params.monitor.err_track_inverted = true;\nif(this->ar.exist_arg({\"mnt-err-tracker-enable\" })) this->params.monitor.err_track_enable = true;\nif(this->ar.exist_arg({\"mnt-err-tracker-filename\"})) this->params.monitor.err_track_filename = ar.get_arg({\"mnt-err-tracker-filename\"});\n+ if(this->params.monitor.err_track_inverted)\n+ {\n+ this->params.monitor.err_track_enable = false;\n+ this->params.source. type = \"USER\";\n+ this->params.encoder.type = \"USER\";\n+ this->params.channel.type = \"USER\";\n+ this->params.source. path = this->params.monitor.err_track_filename + std::string(\"_SNR.src\");\n+ this->params.encoder.path = this->params.monitor.err_track_filename + std::string(\"_SNR.enc\");\n+ this->params.channel.path = this->params.monitor.err_track_filename + std::string(\"_SNR.cha\");\n+ // the paths are set in the Simulation class\n+ }\n+\n// ------------------------------------------------------------------------------------------------------ terminal\nif(ar.exist_arg({\"term-no\" })) params.terminal.disabled = true;\nif(ar.exist_arg({\"term-freq\"})) params.terminal.frequency = milliseconds(ar.get_arg_int({\"term-freq\"}));\n}\ntemplate <typename B, typename R, typename Q>\n-void Launcher<B,R,Q>\n+int Launcher<B,R,Q>\n::read_arguments()\n{\nthis->build_args();\n- opt_args[{\"help\", \"h\"}] =\n- {\"\",\n- \"print this help.\"};\n+// opt_args[{\"help\", \"h\"}] =\n+// {\"\",\n+// \"print this help.\"};\nauto display_help = true;\nif (ar.parse_arguments(req_args, opt_args, cmd_warn))\n@@ -476,11 +496,15 @@ void Launcher<B,R,Q>\narg_grp.push_back({\"term\", \"Terminal parameter(s)\" });\nar.print_usage(arg_grp);\n- exit(EXIT_FAILURE);\n+ return EXIT_FAILURE;\n+ //exit(EXIT_FAILURE);\n}\nif (!ar.check_arguments())\n- std::exit(EXIT_FAILURE);\n+ return EXIT_FAILURE;\n+ //std::exit(EXIT_FAILURE);\n+\n+ return 0;\n}\ntemplate <typename B, typename R, typename Q>\n@@ -776,7 +800,8 @@ void Launcher<B,R,Q>\nsimu = nullptr;\n}\n- this->read_arguments();\n+ if(this->read_arguments())\n+ return;\n// write the command and he curve name in the PyBER format\nif (!params.simulation.pyber.empty() && params.simulation.mpi_rank == 0)\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.hpp", "new_path": "src/Launcher/Launcher.hpp", "diff": "@@ -232,7 +232,7 @@ protected:\nvirtual Simulation* build_simu() = 0;\nprivate:\n- void read_arguments();\n+ int read_arguments();\nvoid print_header();\nvoid print_parameters(std::string grp_name, std::vector<std::pair<std::string,std::string>> params);\nvoid compute_max_n_chars();\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Channel/Additive/User/Channel_additive_user.cpp", "new_path": "src/Module/Channel/Additive/User/Channel_additive_user.cpp", "diff": "@@ -10,14 +10,13 @@ Channel_additive_user<R>\n::Channel_additive_user(const int N, const std::string filename, const int n_frames, const std::string name)\n: Channel<R>(N, n_frames, name), noise(), noise_counter(0)\n{\n- std::ifstream file(filename.c_str(), std::ios::in);\n-\n+ std::ifstream file(filename.c_str(), std::ios::binary);\nif (file.is_open())\n{\nint n_fra = 0, fra_size = 0;\n- file >> n_fra;\n- file >> fra_size;\n+ file.read((char *)&n_fra, sizeof(int));\n+ file.read((char *)&fra_size, sizeof(int));\nassert(n_fra > 0 && fra_size > 0);\n@@ -31,7 +30,7 @@ Channel_additive_user<R>\nfor (auto j = 0; j < fra_size; j++)\n{\nR val;\n- file >> val;\n+ file.read((char *)&val, sizeof(float));\nthis->noise[i][j] = val;\n}\n}\n@@ -52,6 +51,48 @@ Channel_additive_user<R>\n<< std::endl;\nstd::exit(-1);\n}\n+\n+ //std::ifstream file(filename.c_str(), std::ios::in);\n+// if (file.is_open())\n+// {\n+// int n_fra = 0, fra_size = 0;\n+//\n+// file >> n_fra;\n+// file >> fra_size;\n+//\n+// assert(n_fra > 0 && fra_size > 0);\n+//\n+// this->noise.resize(n_fra);\n+// for (auto i = 0; i < n_fra; i++)\n+// this->noise[i].resize(fra_size);\n+//\n+// if (fra_size == this->N)\n+// {\n+// for (auto i = 0; i < n_fra; i++)\n+// for (auto j = 0; j < fra_size; j++)\n+// {\n+// R val;\n+// file >> val;\n+// this->noise[i][j] = val;\n+// }\n+// }\n+// else\n+// {\n+// std::cerr << bold_red(\"(EE) The frame size is wrong (read: \") << bold_red(std::to_string(fra_size))\n+// << bold_red(\", expected: \") << bold_red(std::to_string(this->N))\n+// << bold_red(\"), exiting.\") << std::endl;\n+// file.close();\n+// std::exit(-1);\n+// }\n+//\n+// file.close();\n+// }\n+// else\n+// {\n+// std::cerr << bold_red(\"(EE) Can't open \\\"\") << bold_red(filename) << bold_red(\"\\\" file, exiting.\")\n+// << std::endl;\n+// std::exit(-1);\n+// }\n}\ntemplate <typename R>\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Monitor.hpp", "new_path": "src/Module/Monitor/Monitor.hpp", "diff": "@@ -39,8 +39,6 @@ protected:\nconst int N; /*!< Size of one encoded frame (= number of bits in one frame) */\nconst int Y_size; /*!< Size of one sent frame through the channel (= number of samples in one frame) */\n- const bool error_tracker_enable;\n-\npublic:\n/*!\n* \\brief Constructor.\n@@ -52,9 +50,9 @@ public:\n* \\param n_frames: number of frames to process in the Monitor.\n* \\param name: Monitor's name.\n*/\n- Monitor_i(const int& K, const int& N, const int& Y_size, const bool& error_tracker_enable, const int& n_frames = 1,\n+ Monitor_i(const int& K, const int& N, const int& Y_size, const int& n_frames = 1,\nconst std::string name = \"Monitor_i\")\n- : Module(n_frames, name), K(K), N(N), Y_size(Y_size), error_tracker_enable(error_tracker_enable)\n+ : Module(n_frames, name), K(K), N(N), Y_size(Y_size)\n{\nMonitor_i<B,R>::interrupt = false;\nMonitor_i<B,R>::d_delta_interrupt = std::chrono::nanoseconds(0);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp", "new_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp", "diff": "#include \"Monitor_reduction.hpp\"\n+#include <sys/types.h>\n+#include <sys/stat.h>\n+#include <sstream>\n+#include <fstream>\n+#include <exception>\ntemplate <typename B, typename R>\nMonitor_reduction<B,R>\n::Monitor_reduction(const int& K, const int& N, const int& Y_size, const int& max_fe,\nstd::vector<Monitor<B,R>*>& monitors,\nconst float snr,\n- const bool& error_tracker_enable,\n- const std::string& error_tracker_head_file_name,\nconst int& n_frames, const std::string name)\n-: Monitor_std<B,R> (K, N, Y_size, max_fe, error_tracker_enable, n_frames, name),\n+: Monitor_std<B,R> (K, N, Y_size, max_fe, n_frames, name),\nmonitors (monitors ),\n- snr (snr ),\n- error_tracker_head_file_name(error_tracker_head_file_name)\n+ snr (snr )\n{\nassert(monitors.size() != 0);\n+ for (size_t i = 0; i < monitors.size(); ++i)\n+ {\n+ assert(monitors[i] != nullptr);\n+ }\n}\ntemplate <typename B, typename R>\nMonitor_reduction<B,R>\n::~Monitor_reduction()\n{\n- if(this->error_tracker_enable)\n- flush_erroneous_frame();\n}\ntemplate <typename B, typename R>\n@@ -57,20 +61,72 @@ int Monitor_reduction<B,R>\nreturn cur_be;\n}\n+template <typename B, typename R>\n+bool Monitor_reduction<B,R>\n+::check_file_name(const std::string& error_tracker_head_file_name)\n+{\n+ size_t pos = error_tracker_head_file_name.find_last_of(\"/\");\n+\n+ if (pos == std::string::npos)\n+ return true;\n+\n+ std::string pathname = error_tracker_head_file_name.substr(0, pos);\n+\n+ // TODO : check compatibility on windows. Normally it is good.\n+ struct stat info;\n+\n+ if( stat( pathname.data(), &info ) != 0 )\n+ return false;\n+ else if( info.st_mode & S_IFDIR )\n+ return true;\n+ else\n+ return false;\n+}\n+\n+template <typename B, typename R>\n+void Monitor_reduction<B,R>\n+::get_tracker_filenames(const std::string& error_tracker_head_file_name, const float snr,\n+ std::string& file_name_src, std::string& file_name_enc, std::string& file_name_noise)\n+{\n+ if(!check_file_name(error_tracker_head_file_name))\n+ {\n+ std::cerr << \"(EE) issue while trying to open error tracker log files ; check file name: \\\"\"\n+ << error_tracker_head_file_name << \"\\\" and please create yourself the needed directory.\" << std::endl;\n+ exit(-1);\n+ }\n+\n+ std::stringstream snr_stream;\n+ snr_stream << std::fixed << std::setprecision(3) << snr;\n+\n+ std::string file_name_head = error_tracker_head_file_name + std::string(\"_\") + snr_stream.str();\n+\n+ file_name_src = file_name_head + std::string(\".src\");\n+ file_name_enc = file_name_head + std::string(\".enc\");\n+ file_name_noise = file_name_head + std::string(\".cha\");\n+}\n+\ntemplate <typename B, typename R>\nvoid Monitor_reduction<B,R>\n-::flush_erroneous_frame()\n+::flush_erroneous_frame(const std::string& error_tracker_head_file_name, const float snr)\n{\n- std::string file_name_head = error_tracker_head_file_name + std::string(\"_\") + std::to_string(snr);\n- std::string file_name_src = file_name_head + std::string(\".src\");\n- std::string file_name_enc = file_name_head + std::string(\".enc\");\n- std::string file_name_noise = file_name_head + std::string(\".cha\");\n+ std::string file_name_src, file_name_enc, file_name_noise;\n+\n+ get_tracker_filenames(error_tracker_head_file_name, snr, file_name_src, file_name_enc, file_name_noise);\nstd::ofstream file_src (file_name_src );\nstd::ofstream file_enc (file_name_enc );\n- std::ofstream file_noise(file_name_noise);\n+ std::ofstream file_noise(file_name_noise, std::ios_base::binary);\n+\n+ if (!file_src.is_open() || !file_enc.is_open() || !file_noise.is_open())\n+ {\n+ std::cerr << \"(EE) issue while trying to open error tracker log files ; check file name: \\\"\"\n+ << error_tracker_head_file_name << \"\\\"\" << std::endl;\n+ exit(-1);\n+ }\n+\nint n_fe = get_n_fe();\n+ int Y_size = this->get_Y_size();\n// ************* write headers *****************\nfile_src << n_fe << std::endl << std::endl; // write number frames\n@@ -80,14 +136,13 @@ void Monitor_reduction<B,R>\nfile_enc << this->get_K() << std::endl << std::endl; // write length of non coded frames\nfile_enc << this->get_N() << std::endl << std::endl; // write length of coded frames\n- file_noise << n_fe << std::endl << std::endl; // write number frames\n- file_noise << this->get_Y_size() << std::endl << std::endl; // write length of frames\n+ file_noise.write((char *)&n_fe , sizeof(int)); // write number frames\n+ file_noise.write((char *)&Y_size, sizeof(int)); // write length of frames\n// ************* write frames ********************\n- Monitor<B,R>* mon = nullptr;\nfor (unsigned i = 0; i <= monitors.size(); i++)\n{\n- mon = (i == monitors.size()) ? this : monitors[i];\n+ auto mon = (i == monitors.size()) ? this : monitors[i];\n// write source\nauto buff_src = mon->get_buff_src();\n@@ -110,16 +165,12 @@ void Monitor_reduction<B,R>\nfile_enc << std::endl << std::endl;\n}\n- // noise encoder\n+ // write noise\nauto buff_noise = mon->get_buff_noise();\nassert(buff_src.size() == buff_noise.size());\nfor (unsigned f = 0; f < buff_noise.size(); f++)\n- {\nfor (unsigned b = 0; b < buff_noise[f].size(); b++)\n- file_noise << buff_noise[f][b] << \" \";\n-\n- file_noise << std::endl << std::endl;\n- }\n+ file_noise.write((char *)&buff_noise[f][b], sizeof(R));\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_reduction.hpp", "new_path": "src/Module/Monitor/Standard/Monitor_reduction.hpp", "diff": "#include <string>\n#include <vector>\n-#include <fstream>\n#include \"Monitor_std.hpp\"\n@@ -19,8 +18,6 @@ public:\nMonitor_reduction(const int& K, const int& N, const int& Y_size, const int& max_fe,\nstd::vector<Monitor<B,R>*>& monitors,\nconst float snr,\n- const bool& error_tracker_enable = false,\n- const std::string& error_tracker_head_file_name = \"error_tracker\",\nconst int& n_frames = 1, const std::string name = \"Monitor_reduction\");\nvirtual ~Monitor_reduction();\n@@ -28,8 +25,10 @@ public:\nint get_n_fe() const;\nint get_n_be() const;\n-private:\n- void flush_erroneous_frame();\n+ static bool check_file_name(const std::string& error_tracker_head_file_name); // return true if correct\n+ static void get_tracker_filenames(const std::string& error_tracker_head_file_name, const float snr,\n+ std::string& file_name_src, std::string& file_name_enc, std::string& file_name_noise);\n+ void flush_erroneous_frame(const std::string& error_tracker_head_file_name, const float snr);\n};\n#endif /* MONITOR_REDUCTION_HPP_ */\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_std.cpp", "new_path": "src/Module/Monitor/Standard/Monitor_std.cpp", "diff": "template <typename B, typename R>\nMonitor_std<B,R>\n::Monitor_std(const int& K, const int& N, const int& Y_size, const int& max_fe,\n- const bool& error_tracker_enable, const int& n_frames, const std::string name)\n-: Monitor<B,R>(K, N, Y_size, error_tracker_enable, n_frames, name.c_str()),\n+ const int& n_frames, const std::string name)\n+: Monitor<B,R>(K, N, Y_size, n_frames, name.c_str()),\nmax_fe(max_fe),\nn_bit_errors(0),\nn_frame_errors(0),\n@@ -47,9 +47,7 @@ void Monitor_std<B,R>\nfor (auto i = 0; i < this->n_frames; i++)\n{\n- bool err = check_errors(U.data()+i*this->K, V.data()+i*this->K, this->K);\n-\n- if(this->error_tracker_enable && err)\n+ if (check_errors(U.data()+i*this->K, V.data()+i*this->K, this->K))\nsave_erroneous_frame(U .data()+i*this->K,\nX .data()+i*this->N,\nX_mod.data()+i*this->Y_size,\n@@ -86,7 +84,7 @@ void Monitor_std<B,R>\nauto n = (int)U.size() / this->n_frames;\nfor (auto i = 0; i < this->n_frames; i++)\n- check_errors(U.data()+i*n, V.data()+n, n);\n+ check_errors(U.data()+i*n, V.data()+i*n, n);\nthis->update_n_analyzed_frames();\n}\n@@ -143,13 +141,13 @@ void Monitor_std<B,R>\nbuff_enc. push_back(mipp::vector<B>(this->N ));\nbuff_noise.push_back(mipp::vector<R>(this->Y_size));\n- for (size_t b = 0 ; b < this->K ; b++)\n+ for (int b = 0 ; b < this->K ; b++)\nbuff_src. back()[b] = U[b];\n- for (size_t b = 0 ; b < this->N ; b++)\n+ for (int b = 0 ; b < this->N ; b++)\nbuff_enc. back()[b] = X[b];\n- for (size_t b = 0 ; b < this->Y_size ; b++)\n+ for (int b = 0 ; b < this->Y_size ; b++)\nbuff_noise.back()[b] = Y[b] - X_mod[b];\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_std.hpp", "new_path": "src/Module/Monitor/Standard/Monitor_std.hpp", "diff": "@@ -24,8 +24,7 @@ protected:\npublic:\nMonitor_std(const int& K, const int& N, const int& Y_size, const int& max_fe,\n- const bool& error_tracker_enable = false, const int& n_frames = 1,\n- const std::string name = \"Monitor_std\");\n+ const int& n_frames = 1, const std::string name = \"Monitor_std\");\nvirtual ~Monitor_std(){};\nvirtual void check_track_errors(const mipp::vector<B>& U,\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp", "new_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp", "diff": "@@ -99,6 +99,29 @@ template <typename B, typename R, typename Q>\nvoid Simulation_BFER<B,R,Q>\n::_launch()\n{\n+ // check, if the error tracker is enable, if the given file name is good\n+ if((this->params.monitor.err_track_enable || this->params.monitor.err_track_inverted)\n+ && !Monitor_reduction<B,R>::check_file_name(this->params.monitor.err_track_filename))\n+ {\n+ std::cerr << \"(EE) issue while trying to open error tracker log files ; check file name: \\\"\"\n+ << this->params.monitor.err_track_filename << \"\\\" and please create yourself the needed directory.\"\n+ << std::endl;\n+ exit(-1);\n+ }\n+\n+ if(this->params.monitor.err_track_inverted)\n+ {\n+ std::string file_name_src, file_name_enc, file_name_noise;\n+ Monitor_reduction<B,R>::get_tracker_filenames(this->params.monitor.err_track_filename, this->snr,\n+ file_name_src, file_name_enc, file_name_noise);\n+\n+ parameters *params_writable = const_cast<parameters*>(&this->params);\n+\n+ params_writable->source. path = file_name_src;\n+ params_writable->encoder.path = file_name_enc;\n+ params_writable->channel.path = file_name_noise;\n+ }\n+\n// launch a group of slave threads (there is \"n_threads -1\" slave threads)\nfor (auto tid = 1; tid < this->params.simulation.n_threads; tid++)\nthreads[tid -1] = std::thread(Simulation_BFER<B,R,Q>::Monte_Carlo_method, this, tid);\n@@ -115,6 +138,9 @@ void Simulation_BFER<B,R,Q>\ntime_reduction(true);\nterminal->final_report(std::cout);\n}\n+\n+ if(this->params.monitor.err_track_enable)\n+ monitor_red->flush_erroneous_frame(this->params.monitor.err_track_filename, this->snr);\n}\ntemplate <typename B, typename R, typename Q>\n@@ -186,9 +212,6 @@ void Simulation_BFER<B,R,Q>\nN_mod,\nsimu->params.monitor.n_frame_errors,\nsimu->monitor,\n- simu->snr,\n- simu->params.monitor.err_track_enable,\n- simu->params.monitor.err_track_filename,\nn_fra);\n#endif\n// build the terminal to display the BER/FER\n@@ -363,6 +386,9 @@ void Simulation_BFER<B,R,Q>\n// check errors in the frame\nauto t_check = steady_clock::now();\n+ if(simu->params.monitor.err_track_enable)\n+ simu->monitor[tid]->check_track_errors(simu->U_K[tid], simu->V_K[tid], simu->X_N1[tid], simu->X_N3[tid], simu->Y_N1[tid]);\n+ else\nsimu->monitor[tid]->check_errors(simu->U_K[tid], simu->V_K[tid]);\nauto d_check = steady_clock::now() - t_check;\n@@ -686,6 +712,9 @@ void Simulation_BFER<B,R,Q>\n// check errors in the frame\nauto t_check = steady_clock::now();\n+ if(simu->params.monitor.err_track_enable)\n+ simu->monitor[0]->check_track_errors(simu->U_K[0], simu->V_K[0], simu->X_N1[0], simu->X_N3[0], simu->Y_N1[0]);\n+ else\nsimu->monitor[0]->check_errors(simu->U_K[0], simu->V_K[0]);\nauto d_check = steady_clock::now() - t_check;\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp", "new_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp", "diff": "@@ -101,6 +101,29 @@ template <typename B, typename R, typename Q>\nvoid Simulation_BFERI<B,R,Q>\n::_launch()\n{\n+ // check, if the error tracker is enable, if the given file name is good\n+ if ((this->params.monitor.err_track_enable || this->params.monitor.err_track_inverted)\n+ && !Monitor_reduction<B,R>::check_file_name(this->params.monitor.err_track_filename))\n+ {\n+ std::cerr << \"(EE) issue while trying to open error tracker log files ; check file name: \\\"\"\n+ << this->params.monitor.err_track_filename << \"\\\" and please create yourself the needed directory.\"\n+ << std::endl;\n+ exit(-1);\n+ }\n+\n+ if (this->params.monitor.err_track_inverted)\n+ {\n+ std::string file_name_src, file_name_enc, file_name_noise;\n+ Monitor_reduction<B,R>::get_tracker_filenames(this->params.monitor.err_track_filename, this->snr,\n+ file_name_src, file_name_enc, file_name_noise);\n+\n+ parameters *params_writable = const_cast<parameters*>(&this->params);\n+\n+ params_writable->source. path = file_name_src;\n+ params_writable->encoder.path = file_name_enc;\n+ params_writable->channel.path = file_name_noise;\n+ }\n+\n// launch a group of slave threads (there is \"n_threads -1\" slave threads)\nfor (auto tid = 1; tid < this->params.simulation.n_threads; tid++)\nthreads[tid -1] = std::thread(Simulation_BFERI<B,R,Q>::Monte_Carlo_method, this, tid);\n@@ -117,6 +140,9 @@ void Simulation_BFERI<B,R,Q>\ntime_reduction(true);\nterminal->final_report(std::cout);\n}\n+\n+ if (this->params.monitor.err_track_enable)\n+ monitor_red->flush_erroneous_frame(this->params.monitor.err_track_filename, this->snr);\n}\ntemplate <typename B, typename R, typename Q>\n@@ -187,9 +213,6 @@ void Simulation_BFERI<B,R,Q>\nN_mod,\nsimu->params.monitor.n_frame_errors,\nsimu->monitor,\n- simu->snr,\n- simu->params.monitor.err_track_enable,\n- simu->params.monitor.err_track_filename,\nn_fra);\n#endif\n// build the terminal to display the BER/FER\n@@ -394,9 +417,13 @@ void Simulation_BFERI<B,R,Q>\n// check errors in the frame\nauto t_check = steady_clock::now();\n+ if(simu->params.monitor.err_track_enable)\n+ simu->monitor[tid]->check_track_errors(simu->U_K[tid], simu->V_K[tid], simu->X_N1[tid], simu->X_N3[tid], simu->Y_N1[tid]);\n+ else\nsimu->monitor[tid]->check_errors(simu->U_K[tid], simu->V_K[tid]);\nauto d_check = steady_clock::now() - t_check;\n+\n// increment total durations for each operations\nsimu->d_sourc_total[tid] += d_sourc;\nsimu->d_crc_total [tid] += d_crc;\n@@ -716,7 +743,10 @@ void Simulation_BFERI<B,R,Q>\n// check errors in the frame\nauto t_check = steady_clock::now();\n- simu->monitor_red->check_errors(simu->U_K[0], simu->V_K[0]);\n+ if(simu->params.monitor.err_track_enable)\n+ simu->monitor[0]->check_track_errors(simu->U_K[0], simu->V_K[0], simu->X_N1[0], simu->X_N3[0], simu->Y_N1[0]);\n+ else\n+ simu->monitor[0]->check_errors(simu->U_K[0], simu->V_K[0]);\nauto d_check = steady_clock::now() - t_check;\n// increment total durations for each operations\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments_reader.cpp", "new_path": "src/Tools/Arguments_reader.cpp", "diff": "@@ -236,18 +236,18 @@ void Arguments_reader\nif (!req_args_cpy.empty() || !opt_args_cpy.empty())\n{\ncout << \"Other parameter(s): \" << endl;\n- for (auto it = req_args_cpy.begin(); it != req_args_cpy.end(); ++it)\n+ for (auto it = req_args_cpy.begin(); it != req_args_cpy.end(); )\n{\n// gr->first is a prefix of it->first[0].\nthis->print_usage(it->first, it->second, true);\n- req_args_cpy.erase(it->first);\n+ it = req_args_cpy.erase(it);\n}\n- for (auto it = opt_args_cpy.begin(); it != opt_args_cpy.end(); ++it)\n+ for (auto it = opt_args_cpy.begin(); it != opt_args_cpy.end();)\n{\n// gr->first is a prefix of it->first[0].\nthis->print_usage(it->first, it->second, false);\n- opt_args_cpy.erase(it->first);\n+ it = opt_args_cpy.erase(it);\n}\ncout << endl;\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Factory/Factory_monitor.cpp", "new_path": "src/Tools/Factory/Factory_monitor.cpp", "diff": "@@ -9,8 +9,7 @@ Monitor<B,R>* Factory_monitor<B,R>\nMonitor<B,R> *monitor = nullptr;\n// build the monitor\n- monitor = new Monitor_std<B,R>(params.code.K, params.code.N, Y_size, params.monitor.n_frame_errors,\n- params.monitor.err_track_enable, n_frames);\n+ monitor = new Monitor_std<B,R>(params.code.K, params.code.N, Y_size, params.monitor.n_frame_errors, n_frames);\nreturn monitor;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/params.h", "new_path": "src/Tools/params.h", "diff": "@@ -133,6 +133,7 @@ struct decoder_parameters\nstruct monitor_parameters\n{\nint n_frame_errors;\n+ bool err_track_inverted;\nbool err_track_enable;\nstd::string err_track_filename;\n};\n" } ]
C++
MIT License
aff3ct/aff3ct
working implementation of the error tracker; correction of memory least in Argument reader
8,490
22.02.2017 19:47:39
-3,600
be2db02336e27fbbb1bae993fb53245efad04be7
Add the Polar nodes selection to the code generation.
[ { "change_type": "MODIFY", "old_path": "scripts/generate_polar_decoders.sh", "new_path": "scripts/generate_polar_decoders.sh", "diff": "@@ -74,8 +74,8 @@ echo \"Generate SC decoders (other rates)...\"\n../build/bin/aff3ct --cde-type POLAR --sim-type GEN -N 32768 -K 29492 --dec-snr 4.0 > ../src/Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K29492_SNR40.report 2>&1\necho \"Generate SCL decoders (all rates)...\"\n-../build/bin/aff3ct --cde-type POLAR --sim-type GEN --dec-type SCL -N 4 -K 2 --dec-snr 2.5 > ../src/Module/Decoder/Polar/SCL/CRC/Generated/Decoder_polar_SCL_fast_CA_sys_N4_K2_SNR25.report 2>&1\n-../build/bin/aff3ct --cde-type POLAR --sim-type GEN --dec-type SCL -N 2048 -K 1755 --dec-snr 3.5 > ../src/Module/Decoder/Polar/SCL/CRC/Generated/Decoder_polar_SCL_fast_CA_sys_N2048_K1755_SNR35.report 2>&1\n+../build/bin/aff3ct --cde-type POLAR --sim-type GEN --dec-type SCL -N 4 -K 2 --dec-snr 2.5 --dec-polar-nodes \"{R0,R0L,R1,REP,REPL,SPC_4}\" > ../src/Module/Decoder/Polar/SCL/CRC/Generated/Decoder_polar_SCL_fast_CA_sys_N4_K2_SNR25.report 2>&1\n+../build/bin/aff3ct --cde-type POLAR --sim-type GEN --dec-type SCL -N 2048 -K 1755 --dec-snr 3.5 --dec-polar-nodes \"{R0,R0L,R1,REP,REPL,SPC_4}\" > ../src/Module/Decoder/Polar/SCL/CRC/Generated/Decoder_polar_SCL_fast_CA_sys_N2048_K1755_SNR35.report 2>&1\necho \"Generate SC graphs (from *.dot to *.dot.pdf, rate 1/2)...\"\ndot -Tpdf ../src/Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4_K2_SNR25.dot -O\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/GEN/Polar/Launcher_GEN_polar.cpp", "new_path": "src/Launcher/GEN/Polar/Launcher_GEN_polar.cpp", "diff": "@@ -20,6 +20,7 @@ Launcher_GEN_polar<B,R,Q>\nthis->params.decoder .simd_strategy = \"\";\nthis->params.decoder .type = \"SC\";\nthis->params.decoder .gen_path = \"../src/Module/Decoder/Polar/SC/Generated\";\n+ this->params.decoder .polar_nodes = \"{R0,R0L,R1,REP,REPL,SPC}\";\n}\ntemplate <typename B, typename R, typename Q>\n@@ -67,6 +68,9 @@ void Launcher_GEN_polar<B,R,Q>\n{\"string\",\n\"type of the decoder to generate.\",\n\"SC, SCL\"};\n+ this->opt_args[{\"dec-polar-nodes\"}] =\n+ {\"string\",\n+ \"the type of nodes you want to detect in the Polar tree (ex: {R0,R1,R0L,REP_2-8,REPL,SPC_4+}).\"};\n// --------------------------------------------------------------------------------------------------------- other\n#ifdef MULTI_PREC\n@@ -107,6 +111,7 @@ void Launcher_GEN_polar<B,R,Q>\nif(this->ar.exist_arg({\"dec-type\" })) this->params.decoder.type = this->ar.get_arg({\"dec-type\" });\nif(this->params.decoder.type == \"SCL\") this->params.decoder.gen_path = \"../src/Module/Decoder/Polar/SCL/CRC/Generated\";\nif(this->ar.exist_arg({\"dec-gen-path\" })) this->params.decoder.gen_path = this->ar.get_arg({\"dec-gen-path\" });\n+ if(this->ar.exist_arg({\"dec-polar-nodes\"})) this->params.decoder.polar_nodes = this->ar.get_arg({\"dec-polar-nodes\"});\n}\ntemplate <typename B, typename R, typename Q>\n@@ -159,6 +164,7 @@ std::vector<std::pair<std::string,std::string>> Launcher_GEN_polar<B,R,Q>\np.push_back(std::make_pair(\"Generated decoder path\", this->params.decoder.gen_path ));\np.push_back(std::make_pair(\"Type\", this->params.decoder.type ));\n+ p.push_back(std::make_pair(\"Polar node types\", this->params.decoder.polar_nodes));\nreturn p;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/GEN/Code/Polar/Generation_polar.cpp", "new_path": "src/Simulation/GEN/Code/Polar/Generation_polar.cpp", "diff": "#include \"Tools/params.h\"\n#include \"Tools/Factory/Polar/Factory_frozenbits_generator.hpp\"\n+#include \"Tools/Code/Polar/nodes_parser.h\"\n#include \"Generator/Polar/SC/Generator_polar_SC_sys.hpp\"\n@@ -58,32 +59,11 @@ Generation_polar\n#endif\n// pattern allocations\n- if (params.decoder.type == \"SCL\")\n- {\n- polar_pattern_r0 = new Pattern_polar_SCL_r0;\n- polar_pattern_r1 = new Pattern_polar_SCL_r1;\n-\n- polar_patterns.push_back(new Pattern_polar_SCL_std );\n- polar_patterns.push_back(new Pattern_polar_SCL_r0_left );\n- polar_patterns.push_back( polar_pattern_r0 );\n- polar_patterns.push_back( polar_pattern_r1 );\n- polar_patterns.push_back(new Pattern_polar_SCL_rep_left);\n- polar_patterns.push_back(new Pattern_polar_SCL_rep );\n- polar_patterns.push_back(new Pattern_polar_SCL_spc(2,2));\n- }\n- else if (params.decoder.type == \"SC\")\n- {\n- polar_pattern_r0 = new Pattern_polar_SC_r0;\n- polar_pattern_r1 = new Pattern_polar_SC_r1;\n-\n- polar_patterns.push_back(new Pattern_polar_SC_std );\n- polar_patterns.push_back(new Pattern_polar_SC_r0_left );\n- polar_patterns.push_back( polar_pattern_r0 );\n- polar_patterns.push_back( polar_pattern_r1 );\n- polar_patterns.push_back(new Pattern_polar_SC_rep_left);\n- polar_patterns.push_back(new Pattern_polar_SC_rep );\n- polar_patterns.push_back(new Pattern_polar_SC_spc(2) );\n- }\n+ int idx_r0, idx_r1;\n+ std::string type = params.decoder.type == \"SC\" ? \"SC\" : \"SCL\";\n+ polar_patterns = nodes_parser(params.decoder.polar_nodes, idx_r0, idx_r1, type);\n+ polar_pattern_r0 = polar_patterns[idx_r0];\n+ polar_pattern_r1 = polar_patterns[idx_r1];\nfloat snr = params.simulation.snr_min;\n@@ -170,7 +150,7 @@ void Generation_polar\n{\nauto cur_pattern_SC = polar_patterns[p];\nif (cur_pattern_SC->is_terminal())\n- std::cout << tab << tab << \" - \" << std::setw(11) << cur_pattern_SC->name() << \": \"\n+ std::cout << tab << tab << \" - \" << std::setw(20) << cur_pattern_SC->name() << \": \"\n<< std::setw(5)\n<< generator->get_n_generated_nodes_by_pattern(typeid(*cur_pattern_SC).hash_code(), -1)\n<< \" / \" << n_nodes_gen << std::endl;\n@@ -180,7 +160,7 @@ void Generation_polar\n{\nauto cur_pattern_SC = polar_patterns[p];\nif (!cur_pattern_SC->is_terminal())\n- std::cout << tab << tab << \" - \" << std::setw(11) << cur_pattern_SC->name() << \": \"\n+ std::cout << tab << tab << \" - \" << std::setw(20) << cur_pattern_SC->name() << \": \"\n<< std::setw(5)\n<< generator->get_n_generated_nodes_by_pattern(typeid(*cur_pattern_SC).hash_code(), -1)\n<< \" / \" << n_nodes_gen << std::endl;\n@@ -204,7 +184,7 @@ void Generation_polar\n{\nauto cur_pattern_SC = polar_patterns[p];\nif (cur_pattern_SC->is_terminal())\n- std::cout << tab << tab << tab << \" - \" << std::setw(11) << cur_pattern_SC->name() << \": \"\n+ std::cout << tab << tab << tab << \" - \" << std::setw(20) << cur_pattern_SC->name() << \": \"\n<< std::setw(5)\n<< generator->get_n_generated_nodes_by_pattern(typeid(*cur_pattern_SC).hash_code(), d)\n<< \" / \" << n_nodes_gen << std::endl;\n@@ -214,7 +194,7 @@ void Generation_polar\n{\nauto cur_pattern_SC = polar_patterns[p];\nif (!cur_pattern_SC->is_terminal())\n- std::cout << tab << tab << tab << \" - \" << std::setw(11) << cur_pattern_SC->name() << \": \"\n+ std::cout << tab << tab << tab << \" - \" << std::setw(20) << cur_pattern_SC->name() << \": \"\n<< std::setw(5)\n<< generator->get_n_generated_nodes_by_pattern(typeid(*cur_pattern_SC).hash_code(), d)\n<< \" / \" << n_nodes_gen << std::endl;\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_i.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_i.hpp", "diff": "@@ -123,6 +123,18 @@ public:\nvirtual std::string apply_g(std::string start_indent = \"\", std::string str_off_l = \"\", std::string str_off_s = \"\") const { return \"\"; }\nvirtual std::string apply_h(std::string start_indent = \"\", std::string str_off_l = \"\", std::string str_off_s = \"\") const { return \"\"; }\n+ virtual std::string range_name() const\n+ {\n+ if (min_level == 0 && max_level == -1)\n+ return \"\";\n+ else if (min_level > 0 && max_level == -1)\n+ return \" (\" + std::to_string((int)std::exp2(min_level)) + \"+)\";\n+ else if (max_level == min_level)\n+ return \" (\" + std::to_string((int)std::exp2(min_level)) + \")\";\n+ else\n+ return \" (\" + std::to_string((int)std::exp2(min_level)) + \"-\" + std::to_string((int)std::exp2(max_level)) + \")\";\n+ }\n+\nvirtual int match(const int &reverse_graph_depth, const Binary_node<Pattern_polar_i>* node_curr)\n{\nassert(reverse_graph_depth > 0);\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_r0.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_r0.hpp", "diff": "@@ -33,7 +33,7 @@ public:\nvirtual ~Pattern_polar_r0() {}\nvirtual polar_node_t type() const { return polar_node_t::RATE_0; }\n- virtual std::string name() const { return \"Rate 0\"; }\n+ virtual std::string name() const { return \"Rate 0\" + range_name();}\nvirtual std::string short_name() const { return \"r0\"; }\nvirtual std::string fill_color() const { return \"#FFFFFF\"; }\nvirtual std::string font_color() const { return \"#000000\"; }\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_r0_left.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_r0_left.hpp", "diff": "@@ -37,7 +37,7 @@ public:\nvirtual ~Pattern_polar_r0_left() {}\nvirtual polar_node_t type() const { return polar_node_t::RATE_0_LEFT; }\n- virtual std::string name() const { return \"Rate 0 left\"; }\n+ virtual std::string name() const { return \"Rate 0 left\" + range_name();}\nvirtual std::string short_name() const { return \"r0l\"; }\nvirtual std::string fill_color() const { return \"#dadada\"; }\nvirtual std::string font_color() const { return \"#000000\"; }\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_r1.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_r1.hpp", "diff": "@@ -33,7 +33,7 @@ public:\nvirtual ~Pattern_polar_r1() {}\nvirtual polar_node_t type() const { return polar_node_t::RATE_1; }\n- virtual std::string name() const { return \"Rate 1\"; }\n+ virtual std::string name() const { return \"Rate 1\" + range_name();}\nvirtual std::string short_name() const { return \"r1\"; }\nvirtual std::string fill_color() const { return \"#000000\"; }\nvirtual std::string font_color() const { return \"#FFFFFF\"; }\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_rep.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_rep.hpp", "diff": "@@ -38,7 +38,7 @@ public:\nvirtual ~Pattern_polar_rep() {}\nvirtual polar_node_t type() const { return polar_node_t::REP; }\n- virtual std::string name() const { return \"Rep\"; }\n+ virtual std::string name() const { return \"Rep\" + range_name();}\nvirtual std::string short_name() const { return \"re\"; }\nvirtual std::string fill_color() const { return \"#8F463F\"; }\nvirtual std::string font_color() const { return \"#FFFFFF\"; }\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_rep_left.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_rep_left.hpp", "diff": "@@ -37,7 +37,7 @@ public:\nvirtual ~Pattern_polar_rep_left() {}\nvirtual polar_node_t type() const { return polar_node_t::REP_LEFT; }\n- virtual std::string name() const { return \"Rep left\"; }\n+ virtual std::string name() const { return \"Rep left\" + range_name();}\nvirtual std::string short_name() const { return \"rl\"; }\nvirtual std::string fill_color() const { return \"#8e726f\"; }\nvirtual std::string font_color() const { return \"#FFFFFF\"; }\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_spc.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_spc.hpp", "diff": "@@ -39,19 +39,11 @@ public:\nvirtual ~Pattern_polar_spc() {}\nvirtual polar_node_t type() const { return polar_node_t::SPC; }\n+ virtual std::string name() const { return \"SPC\" + range_name();}\nvirtual std::string short_name() const { return \"s\"; }\nvirtual std::string fill_color() const { return \"#2F3F60\"; }\nvirtual std::string font_color() const { return \"#FFFFFF\"; }\n- virtual std::string name() const\n- {\n- if (min_level == -1 && min_level == -1)\n- return \"SPC\";\n- else if (min_level != -1 && min_level == -1)\n- return \"SPC\" + std::to_string(min_level) + \"+\";\n- return \"SPC[\" + std::to_string(min_level) + \",\" + std::to_string(max_level) + \"]\";\n- }\n-\nvirtual std::string f() const { return \"\"; }\nvirtual std::string g() const { return \"\"; }\nvirtual std::string h() const { return \"spc\"; }\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/Code/Polar/nodes_parser.cpp", "diff": "+#include <string>\n+#include <sstream>\n+#include <vector>\n+#include <cmath>\n+\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_r0.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_r0_left.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_r1.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_rep.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_rep_left.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_spc.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_std.hpp\"\n+\n+#include \"Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_r0.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_r0_left.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_r1.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_rep.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_rep_left.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_spc.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_std.hpp\"\n+\n+#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_r0.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_r0_left.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_r1.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_rep.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_rep_left.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_spc.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_std.hpp\"\n+\n+#include \"Tools/Display/bash_tools.h\"\n+\n+#include \"nodes_parser.h\"\n+\n+std::vector<std::string> string_split(const std::string &s, char delim)\n+{\n+ std::stringstream ss(s);\n+ std::string item;\n+ std::vector<std::string> elems;\n+ while (std::getline(ss, item, delim))\n+ elems.push_back(std::move(item));\n+\n+ return elems;\n+}\n+\n+std::vector<Pattern_polar_i*> nodes_parser(const std::string &str_polar,\n+ int &idx_r0,\n+ int &idx_r1,\n+ const std::string type)\n+{\n+ idx_r0 = -1;\n+ idx_r1 = -1;\n+\n+ auto str_polar_bis = str_polar;\n+\n+ str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), ' '), str_polar_bis.end());\n+ str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), '{'), str_polar_bis.end());\n+ str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), '}'), str_polar_bis.end());\n+ str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), '('), str_polar_bis.end());\n+ str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), ')'), str_polar_bis.end());\n+\n+ std::vector<Pattern_polar_i*> polar_patterns;\n+\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_std );\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_std);\n+ else polar_patterns.push_back(new Pattern_polar_std );\n+\n+ auto v_polar = string_split(str_polar_bis, ',');\n+ for (auto i = 0; i < (int)v_polar.size(); i++)\n+ {\n+ auto v_str1 = string_split(v_polar[i], '_');\n+\n+ if (v_str1.size() >= 1)\n+ {\n+ if (v_str1[0] == \"R0L\")\n+ {\n+ if (v_str1.size() == 1)\n+ {\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r0_left );\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r0_left);\n+ else polar_patterns.push_back(new Pattern_polar_r0_left );\n+ }\n+ else\n+ {\n+ auto v_str2 = string_split(v_str1[1], '-');\n+\n+ if (v_str2.size() > 1)\n+ {\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+ auto max = (int)std::log2(std::stoi(v_str2[1]));\n+\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r0_left (min, max));\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r0_left(min, max));\n+ else polar_patterns.push_back(new Pattern_polar_r0_left (min, max));\n+\n+ }\n+ else\n+ {\n+ bool plus = v_str2[0].find(\"+\") != std::string::npos;\n+\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+\n+ if (plus)\n+ {\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r0_left (min));\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r0_left(min));\n+ else polar_patterns.push_back(new Pattern_polar_r0_left (min));\n+ }\n+ else\n+ {\n+\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r0_left (min, min));\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r0_left(min, min));\n+ else polar_patterns.push_back(new Pattern_polar_r0_left (min, min));\n+ }\n+ }\n+ }\n+ }\n+ else if (v_str1[0] == \"R0\")\n+ {\n+ idx_r0 = (int)polar_patterns.size();\n+\n+ if (v_str1.size() == 1)\n+ {\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r0 );\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r0);\n+ else polar_patterns.push_back(new Pattern_polar_r0 );\n+ }\n+ else\n+ {\n+ auto v_str2 = string_split(v_str1[1], '-');\n+\n+ if (v_str2.size() > 1)\n+ {\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+ auto max = (int)std::log2(std::stoi(v_str2[1]));\n+\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r0 (min, max));\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r0(min, max));\n+ else polar_patterns.push_back(new Pattern_polar_r0 (min, max));\n+ }\n+ else\n+ {\n+ bool plus = v_str2[0].find(\"+\") != std::string::npos;\n+\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+\n+ if (plus)\n+ {\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r0 (min));\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r0(min));\n+ else polar_patterns.push_back(new Pattern_polar_r0 (min));\n+ }\n+ else\n+ {\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r0 (min, min));\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r0(min, min));\n+ else polar_patterns.push_back(new Pattern_polar_r0 (min, min));\n+ }\n+ }\n+ }\n+ }\n+ else if (v_str1[0] == \"R1\")\n+ {\n+ idx_r1 = (int)polar_patterns.size();\n+\n+ if (v_str1.size() == 1)\n+ {\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r1 );\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r1);\n+ else polar_patterns.push_back(new Pattern_polar_r1 );\n+ }\n+ else\n+ {\n+ auto v_str2 = string_split(v_str1[1], '-');\n+\n+ if (v_str2.size() > 1)\n+ {\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+ auto max = (int)std::log2(std::stoi(v_str2[1]));\n+\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r1 (min, max));\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r1(min, max));\n+ else polar_patterns.push_back(new Pattern_polar_r1 (min, max));\n+ }\n+ else\n+ {\n+ bool plus = v_str2[0].find(\"+\") != std::string::npos;\n+\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+\n+ if (plus)\n+ {\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r1 (min));\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r1(min));\n+ else polar_patterns.push_back(new Pattern_polar_r1 (min));\n+ }\n+ else\n+ {\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r1 (min, min));\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r1(min, min));\n+ else polar_patterns.push_back(new Pattern_polar_r1 (min, min));\n+ }\n+ }\n+ }\n+ }\n+ else if (v_str1[0] == \"REPL\")\n+ {\n+ if (v_str1.size() == 1)\n+ {\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_rep_left );\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_rep_left);\n+ else polar_patterns.push_back(new Pattern_polar_rep_left );\n+ }\n+ else\n+ {\n+ auto v_str2 = string_split(v_str1[1], '-');\n+\n+ if (v_str2.size() > 1)\n+ {\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+ auto max = (int)std::log2(std::stoi(v_str2[1]));\n+\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_rep_left (min, max));\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_rep_left(min, max));\n+ else polar_patterns.push_back(new Pattern_polar_rep_left (min, max));\n+ }\n+ else\n+ {\n+ bool plus = v_str2[0].find(\"+\") != std::string::npos;\n+\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+\n+ if (plus)\n+ {\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_rep_left (min));\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_rep_left(min));\n+ else polar_patterns.push_back(new Pattern_polar_rep_left (min));\n+ }\n+ else\n+ {\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_rep_left (min, min));\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_rep_left(min, min));\n+ else polar_patterns.push_back(new Pattern_polar_rep_left (min, min));\n+ }\n+ }\n+ }\n+ }\n+ else if (v_str1[0] == \"REP\")\n+ {\n+ if (v_str1.size() == 1)\n+ {\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_rep );\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_rep);\n+ else polar_patterns.push_back(new Pattern_polar_rep );\n+ }\n+ else\n+ {\n+ auto v_str2 = string_split(v_str1[1], '-');\n+\n+ if (v_str2.size() > 1)\n+ {\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+ auto max = (int)std::log2(std::stoi(v_str2[1]));\n+\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_rep (min, max));\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_rep(min, max));\n+ else polar_patterns.push_back(new Pattern_polar_rep (min, max));\n+ }\n+ else\n+ {\n+ bool plus = v_str2[0].find(\"+\") != std::string::npos;\n+\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+\n+ if (plus)\n+ {\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_rep (min));\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_rep(min));\n+ else polar_patterns.push_back(new Pattern_polar_rep (min));\n+ }\n+ else\n+ {\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_rep (min, min));\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_rep(min, min));\n+ else polar_patterns.push_back(new Pattern_polar_rep (min, min));\n+ }\n+ }\n+ }\n+ }\n+ else if (v_str1[0] == \"SPC\")\n+ {\n+ if (v_str1.size() == 1)\n+ {\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_spc );\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_spc);\n+ else polar_patterns.push_back(new Pattern_polar_spc );\n+ }\n+ else\n+ {\n+ auto v_str2 = string_split(v_str1[1], '-');\n+\n+ if (v_str2.size() > 1)\n+ {\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+ auto max = (int)std::log2(std::stoi(v_str2[1]));\n+\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_spc (min, max));\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_spc(min, max));\n+ else polar_patterns.push_back(new Pattern_polar_spc (min, max));\n+ }\n+ else\n+ {\n+ bool plus = v_str2[0].find(\"+\") != std::string::npos;\n+\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+\n+ if (plus)\n+ {\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_spc (min));\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_spc(min));\n+ else polar_patterns.push_back(new Pattern_polar_spc (min));\n+ }\n+ else\n+ {\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_spc (min, min));\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_spc(min, min));\n+ else polar_patterns.push_back(new Pattern_polar_spc (min, min));\n+ }\n+ }\n+ }\n+ }\n+ else\n+ {\n+ std::clog << bold_yellow(\"(WW) Unrecognized Polar node type (\")\n+ << bold_yellow(v_polar[i])\n+ << bold_yellow(\").\")\n+ << std::endl;\n+ }\n+ }\n+ }\n+\n+ if (idx_r0 == -1)\n+ {\n+ idx_r0 = (int)polar_patterns.size();\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r0 (0,0));\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r0(0,0));\n+ else polar_patterns.push_back(new Pattern_polar_r0 (0,0));\n+ }\n+\n+ if (idx_r1 == -1)\n+ {\n+ idx_r1 = (int)polar_patterns.size();\n+ if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r1 (0,0));\n+ else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r1(0,0));\n+ else polar_patterns.push_back(new Pattern_polar_r1 (0,0));\n+ }\n+\n+ return polar_patterns;\n+}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/nodes_parser.h", "new_path": "src/Tools/Code/Polar/nodes_parser.h", "diff": "#define NODES_PARSER_HPP\n#include <string>\n-#include <sstream>\n#include <vector>\n-#include <cmath>\n-#include \"Tools/Code/Polar/Patterns/Pattern_polar_r0.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Pattern_polar_r0_left.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Pattern_polar_r1.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Pattern_polar_rep.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Pattern_polar_rep_left.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Pattern_polar_spc.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Pattern_polar_std.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_i.hpp\"\n-#include \"Tools/Display/bash_tools.h\"\n+std::vector<Pattern_polar_i*> nodes_parser(const std::string &str_polar,\n+ int &idx_r0,\n+ int &idx_r1,\n+ const std::string type = \"STD\");\n-std::vector<std::string> string_split(const std::string &s, char delim)\n-{\n- std::stringstream ss(s);\n- std::string item;\n- std::vector<std::string> elems;\n- while (std::getline(ss, item, delim))\n- elems.push_back(std::move(item));\n-\n- return elems;\n-}\n-\n-std::vector<Pattern_polar_i*> nodes_parser(const std::string &str_polar, int &idx_r0, int &idx_r1)\n-{\n- idx_r0 = -1;\n- idx_r1 = -1;\n-\n- auto str_polar_bis = str_polar;\n-\n- str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), ' '), str_polar_bis.end());\n- str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), '{'), str_polar_bis.end());\n- str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), '}'), str_polar_bis.end());\n- str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), '('), str_polar_bis.end());\n- str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), ')'), str_polar_bis.end());\n-\n- std::vector<Pattern_polar_i*> polar_patterns;\n- polar_patterns.push_back(new Pattern_polar_std);\n-\n- auto v_polar = string_split(str_polar_bis, ',');\n- for (auto i = 0; i < (int)v_polar.size(); i++)\n- {\n- auto v_str1 = string_split(v_polar[i], '_');\n-\n- if (v_str1.size() >= 1)\n- {\n- if (v_str1[0] == \"R0L\")\n- {\n- if (v_str1.size() == 1)\n- {\n- polar_patterns.push_back(new Pattern_polar_r0_left);\n- }\n- else\n- {\n- auto v_str2 = string_split(v_str1[1], '-');\n-\n- if (v_str2.size() > 1)\n- {\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n- auto max = (int)std::log2(std::stoi(v_str2[1]));\n-\n- polar_patterns.push_back(new Pattern_polar_r0_left(min, max));\n- }\n- else\n- {\n- bool plus = v_str2[0].find(\"+\") != std::string::npos;\n-\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n-\n- if (plus)\n- polar_patterns.push_back(new Pattern_polar_r0_left(min));\n- else\n- polar_patterns.push_back(new Pattern_polar_r0_left(min, min));\n- }\n- }\n- }\n- else if (v_str1[0] == \"R0\")\n- {\n- idx_r0 = (int)polar_patterns.size();\n-\n- if (v_str1.size() == 1)\n- {\n- polar_patterns.push_back(new Pattern_polar_r0);\n- }\n- else\n- {\n- auto v_str2 = string_split(v_str1[1], '-');\n-\n- if (v_str2.size() > 1)\n- {\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n- auto max = (int)std::log2(std::stoi(v_str2[1]));\n-\n- polar_patterns.push_back(new Pattern_polar_r0(min, max));\n- }\n- else\n- {\n- bool plus = v_str2[0].find(\"+\") != std::string::npos;\n-\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n-\n- if (plus)\n- polar_patterns.push_back(new Pattern_polar_r0(min));\n- else\n- polar_patterns.push_back(new Pattern_polar_r0(min, min));\n- }\n- }\n- }\n- else if (v_str1[0] == \"R1\")\n- {\n- idx_r1 = (int)polar_patterns.size();\n-\n- if (v_str1.size() == 1)\n- {\n- polar_patterns.push_back(new Pattern_polar_r1);\n- }\n- else\n- {\n- auto v_str2 = string_split(v_str1[1], '-');\n-\n- if (v_str2.size() > 1)\n- {\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n- auto max = (int)std::log2(std::stoi(v_str2[1]));\n-\n- polar_patterns.push_back(new Pattern_polar_r1(min, max));\n- }\n- else\n- {\n- bool plus = v_str2[0].find(\"+\") != std::string::npos;\n-\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n-\n- if (plus)\n- polar_patterns.push_back(new Pattern_polar_r1(min));\n- else\n- polar_patterns.push_back(new Pattern_polar_r1(min, min));\n- }\n- }\n- }\n- else if (v_str1[0] == \"REPL\")\n- {\n- if (v_str1.size() == 1)\n- {\n- polar_patterns.push_back(new Pattern_polar_rep_left);\n- }\n- else\n- {\n- auto v_str2 = string_split(v_str1[1], '-');\n-\n- if (v_str2.size() > 1)\n- {\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n- auto max = (int)std::log2(std::stoi(v_str2[1]));\n-\n- polar_patterns.push_back(new Pattern_polar_rep_left(min, max));\n- }\n- else\n- {\n- bool plus = v_str2[0].find(\"+\") != std::string::npos;\n-\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n-\n- if (plus)\n- polar_patterns.push_back(new Pattern_polar_rep_left(min));\n- else\n- polar_patterns.push_back(new Pattern_polar_rep_left(min, min));\n- }\n- }\n- }\n- else if (v_str1[0] == \"REP\")\n- {\n- if (v_str1.size() == 1)\n- {\n- polar_patterns.push_back(new Pattern_polar_rep);\n- }\n- else\n- {\n- auto v_str2 = string_split(v_str1[1], '-');\n-\n- if (v_str2.size() > 1)\n- {\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n- auto max = (int)std::log2(std::stoi(v_str2[1]));\n-\n- polar_patterns.push_back(new Pattern_polar_rep(min, max));\n- }\n- else\n- {\n- bool plus = v_str2[0].find(\"+\") != std::string::npos;\n-\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n-\n- if (plus)\n- polar_patterns.push_back(new Pattern_polar_rep(min));\n- else\n- polar_patterns.push_back(new Pattern_polar_rep(min, min));\n- }\n- }\n- }\n- else if (v_str1[0] == \"SPC\")\n- {\n- if (v_str1.size() == 1)\n- {\n- polar_patterns.push_back(new Pattern_polar_spc);\n- }\n- else\n- {\n- auto v_str2 = string_split(v_str1[1], '-');\n-\n- if (v_str2.size() > 1)\n- {\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n- auto max = (int)std::log2(std::stoi(v_str2[1]));\n-\n- polar_patterns.push_back(new Pattern_polar_spc(min, max));\n- }\n- else\n- {\n- bool plus = v_str2[0].find(\"+\") != std::string::npos;\n-\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n-\n- if (plus)\n- polar_patterns.push_back(new Pattern_polar_spc(min));\n- else\n- polar_patterns.push_back(new Pattern_polar_spc(min, min));\n- }\n- }\n- }\n- else\n- {\n- std::clog << bold_yellow(\"(WW) Unrecognized Polar node type (\")\n- << bold_yellow(v_polar[i])\n- << bold_yellow(\").\")\n- << std::endl;\n- }\n- }\n- }\n-\n- if (idx_r0 == -1)\n- {\n- idx_r0 = (int)polar_patterns.size();\n- polar_patterns.push_back(new Pattern_polar_r0(0,0));\n- }\n-\n- if (idx_r1 == -1)\n- {\n- idx_r1 = (int)polar_patterns.size();\n- polar_patterns.push_back(new Pattern_polar_r1(0,0));\n- }\n-\n- return polar_patterns;\n-}\n-\n-#endif /* PATTERN_POLAR_PARSER_HPP */\n+#endif /* NODES_PARSER_HPP */\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the Polar nodes selection to the code generation.
8,490
22.02.2017 20:21:58
-3,600
00ba7945404077488dc8a87ceb86b8bc9e249756
Disable a litte optim on Rate 0 left nodes (Polar) to be more generic.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx", "diff": "@@ -77,7 +77,7 @@ struct Decoder_polar_SC_fast_sys_static\n// h\nswitch (node_type)\n{\n- case RATE_0: if (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT, REV_D+1))\n+ case RATE_0: // if (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT, REV_D+1))\nAPI_polar::template h0 <n_elmts>(s, off_s, n_elmts); break;\ncase RATE_1: API_polar::template h <n_elmts>(s, l, off_l, off_s, n_elmts); break;\ncase REP: API_polar::template rep<n_elmts>(s, l, off_l, off_s, n_elmts); break;\n@@ -102,7 +102,7 @@ struct Decoder_polar_SC_fast_sys_static<B,R,API_polar,0>\nswitch (node_t)\n{\n- case RATE_0: if (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT, 1))\n+ case RATE_0: // if (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT, 1))\nAPI_polar::template h0<n_elmts>(s, off_s, n_elmts); break;\ncase RATE_1: API_polar::template h <n_elmts>(s, l, off_l, off_s, n_elmts); break;\ndefault:\n@@ -258,7 +258,7 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\n// h\nswitch (node_type)\n{\n- case RATE_0: if (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT, reverse_depth +1))\n+ case RATE_0: // if (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT, reverse_depth +1))\nAPI_polar::h0 (s, off_s, n_elmts); break;\ncase RATE_1: API_polar::h (s, l, off_l, off_s, n_elmts); break;\ncase REP: API_polar::rep(s, l, off_l, off_s, n_elmts); break;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -418,7 +418,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nmetrics[path] = sat_m<R>(metrics[path] + pen); // add a penalty to the current path metric\n}\n- if (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT, r_d +1))\n+// if (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT, r_d +1))\nfor (auto i = 0; i < n_active_paths; i++)\nAPI_polar::h0(s[paths[i]], off_s, n_elmts);\n}\n@@ -440,7 +440,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nmetrics[path] = sat_m<R>(metrics[path] + pen); // add a penalty to the current path metric\n}\n- if (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT, REV_D +1))\n+// if (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT, REV_D +1))\nfor (auto i = 0; i < n_active_paths; i++)\nAPI_polar::template h0<N_ELMTS>(s[paths[i]], off_s, N_ELMTS);\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Disable a litte optim on Rate 0 left nodes (Polar) to be more generic.
8,490
23.02.2017 08:49:57
-3,600
17d91ea9f3a28f2ec29aa6f687bbd32a7552d9fa
Add the new generated SCL decoder in the generation script.
[ { "change_type": "MODIFY", "old_path": "scripts/generate_polar_decoders.sh", "new_path": "scripts/generate_polar_decoders.sh", "diff": "@@ -76,6 +76,7 @@ echo \"Generate SC decoders (other rates)...\"\necho \"Generate SCL decoders (all rates)...\"\n../build/bin/aff3ct --cde-type POLAR --sim-type GEN --dec-type SCL -N 4 -K 2 --dec-snr 2.5 --dec-polar-nodes \"{R0,R0L,R1,REP,REPL,SPC_4}\" > ../src/Module/Decoder/Polar/SCL/CRC/Generated/Decoder_polar_SCL_fast_CA_sys_N4_K2_SNR25.report 2>&1\n../build/bin/aff3ct --cde-type POLAR --sim-type GEN --dec-type SCL -N 2048 -K 1755 --dec-snr 3.5 --dec-polar-nodes \"{R0,R0L,R1,REP,REPL,SPC_4}\" > ../src/Module/Decoder/Polar/SCL/CRC/Generated/Decoder_polar_SCL_fast_CA_sys_N2048_K1755_SNR35.report 2>&1\n+../build/bin/aff3ct --cde-type POLAR --sim-type GEN --dec-type SCL -N 256 -K 64 --dec-snr 3.0 --dec-polar-nodes \"{R0,R0L,R1,REP,REPL,SPC_4+}\" > ../src/Module/Decoder/Polar/SCL/CRC/Generated/Decoder_polar_SCL_fast_CA_sys_N256_K64_SNR30.report 2>&1\necho \"Generate SC graphs (from *.dot to *.dot.pdf, rate 1/2)...\"\ndot -Tpdf ../src/Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4_K2_SNR25.dot -O\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the new generated SCL decoder in the generation script.
8,483
23.02.2017 09:04:25
-3,600
3730e60c492edcf879878ea8de11cf15f8ae9948
change names of arguments
[ { "change_type": "MODIFY", "old_path": "scripts/aff3ct_completion.sh", "new_path": "scripts/aff3ct_completion.sh", "diff": "@@ -50,8 +50,8 @@ _aff3ct() {\n--dmod-no-sig2 --chn-type --chn-path --chn-blk-fad --qnt-type \\\n--qnt-int --qnt-bits --qnt-range --dec-type --dec-implem \\\n--term-no --term-freq --sim-seed --sim-mpi-comm --sim-pyber \\\n- --sim-no-colors --mnt-err-tracker-enable \\\n- --mnt-err-tracker-filename\"\n+ --sim-no-colors --mnt-err-trk --mnt-err-trk-rev \\\n+ --mnt-err-trk-path\"\nfi\n# add contents of Launcher_BFER.cpp\n@@ -188,7 +188,7 @@ _aff3ct() {\n-v | --version | -h | --help | --dmod-no-sig2 | --term-no | \\\n--sim-benchs-no-ldst | -B | --sim-debug | -d | --sim-time-report | \\\n--cde-coset | -c | enc-no-buff | --enc-no-sys | --dec-no-synd | \\\n- --mnt-err-tracker-enable)\n+ --mnt-err-trk | --mnt-err-trk-rev)\nCOMPREPLY=( $(compgen -W \"${opts}\" -- ${cur}) )\n;;\n@@ -265,7 +265,7 @@ _aff3ct() {\n--cde-awgn-fb-path | --dec-gen-path | --sim-pb-path | --itl-path | \\\n--mod-const-path | --src-path | --enc-path | --chn-path | \\\n- --cde-alist-path | --sim-trace-path | --mnt-err-tracker-filename)\n+ --cde-alist-path | --sim-trace-path | --mnt-err-trk-path)\n_filedir\n;;\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/BFER/Launcher_BFER.cpp", "new_path": "src/Launcher/BFER/Launcher_BFER.cpp", "diff": "@@ -109,11 +109,11 @@ void Launcher_BFER<B,R,Q>\n// ---------------------------------------------------------------------------------------------------------- code\nif(this->ar.exist_arg({\"cde-coset\", \"c\"})) this->params.code.coset = true;\n- if (this->params.code.coset && !this->params.monitor.err_track_inverted) // if err_track_inverted == true then encoder.type = \"USER\"\n+ if (this->params.code.coset && !this->params.monitor.err_track_revert) // if err_track_inverted == true then encoder.type = \"USER\"\nthis->params.encoder.type = \"COSET\";\n// ------------------------------------------------------------------------------------------------------- encoder\n- if (!this->params.monitor.err_track_inverted) // if err_track_inverted == true then encoder.type = \"USER\" and encoder.path is set automatically\n+ if (!this->params.monitor.err_track_revert) // if err_track_inverted == true then encoder.type = \"USER\" and encoder.path is set automatically\n{\nif(this->ar.exist_arg({\"enc-type\"})) this->params.encoder.type = this->ar.get_arg({\"enc-type\"});\nif (this->params.encoder.type == \"COSET\")\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/BFERI/Launcher_BFERI.cpp", "new_path": "src/Launcher/BFERI/Launcher_BFERI.cpp", "diff": "@@ -124,11 +124,11 @@ void Launcher_BFERI<B,R,Q>\n// ---------------------------------------------------------------------------------------------------------- code\nif(this->ar.exist_arg({\"cde-coset\", \"c\"})) this->params.code.coset = true;\n- if (this->params.code.coset && !this->params.monitor.err_track_inverted) // if err_track_inverted == true then encoder.type = \"USER\"\n+ if (this->params.code.coset && !this->params.monitor.err_track_revert) // if err_track_inverted == true then encoder.type = \"USER\"\nthis->params.encoder.type = \"COSET\";\n// ------------------------------------------------------------------------------------------------------- encoder\n- if (!this->params.monitor.err_track_inverted) // if err_track_inverted == true then encoder.type = \"USER\" and encoder.path is set automatically\n+ if (!this->params.monitor.err_track_revert) // if err_track_inverted == true then encoder.type = \"USER\" and encoder.path is set automatically\n{\nif(this->ar.exist_arg({\"enc-type\"})) this->params.encoder.type = this->ar.get_arg({\"enc-type\"});\nif (this->params.encoder.type == \"COSET\")\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -77,8 +77,8 @@ Launcher<B,R,Q>\n#endif\nparams.quantizer .range = 0.f;\nparams.monitor .err_track_enable = false;\n- params.monitor .err_track_inverted= false;\n- params.monitor .err_track_filename= \"error_tracker\";\n+ params.monitor .err_track_revert = false;\n+ params.monitor .err_track_path = \"error_tracker\";\nparams.terminal .disabled = false;\nparams.terminal .frequency = std::chrono::milliseconds(500);\n@@ -271,14 +271,14 @@ void Launcher<B,R,Q>\n\"select the implementation of the algorithm to decode.\"};\n// ------------------------------------------------------------------------------------------------------- monitor\n- opt_args[{\"mnt-err-tracker-enable\"}] =\n+ opt_args[{\"mnt-err-trk\"}] =\n{\"\",\n\"enable the tracking of the wrong frames. Automatically disabled by mnt-err-tracker-inverted.\"};\n- opt_args[{\"mnt-err-tracker-inverted\"}] =\n+ opt_args[{\"mnt-err-trk-rev\"}] =\n{\"\",\nstd::string(\"automatically reply the saved frames in error tracker files for the source, the encoder and the channel noise.\") +\nstd::string(\" Warning! This feature does not set automatically the configuration of all the other modules.\")};\n- opt_args[{\"mnt-err-tracker-filename\"}] =\n+ opt_args[{\"mnt-err-trk-path\"}] =\n{\"string\",\nstd::string(\"header of filenames where will be returned/read the wrong source, encoder and channel noise frames.\") +\nstd::string(\" To this name will be automatically added the run SNR and the extension (.src .enc .cha).\")};\n@@ -434,19 +434,19 @@ void Launcher<B,R,Q>\nif(ar.exist_arg({\"dec-implem\" })) params.decoder.implem = ar.get_arg({\"dec-implem\" });\n// ------------------------------------------------------------------------------------------------------- monitor\n- if(this->ar.exist_arg({\"mnt-err-tracker-inverted\"})) this->params.monitor.err_track_inverted = true;\n- if(this->ar.exist_arg({\"mnt-err-tracker-enable\" })) this->params.monitor.err_track_enable = true;\n- if(this->ar.exist_arg({\"mnt-err-tracker-filename\"})) this->params.monitor.err_track_filename = ar.get_arg({\"mnt-err-tracker-filename\"});\n+ if(this->ar.exist_arg({\"mnt-err-trk-rev\" })) this->params.monitor.err_track_revert = true;\n+ if(this->ar.exist_arg({\"mnt-err-trk\" })) this->params.monitor.err_track_enable = true;\n+ if(this->ar.exist_arg({\"mnt-err-trk-path\"})) this->params.monitor.err_track_path = ar.get_arg({\"mnt-err-tracker-filename\"});\n- if(this->params.monitor.err_track_inverted)\n+ if(this->params.monitor.err_track_revert)\n{\nthis->params.monitor.err_track_enable = false;\nthis->params.source. type = \"USER\";\nthis->params.encoder.type = \"USER\";\nthis->params.channel.type = \"USER\";\n- this->params.source. path = this->params.monitor.err_track_filename + std::string(\"_SNR.src\");\n- this->params.encoder.path = this->params.monitor.err_track_filename + std::string(\"_SNR.enc\");\n- this->params.channel.path = this->params.monitor.err_track_filename + std::string(\"_SNR.cha\");\n+ this->params.source. path = this->params.monitor.err_track_path + std::string(\"_SNR.src\");\n+ this->params.encoder.path = this->params.monitor.err_track_path + std::string(\"_SNR.enc\");\n+ this->params.channel.path = this->params.monitor.err_track_path + std::string(\"_SNR.cha\");\n// the paths are set in the Simulation class\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Monitor.hpp", "new_path": "src/Module/Monitor/Monitor.hpp", "diff": "@@ -224,7 +224,7 @@ private:\nMonitor_i<B,R>::interrupt = true;\n}\n- virtual void save_erroneous_frame(const B* U, const B* X, const R* X_mod, const R* Y) = 0;\n+ virtual void save_wrong_frame(const B* U, const B* X, const R* X_mod, const R* Y) = 0;\n};\ntemplate <typename B, typename R>\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp", "new_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp", "diff": "#include <fstream>\n#include <exception>\n+#include \"Tools/Display/bash_tools.h\"\n+\ntemplate <typename B, typename R>\nMonitor_reduction<B,R>\n::Monitor_reduction(const int& K, const int& N, const int& Y_size, const int& max_fe,\n@@ -85,42 +87,42 @@ bool Monitor_reduction<B,R>\ntemplate <typename B, typename R>\nvoid Monitor_reduction<B,R>\n-::get_tracker_filenames(const std::string& error_tracker_head_file_name, const float snr,\n- std::string& file_name_src, std::string& file_name_enc, std::string& file_name_noise)\n+::get_tracker_filenames(const std::string& error_tracker_head_filename, const float snr,\n+ std::string& filename_src, std::string& filename_enc, std::string& filename_noise)\n{\n- if(!check_file_name(error_tracker_head_file_name))\n+ if(!check_file_name(error_tracker_head_filename))\n{\n- std::cerr << \"(EE) issue while trying to open error tracker log files ; check file name: \\\"\"\n- << error_tracker_head_file_name << \"\\\" and please create yourself the needed directory.\" << std::endl;\n+ std::cerr << bold_red(\"(EE) issue while trying to open error tracker log files ; check head of the filename: \\\"\")\n+ << bold_red(error_tracker_head_filename) << bold_red(\"\\\" and please create yourself the needed directory.\") << std::endl;\nexit(-1);\n}\nstd::stringstream snr_stream;\nsnr_stream << std::fixed << std::setprecision(3) << snr;\n- std::string file_name_head = error_tracker_head_file_name + std::string(\"_\") + snr_stream.str();\n+ std::string filename_head = error_tracker_head_filename + std::string(\"_\") + snr_stream.str();\n- file_name_src = file_name_head + std::string(\".src\");\n- file_name_enc = file_name_head + std::string(\".enc\");\n- file_name_noise = file_name_head + std::string(\".cha\");\n+ filename_src = filename_head + std::string(\".src\");\n+ filename_enc = filename_head + std::string(\".enc\");\n+ filename_noise = filename_head + std::string(\".cha\");\n}\ntemplate <typename B, typename R>\nvoid Monitor_reduction<B,R>\n-::flush_erroneous_frame(const std::string& error_tracker_head_file_name, const float snr)\n+::flush_wrong_frame(const std::string& error_tracker_head_filename, const float snr)\n{\n- std::string file_name_src, file_name_enc, file_name_noise;\n+ std::string filename_src, filename_enc, filename_noise;\n- get_tracker_filenames(error_tracker_head_file_name, snr, file_name_src, file_name_enc, file_name_noise);\n+ get_tracker_filenames(error_tracker_head_filename, snr, filename_src, filename_enc, filename_noise);\n- std::ofstream file_src (file_name_src );\n- std::ofstream file_enc (file_name_enc );\n- std::ofstream file_noise(file_name_noise, std::ios_base::binary);\n+ std::ofstream file_src (filename_src );\n+ std::ofstream file_enc (filename_enc );\n+ std::ofstream file_noise(filename_noise, std::ios_base::binary);\nif (!file_src.is_open() || !file_enc.is_open() || !file_noise.is_open())\n{\n- std::cerr << \"(EE) issue while trying to open error tracker log files ; check file name: \\\"\"\n- << error_tracker_head_file_name << \"\\\"\" << std::endl;\n+ std::cerr << bold_red(\"(EE) issue while trying to open error tracker log files ; check file name: \\\"\")\n+ << bold_red(error_tracker_head_filename) << bold_red(\"\\\"\") << std::endl;\nexit(-1);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_reduction.hpp", "new_path": "src/Module/Monitor/Standard/Monitor_reduction.hpp", "diff": "@@ -26,9 +26,9 @@ public:\nint get_n_be() const;\nstatic bool check_file_name(const std::string& error_tracker_head_file_name); // return true if correct\n- static void get_tracker_filenames(const std::string& error_tracker_head_file_name, const float snr,\n- std::string& file_name_src, std::string& file_name_enc, std::string& file_name_noise);\n- void flush_erroneous_frame(const std::string& error_tracker_head_file_name, const float snr);\n+ static void get_tracker_filenames(const std::string& error_tracker_head_filename, const float snr,\n+ std::string& filename_src, std::string& filename_enc, std::string& filename_noise);\n+ void flush_wrong_frame(const std::string& error_tracker_head_file_name, const float snr);\n};\n#endif /* MONITOR_REDUCTION_HPP_ */\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_std.cpp", "new_path": "src/Module/Monitor/Standard/Monitor_std.cpp", "diff": "@@ -48,7 +48,7 @@ void Monitor_std<B,R>\nfor (auto i = 0; i < this->n_frames; i++)\n{\nif (check_errors(U.data()+i*this->K, V.data()+i*this->K, this->K))\n- save_erroneous_frame(U .data()+i*this->K,\n+ save_wrong_frame(U .data()+i*this->K,\nX .data()+i*this->N,\nX_mod.data()+i*this->Y_size,\nY .data()+i*this->Y_size);\n@@ -135,7 +135,7 @@ float Monitor_std<B,R>\ntemplate <typename B, typename R>\nvoid Monitor_std<B,R>\n-::save_erroneous_frame(const B* U, const B* X, const R* X_mod, const R* Y)\n+::save_wrong_frame(const B* U, const B* X, const R* X_mod, const R* Y)\n{\nbuff_src. push_back(mipp::vector<B>(this->K ));\nbuff_enc. push_back(mipp::vector<B>(this->N ));\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_std.hpp", "new_path": "src/Module/Monitor/Standard/Monitor_std.hpp", "diff": "@@ -52,7 +52,7 @@ public:\nprivate:\nvoid update_n_analyzed_frames();\n- void save_erroneous_frame(const B* U, const B* X, const R* X_mod, const R* Y);\n+ void save_wrong_frame(const B* U, const B* X, const R* X_mod, const R* Y);\n};\n#endif /* MONITOR_STD_HPP_ */\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp", "new_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp", "diff": "@@ -100,26 +100,26 @@ void Simulation_BFER<B,R,Q>\n::_launch()\n{\n// check, if the error tracker is enable, if the given file name is good\n- if((this->params.monitor.err_track_enable || this->params.monitor.err_track_inverted)\n- && !Monitor_reduction<B,R>::check_file_name(this->params.monitor.err_track_filename))\n+ if((this->params.monitor.err_track_enable || this->params.monitor.err_track_revert)\n+ && !Monitor_reduction<B,R>::check_file_name(this->params.monitor.err_track_path))\n{\n- std::cerr << \"(EE) issue while trying to open error tracker log files ; check file name: \\\"\"\n- << this->params.monitor.err_track_filename << \"\\\" and please create yourself the needed directory.\"\n+ std::cerr << bold_red(\"(EE) issue while trying to open error tracker log files ; check file name: \\\"\")\n+ << bold_red(this->params.monitor.err_track_path) << bold_red(\"\\\" and please create yourself the needed directory.\")\n<< std::endl;\nexit(-1);\n}\n- if(this->params.monitor.err_track_inverted)\n+ if(this->params.monitor.err_track_revert)\n{\n- std::string file_name_src, file_name_enc, file_name_noise;\n- Monitor_reduction<B,R>::get_tracker_filenames(this->params.monitor.err_track_filename, this->snr,\n- file_name_src, file_name_enc, file_name_noise);\n+ std::string filename_src, filename_enc, filename_noise;\n+ Monitor_reduction<B,R>::get_tracker_filenames(this->params.monitor.err_track_path, this->snr,\n+ filename_src, filename_enc, filename_noise);\nparameters *params_writable = const_cast<parameters*>(&this->params);\n- params_writable->source. path = file_name_src;\n- params_writable->encoder.path = file_name_enc;\n- params_writable->channel.path = file_name_noise;\n+ params_writable->source. path = filename_src;\n+ params_writable->encoder.path = filename_enc;\n+ params_writable->channel.path = filename_noise;\n}\n// launch a group of slave threads (there is \"n_threads -1\" slave threads)\n@@ -140,7 +140,7 @@ void Simulation_BFER<B,R,Q>\n}\nif(this->params.monitor.err_track_enable)\n- monitor_red->flush_erroneous_frame(this->params.monitor.err_track_filename, this->snr);\n+ monitor_red->flush_wrong_frame(this->params.monitor.err_track_path, this->snr);\n}\ntemplate <typename B, typename R, typename Q>\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp", "new_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp", "diff": "@@ -102,26 +102,26 @@ void Simulation_BFERI<B,R,Q>\n::_launch()\n{\n// check, if the error tracker is enable, if the given file name is good\n- if ((this->params.monitor.err_track_enable || this->params.monitor.err_track_inverted)\n- && !Monitor_reduction<B,R>::check_file_name(this->params.monitor.err_track_filename))\n+ if ((this->params.monitor.err_track_enable || this->params.monitor.err_track_revert)\n+ && !Monitor_reduction<B,R>::check_file_name(this->params.monitor.err_track_path))\n{\n- std::cerr << \"(EE) issue while trying to open error tracker log files ; check file name: \\\"\"\n- << this->params.monitor.err_track_filename << \"\\\" and please create yourself the needed directory.\"\n+ std::cerr << bold_red(\"(EE) issue while trying to open error tracker log files ; check file name: \\\"\")\n+ << bold_red(this->params.monitor.err_track_path) << bold_red(\"\\\" and please create yourself the needed directory.\")\n<< std::endl;\nexit(-1);\n}\n- if (this->params.monitor.err_track_inverted)\n+ if (this->params.monitor.err_track_revert)\n{\n- std::string file_name_src, file_name_enc, file_name_noise;\n- Monitor_reduction<B,R>::get_tracker_filenames(this->params.monitor.err_track_filename, this->snr,\n- file_name_src, file_name_enc, file_name_noise);\n+ std::string filename_src, filename_enc, filename_noise;\n+ Monitor_reduction<B,R>::get_tracker_filenames(this->params.monitor.err_track_path, this->snr,\n+ filename_src, filename_enc, filename_noise);\nparameters *params_writable = const_cast<parameters*>(&this->params);\n- params_writable->source. path = file_name_src;\n- params_writable->encoder.path = file_name_enc;\n- params_writable->channel.path = file_name_noise;\n+ params_writable->source. path = filename_src;\n+ params_writable->encoder.path = filename_enc;\n+ params_writable->channel.path = filename_noise;\n}\n// launch a group of slave threads (there is \"n_threads -1\" slave threads)\n@@ -142,7 +142,7 @@ void Simulation_BFERI<B,R,Q>\n}\nif (this->params.monitor.err_track_enable)\n- monitor_red->flush_erroneous_frame(this->params.monitor.err_track_filename, this->snr);\n+ monitor_red->flush_wrong_frame(this->params.monitor.err_track_path, this->snr);\n}\ntemplate <typename B, typename R, typename Q>\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/params.h", "new_path": "src/Tools/params.h", "diff": "@@ -133,9 +133,9 @@ struct decoder_parameters\nstruct monitor_parameters\n{\nint n_frame_errors;\n- bool err_track_inverted;\n+ bool err_track_revert;\nbool err_track_enable;\n- std::string err_track_filename;\n+ std::string err_track_path;\n};\nstruct terminal_parameters\n" } ]
C++
MIT License
aff3ct/aff3ct
change names of arguments
8,483
23.02.2017 09:17:55
-3,600
8c3f1f15258c998aa5a35ee59509a063a45e032d
correct a bug
[ { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -436,7 +436,7 @@ void Launcher<B,R,Q>\n// ------------------------------------------------------------------------------------------------------- monitor\nif(this->ar.exist_arg({\"mnt-err-trk-rev\" })) this->params.monitor.err_track_revert = true;\nif(this->ar.exist_arg({\"mnt-err-trk\" })) this->params.monitor.err_track_enable = true;\n- if(this->ar.exist_arg({\"mnt-err-trk-path\"})) this->params.monitor.err_track_path = ar.get_arg({\"mnt-err-tracker-filename\"});\n+ if(this->ar.exist_arg({\"mnt-err-trk-path\"})) this->params.monitor.err_track_path = ar.get_arg({\"mnt-err-trk-path\"});\nif(this->params.monitor.err_track_revert)\n{\n@@ -446,7 +446,7 @@ void Launcher<B,R,Q>\nthis->params.channel.type = \"USER\";\nthis->params.source. path = this->params.monitor.err_track_path + std::string(\"_SNR.src\");\nthis->params.encoder.path = this->params.monitor.err_track_path + std::string(\"_SNR.enc\");\n- this->params.channel.path = this->params.monitor.err_track_path + std::string(\"_SNR.cha\");\n+ this->params.channel.path = this->params.monitor.err_track_path + std::string(\"_SNR.chn\");\n// the paths are set in the Simulation class\n}\n@@ -461,10 +461,6 @@ int Launcher<B,R,Q>\n{\nthis->build_args();\n-// opt_args[{\"help\", \"h\"}] =\n-// {\"\",\n-// \"print this help.\"};\n-\nauto display_help = true;\nif (ar.parse_arguments(req_args, opt_args, cmd_warn))\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp", "new_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp", "diff": "@@ -104,7 +104,7 @@ void Monitor_reduction<B,R>\nfilename_src = filename_head + std::string(\".src\");\nfilename_enc = filename_head + std::string(\".enc\");\n- filename_noise = filename_head + std::string(\".cha\");\n+ filename_noise = filename_head + std::string(\".chn\");\n}\ntemplate <typename B, typename R>\n" } ]
C++
MIT License
aff3ct/aff3ct
correct a bug
8,483
23.02.2017 10:49:43
-3,600
eca570556cf49aab15a58210ad74dfdb176d397a
change place of default monitor arguments
[ { "change_type": "MODIFY", "old_path": "src/Launcher/BFER/Launcher_BFER.cpp", "new_path": "src/Launcher/BFER/Launcher_BFER.cpp", "diff": "@@ -26,6 +26,9 @@ Launcher_BFER<B,R,Q>\nthis->params.encoder .path = \"\";\nthis->params.encoder .systematic = true;\nthis->params.monitor .n_frame_errors = 100;\n+ this->params.monitor .err_track_enable = false;\n+ this->params.monitor .err_track_revert = false;\n+ this->params.monitor .err_track_path = \"error_tracker\";\nthis->params.encoder .systematic = true;\nthis->params.demodulator.max = \"MAX\";\nthis->params.terminal .type = \"STD\";\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/BFERI/Launcher_BFERI.cpp", "new_path": "src/Launcher/BFERI/Launcher_BFERI.cpp", "diff": "@@ -30,6 +30,9 @@ Launcher_BFERI<B,R,Q>\nthis->params.demodulator.max = \"MAX\";\nthis->params.demodulator.n_ite = 30;\nthis->params.monitor .n_frame_errors = 100;\n+ this->params.monitor .err_track_enable = false;\n+ this->params.monitor .err_track_revert = false;\n+ this->params.monitor .err_track_path = \"error_tracker\";\nthis->params.terminal .type = \"STD\";\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -76,9 +76,6 @@ Launcher<B,R,Q>\nparams.quantizer .type = (typeid(R) == typeid(double)) ? \"STD\" : \"STD_FAST\";\n#endif\nparams.quantizer .range = 0.f;\n- params.monitor .err_track_enable = false;\n- params.monitor .err_track_revert = false;\n- params.monitor .err_track_path = \"error_tracker\";\nparams.terminal .disabled = false;\nparams.terminal .frequency = std::chrono::milliseconds(500);\n" } ]
C++
MIT License
aff3ct/aff3ct
change place of default monitor arguments
8,483
23.02.2017 11:14:21
-3,600
5a9f71f5e57d753c41c3a765edac8e534caf725b
write tracking files even whether there is no wrong frame
[ { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp", "new_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp", "diff": "@@ -111,11 +111,6 @@ template <typename B, typename R>\nvoid Monitor_reduction<B,R>\n::flush_wrong_frame(const std::string& error_tracker_head_filename, const float snr)\n{\n- int n_fe = get_n_fe();\n-\n- if(n_fe == 0)\n- return;\n-\n// ************* get filename and open them ******************\nstd::string filename_src, filename_enc, filename_noise;\n@@ -132,6 +127,7 @@ void Monitor_reduction<B,R>\nexit(-1);\n}\n+ int n_fe = get_n_fe();\nint Y_size = 0;\n// ************* get Y_size *******************\nfor (unsigned i = 0; i <= monitors.size(); i++)\n" } ]
C++
MIT License
aff3ct/aff3ct
write tracking files even whether there is no wrong frame
8,490
23.02.2017 15:06:31
-3,600
d6276b09e9511294eee2dfd7b3c9c5459b2ad3ba
Improve the graphs for the Polar codes.
[ { "change_type": "MODIFY", "old_path": "src/Generator/Polar/Generator_polar.cpp", "new_path": "src/Generator/Polar/Generator_polar.cpp", "diff": "@@ -136,8 +136,9 @@ void Generator_polar\ngraph_common1 << tab << tab << \"rank=same;\" << endl;\nfor (unsigned p = 0; p < patterns.size(); p++)\n{\n+ std::string rng = patterns[p]->range().empty() ? \"\" : std::string(\"\\n\") + patterns[p]->range();\ngraph_common1 << tab << tab;\n- graph_common1 << \"\\\"\" << patterns[p]->name() << \"\\\"[\"\n+ graph_common1 << \"\\\"\" << patterns[p]->name() << rng << \"\\\"[\"\n<< \"style=filled, \"\n<< \"fillcolor=\\\"\" << patterns[p]->fill_color() << \"\\\",\"\n<< \"fontcolor=\\\"\" << patterns[p]->font_color() << \"\\\"\"\n@@ -145,8 +146,11 @@ void Generator_polar\n}\nfor (unsigned p = 0; p < patterns.size() -1; p++)\n{\n+ std::string rng0 = patterns[p ]->range().empty() ? \"\" : std::string(\"\\n\") + patterns[p ]->range();\n+ std::string rng1 = patterns[p +1]->range().empty() ? \"\" : std::string(\"\\n\") + patterns[p +1]->range();\ngraph_common1 << tab << tab;\n- graph_common1 << \"\\\"\" << patterns[p]->name() << \"\\\" -> \" << \"\\\"\" << patterns[p +1]->name() << \"\\\";\" << endl;\n+ graph_common1 << \"\\\"\" << patterns[p ]->name() << rng0 << \"\\\" -> \" << \"\\\"\"\n+ << patterns[p +1]->name() << rng1 << \"\\\";\" << endl;\n}\nfloat compression_rate = 1.f;\n@@ -190,51 +194,59 @@ void Generator_polar\n}\nvoid Generator_polar\n-::recursive_generate_graph(const Binary_node<Pattern_polar_i>* node_curr, ostream &stream)\n+::recursive_generate_graph(const Binary_node<Pattern_polar_i>* n_c, ostream &stream)\n{\nstring key = \"\";\n+ string ne_c = string(\"\\n(\") + to_string(n_c->get_c()->get_size()) + string(\")\");\n+\n// generate graphviz tree\nstream << tab << tab;\n- stream << \"N\" << node_curr->get_c()->get_id() << \"[\"\n+ stream << \"\\\"N\" << n_c->get_c()->get_id() << ne_c << \"\\\"[\"\n<< \"style=filled,\"\n- << \"fillcolor=\\\"\" << node_curr->get_c()->fill_color() << \"\\\",\"\n- << \"fontcolor=\\\"\" << node_curr->get_c()->font_color() << \"\\\"\"\n+ << \"fillcolor=\\\"\" << n_c->get_c()->fill_color() << \"\\\",\"\n+ << \"fontcolor=\\\"\" << n_c->get_c()->font_color() << \"\\\"\"\n<< \"];\" << endl;\n- if (!node_curr->is_leaf()) // stop condition\n+ if (!n_c->is_leaf()) // stop condition\n{\n+ string ne_l = string(\"\\n(\") + to_string(n_c->get_left ()->get_c()->get_size()) + string(\")\");\n+ string ne_r = string(\"\\n(\") + to_string(n_c->get_right()->get_c()->get_size()) + string(\")\");\n+\nstream << tab << tab;\n- stream << \"N\" << node_curr->get_c()->get_id() << \" -> N\" << node_curr->get_left()->get_c()->get_id()\n- << \"[label=\\\"\" << node_curr->get_c()->f() << ((!node_curr->get_c()->f().empty()) ? \"()\" : \"\")\n+ stream << \"\\\"N\" << n_c ->get_c()->get_id() << ne_c << \"\\\" -> \"\n+ << \"\\\"N\" << n_c->get_left()->get_c()->get_id() << ne_l << \"\\\"\"\n+ << \"[label=\\\"\" << n_c->get_c()->f() << ((!n_c->get_c()->f().empty()) ? \"()\" : \"\")\n<< \"\\\"];\" << endl;\n- this->recursive_generate_graph(node_curr->get_left(), stream); // recursive call\n- key += node_curr->get_left()->get_c()->get_key();\n+ this->recursive_generate_graph(n_c->get_left(), stream); // recursive call\n+ key += n_c->get_left()->get_c()->get_key();\nstream << tab << tab;\n- stream << \"N\" << node_curr->get_c()->get_id() << \" -> N\" << node_curr->get_right()->get_c()->get_id()\n- << \"[label=\\\"\" << node_curr->get_c()->g() << ((!node_curr->get_c()->g().empty()) ? \"()\" : \"\")\n+ stream << \"\\\"N\" << n_c ->get_c()->get_id() << ne_c << \"\\\" -> \"\n+ << \"\\\"N\" << n_c->get_right()->get_c()->get_id() << ne_r << \"\\\"\"\n+ << \"[label=\\\"\" << n_c->get_c()->g() << ((!n_c->get_c()->g().empty()) ? \"()\" : \"\")\n<< \"\\\"];\" << endl;\n- this->recursive_generate_graph(node_curr->get_right(), stream); // recursive call\n- key += node_curr->get_right()->get_c()->get_key();\n+ this->recursive_generate_graph(n_c->get_right(), stream); // recursive call\n+ key += n_c->get_right()->get_c()->get_key();\n}\nelse\n{\n- key += node_curr->get_c()->short_name() + to_string(node_curr->get_depth());\n+ key += n_c->get_c()->short_name() + to_string(n_c->get_depth());\n}\n- if (!node_curr->get_c()->h().empty())\n+ if (!n_c->get_c()->h().empty())\n{\nstream << tab << tab;\n- stream << \"N\" << node_curr->get_c()->get_id() << \" -> N\" << node_curr->get_c()->get_id()\n- << \"[label=\\\"\" << node_curr->get_c()->h() << \"()\\\"];\" << endl;\n+ stream << \"\\\"N\" << n_c->get_c()->get_id() << ne_c << \"\\\" -> \"\n+ << \"\\\"N\" << n_c->get_c()->get_id() << ne_c << \"\\\"\"\n+ << \"[label=\\\"\" << n_c->get_c()->h() << \"()\\\"];\" << endl;\n}\n// statistics\nint pattern_id = 0;\n- Pattern_polar_i* pattern = node_curr->get_c();\n+ Pattern_polar_i* pattern = n_c->get_c();\nfor (unsigned i = 0; i < patterns.size(); i++)\n{\nauto cur_pattern = patterns[i];\n@@ -244,9 +256,9 @@ void Generator_polar\nbreak;\n}\n}\n- stats[node_curr->get_depth()][pattern_id]++;\n+ stats[n_c->get_depth()][pattern_id]++;\n- node_curr->get_c()->set_key(key);\n+ n_c->get_c()->set_key(key);\nif (subtree_occurences.find(key) != subtree_occurences.end())\nsubtree_occurences[key]++;\nelse\n@@ -254,43 +266,64 @@ void Generator_polar\n}\nvoid Generator_polar\n-::recursive_generate_short_graph(const Binary_node<Pattern_polar_i>* node_curr, ostream &stream)\n+::recursive_generate_short_graph(const Binary_node<Pattern_polar_i>* n_c, ostream &stream)\n{\n- if (subtree_occurences_cpy[node_curr->get_c()->get_key()])\n+ if (subtree_occurences_cpy[n_c->get_c()->get_key()])\n{\n+ string ne_c = string(\"\\n(\") + to_string(n_c->get_c()->get_size()) + string(\")\");\n+\nn_nodes_after_compression++;\n- subtree_occurences_cpy[node_curr->get_c()->get_key()] = 0;\n+ subtree_occurences_cpy[n_c->get_c()->get_key()] = 0;\n+ subtree_nodes [n_c->get_c()->get_key()] = string(\"\\\"N\") + to_string(n_c->get_c()->get_id()) + ne_c +\n+ string(\"\\\"\");\n// generate graphviz tree\nstream << tab << tab;\n- stream << \"N\" << node_curr->get_c()->get_id() << \"[\"\n+ stream << \"\\\"N\" << n_c->get_c()->get_id() << ne_c << \"\\\"[\"\n<< \"style=filled,\"\n- << \"fillcolor=\\\"\" << node_curr->get_c()->fill_color() << \"\\\",\"\n- << \"fontcolor=\\\"\" << node_curr->get_c()->font_color() << \"\\\"\"\n+ << \"fillcolor=\\\"\" << n_c->get_c()->fill_color() << \"\\\",\"\n+ << \"fontcolor=\\\"\" << n_c->get_c()->font_color() << \"\\\"\"\n<< \"];\" << endl;\n- if (!node_curr->is_leaf()) // stop condition\n+ if (!n_c->is_leaf()) // stop condition\n{\n- auto occurences = subtree_occurences_cpy[node_curr->get_left()->get_c()->get_key()];\n+ string ne_l = string(\"\\n(\") + to_string(n_c->get_left ()->get_c()->get_size()) + string(\")\");\n+ string ne_r = string(\"\\n(\") + to_string(n_c->get_right()->get_c()->get_size()) + string(\")\");\n+\n+ auto occurences = subtree_occurences_cpy[n_c->get_left()->get_c()->get_key()];\nif (occurences)\n{\nstream << tab << tab;\n- stream << \"N\" << node_curr->get_c()->get_id() << \" -> \"\n- << \"N\" << node_curr->get_left()->get_c()->get_id()\n- << \"[label=\\\"\" << occurences << \"\\\"];\" << endl;\n+ stream << \"\\\"N\" << n_c ->get_c()->get_id() << ne_c << \"\\\" -> \"\n+ << \"\\\"N\" << n_c->get_left()->get_c()->get_id() << ne_l << \"\\\"\"\n+// << \"[label=\\\"\" << occurences << \"\\\"];\"\n+ << endl;\n- this->recursive_generate_short_graph(node_curr->get_left(), stream); // recursive call\n+ this->recursive_generate_short_graph(n_c->get_left(), stream); // recursive call\n+ }\n+ else\n+ {\n+ auto name = subtree_nodes[n_c->get_left()->get_c()->get_key()];\n+ stream << tab << tab;\n+ stream << \"\\\"N\" << n_c->get_c()->get_id() << ne_c << \"\\\" -> \" << name << endl;\n}\n- occurences = subtree_occurences_cpy[node_curr->get_right()->get_c()->get_key()];\n+ occurences = subtree_occurences_cpy[n_c->get_right()->get_c()->get_key()];\nif (occurences)\n{\nstream << tab << tab;\n- stream << \"N\" << node_curr->get_c()->get_id() << \" -> \"\n- << \"N\" << node_curr->get_right()->get_c()->get_id()\n- << \"[label=\\\"\" << occurences << \"\\\"];\" << endl;\n+ stream << \"\\\"N\" << n_c ->get_c()->get_id() << ne_c << \"\\\" -> \"\n+ << \"\\\"N\" << n_c->get_right()->get_c()->get_id() << ne_r << \"\\\"\"\n+// << \"[label=\\\"\" << occurences << \"\\\"];\"\n+ << endl;\n- this->recursive_generate_short_graph(node_curr->get_right(), stream); // recursive call\n+ this->recursive_generate_short_graph(n_c->get_right(), stream); // recursive call\n+ }\n+ else\n+ {\n+ auto name = subtree_nodes[n_c->get_right()->get_c()->get_key()];\n+ stream << tab << tab;\n+ stream << \"\\\"N\" << n_c->get_c()->get_id() << ne_c << \"\\\" -> \" << name << endl;\n}\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Generator/Polar/Generator_polar.hpp", "new_path": "src/Generator/Polar/Generator_polar.hpp", "diff": "@@ -40,6 +40,7 @@ protected:\nstd::vector<std::vector<int>> stats;\nstd::map<std::string, int> subtree_occurences;\nstd::map<std::string, int> subtree_occurences_cpy;\n+ std::map<std::string, std::string> subtree_nodes;\nunsigned n_nodes_before_compression;\nunsigned n_nodes_after_compression;\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/GEN/Code/Polar/Generation_polar.cpp", "new_path": "src/Simulation/GEN/Code/Polar/Generation_polar.cpp", "diff": "@@ -134,7 +134,7 @@ void Generation_polar\n{\nauto cur_pattern_SC = polar_patterns[p];\nif (cur_pattern_SC->is_terminal())\n- std::cout << tab << tab << \" - \" << std::setw(20) << cur_pattern_SC->name() << \": \"\n+ std::cout << tab << tab << \" - \" << std::setw(11) << cur_pattern_SC->name() << \": \"\n<< std::setw(5)\n<< generator->get_n_generated_nodes_by_pattern(typeid(*cur_pattern_SC).hash_code(), -1)\n<< \" / \" << n_nodes_gen << std::endl;\n@@ -144,7 +144,7 @@ void Generation_polar\n{\nauto cur_pattern_SC = polar_patterns[p];\nif (!cur_pattern_SC->is_terminal())\n- std::cout << tab << tab << \" - \" << std::setw(20) << cur_pattern_SC->name() << \": \"\n+ std::cout << tab << tab << \" - \" << std::setw(11) << cur_pattern_SC->name() << \": \"\n<< std::setw(5)\n<< generator->get_n_generated_nodes_by_pattern(typeid(*cur_pattern_SC).hash_code(), -1)\n<< \" / \" << n_nodes_gen << std::endl;\n@@ -168,7 +168,7 @@ void Generation_polar\n{\nauto cur_pattern_SC = polar_patterns[p];\nif (cur_pattern_SC->is_terminal())\n- std::cout << tab << tab << tab << \" - \" << std::setw(20) << cur_pattern_SC->name() << \": \"\n+ std::cout << tab << tab << tab << \" - \" << std::setw(11) << cur_pattern_SC->name() << \": \"\n<< std::setw(5)\n<< generator->get_n_generated_nodes_by_pattern(typeid(*cur_pattern_SC).hash_code(), d)\n<< \" / \" << n_nodes_gen << std::endl;\n@@ -178,7 +178,7 @@ void Generation_polar\n{\nauto cur_pattern_SC = polar_patterns[p];\nif (!cur_pattern_SC->is_terminal())\n- std::cout << tab << tab << tab << \" - \" << std::setw(20) << cur_pattern_SC->name() << \": \"\n+ std::cout << tab << tab << tab << \" - \" << std::setw(11) << cur_pattern_SC->name() << \": \"\n<< std::setw(5)\n<< generator->get_n_generated_nodes_by_pattern(typeid(*cur_pattern_SC).hash_code(), d)\n<< \" / \" << n_nodes_gen << std::endl;\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_i.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_i.hpp", "diff": "@@ -123,7 +123,7 @@ public:\nvirtual std::string apply_g(std::string start_indent = \"\", std::string str_off_l = \"\", std::string str_off_s = \"\") const { return \"\"; }\nvirtual std::string apply_h(std::string start_indent = \"\", std::string str_off_l = \"\", std::string str_off_s = \"\") const { return \"\"; }\n- virtual std::string range_name() const\n+ virtual std::string range() const\n{\nif (min_level == 0 && max_level == -1)\nreturn \"\";\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_r0.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_r0.hpp", "diff": "@@ -33,7 +33,7 @@ public:\nvirtual ~Pattern_polar_r0() {}\nvirtual polar_node_t type() const { return polar_node_t::RATE_0; }\n- virtual std::string name() const { return \"Rate 0\" + range_name();}\n+ virtual std::string name() const { return \"Rate 0\"; }\nvirtual std::string short_name() const { return \"r0\"; }\nvirtual std::string fill_color() const { return \"#FFFFFF\"; }\nvirtual std::string font_color() const { return \"#000000\"; }\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_r0_left.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_r0_left.hpp", "diff": "@@ -37,7 +37,7 @@ public:\nvirtual ~Pattern_polar_r0_left() {}\nvirtual polar_node_t type() const { return polar_node_t::RATE_0_LEFT; }\n- virtual std::string name() const { return \"Rate 0 left\" + range_name();}\n+ virtual std::string name() const { return \"Rate 0 left\"; }\nvirtual std::string short_name() const { return \"r0l\"; }\nvirtual std::string fill_color() const { return \"#dadada\"; }\nvirtual std::string font_color() const { return \"#000000\"; }\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_r1.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_r1.hpp", "diff": "@@ -33,7 +33,7 @@ public:\nvirtual ~Pattern_polar_r1() {}\nvirtual polar_node_t type() const { return polar_node_t::RATE_1; }\n- virtual std::string name() const { return \"Rate 1\" + range_name();}\n+ virtual std::string name() const { return \"Rate 1\"; }\nvirtual std::string short_name() const { return \"r1\"; }\nvirtual std::string fill_color() const { return \"#000000\"; }\nvirtual std::string font_color() const { return \"#FFFFFF\"; }\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_rep.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_rep.hpp", "diff": "@@ -38,7 +38,7 @@ public:\nvirtual ~Pattern_polar_rep() {}\nvirtual polar_node_t type() const { return polar_node_t::REP; }\n- virtual std::string name() const { return \"Rep\" + range_name();}\n+ virtual std::string name() const { return \"Rep\"; }\nvirtual std::string short_name() const { return \"re\"; }\nvirtual std::string fill_color() const { return \"#8F463F\"; }\nvirtual std::string font_color() const { return \"#FFFFFF\"; }\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_rep_left.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_rep_left.hpp", "diff": "@@ -37,7 +37,7 @@ public:\nvirtual ~Pattern_polar_rep_left() {}\nvirtual polar_node_t type() const { return polar_node_t::REP_LEFT; }\n- virtual std::string name() const { return \"Rep left\" + range_name();}\n+ virtual std::string name() const { return \"Rep left\"; }\nvirtual std::string short_name() const { return \"rl\"; }\nvirtual std::string fill_color() const { return \"#8e726f\"; }\nvirtual std::string font_color() const { return \"#FFFFFF\"; }\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_spc.hpp", "new_path": "src/Tools/Code/Polar/Patterns/Pattern_polar_spc.hpp", "diff": "@@ -39,7 +39,7 @@ public:\nvirtual ~Pattern_polar_spc() {}\nvirtual polar_node_t type() const { return polar_node_t::SPC; }\n- virtual std::string name() const { return \"SPC\" + range_name();}\n+ virtual std::string name() const { return \"SPC\"; }\nvirtual std::string short_name() const { return \"s\"; }\nvirtual std::string fill_color() const { return \"#2F3F60\"; }\nvirtual std::string font_color() const { return \"#FFFFFF\"; }\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve the graphs for the Polar codes.
8,490
24.02.2017 10:07:13
-3,600
6fe933a3157a0baba749e38f9c4a393a2fbee638
Refacto and renaming.
[ { "change_type": "MODIFY", "old_path": "src/Launcher/BFER/Launcher_BFER.cpp", "new_path": "src/Launcher/BFER/Launcher_BFER.cpp", "diff": "@@ -82,18 +82,15 @@ void Launcher_BFER<B,R,Q>\nthis->opt_args[{\"mnt-max-fe\", \"e\"}] =\n{\"positive_int\",\n\"max number of frame errors for each SNR simulation.\"};\n-\nthis->opt_args[{\"mnt-err-trk\"}] =\n{\"\",\n- \"enable the tracking of the wrong frames. Automatically disabled by mnt-err-trk-rev but enabled by mnt-err-trk-path option.\"};\n+ \"enable the tracking of the bad frames (by default the frames are stored in the current folder).\"};\nthis->opt_args[{\"mnt-err-trk-rev\"}] =\n{\"\",\n- std::string(\"automatically reply the saved frames in error tracker files for the source, the encoder and the channel noise.\") +\n- std::string(\" Warning! This feature does not set automatically the configuration of all the other modules.\")};\n+ \"automatically replay the saved frames.\"};\nthis->opt_args[{\"mnt-err-trk-path\"}] =\n{\"string\",\n- std::string(\"header of filenames where will be returned/read the wrong source, encoder and channel noise frames.\") +\n- std::string(\" To this name will be automatically added the run SNR and the extension (.src .enc .chn).\")};\n+ \"base path for the files where the bad frames will be stored or read.\"};\n// ------------------------------------------------------------------------------------------------------ terminal\nthis->opt_args[{\"term-type\"}] =\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/BFERI/Launcher_BFERI.cpp", "new_path": "src/Launcher/BFERI/Launcher_BFERI.cpp", "diff": "@@ -99,18 +99,15 @@ void Launcher_BFERI<B,R,Q>\nthis->opt_args[{\"mnt-max-fe\", \"e\"}] =\n{\"positive_int\",\n\"max number of frame errors for each SNR simulation.\"};\n-\nthis->opt_args[{\"mnt-err-trk\"}] =\n{\"\",\n- \"enable the tracking of the wrong frames. Automatically disabled by mnt-err-trk-rev but enabled by mnt-err-trk-path option.\"};\n+ \"enable the tracking of the bad frames (by default the frames are stored in the current folder).\"};\nthis->opt_args[{\"mnt-err-trk-rev\"}] =\n{\"\",\n- std::string(\"automatically reply the saved frames in error tracker files for the source, the encoder and the channel noise.\") +\n- std::string(\" Warning! This feature does not set automatically the configuration of all the other modules.\")};\n+ \"automatically replay the saved frames.\"};\nthis->opt_args[{\"mnt-err-trk-path\"}] =\n{\"string\",\n- std::string(\"header of filenames where will be returned/read the wrong source, encoder and channel noise frames.\") +\n- std::string(\" To this name will be automatically added the run SNR and the extension (.src .enc .chn).\")};\n+ \"base path for the files where the bad frames will be stored or read.\"};\n// ------------------------------------------------------------------------------------------------------ terminal\nthis->opt_args[{\"term-type\"}] =\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Monitor.hpp", "new_path": "src/Module/Monitor/Monitor.hpp", "diff": "@@ -148,6 +148,31 @@ public:\n*/\nvirtual void check_errors(const mipp::vector<B>& U, const mipp::vector<B>& V) = 0;\n+ /*!\n+ * \\brief Tells if the user asked for stopping the current computations.\n+ *\n+ * \\return true if the SIGINT (ctrl+c) is called.\n+ */\n+ static bool is_interrupt()\n+ {\n+ return Monitor_i<B,R>::interrupt;\n+ }\n+\n+ /*!\n+ * \\brief Tells if the user asked for stopping the whole simulation.\n+ *\n+ * \\return true if the SIGINT (ctrl+c) is called twice.\n+ */\n+ static bool is_over()\n+ {\n+ return Monitor_i<B,R>::over;\n+ }\n+\n+ ////////////////////////////////////////////////////////////////////////////////////////////////////\n+ // The following public methods are specific to catch the bad frames and to dump them into files. //\n+ // The proposed default implementation do nothing. //\n+ ////////////////////////////////////////////////////////////////////////////////////////////////////\n+\n/*!\n* \\brief Compares two messages and counts the number of frame errors and bit errors.\n*\n@@ -159,7 +184,7 @@ public:\n* \\param X_mod: the modulated message (from the Modulator, the input of the Channel).\n* \\param Y: the noised message (the output of the Channel).\n*/\n- virtual void check_track_errors(const mipp::vector<B>& U,\n+ virtual void check_and_track_errors(const mipp::vector<B>& U,\nconst mipp::vector<B>& V,\nconst mipp::vector<B>& X,\nconst mipp::vector<R>& X_mod,\n@@ -168,28 +193,14 @@ public:\ncheck_errors(U, V);\n}\n- virtual void flush_wrong_frames(const std::string& error_tracker_head_file_name, const float snr)\n- {\n- }\n-\n/*!\n- * \\brief Tells if the user asked for stopping the current computations.\n+ * \\brief Write the bad frames into files.\n*\n- * \\return true if the SIGINT (ctrl+c) is called.\n+ * \\param base_path: base path for files to write the bad frames.\n+ * \\param snr: the current SNR.\n*/\n- static bool is_interrupt()\n+ virtual void dump_bad_frames(const std::string& base_path, const float snr)\n{\n- return Monitor_i<B,R>::interrupt;\n- }\n-\n- /*!\n- * \\brief Tells if the user asked for stopping the whole simulation.\n- *\n- * \\return true if the SIGINT (ctrl+c) is called twice.\n- */\n- static bool is_over()\n- {\n- return Monitor_i<B,R>::over;\n}\n/*!\n@@ -237,19 +248,6 @@ private:\nMonitor_i<B,R>::first_interrupt = false;\nMonitor_i<B,R>::interrupt = true;\n}\n-\n-// virtual void save_wrong_frame(const B* U, const B* X, const R* X_mod, const R* Y, const int Y_size) = 0;\n-\n-// /*!\n-// * \\brief Compares two messages and counts the number of frame errors and bit errors.\n-// *\n-// * Typically this method is called at the very end of a communication chain.\n-// *\n-// * \\param U: a pointer to the original message (from the Source or the CRC).\n-// * \\param V: a pointer to the decoded message (from the Decoder).\n-// * \\param length: the size of the messages (U and V).\n-// */\n-// virtual bool check_errors(const B* U, const B* V, const int length) = 0;\n};\ntemplate <typename B, typename R>\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp", "new_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp", "diff": "@@ -58,60 +58,14 @@ int Monitor_reduction<B,R>\nreturn cur_be;\n}\n-template <typename B, typename R>\n-bool Monitor_reduction<B,R>\n-::check_path(const std::string& error_tracker_head_path)\n-{\n- size_t pos = error_tracker_head_path.find_last_of(\"/\");\n-\n- if (pos == std::string::npos)\n- return true;\n-\n- std::string pathname = error_tracker_head_path.substr(0, pos);\n-\n- // TODO : check compatibility on windows. Normally it is good.\n- struct stat info;\n-\n- if( stat( pathname.data(), &info ) != 0 )\n- return false;\n- else if( info.st_mode & S_IFDIR )\n- return true;\n- else\n- return false;\n-}\n-\n-template <typename B, typename R>\n-void Monitor_reduction<B,R>\n-::get_tracker_paths(const std::string& error_tracker_head_path, const float snr,\n- std::string& path_src, std::string& path_enc, std::string& path_noise)\n-{\n- if (!check_path(error_tracker_head_path))\n- {\n- std::cerr << bold_red(\"(EE) issue while trying to open error tracker log files ; check head of the path: \\\"\")\n- << bold_red(error_tracker_head_path)\n- << bold_red(\"\\\" and please create yourself the needed directory.\")\n- << std::endl;\n- std::exit(-1);\n- }\n-\n- std::stringstream snr_stream;\n- snr_stream << std::fixed << std::setprecision(3) << snr;\n-\n- std::string path_head = error_tracker_head_path + std::string(\"_\") + snr_stream.str();\n-\n- path_src = path_head + std::string(\".src\");\n- path_enc = path_head + std::string(\".enc\");\n- path_noise = path_head + std::string(\".chn\");\n-}\n-\ntemplate <typename B, typename R>\nvoid Monitor_reduction<B,R>\n-::flush_wrong_frames(const std::string& error_tracker_head_path, const float snr)\n+::dump_bad_frames(const std::string& base_path, const float snr)\n{\n- // ************* get path and open them ******************\n+ // get path and open them\nstd::string path_src, path_enc, path_noise;\n- get_tracker_paths(error_tracker_head_path, snr, path_src, path_enc, path_noise);\n+ get_tracker_paths(base_path, snr, path_src, path_enc, path_noise);\nstd::ofstream file_src (path_src);\nstd::ofstream file_enc (path_enc);\n@@ -120,13 +74,13 @@ void Monitor_reduction<B,R>\nif (!file_src.is_open() || !file_enc.is_open() || !file_noise.is_open())\n{\nstd::cerr << bold_red(\"(EE) issue while trying to open error tracker log files ; check file name: \\\"\")\n- << bold_red(error_tracker_head_path) << bold_red(\"\\\"\") << std::endl;\n+ << bold_red(base_path) << bold_red(\"\\\"\") << std::endl;\nstd::exit(-1);\n}\nint n_fe = get_n_fe();\nint Y_size = 0;\n- // ************* get Y_size *******************\n+ // get Y_size\nfor (unsigned i = 0; i <= monitors.size(); i++)\n{\nauto mon = (i == monitors.size()) ? this : monitors[i];\n@@ -141,7 +95,7 @@ void Monitor_reduction<B,R>\nbreak;\n}\n- // ************* write headers *****************\n+ // write headers\nfile_src << n_fe << std::endl << std::endl; // write number frames\nfile_src << this->get_K() << std::endl << std::endl; // write length of frames\n@@ -152,7 +106,7 @@ void Monitor_reduction<B,R>\nfile_noise.write((char *)&n_fe , sizeof(int)); // write number frames\nfile_noise.write((char *)&Y_size, sizeof(int)); // write length of frames\n- // ************* write frames ********************\n+ // write frames\nfor (unsigned i = 0; i <= monitors.size(); i++)\n{\nauto mon = (i == monitors.size()) ? this : monitors[i];\n@@ -187,6 +141,52 @@ void Monitor_reduction<B,R>\n}\n}\n+template <typename B, typename R>\n+bool Monitor_reduction<B,R>\n+::check_path(const std::string& base_path)\n+{\n+ size_t pos = base_path.find_last_of(\"/\");\n+\n+ if (pos == std::string::npos)\n+ return true;\n+\n+ std::string pathname = base_path.substr(0, pos);\n+\n+ // TODO: check compatibility on windows. Normally it is good.\n+ struct stat info;\n+\n+ if (stat(pathname.data(), &info) != 0)\n+ return false;\n+ else if (info.st_mode & S_IFDIR)\n+ return true;\n+ else\n+ return false;\n+}\n+\n+template <typename B, typename R>\n+void Monitor_reduction<B,R>\n+::get_tracker_paths(const std::string& base_path, const float snr,\n+ std::string& path_src, std::string& path_enc, std::string& path_noise)\n+{\n+ if (!check_path(base_path))\n+ {\n+ std::cerr << bold_red(\"(EE) issue while trying to open error tracker log files ; check head of the path: \\\"\")\n+ << bold_red(base_path)\n+ << bold_red(\"\\\" and please create yourself the needed directory.\")\n+ << std::endl;\n+ std::exit(-1);\n+ }\n+\n+ std::stringstream snr_stream;\n+ snr_stream << std::fixed << std::setprecision(3) << snr;\n+\n+ std::string path_head = base_path + std::string(\"_\") + snr_stream.str();\n+\n+ path_src = path_head + std::string(\".src\");\n+ path_enc = path_head + std::string(\".enc\");\n+ path_noise = path_head + std::string(\".chn\");\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_reduction.hpp", "new_path": "src/Module/Monitor/Standard/Monitor_reduction.hpp", "diff": "@@ -22,10 +22,11 @@ public:\nint get_n_fe() const;\nint get_n_be() const;\n- static bool check_path(const std::string& error_tracker_head_path); // return true if correct\n- static void get_tracker_paths(const std::string& error_tracker_head_path, const float snr,\n+ void dump_bad_frames(const std::string& base_path, const float snr);\n+\n+ static bool check_path(const std::string& base_path); // return true if correct\n+ static void get_tracker_paths(const std::string& base_path, const float snr,\nstd::string& path_src, std::string& path_enc, std::string& path_noise);\n- void flush_wrong_frames(const std::string& error_tracker_head_path, const float snr);\n};\n#endif /* MONITOR_REDUCTION_HPP_ */\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_std.cpp", "new_path": "src/Module/Monitor/Standard/Monitor_std.cpp", "diff": "#include <vector>\n#include <cassert>\n+#include \"Tools/Display/bash_tools.h\"\n+\n#include \"Monitor_std.hpp\"\ntemplate <typename B, typename R>\n@@ -32,7 +34,7 @@ void Monitor_std<B,R>\ntemplate <typename B, typename R>\nvoid Monitor_std<B,R>\n-::check_track_errors(const mipp::vector<B>& U,\n+::check_and_track_errors(const mipp::vector<B>& U,\nconst mipp::vector<B>& V,\nconst mipp::vector<B>& X,\nconst mipp::vector<R>& X_mod,\n@@ -46,14 +48,12 @@ void Monitor_std<B,R>\nconst int Y_size = (int)X_mod.size() / this->n_frames;\nfor (auto i = 0; i < this->n_frames; i++)\n- {\nif (check_errors(U.data() + i * this->K, V.data() + i * this->K, this->K))\n- save_wrong_frame(U .data() + i * this->K,\n+ copy_bad_frame(U .data() + i * this->K,\nX .data() + i * this->N,\nX_mod.data() + i * Y_size,\nY .data() + i * Y_size,\nY_size);\n- }\nthis->update_n_analyzed_frames();\n}\n@@ -136,7 +136,7 @@ float Monitor_std<B,R>\ntemplate <typename B, typename R>\nvoid Monitor_std<B,R>\n-::save_wrong_frame(const B* U, const B* X, const R* X_mod, const R* Y, const int Y_size)\n+::copy_bad_frame(const B* U, const B* X, const R* X_mod, const R* Y, const int Y_size)\n{\nbuff_src. push_back(mipp::vector<B>(this->K));\nbuff_enc. push_back(mipp::vector<B>(this->N));\n@@ -152,6 +152,17 @@ void Monitor_std<B,R>\nbuff_noise.back()[b] = Y[b] - X_mod[b];\n}\n+template <typename B, typename R>\n+void Monitor_std<B,R>\n+::dump_bad_frames(const std::string& base_path, const float snr)\n+{\n+ std::cerr << bold_red(\"\\\"dump_bad_frames\\\" is not defined in \\\"Monitor_std\\\", please call this method on \")\n+ << bold_red(\"\\\"Monitor_reduction\\\" instead.\")\n+ << std::endl;\n+\n+ std::exit(-1);\n+}\n+\ntemplate <typename B, typename R>\nconst std::vector<mipp::vector<B>> Monitor_std<B,R>\n::get_buff_src() const\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_std.hpp", "new_path": "src/Module/Monitor/Standard/Monitor_std.hpp", "diff": "@@ -27,14 +27,14 @@ public:\nconst std::string name = \"Monitor_std\");\nvirtual ~Monitor_std(){};\n- virtual void check_track_errors(const mipp::vector<B>& U,\n+ virtual void check_errors(const mipp::vector<B>& U, const mipp::vector<B>& V);\n+\n+ virtual void check_and_track_errors(const mipp::vector<B>& U,\nconst mipp::vector<B>& V,\nconst mipp::vector<B>& X,\nconst mipp::vector<R>& X_mod,\nconst mipp::vector<R>& Y);\n- virtual void check_errors(const mipp::vector<B>& U, const mipp::vector<B>& V);\n-\nvirtual bool fe_limit_achieved();\nint get_fe_limit() const;\n@@ -45,13 +45,15 @@ public:\nfloat get_fer() const;\nfloat get_ber() const;\n+ void dump_bad_frames(const std::string& base_path, const float snr);\n+\nconst std::vector<mipp::vector<B>> get_buff_src () const;\nconst std::vector<mipp::vector<B>> get_buff_enc () const;\nconst std::vector<mipp::vector<R>> get_buff_noise() const;\nprivate:\nvoid update_n_analyzed_frames();\n- void save_wrong_frame(const B* U, const B* X, const R* X_mod, const R* Y, const int Y_size);\n+ void copy_bad_frame(const B* U, const B* X, const R* X_mod, const R* Y, const int Y_size);\ninline bool check_errors(const B* U, const B* V, const int length);\n};\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp", "new_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp", "diff": "@@ -142,7 +142,7 @@ void Simulation_BFER<B,R,Q>\n}\nif (this->params.monitor.err_track_enable)\n- monitor_red->flush_wrong_frames(this->params.monitor.err_track_path, this->snr);\n+ monitor_red->dump_bad_frames(this->params.monitor.err_track_path, this->snr);\n}\ntemplate <typename B, typename R, typename Q>\n@@ -388,7 +388,7 @@ void Simulation_BFER<B,R,Q>\n// check errors in the frame\nauto t_check = steady_clock::now();\nif (simu->params.monitor.err_track_enable)\n- simu->monitor[tid]->check_track_errors(simu->U_K [tid], simu->V_K [tid], simu->X_N1[tid],\n+ simu->monitor[tid]->check_and_track_errors(simu->U_K [tid], simu->V_K [tid], simu->X_N1[tid],\nsimu->X_N3[tid], simu->Y_N1[tid]);\nelse\nsimu->monitor[tid]->check_errors(simu->U_K[tid], simu->V_K[tid]);\n@@ -715,7 +715,7 @@ void Simulation_BFER<B,R,Q>\n// check errors in the frame\nauto t_check = steady_clock::now();\nif (simu->params.monitor.err_track_enable)\n- simu->monitor[0]->check_track_errors(simu->U_K [0], simu->V_K [0], simu->X_N1[0],\n+ simu->monitor[0]->check_and_track_errors(simu->U_K [0], simu->V_K [0], simu->X_N1[0],\nsimu->X_N3[0], simu->Y_N1[0]);\nelse\nsimu->monitor[0]->check_errors(simu->U_K[0], simu->V_K[0]);\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp", "new_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp", "diff": "@@ -144,7 +144,7 @@ void Simulation_BFERI<B,R,Q>\n}\nif (this->params.monitor.err_track_enable)\n- monitor_red->flush_wrong_frames(this->params.monitor.err_track_path, this->snr);\n+ monitor_red->dump_bad_frames(this->params.monitor.err_track_path, this->snr);\n}\ntemplate <typename B, typename R, typename Q>\n@@ -419,7 +419,7 @@ void Simulation_BFERI<B,R,Q>\n// check errors in the frame\nauto t_check = steady_clock::now();\nif (simu->params.monitor.err_track_enable)\n- simu->monitor[tid]->check_track_errors(simu->U_K [tid], simu->V_K [tid], simu->X_N1[tid],\n+ simu->monitor[tid]->check_and_track_errors(simu->U_K [tid], simu->V_K [tid], simu->X_N1[tid],\nsimu->X_N3[tid], simu->Y_N1[tid]);\nelse\nsimu->monitor[tid]->check_errors(simu->U_K[tid], simu->V_K[tid]);\n@@ -746,7 +746,7 @@ void Simulation_BFERI<B,R,Q>\n// check errors in the frame\nauto t_check = steady_clock::now();\nif (simu->params.monitor.err_track_enable)\n- simu->monitor[0]->check_track_errors(simu->U_K [0], simu->V_K [0], simu->X_N1[0],\n+ simu->monitor[0]->check_and_track_errors(simu->U_K [0], simu->V_K [0], simu->X_N1[0],\nsimu->X_N3[0], simu->Y_N1[0]);\nelse\nsimu->monitor[0]->check_errors(simu->U_K[0], simu->V_K[0]);\n" } ]
C++
MIT License
aff3ct/aff3ct
Refacto and renaming.
8,490
24.02.2017 10:20:25
-3,600
6ce36b9688bac4b6dc722f49dfbe422dda8f96fc
Fix a bug in the MPI monitor: update with the new R template param.
[ { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_reduction_mpi.cpp", "new_path": "src/Module/Monitor/Standard/Monitor_reduction_mpi.cpp", "diff": "@@ -26,15 +26,15 @@ void MPI_SUM_monitor_vals_func(void *in, void *inout, int *len, MPI_Datatype *da\n}\n}\n-template <typename B>\n-Monitor_reduction_mpi<B>\n+template <typename B, typename R>\n+Monitor_reduction_mpi<B,R>\n::Monitor_reduction_mpi(const int& K, const int& N, const int& max_fe,\n- std::vector<Monitor<B>*>& error_analyzers,\n+ std::vector<Monitor<B,R>*>& monitors,\nconst std::thread::id master_thread_id,\nconst std::chrono::nanoseconds d_mpi_comm_frequency,\nconst int& n_frames,\nconst std::string name)\n-: Monitor_reduction<B>(K, N, max_fe, error_analyzers, n_frames, name),\n+: Monitor_reduction<B,R>(K, N, max_fe, monitors, n_frames, name),\nmaster_thread_id(master_thread_id),\nis_fe_limit_achieved(false),\nt_last_mpi_comm(std::chrono::steady_clock::now()),\n@@ -70,14 +70,14 @@ Monitor_reduction_mpi<B>\n}\n}\n-template <typename B>\n-Monitor_reduction_mpi<B>\n+template <typename B, typename R>\n+Monitor_reduction_mpi<B,R>\n::~Monitor_reduction_mpi()\n{\n}\n-template <typename B>\n-bool Monitor_reduction_mpi<B>\n+template <typename B, typename R>\n+bool Monitor_reduction_mpi<B,R>\n::fe_limit_achieved()\n{\n// only the master thread can do this\n@@ -106,12 +106,12 @@ bool Monitor_reduction_mpi<B>\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template class Monitor_reduction_mpi<B_8>;\n-template class Monitor_reduction_mpi<B_16>;\n-template class Monitor_reduction_mpi<B_32>;\n-template class Monitor_reduction_mpi<B_64>;\n+template class Monitor_reduction_mpi<B_8 ,R_8>;\n+template class Monitor_reduction_mpi<B_16,R_16>;\n+template class Monitor_reduction_mpi<B_32,R_32>;\n+template class Monitor_reduction_mpi<B_64,R_64>;\n#else\n-template class Monitor_reduction_mpi<B>;\n+template class Monitor_reduction_mpi<B,R>;\n#endif\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_reduction_mpi.hpp", "new_path": "src/Module/Monitor/Standard/Monitor_reduction_mpi.hpp", "diff": "#include \"Monitor_reduction.hpp\"\n-template <typename B>\n-class Monitor_reduction_mpi : public Monitor_reduction<B>\n+template <typename B, typename R>\n+class Monitor_reduction_mpi : public Monitor_reduction<B,R>\n{\nprivate:\nconst std::thread::id master_thread_id;\n@@ -26,7 +26,7 @@ private:\npublic:\nMonitor_reduction_mpi(const int& K, const int& N, const int& max_fe,\n- std::vector<Monitor<B>*>& error_analyzers,\n+ std::vector<Monitor<B,R>*>& monitors,\nconst std::thread::id master_thread_id,\nconst std::chrono::nanoseconds d_mpi_comm_frequency = std::chrono::milliseconds(1000),\nconst int& n_frames = 1,\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp", "new_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp", "diff": "@@ -200,7 +200,7 @@ void Simulation_BFER<B,R,Q>\n{\n#ifdef ENABLE_MPI\n// build a monitor to compute BER/FER (reduce the other monitors)\n- simu->monitor_red = new Monitor_reduction_mpi<B>(simu->params.code.K,\n+ simu->monitor_red = new Monitor_reduction_mpi<B,R>(simu->params.code.K,\nsimu->params.code.N,\nsimu->params.monitor.n_frame_errors,\nsimu->monitor,\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp", "new_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp", "diff": "@@ -201,7 +201,7 @@ void Simulation_BFERI<B,R,Q>\n{\n#ifdef ENABLE_MPI\n// build a monitor to compute BER/FER (reduce the other monitors)\n- simu->monitor_red = new Monitor_reduction_mpi<B>(simu->params.code.K,\n+ simu->monitor_red = new Monitor_reduction_mpi<B,R>(simu->params.code.K,\nsimu->params.code.N,\nsimu->params.monitor.n_frame_errors,\nsimu->monitor,\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix a bug in the MPI monitor: update with the new R template param.
8,490
24.02.2017 10:24:39
-3,600
ea4036419f3d99c2425904419ec751ffa1a2ce8c
Disable the tracking feature when STARPU or SYSTEMC simulations.
[ { "change_type": "MODIFY", "old_path": "src/Launcher/BFER/Launcher_BFER.cpp", "new_path": "src/Launcher/BFER/Launcher_BFER.cpp", "diff": "@@ -82,6 +82,8 @@ void Launcher_BFER<B,R,Q>\nthis->opt_args[{\"mnt-max-fe\", \"e\"}] =\n{\"positive_int\",\n\"max number of frame errors for each SNR simulation.\"};\n+\n+#if !defined(STARPU) && !defined(SYSTEMC)\nthis->opt_args[{\"mnt-err-trk\"}] =\n{\"\",\n\"enable the tracking of the bad frames (by default the frames are stored in the current folder).\"};\n@@ -91,6 +93,7 @@ void Launcher_BFER<B,R,Q>\nthis->opt_args[{\"mnt-err-trk-path\"}] =\n{\"string\",\n\"base path for the files where the bad frames will be stored or read.\"};\n+#endif\n// ------------------------------------------------------------------------------------------------------ terminal\nthis->opt_args[{\"term-type\"}] =\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/BFERI/Launcher_BFERI.cpp", "new_path": "src/Launcher/BFERI/Launcher_BFERI.cpp", "diff": "@@ -99,6 +99,8 @@ void Launcher_BFERI<B,R,Q>\nthis->opt_args[{\"mnt-max-fe\", \"e\"}] =\n{\"positive_int\",\n\"max number of frame errors for each SNR simulation.\"};\n+\n+#if !defined(STARPU) && !defined(SYSTEMC)\nthis->opt_args[{\"mnt-err-trk\"}] =\n{\"\",\n\"enable the tracking of the bad frames (by default the frames are stored in the current folder).\"};\n@@ -108,6 +110,7 @@ void Launcher_BFERI<B,R,Q>\nthis->opt_args[{\"mnt-err-trk-path\"}] =\n{\"string\",\n\"base path for the files where the bad frames will be stored or read.\"};\n+#endif\n// ------------------------------------------------------------------------------------------------------ terminal\nthis->opt_args[{\"term-type\"}] =\n" } ]
C++
MIT License
aff3ct/aff3ct
Disable the tracking feature when STARPU or SYSTEMC simulations.
8,490
24.02.2017 10:43:00
-3,600
c45dd080bf95366c9c48301a95344093209e2ed1
Add some info about the bad frames tracking in the displayed parameters.
[ { "change_type": "MODIFY", "old_path": "src/Launcher/BFER/Launcher_BFER.cpp", "new_path": "src/Launcher/BFER/Launcher_BFER.cpp", "diff": "@@ -150,9 +150,9 @@ void Launcher_BFER<B,R,Q>\nthis->params.source. type = \"USER\";\nthis->params.encoder.type = \"USER\";\nthis->params.channel.type = \"USER\";\n- this->params.source. path = this->params.monitor.err_track_path + std::string(\"_SNR.src\");\n- this->params.encoder.path = this->params.monitor.err_track_path + std::string(\"_SNR.enc\");\n- this->params.channel.path = this->params.monitor.err_track_path + std::string(\"_SNR.chn\");\n+ this->params.source. path = this->params.monitor.err_track_path + std::string(\"_$snr.src\");\n+ this->params.encoder.path = this->params.monitor.err_track_path + std::string(\"_$snr.enc\");\n+ this->params.channel.path = this->params.monitor.err_track_path + std::string(\"_$snr.chn\");\n// the paths are set in the Simulation class\n}\n@@ -230,6 +230,20 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFER<B,R,Q>\np.push_back(std::make_pair(\"Frame error count (e)\", std::to_string(this->params.monitor.n_frame_errors)));\n+#if !defined(STARPU) && !defined(SYSTEMC)\n+ std::string enable_track = (this->params.monitor.err_track_enable) ? \"on\" : \"off\";\n+ p.push_back(std::make_pair(\"Bad frames tracking\", enable_track));\n+\n+ std::string enable_rev_track = (this->params.monitor.err_track_revert) ? \"on\" : \"off\";\n+ p.push_back(std::make_pair(\"Bad frames replay\", enable_rev_track));\n+\n+ if (this->params.monitor.err_track_enable || this->params.monitor.err_track_revert)\n+ {\n+ std::string path = this->params.monitor.err_track_path + std::string(\"_$snr.[src,enc,chn]\");\n+ p.push_back(std::make_pair(\"Bad frames base path\", path));\n+ }\n+#endif\n+\nreturn p;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/BFERI/Launcher_BFERI.cpp", "new_path": "src/Launcher/BFERI/Launcher_BFERI.cpp", "diff": "@@ -172,9 +172,9 @@ void Launcher_BFERI<B,R,Q>\nthis->params.source. type = \"USER\";\nthis->params.encoder.type = \"USER\";\nthis->params.channel.type = \"USER\";\n- this->params.source. path = this->params.monitor.err_track_path + std::string(\"_SNR.src\");\n- this->params.encoder.path = this->params.monitor.err_track_path + std::string(\"_SNR.enc\");\n- this->params.channel.path = this->params.monitor.err_track_path + std::string(\"_SNR.chn\");\n+ this->params.source. path = this->params.monitor.err_track_path + std::string(\"_$snr.src\");\n+ this->params.encoder.path = this->params.monitor.err_track_path + std::string(\"_$snr.enc\");\n+ this->params.channel.path = this->params.monitor.err_track_path + std::string(\"_$snr.chn\");\n// the paths are set in the Simulation class\n}\n@@ -273,6 +273,20 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFERI<B,R,Q>\np.push_back(std::make_pair(\"Frame error count (e)\", std::to_string(this->params.monitor.n_frame_errors)));\n+#if !defined(STARPU) && !defined(SYSTEMC)\n+ std::string enable_track = (this->params.monitor.err_track_enable) ? \"on\" : \"off\";\n+ p.push_back(std::make_pair(\"Bad frames tracking\", enable_track));\n+\n+ std::string enable_rev_track = (this->params.monitor.err_track_revert) ? \"on\" : \"off\";\n+ p.push_back(std::make_pair(\"Bad frames replay\", enable_rev_track));\n+\n+ if (this->params.monitor.err_track_enable || this->params.monitor.err_track_revert)\n+ {\n+ std::string path = this->params.monitor.err_track_path + std::string(\".$snr.[src,enc,chn]\");\n+ p.push_back(std::make_pair(\"Bad frames base path\", path));\n+ }\n+#endif\n+\nreturn p;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Add some info about the bad frames tracking in the displayed parameters.
8,483
24.02.2017 13:47:35
-3,600
f782c72bcb07bbfa94c6108f9ef47dc9963710f9
improve the write and the read of the noise from/to the file ; add warning when using feature in multi threading and multi inter frame level
[ { "change_type": "MODIFY", "old_path": "src/Module/Channel/Additive/User/Channel_additive_user.cpp", "new_path": "src/Module/Channel/Additive/User/Channel_additive_user.cpp", "diff": "@@ -27,12 +27,7 @@ Channel_additive_user<R>\nif (fra_size == this->N)\n{\nfor (auto i = 0; i < n_fra; i++)\n- for (auto j = 0; j < fra_size; j++)\n- {\n- R val;\n- file.read((char*)&val, sizeof(float));\n- this->noise[i][j] = val;\n- }\n+ file.read(reinterpret_cast<char*>(&this->noise[i][0]), fra_size*sizeof(R));\n}\nelse\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp", "new_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp", "diff": "@@ -136,8 +136,7 @@ void Monitor_reduction<B,R>\nauto buff_noise = mon->get_buff_noise();\nassert(buff_src.size() == buff_noise.size());\nfor (unsigned f = 0; f < buff_noise.size(); f++)\n- for (unsigned b = 0; b < buff_noise[f].size(); b++)\n- file_noise.write((char *)&buff_noise[f][b], sizeof(R));\n+ file_noise.write(reinterpret_cast<char*>(&buff_noise[f][0]), buff_noise[f].size()*sizeof(R));\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp", "new_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp", "diff": "@@ -112,6 +112,15 @@ void Simulation_BFER<B,R,Q>\nif (this->params.monitor.err_track_revert)\n{\n+ if(this->params.simulation.n_threads != 1)\n+ std::clog << bold_yellow(\"(WW) Multi-threading detected with error tracking revert feature!\")\n+ << bold_yellow(\" Each thread will play the same frames. Please run with one thread.\")\n+ << std::endl;\n+ if(this->params.simulation.inter_frame_level != 1)\n+ std::clog << bold_yellow(\"(WW) Inter frame level different than 1 detected with error tracking revert feature!\")\n+ << bold_yellow(\" Each bad frame may be played several times. Please run with an inter frame level of 1.\")\n+ << std::endl;\n+\nstd::string path_src, path_enc, path_noise;\nMonitor_reduction<B,R>::get_tracker_paths(this->params.monitor.err_track_path, this->snr,\npath_src, path_enc, path_noise);\n@@ -210,7 +219,7 @@ void Simulation_BFER<B,R,Q>\n#else\n// build a monitor to compute BER/FER (reduce the other monitors)\nsimu->monitor_red = new Monitor_reduction<B,R>(simu->params.code.K,\n- simu->params.code.N,\n+ simu->params.code.N + tail,\nsimu->params.monitor.n_frame_errors,\nsimu->monitor,\nn_fra);\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp", "new_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp", "diff": "@@ -114,6 +114,15 @@ void Simulation_BFERI<B,R,Q>\nif (this->params.monitor.err_track_revert)\n{\n+ if(this->params.simulation.n_threads != 1)\n+ std::clog << bold_yellow(\"(WW) Multi-threading detected with error tracking revert feature!\")\n+ << bold_yellow(\" Each thread will play the same frames. Please run one thread.\")\n+ << std::endl;\n+ if(this->params.simulation.inter_frame_level != 1)\n+ std::clog << bold_yellow(\"(WW) Inter frame level different than 1 detected with error tracking revert feature!\")\n+ << bold_yellow(\" Each bad frame may be played several times. Please run with an inter frame level of 1.\")\n+ << std::endl;\n+\nstd::string path_src, path_enc, path_noise;\nMonitor_reduction<B,R>::get_tracker_paths(this->params.monitor.err_track_path, this->snr,\npath_src, path_enc, path_noise);\n@@ -211,7 +220,7 @@ void Simulation_BFERI<B,R,Q>\n#else\n// build a monitor to compute BER/FER (reduce the other monitors)\nsimu->monitor_red = new Monitor_reduction<B,R>(simu->params.code.K,\n- simu->params.code.N,\n+ simu->params.code.N + tail,\nsimu->params.monitor.n_frame_errors,\nsimu->monitor,\nn_fra);\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Display/Frame_trace/Frame_trace.hxx", "new_path": "src/Tools/Display/Frame_trace/Frame_trace.hxx", "diff": "@@ -47,7 +47,7 @@ void Frame_trace<B>\nif (row_width == vec.size())\n{\nfor (auto i = 0; i < n_bits; i++)\n- stream << std::setw(5) << i << \"|\";\n+ stream << std::setw(15) << i << \"|\";\nif (n_bits < (int)vec.size())\nstream << \" ...\";\n@@ -81,9 +81,9 @@ void Frame_trace<B>\nbreak;\ncase REAL:\nif (value >= 0)\n- stream << std::setprecision(2) << std::setw(5) << +value << \"|\";\n+ stream << std::setprecision(12) << std::setw(15) << +value << \"|\";\nelse\n- stream << std::setprecision(1) << std::setw(5) << +value << \"|\";\n+ stream << std::setprecision(11) << std::setw(15) << +value << \"|\";\nbreak;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Factory/Factory_monitor.cpp", "new_path": "src/Tools/Factory/Factory_monitor.cpp", "diff": "@@ -9,7 +9,7 @@ Monitor<B,R>* Factory_monitor<B,R>\nMonitor<B,R> *monitor = nullptr;\n// build the monitor\n- monitor = new Monitor_std<B,R>(params.code.K, params.code.N, params.monitor.n_frame_errors, n_frames);\n+ monitor = new Monitor_std<B,R>(params.code.K, params.code.N + params.code.tail_length, params.monitor.n_frame_errors, n_frames);\nreturn monitor;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
improve the write and the read of the noise from/to the file ; add warning when using feature in multi threading and multi inter frame level
8,483
24.02.2017 14:05:09
-3,600
c98eb7753256434a646ca70dfc505a9c8d4ecbcf
save and read the Channel output and not anymore the noise
[ { "change_type": "MODIFY", "old_path": "src/Module/Channel/Additive/User/Channel_additive_user.cpp", "new_path": "src/Module/Channel/Additive/User/Channel_additive_user.cpp", "diff": "@@ -63,7 +63,8 @@ void Channel_additive_user<R>\nfor (auto f = 0; f < this->n_frames; f++)\n{\nfor (auto i = 0; i < this->N; i++)\n- Y_N[f * this->N +i] = X_N[f * this->N +i] + this->noise[this->noise_counter][i];\n+ //Y_N[f * this->N +i] = X_N[f * this->N +i] + this->noise[this->noise_counter][i];\n+ Y_N[f * this->N +i] = this->noise[this->noise_counter][i];\nthis->noise_counter = (this->noise_counter +1) % (int)this->noise.size();\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_std.cpp", "new_path": "src/Module/Monitor/Standard/Monitor_std.cpp", "diff": "@@ -149,7 +149,7 @@ void Monitor_std<B,R>\nbuff_enc.back()[b] = X[b];\nfor (int b = 0; b < Y_size; b++)\n- buff_noise.back()[b] = Y[b] - X_mod[b];\n+ buff_noise.back()[b] = Y[b];// - X_mod[b];\n}\ntemplate <typename B, typename R>\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Display/Frame_trace/Frame_trace.hxx", "new_path": "src/Tools/Display/Frame_trace/Frame_trace.hxx", "diff": "@@ -47,7 +47,7 @@ void Frame_trace<B>\nif (row_width == vec.size())\n{\nfor (auto i = 0; i < n_bits; i++)\n- stream << std::setw(15) << i << \"|\";\n+ stream << std::setw(5) << i << \"|\";\nif (n_bits < (int)vec.size())\nstream << \" ...\";\n@@ -81,9 +81,9 @@ void Frame_trace<B>\nbreak;\ncase REAL:\nif (value >= 0)\n- stream << std::setprecision(12) << std::setw(15) << +value << \"|\";\n+ stream << std::setprecision(2) << std::setw(5) << +value << \"|\";\nelse\n- stream << std::setprecision(11) << std::setw(15) << +value << \"|\";\n+ stream << std::setprecision(1) << std::setw(5) << +value << \"|\";\nbreak;\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
save and read the Channel output and not anymore the noise
8,483
24.02.2017 16:43:04
-3,600
7eb5387c251365cff42f3a62b45f05b83f41d94c
add a channel user next to the channel additive user because the saved noise is not precise enough; we need to the the directly product noise
[ { "change_type": "MODIFY", "old_path": "scripts/aff3ct_completion.sh", "new_path": "scripts/aff3ct_completion.sh", "diff": "@@ -289,7 +289,7 @@ _aff3ct() {\n;;\n--chn-type)\n- local params=\"NO AWGN AWGN_FAST AWGN_GSL AWGN_MKL RAYLEIGH\"\n+ local params=\"NO AWGN AWGN_FAST AWGN_GSL AWGN_MKL RAYLEIGH USER ADD_USER\"\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/BFERI/Launcher_BFERI.cpp", "new_path": "src/Launcher/BFERI/Launcher_BFERI.cpp", "diff": "@@ -172,9 +172,11 @@ void Launcher_BFERI<B,R,Q>\nthis->params.source .type = \"USER\";\nthis->params.encoder .type = \"USER\";\nthis->params.channel .type = \"USER\";\n+ this->params.interleaver.type = \"USER\";\nthis->params.source .path = this->params.monitor.err_track_path + std::string(\"_$snr.src\");\nthis->params.encoder .path = this->params.monitor.err_track_path + std::string(\"_$snr.enc\");\nthis->params.channel .path = this->params.monitor.err_track_path + std::string(\"_$snr.chn\");\n+ this->params.interleaver.path = this->params.monitor.err_track_path + std::string(\"_$snr.itl\");\n// the paths are set in the Simulation class\n}\n@@ -282,7 +284,7 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFERI<B,R,Q>\nif (this->params.monitor.err_track_enable || this->params.monitor.err_track_revert)\n{\n- std::string path = this->params.monitor.err_track_path + std::string(\".$snr.[src,enc,chn]\");\n+ std::string path = this->params.monitor.err_track_path + std::string(\"_$snr.[src,enc,itl,chn]\");\np.push_back(std::make_pair(\"Bad frames base path\", path));\n}\n#endif\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -221,7 +221,7 @@ void Launcher<B,R,Q>\n\"turn off the division by sigma square in the demodulation.\"};\n// ------------------------------------------------------------------------------------------------------- channel\n- std::string chan_avail = \"NO, USER, AWGN, AWGN_FAST, RAYLEIGH\";\n+ std::string chan_avail = \"NO, USER, ADD_USER, AWGN, AWGN_FAST, RAYLEIGH\";\n#ifdef CHANNEL_GSL\nchan_avail += \", AWGN_GSL\";\n#endif\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Channel/Additive/User/Channel_additive_user.cpp", "new_path": "src/Module/Channel/Additive/User/Channel_additive_user.cpp", "diff": "@@ -63,8 +63,7 @@ void Channel_additive_user<R>\nfor (auto f = 0; f < this->n_frames; f++)\n{\nfor (auto i = 0; i < this->N; i++)\n- //Y_N[f * this->N +i] = X_N[f * this->N +i] + this->noise[this->noise_counter][i];\n- Y_N[f * this->N +i] = this->noise[this->noise_counter][i];\n+ Y_N[f * this->N +i] = X_N[f * this->N +i] + this->noise[this->noise_counter][i];\nthis->noise_counter = (this->noise_counter +1) % (int)this->noise.size();\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Channel/User/Channel_user.cpp", "diff": "+\n+#include <fstream>\n+#include <cassert>\n+\n+#include \"Tools/Display/bash_tools.h\"\n+#include \"Channel_user.hpp\"\n+\n+template <typename R>\n+Channel_user<R>\n+::Channel_user(const int N, const std::string filename, const int n_frames, const std::string name)\n+: Channel<R>(N, n_frames, name), noise(), noise_counter(0)\n+{\n+ std::ifstream file(filename.c_str(), std::ios::binary);\n+ if (file.is_open())\n+ {\n+ int n_fra = 0, fra_size = 0;\n+\n+ file.read((char*)&n_fra, sizeof(int));\n+ file.read((char*)&fra_size, sizeof(int));\n+\n+ assert(n_fra > 0 && fra_size > 0);\n+\n+ this->noise.resize(n_fra);\n+ for (auto i = 0; i < n_fra; i++)\n+ this->noise[i].resize(fra_size);\n+\n+ if (fra_size == this->N)\n+ {\n+ for (auto i = 0; i < n_fra; i++)\n+ file.read(reinterpret_cast<char*>(&this->noise[i][0]), fra_size*sizeof(R));\n+ }\n+ else\n+ {\n+ std::cerr << bold_red(\"(EE) The frame size is wrong (read: \") << bold_red(std::to_string(fra_size))\n+ << bold_red(\", expected: \") << bold_red(std::to_string(this->N))\n+ << bold_red(\"), exiting.\") << std::endl;\n+ file.close();\n+ std::exit(-1);\n+ }\n+\n+ file.close();\n+ }\n+ else\n+ {\n+ std::cerr << bold_red(\"(EE) Can't open \\\"\") << bold_red(filename) << bold_red(\"\\\" file, exiting.\")\n+ << std::endl;\n+ std::exit(-1);\n+ }\n+}\n+\n+template <typename R>\n+Channel_user<R>\n+::~Channel_user()\n+{\n+}\n+\n+template <typename R>\n+void Channel_user<R>\n+::add_noise(const mipp::vector<R>& X_N, mipp::vector<R>& Y_N)\n+{\n+ assert((int)X_N.size() == this->N * this->n_frames);\n+\n+ for (auto f = 0; f < this->n_frames; f++)\n+ {\n+ for (auto i = 0; i < this->N; i++)\n+ Y_N[f * this->N +i] = this->noise[this->noise_counter][i];\n+// Y_N[f * this->N +i] = X_N[f * this->N +i] + this->noise[this->noise_counter][i];\n+\n+ this->noise_counter = (this->noise_counter +1) % (int)this->noise.size();\n+ }\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class Channel_user<R_32>;\n+template class Channel_user<R_64>;\n+#else\n+template class Channel_user<R>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Channel/User/Channel_user.hpp", "diff": "+#ifndef CHANNELS_USER_HPP_\n+#define CHANNELS_USER_HPP_\n+\n+#include <vector>\n+#include \"Tools/Perf/MIPP/mipp.h\"\n+\n+#include \"../Channel.hpp\"\n+\n+template <typename R>\n+class Channel_user : public Channel<R>\n+{\n+private:\n+ mipp::vector<mipp::vector<R>> noise;\n+ int noise_counter;\n+\n+public:\n+ Channel_user(const int N, const std::string filename, const int n_frames = 1,\n+ const std::string name = \"Channel_additive_user\");\n+ virtual ~Channel_user();\n+\n+ void add_noise(const mipp::vector<R>& X_N, mipp::vector<R>& Y_N);\n+};\n+\n+#endif /* CHANNELS_USER_HPP_ */\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Monitor.hpp", "new_path": "src/Module/Monitor/Monitor.hpp", "diff": "@@ -199,7 +199,7 @@ public:\n* \\param base_path: base path for files to write the bad frames.\n* \\param snr: the current SNR.\n*/\n- virtual void dump_bad_frames(const std::string& base_path, const float snr)\n+ virtual void dump_bad_frames(const std::string& base_path, const float snr, const mipp::vector<int>& itl_pi = mipp::vector<int>(0))\n{\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp", "new_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp", "diff": "@@ -60,12 +60,12 @@ int Monitor_reduction<B,R>\ntemplate <typename B, typename R>\nvoid Monitor_reduction<B,R>\n-::dump_bad_frames(const std::string& base_path, const float snr)\n+::dump_bad_frames(const std::string& base_path, const float snr, const mipp::vector<int>& itl_pi)\n{\n// get path and open them\n- std::string path_src, path_enc, path_noise;\n+ std::string path_src, path_enc, path_itl, path_noise;\n- get_tracker_paths(base_path, snr, path_src, path_enc, path_noise);\n+ get_tracker_paths(base_path, snr, path_src, path_enc, path_noise, path_itl);\nstd::ofstream file_src (path_src);\nstd::ofstream file_enc (path_enc);\n@@ -138,6 +138,25 @@ void Monitor_reduction<B,R>\nfor (unsigned f = 0; f < buff_noise.size(); f++)\nfile_noise.write(reinterpret_cast<char*>(&buff_noise[f][0]), buff_noise[f].size()*sizeof(R));\n}\n+\n+ // write interleaver table\n+ if (itl_pi.size())\n+ {\n+ std::ofstream file_itl(path_itl);\n+\n+ if (!file_itl.is_open())\n+ {\n+ std::cerr << bold_red(\"(EE) issue while trying to open error tracker log files ; check file name: \\\"\")\n+ << bold_red(base_path) << bold_red(\"\\\"\") << std::endl;\n+ std::exit(-1);\n+ }\n+\n+ assert(this->get_N() == (int)itl_pi.size());\n+ file_itl << itl_pi.size() << std::endl << std::endl; // write length of coded frames\n+\n+ for (unsigned b = 0; b < itl_pi.size(); b++)\n+ file_itl << itl_pi[b] << \" \";\n+ }\n}\ntemplate <typename B, typename R>\n@@ -164,8 +183,8 @@ bool Monitor_reduction<B,R>\ntemplate <typename B, typename R>\nvoid Monitor_reduction<B,R>\n-::get_tracker_paths(const std::string& base_path, const float snr,\n- std::string& path_src, std::string& path_enc, std::string& path_noise)\n+::get_tracker_paths(const std::string& base_path, const float snr, std::string& path_src,\n+ std::string& path_enc, std::string& path_noise, std::string& path_itl)\n{\nif (!check_path(base_path))\n{\n@@ -183,6 +202,7 @@ void Monitor_reduction<B,R>\npath_src = path_head + std::string(\".src\");\npath_enc = path_head + std::string(\".enc\");\n+ path_itl = path_head + std::string(\".itl\");\npath_noise = path_head + std::string(\".chn\");\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_reduction.hpp", "new_path": "src/Module/Monitor/Standard/Monitor_reduction.hpp", "diff": "#include <string>\n#include <vector>\n+#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"Monitor_std.hpp\"\ntemplate <typename B, typename R>\n@@ -22,11 +23,11 @@ public:\nint get_n_fe() const;\nint get_n_be() const;\n- void dump_bad_frames(const std::string& base_path, const float snr);\n+ void dump_bad_frames(const std::string& base_path, const float snr, const mipp::vector<int>& itl_pi = mipp::vector<int>(0));\nstatic bool check_path(const std::string& base_path); // return true if correct\n- static void get_tracker_paths(const std::string& base_path, const float snr,\n- std::string& path_src, std::string& path_enc, std::string& path_noise);\n+ static void get_tracker_paths(const std::string& base_path, const float snr, std::string& path_src,\n+ std::string& path_enc, std::string& path_noise, std::string& path_itl);\n};\n#endif /* MONITOR_REDUCTION_HPP_ */\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_std.cpp", "new_path": "src/Module/Monitor/Standard/Monitor_std.cpp", "diff": "@@ -154,7 +154,7 @@ void Monitor_std<B,R>\ntemplate <typename B, typename R>\nvoid Monitor_std<B,R>\n-::dump_bad_frames(const std::string& base_path, const float snr)\n+::dump_bad_frames(const std::string& base_path, const float snr, mipp::vector<int> itl_pi)\n{\nstd::cerr << bold_red(\"\\\"dump_bad_frames\\\" is not defined in \\\"Monitor_std\\\", please call this method on \")\n<< bold_red(\"\\\"Monitor_reduction\\\" instead.\")\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Standard/Monitor_std.hpp", "new_path": "src/Module/Monitor/Standard/Monitor_std.hpp", "diff": "@@ -45,7 +45,7 @@ public:\nfloat get_fer() const;\nfloat get_ber() const;\n- void dump_bad_frames(const std::string& base_path, const float snr);\n+ void dump_bad_frames(const std::string& base_path, const float snr, mipp::vector<int> itl_pi = mipp::vector<int>(0));\nconst std::vector<mipp::vector<B>> get_buff_src () const;\nconst std::vector<mipp::vector<B>> get_buff_enc () const;\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp", "new_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp", "diff": "@@ -121,9 +121,9 @@ void Simulation_BFER<B,R,Q>\n<< bold_yellow(\" Each bad frame may be played several times. Please run with an inter frame level of 1.\")\n<< std::endl;\n- std::string path_src, path_enc, path_noise;\n+ std::string path_src, path_enc, path_noise, path_itl;\nMonitor_reduction<B,R>::get_tracker_paths(this->params.monitor.err_track_path, this->snr,\n- path_src, path_enc, path_noise);\n+ path_src, path_enc, path_noise, path_itl);\n// dirty hack to override simulation params\nparameters *params_writable = const_cast<parameters*>(&this->params);\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFERI/Simulation_BFERI.cpp", "new_path": "src/Simulation/BFERI/Simulation_BFERI.cpp", "diff": "@@ -218,7 +218,7 @@ template <typename B, typename R, typename Q>\nInterleaver<int>* Simulation_BFERI_i<B,R,Q>\n::build_interleaver(const int tid)\n{\n- return Factory_interleaver<int>::build(params, params.code.N + params.code.tail_length, rd_engine_seed[tid]());\n+ return Factory_interleaver<int>::build(params, params.code.N + params.code.tail_length, params.simulation.seed);\n}\ntemplate <typename B, typename R, typename Q>\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp", "new_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp", "diff": "@@ -123,9 +123,9 @@ void Simulation_BFERI<B,R,Q>\n<< bold_yellow(\" Each bad frame may be played several times. Please run with an inter frame level of 1.\")\n<< std::endl;\n- std::string path_src, path_enc, path_noise;\n+ std::string path_src, path_enc, path_noise, path_itl;\nMonitor_reduction<B,R>::get_tracker_paths(this->params.monitor.err_track_path, this->snr,\n- path_src, path_enc, path_noise);\n+ path_src, path_enc, path_noise, path_itl);\n// dirty hack to override simulation params\nparameters *params_writable = const_cast<parameters*>(&this->params);\n@@ -133,6 +133,7 @@ void Simulation_BFERI<B,R,Q>\nparams_writable->source .path = path_src;\nparams_writable->encoder .path = path_enc;\nparams_writable->channel .path = path_noise;\n+ params_writable->interleaver.path = path_itl;\n}\n// launch a group of slave threads (there is \"n_threads -1\" slave threads)\n@@ -153,7 +154,7 @@ void Simulation_BFERI<B,R,Q>\n}\nif (this->params.monitor.err_track_enable)\n- monitor_red->dump_bad_frames(this->params.monitor.err_track_path, this->snr);\n+ monitor_red->dump_bad_frames(this->params.monitor.err_track_path, this->snr, this->interleaver[0]->get_lookup_table());\n}\ntemplate <typename B, typename R, typename Q>\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Factory/Factory_channel.cpp", "new_path": "src/Tools/Factory/Factory_channel.cpp", "diff": "#include \"Module/Channel/NO/Channel_NO.hpp\"\n+#include \"Module/Channel/User/Channel_user.hpp\"\n#include \"Module/Channel/Additive/User/Channel_additive_user.hpp\"\n#include \"Module/Channel/Additive/AWGN/Standard/Channel_AWGN_std_LR.hpp\"\n#include \"Module/Channel/Additive/AWGN/Standard/Channel_AWGN_std_LLR.hpp\"\n@@ -71,10 +72,14 @@ Channel<R>* Factory_channel<R>\n{\nchannel = new Channel_NO<R>(size);\n}\n- else if (params.channel.type == \"USER\")\n+ else if (params.channel.type == \"ADD_USER\")\n{\nchannel = new Channel_additive_user<R>(size, params.channel.path);\n}\n+ else if (params.channel.type == \"USER\")\n+ {\n+ channel = new Channel_user<R>(size, params.channel.path);\n+ }\nreturn channel;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
add a channel user next to the channel additive user because the saved noise is not precise enough; we need to the the directly product noise
8,490
25.02.2017 15:26:46
-3,600
983ca8a63b1c8ec279cd137226779aa168f7385d
Fix the SystemC simulations (BFER & BFERI).
[ { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/SystemC/SC_Simulation_BFER.cpp", "new_path": "src/Simulation/BFER/SystemC/SC_Simulation_BFER.cpp", "diff": "@@ -339,7 +339,7 @@ template <typename B, typename R, typename Q>\nTerminal* Simulation_BFER<B,R,Q>\n::build_terminal()\n{\n- return Factory_terminal<B,R>::build(this->params, this->snr, this->monitor[0], this->t_snr);\n+ return Factory_terminal<B,R>::build(this->params, this->snr_s, this->snr_b, this->monitor[0], this->t_snr);\n}\ntemplate <typename B, typename R, typename Q>\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/SystemC/SC_Simulation_BFER.hpp", "new_path": "src/Simulation/BFER/SystemC/SC_Simulation_BFER.hpp", "diff": "@@ -29,7 +29,7 @@ private:\nstd::condition_variable cond_terminal;\nprotected:\n- Terminal *terminal;\n+ tools::Terminal *terminal;\ntools::SC_Duplicator *duplicator[3];\ntools::SC_Debug<B> *dbg_B [6];\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFERI/SystemC/SC_Simulation_BFERI.cpp", "new_path": "src/Simulation/BFERI/SystemC/SC_Simulation_BFERI.cpp", "diff": "@@ -412,7 +412,7 @@ template <typename B, typename R, typename Q>\nTerminal* Simulation_BFERI<B,R,Q>\n::build_terminal(const int tid)\n{\n- return Factory_terminal<B,R>::build(this->params, this->snr, this->monitor[0], this->t_snr);\n+ return Factory_terminal<B,R>::build(this->params, this->snr_s, this->snr_b, this->monitor[0], this->t_snr);\n}\ntemplate <typename B, typename R, typename Q>\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFERI/SystemC/SC_Simulation_BFERI.hpp", "new_path": "src/Simulation/BFERI/SystemC/SC_Simulation_BFERI.hpp", "diff": "@@ -29,7 +29,7 @@ private:\nstd::condition_variable cond_terminal;\nprotected:\n- tools::Interleaver<int> *interleaver_e;\n+ module::Interleaver<int> *interleaver_e;\nmodule::Coset<B,Q> *coset_real_i;\ntools::Terminal *terminal;\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the SystemC simulations (BFER & BFERI).