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,488
09.07.2019 09:52:55
-7,200
8efa6de9e955347f19bce383ad4f75f7ed0f436f
Test dev ppa.
[ { "change_type": "MODIFY", "old_path": "ci/deploy-upload-ppa.sh", "new_path": "ci/deploy-upload-ppa.sh", "diff": "@@ -45,7 +45,7 @@ then\nDPUT_HOST=\"ppa:aff3ct/aff3ct-stable\"\nelif [ \"$GIT_BRANCH\" = \"ppa_upload\" ]\nthen\n- DPUT_HOST=\"ppa:aff3ct/aff3ct\"\n+ DPUT_HOST=\"ppa:aff3ct/aff3ct-dev\"\nelse\necho \"Deploy upload ppa must be run only on master or development branch.\"\nexit 1\n" } ]
C++
MIT License
aff3ct/aff3ct
Test dev ppa.
8,488
09.07.2019 11:22:32
-7,200
5d3df476005d4a1ad78d72e1bcd796547f8c76a1
Lighten artifacts for ppa_upload deploy stage.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -1247,7 +1247,6 @@ deploy-upload-ppa:\nname: ppa_files\nwhen: always\npaths:\n- - build/Debian/xenial/*.gz\n- build/Debian/xenial/*.xz\n- build/Debian/xenial/*.dsc\n- build/Debian/xenial/*.build\n" } ]
C++
MIT License
aff3ct/aff3ct
Lighten artifacts for ppa_upload deploy stage.
8,488
09.07.2019 14:52:55
-7,200
6eebe580c340b23ff73db8f9383baf9a85a0ce09
Fix ppa_upload job to be done only on gitla.com.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -1232,6 +1232,7 @@ deploy-upload-ppa:\n- schedules\ndependencies:\n- documentation-sphinx\n+ allow_failure: true\ntags:\n- linux\n- gcc\n" }, { "change_type": "MODIFY", "old_path": "ci/deploy-upload-ppa.sh", "new_path": "ci/deploy-upload-ppa.sh", "diff": "#!/bin/bash\nset -x\n+if [[ ( -z \"$CI_AFF3CT_DEPLOY\" ) || ( \"$CI_AFF3CT_DEPLOY\" != \"ON\" ) ]]\n+then\n+ echo \"This job is disabled, try to set the CI_AFF3CT_DEPLOY environment variable to 'ON' to enable it.\"\n+ exit 1\n+fi\n+\ncmake --version\nmkdir build\nmv doc/sphinx/build doc/sphinx/built\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix ppa_upload job to be done only on gitla.com.
8,488
10.07.2019 11:43:17
-7,200
5076c9fc1574363921bb0a584d36eda5c89d3c1e
Disable external strings on ppa build.
[ { "change_type": "MODIFY", "old_path": "cmake/Modules/UploadPPA.cmake", "new_path": "cmake/Modules/UploadPPA.cmake", "diff": "@@ -103,7 +103,7 @@ foreach(DISTRI ${AFF3CT_PPA_DISTRIB})\n\"\\tdh $@ --buildsystem=cmake\\n\"\n\"\\noverride_dh_auto_configure:\\n\"\n\"\\tDESTDIR=\\\"$(CURDIR)\\\" dh_auto_configure\"\n- \" -- -DCMAKE_BUILD_TYPE=Release -DAFF3CT_COMPILE_SHARED_LIB=ON \"\n+ \" -- -DCMAKE_BUILD_TYPE=Release -DAFF3CT_COMPILE_SHARED_LIB=ON -DAFF3CT_EXT_STRINGS=OFF\"\n\"-DAFF3CT_OVERRIDE_VERSION=${GIT_VERSION} -DCMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'\"\n\"\\n\\noverride_dh_auto_install:\\n\"\n\"\\tdh_auto_install --destdir=\\\"$(CURDIR)\\\" --buildsystem=cmake\"\n" } ]
C++
MIT License
aff3ct/aff3ct
Disable external strings on ppa build.
8,490
11.07.2019 16:16:38
-7,200
e401e013c5edad71f2e22f373e2c2f8e6017e213
Doc: working on library examples.
[ { "change_type": "MODIFY", "old_path": "doc/sphinx/source/user/library/library.rst", "new_path": "doc/sphinx/source/user/library/library.rst", "diff": "@@ -15,6 +15,8 @@ calculated from 0.0 dB to 10.0 dB with a 1.0 dB step.\nSimulated communication chain.\n+.. _user_library_bootstrap:\n+\nBootstrap\n=========\n@@ -22,10 +24,8 @@ The `bootstrap` example is the most simple way to use |AFF3CT|, it is based on\n``C++`` classes and methods that operate on buffers: it is a good point to\nstart. Keep in mind that this is the most simple way to use |AFF3CT| but not the\nmost powerful. More advanced features like benchmarking, debugging, command line\n-interface and more are available in the ``tasks`` and ``factory`` examples.\n-The :numref:`fig_simple_chain_code` illustrates the source code: the\n-green boxes are the classes, the blue boxes are the methods and the arrows are\n-the buffers.\n+interface and more are available in the :ref:`user_library_tasks` and\n+:ref:`user_library_factory` examples.\n.. _fig_simple_chain_code:\n@@ -34,6 +34,9 @@ the buffers.\nSimulated communication chain: classes and methods.\n+The :numref:`fig_simple_chain_code` illustrates the source code: the green boxes\n+are the classes, the blue boxes are the methods and the arrows are the buffers.\n+\n.. code-block:: cpp\n:caption: Bootstrap: main function\n:name: lst_bootstrap_main\n@@ -44,10 +47,10 @@ the buffers.\nint main(int argc, char** argv)\n{\n- auto p = init_params ( ); // get parameters defined by the user\n- auto m = init_modules(p); // create the AFF3CT modules\n- auto b = init_buffers(p); // create the buffers required by the AFF3CT modules\n- auto u = init_utils (m); // create the AFF3CT utils\n+ params p; init_params (p ); // create and initialize the parameters defined by the user\n+ modules m; init_modules(p, m); // create and initialize the modules\n+ buffers b; init_buffers(p, b); // create and initialize the buffers required by the modules\n+ utils u; init_utils (m, u); // create and initialize the utils\n// display the legend in the terminal\nu.terminal->legend();\n@@ -69,7 +72,7 @@ the buffers.\nu.terminal->start_temp_report();\n// run the simulation chain\n- while (!m.monitor->fe_limit_achieved() && !u.terminal->is_interrupt())\n+ while (!m.monitor->fe_limit_achieved())\n{\nm.source ->generate ( b.ref_bits );\nm.encoder->encode (b.ref_bits, b.enc_bits );\n@@ -116,31 +119,19 @@ those templates are ``int32_t`` or ``float``.\nstruct params\n{\n- int K; // the number of information bits\n- int N; // the codeword size\n- int fe; // the number of frame errors\n- int seed; // the PRNG seed for AWGN channel\n+ int K = 32; // the number of information bits\n+ int N = 128; // the codeword size\n+ int fe = 100; // the number of frame errors\n+ int seed = 0; // the PRNG seed for the AWGN channel\n+ float ebn0_min = 0.00f; // the minimum SNR value\n+ float ebn0_max = 10.01f; // the maximum SNR value\n+ float ebn0_step = 1.00f; // the SNR step\nfloat R; // the code rate (R=K/N)\n- float ebn0_min; // the minimum SNR value\n- float ebn0_max; // the maximum SNR value\n- float ebn0_step; // the SNR step\n};\n- params init_params()\n+ void init_params(params &p)\n{\n- params p;\n-\n- p.K = 32;\n- p.N = 128;\n- p.fe = 100;\n- p.seed = 0;\n- p.ebn0_min = 0.00f;\n- p.ebn0_max = 10.01f;\n- p.ebn0_step = 1.00f;\n-\np.R = (float)p.K / (float)p.N;\n-\n- return p;\n}\nThe :numref:`lst_bootstrap_params` describes the simulation parameters.\n@@ -160,24 +151,21 @@ The :numref:`lst_bootstrap_params` describes the simulation parameters.\nstd::unique_ptr<module::Monitor_BFER<>> monitor;\n};\n- modules init_modules(const params &p)\n+ void init_modules(const params &p, modules &m)\n{\n- modules m;\n-\nm.source = std::unique_ptr<module::Source_random <>>(new module::Source_random <>(p.K ));\nm.encoder = std::unique_ptr<module::Encoder_repetition_sys<>>(new module::Encoder_repetition_sys<>(p.K, p.N ));\nm.modem = std::unique_ptr<module::Modem_BPSK <>>(new module::Modem_BPSK <>(p.N ));\nm.channel = std::unique_ptr<module::Channel_AWGN_LLR <>>(new module::Channel_AWGN_LLR <>(p.N, p.seed));\nm.decoder = std::unique_ptr<module::Decoder_repetition_std<>>(new module::Decoder_repetition_std<>(p.K, p.N ));\nm.monitor = std::unique_ptr<module::Monitor_BFER <>>(new module::Monitor_BFER <>(p.K, p.fe ));\n-\n- return m;\n};\nThe :numref:`lst_bootstrap_modules` allocates the modules of the communication\nchain. Those modules are allocated on the heap and manage by smart pointers\n-(``std::unique_ptr``). Not that the ``init_modules`` function takes a ``params``\n-structure in parameters. These parameters are used to build the modules.\n+(``std::unique_ptr``). Not that the ``init_modules`` function takes a\n+``params`` structure in parameters. These parameters are used to build the\n+modules.\n.. code-block:: cpp\n:caption: Bootstrap: buffers\n@@ -194,18 +182,14 @@ structure in parameters. These parameters are used to build the modules.\nstd::vector<int > dec_bits;\n};\n- buffers init_buffers(const params &p)\n+ void init_buffers(const params &p, buffers &b)\n{\n- buffers b;\n-\nb.ref_bits = std::vector<int >(p.K);\nb.enc_bits = std::vector<int >(p.N);\nb.symbols = std::vector<float>(p.N);\nb.noisy_symbols = std::vector<float>(p.N);\nb.LLRs = std::vector<float>(p.N);\nb.dec_bits = std::vector<int >(p.K);\n-\n- return b;\n}\nThe :numref:`lst_bootstrap_buffers` allocates the buffers of the communication\n@@ -226,10 +210,8 @@ function.\nstd::unique_ptr<tools::Terminal_std> terminal; // manage the output text in the terminal\n};\n- utils init_utils(const modules &m)\n+ void init_utils(const modules &m, utils &u)\n{\n- utils u;\n-\n// create a sigma noise type\nu.noise = std::unique_ptr<tools::Sigma<>>(new tools::Sigma<>());\n// report the noise values (Es/N0 and Eb/N0)\n@@ -240,8 +222,6 @@ function.\nu.reporters.push_back(std::unique_ptr<tools::Reporter>(new tools::Reporter_throughput<>(*m.monitor)));\n// create a terminal that will display the collected data from the reporters\nu.terminal = std::unique_ptr<tools::Terminal_std>(new tools::Terminal_std(u.reporters));\n-\n- return u;\n}\n|AFF3CT| comes with useful tools, the ``init_utils`` function allocate some of\n@@ -279,6 +259,8 @@ If you run the `bootstrap` example the expected output is shown by\n2.98 | 9.00 || 93840 | 100 | 100 | 3.33e-05 | 1.07e-03 || 5.418 | 00h00'00\n3.98 | 10.00 || 866433 | 100 | 100 | 3.61e-06 | 1.15e-04 || 4.931 | 00h00'05\n+.. _user_library_tasks:\n+\nTasks\n=====\n@@ -294,16 +276,17 @@ of ``Socket``.\n:linenos:\n:caption: Tasks: main function\n:name: lst_tasks_main\n- :emphasize-lines: 13-21,42-48,59-60\n+ :emphasize-lines: 8,14-22,43-49,60-61\n#include <aff3ct.hpp>\nusing namespace aff3ct;\nint main(int argc, char** argv)\n{\n- auto p = init_params ( ); // get parameters defined by the user\n- auto m = init_modules(p); // create the AFF3CT modules\n- auto u = init_utils (m); // create the AFF3CT utils\n+ params p; init_params (p ); // create and initialize the parameters defined by the user\n+ modules m; init_modules(p, m); // create and initialize the modules\n+ // the 'init_buffers' function is not required anymore\n+ utils u; init_utils (m, u); // create and initialize the utils\n// display the legend in the terminal\nu.terminal->legend();\n@@ -335,7 +318,7 @@ of ``Socket``.\nu.terminal->start_temp_report();\n// run the simulation chain\n- while (!m.monitor->fe_limit_achieved() && !u.terminal->is_interrupt())\n+ while (!m.monitor->fe_limit_achieved())\n{\n(*m.source )[src::tsk::generate ].exec();\n(*m.encoder)[enc::tsk::encode ].exec();\n@@ -364,7 +347,7 @@ of ``Socket``.\n:linenos:\n:caption: Tasks: modules\n:name: lst_tasks_modules\n- :emphasize-lines: 10,24-39\n+ :emphasize-lines: 9,21-36\nstruct modules\n{\n@@ -374,14 +357,11 @@ of ``Socket``.\nstd::unique_ptr<module::Channel_AWGN_LLR<>> channel;\nstd::unique_ptr<module::Decoder_repetition_std<>> decoder;\nstd::unique_ptr<module::Monitor_BFER<>> monitor;\n-\n- std::vector<const module::Module*> list;\n+ std::vector<const module::Module*> list; // the list of module pointers declared in this structure\n};\n- modules init_modules(const params &p)\n+ void init_modules(const params &p, modules &m)\n{\n- modules m;\n-\nm.source = std::unique_ptr<module::Source_random <>>(new module::Source_random <>(p.K ));\nm.encoder = std::unique_ptr<module::Encoder_repetition_sys<>>(new module::Encoder_repetition_sys<>(p.K, p.N ));\nm.modem = std::unique_ptr<module::Modem_BPSK <>>(new module::Modem_BPSK <>(p.N ));\n@@ -405,9 +385,7 @@ of ``Socket``.\nif (!tsk->is_debug() && !tsk->is_stats())\ntsk->set_fast(true);\n}\n-\n- return m;\n- };\n+ }\nLines ``68-81``, each ``Module`` is parsed to get its tasks, each ``Task`` is\nconfigured to automatically allocate its output memory (line ``72``) and make\n@@ -422,6 +400,102 @@ input socket ``U_K`` of the ``encode`` task (``Encoder`` module).\nOnce the binding is made the tasks can be executed lines ``110-119`` with the\n``exec`` method.\n+.. _user_library_systemc:\n+\n+SystemC/TLM\n+===========\n+\n+Alternatively, the AFF3CT modules support TLM interfaces, the ``systemc``\n+example illustrates this feature.\n+\n+.. code-block:: cpp\n+ :caption: SystemC/TLM: main function\n+ :name: lst_systemc_main\n+ :emphasize-lines: 13-18,33-54,59-61,70-72\n+ :linenos:\n+\n+ #include <aff3ct.hpp>\n+ using namespace aff3ct;\n+\n+ int sc_main(int argc, char** argv)\n+ {\n+ params p; init_params (p ); // create and initialize the parameters defined by the user\n+ modules m; init_modules(p, m); // create and initialize the modules\n+ utils u; init_utils (m, u); // create and initialize the utils\n+\n+ // display the legend in the terminal\n+ u.terminal->legend();\n+\n+ // add a callback to the monitor to call the \"sc_core::sc_stop()\" function\n+ m.monitor->add_handler_check([&m, &u]() -> void\n+ {\n+ if (m.monitor->fe_limit_achieved())\n+ sc_core::sc_stop();\n+ });\n+\n+ // a loop over the various SNRs\n+ for (auto ebn0 = p.ebn0_min; ebn0 < p.ebn0_max; ebn0 += p.ebn0_step)\n+ {\n+ // compute the current sigma for the channel noise\n+ const auto esn0 = tools::ebn0_to_esn0 (ebn0, p.R);\n+ const auto sigma = tools::esn0_to_sigma(esn0 );\n+\n+ u.noise->set_noise(sigma, ebn0, esn0);\n+\n+ // update the sigma of the modem and the channel\n+ m.modem ->set_noise(*u.noise);\n+ m.channel->set_noise(*u.noise);\n+\n+ // create \"sc_core::sc_module\" instances for each task\n+ using namespace module;\n+ m.source ->sc.create_module(+src::tsk::generate );\n+ m.encoder->sc.create_module(+enc::tsk::encode );\n+ m.modem ->sc.create_module(+mdm::tsk::modulate );\n+ m.modem ->sc.create_module(+mdm::tsk::demodulate );\n+ m.channel->sc.create_module(+chn::tsk::add_noise );\n+ m.decoder->sc.create_module(+dec::tsk::decode_siho );\n+ m.monitor->sc.create_module(+mnt::tsk::check_errors);\n+\n+ // declare a SystemC duplicator to duplicate the source 'generate' task output\n+ tools::SC_Duplicator duplicator;\n+\n+ // bind the sockets between the modules\n+ m.source ->sc[+src::tsk::generate ].s_out[+src::sck::generate ::U_K ](duplicator .s_in );\n+ duplicator .s_out1 (m.monitor->sc[+mnt::tsk::check_errors].s_in[+mnt::sck::check_errors::U ]);\n+ duplicator .s_out2 (m.encoder->sc[+enc::tsk::encode ].s_in[+enc::sck::encode ::U_K ]);\n+ m.encoder->sc[+enc::tsk::encode ].s_out[+enc::sck::encode ::X_N ](m.modem ->sc[+mdm::tsk::modulate ].s_in[+mdm::sck::modulate ::X_N1]);\n+ m.modem ->sc[+mdm::tsk::modulate ].s_out[+mdm::sck::modulate ::X_N2](m.channel->sc[+chn::tsk::add_noise ].s_in[+chn::sck::add_noise ::X_N ]);\n+ m.channel->sc[+chn::tsk::add_noise ].s_out[+chn::sck::add_noise ::Y_N ](m.modem ->sc[+mdm::tsk::demodulate ].s_in[+mdm::sck::demodulate ::Y_N1]);\n+ m.modem ->sc[+mdm::tsk::demodulate ].s_out[+mdm::sck::demodulate ::Y_N2](m.decoder->sc[+dec::tsk::decode_siho ].s_in[+dec::sck::decode_siho ::Y_N ]);\n+ m.decoder->sc[+dec::tsk::decode_siho].s_out[+dec::sck::decode_siho::V_K ](m.monitor->sc[+mnt::tsk::check_errors].s_in[+mnt::sck::check_errors::V ]);\n+\n+ // display the performance (BER and FER) in real time (in a separate thread)\n+ u.terminal->start_temp_report();\n+\n+ // start the SystemC simulation\n+ sc_core::sc_report_handler::set_actions(sc_core::SC_INFO, sc_core::SC_DO_NOTHING);\n+ sc_core::sc_start();\n+\n+ // display the performance (BER and FER) in the terminal\n+ u.terminal->final_report();\n+\n+ // reset the monitor and the terminal for the next SNR\n+ m.monitor->reset();\n+ u.terminal->reset();\n+\n+ // dirty way to create a new SystemC simulation context\n+ sc_core::sc_curr_simcontext = new sc_core::sc_simcontext();\n+ sc_core::sc_default_global_context = sc_core::sc_curr_simcontext;\n+ }\n+\n+ // display the statistics of the tasks (if enabled)\n+ tools::Stats::show(m.list, true);\n+\n+ return 0;\n+ }\n+\n+.. _user_library_factory:\n+\nFactory\n=======\n@@ -450,9 +524,9 @@ code types).\nint main(int argc, char** argv)\n{\n- auto p = init_params (argc, argv); // initialize the params from the command line with factories\n- auto m = init_modules(p ); // create the AFF3CT modules\n- auto u = init_utils (p, m ); // create the AFF3CT utils\n+ params p; init_params (argc, argv, p); // create and initialize the parameters from the command line with factories\n+ modules m; init_modules(p, m ); // create and initialize the modules\n+ utils u; init_utils (p, m, u ); // create and initialize the utils\n// [...]\n@@ -462,28 +536,26 @@ code types).\n.. code-block:: cpp\n:caption: Factory: parameters\n:name: lst_factory_params\n- :emphasize-lines: 3-8,20-25,31-49\n+ :emphasize-lines: 8-13,18-43\n:linenos:\nstruct params\n{\n+ float ebn0_min = 0.00f; // the minimum SNR value\n+ float ebn0_max = 10.01f; // the maximum SNR value\n+ float ebn0_step = 1.00f; // the SNR step\n+ float R; // the code rate (R=K/N)\n+\nstd::unique_ptr<factory::Source ::parameters> source;\nstd::unique_ptr<factory::Codec_repetition::parameters> codec;\nstd::unique_ptr<factory::Modem ::parameters> modem;\nstd::unique_ptr<factory::Channel ::parameters> channel;\nstd::unique_ptr<factory::Monitor_BFER ::parameters> monitor;\nstd::unique_ptr<factory::Terminal ::parameters> terminal;\n-\n- float R; // the code rate (R=K/N)\n- float ebn0_min; // min SNR value\n- float ebn0_max; // max SNR value\n- float ebn0_step; // SNR step\n};\n- params init_params(int argc, char** argv)\n+ void init_params(int argc, char** argv, params &p)\n{\n- params p;\n-\np.source = std::unique_ptr<factory::Source ::parameters>(new factory::Source ::parameters());\np.codec = std::unique_ptr<factory::Codec_repetition::parameters>(new factory::Codec_repetition::parameters());\np.modem = std::unique_ptr<factory::Modem ::parameters>(new factory::Modem ::parameters());\n@@ -491,10 +563,6 @@ code types).\np.monitor = std::unique_ptr<factory::Monitor_BFER ::parameters>(new factory::Monitor_BFER ::parameters());\np.terminal = std::unique_ptr<factory::Terminal ::parameters>(new factory::Terminal ::parameters());\n- p.ebn0_min = 0.00f;\n- p.ebn0_max = 10.01f;\n- p.ebn0_step = 1.00f;\n-\nstd::vector<factory::Factory::parameters*> params_list = { p.source .get(), p.codec .get(), p.modem .get(),\np.channel.get(), p.monitor.get(), p.terminal.get() };\n@@ -514,14 +582,12 @@ code types).\ncp.print_warnings();\np.R = (float)p.codec->enc->K / (float)p.codec->enc->N_cw; // compute the code rate\n-\n- return p;\n}\n.. code-block:: cpp\n:caption: Factory: modules\n:name: lst_factory_modules\n- :emphasize-lines: 8-9,18-24\n+ :emphasize-lines: 4,8-9,15-23\n:linenos:\nstruct modules\n@@ -533,14 +599,11 @@ code types).\nstd::unique_ptr<module::Monitor_BFER<>> monitor;\nmodule::Encoder<>* encoder;\nmodule::Decoder_SIHO<>* decoder;\n-\n- std::vector<const module::Module*> list;\n+ std::vector<const module::Module*> list; // the list of module pointers declared in this structure\n};\n- modules init_modules(const params &p)\n+ void init_modules(const params &p, modules &m)\n{\n- modules m;\n-\nm.source = std::unique_ptr<module::Source <>>(p.source ->build());\nm.codec = std::unique_ptr<module::Codec_SIHO <>>(p.codec ->build());\nm.modem = std::unique_ptr<module::Modem <>>(p.modem ->build());\n@@ -566,13 +629,22 @@ code types).\ntsk->set_fast(true);\n}\n- return m;\n- };\n+ // reset the memory of the decoder after the end of each communication\n+ m.monitor->add_handler_check(std::bind(&module::Decoder::reset, m.decoder));\n+\n+ // initialize the interleaver if this code use an interleaver\n+ try\n+ {\n+ auto& interleaver = m.codec->get_interleaver();\n+ interleaver->init();\n+ }\n+ catch (const std::exception&) { /* do nothing if there is no interleaver */ }\n+ }\n.. code-block:: cpp\n:caption: Factory: utils\n:name: lst_factory_utils\n- :emphasize-lines: 8,21\n+ :emphasize-lines: 8,19\n:linenos:\nstruct utils\n@@ -582,10 +654,8 @@ code types).\nstd::unique_ptr<tools::Terminal> terminal; // manage the output text in the terminal\n};\n- utils init_utils(const params &p, const modules &m)\n+ void init_utils(const params &p, const modules &m, utils &u)\n{\n- utils u;\n-\n// create a sigma noise type\nu.noise = std::unique_ptr<tools::Sigma<>>(new tools::Sigma<>());\n// report the noise values (Es/N0 and Eb/N0)\n@@ -596,40 +666,52 @@ code types).\nu.reporters.push_back(std::unique_ptr<tools::Reporter>(new tools::Reporter_throughput<>(*m.monitor)));\n// create a terminal that will display the collected data from the reporters\nu.terminal = std::unique_ptr<tools::Terminal>(p.terminal->build(u.reporters));\n-\n- return u;\n}\n-SystemC/TLM\n-===========\n+.. _user_library_openmp:\n-Alternatively, the AFF3CT modules support TLM interfaces, the ``systemc``\n-example illustrates this feature.\n+OpenMP\n+======\n.. code-block:: cpp\n- :caption: SystemC/TLM: main function\n- :name: lst_systemc_main\n- :emphasize-lines: 13-18,33-54,59-61,70-72\n+ :caption: OpenMP: main function\n+ :name: lst_factory_main\n+ :emphasize-lines: 4,6,8,10-13,15,17-18,42,49,65-67,69-70,76,81\n:linenos:\n- #include <aff3ct.hpp>\n- using namespace aff3ct;\n+ int main(int argc, char** argv)\n+ {\n+ params p; init_params(argc, argv, p); // create and initialize the parameters from the command line with factories\n+ utils u; // create an 'utils' structure\n- int sc_main(int argc, char** argv)\n+ #pragma omp parallel\n{\n- auto p = init_params ( ); // get parameters defined by the user\n- auto m = init_modules(p); // create the AFF3CT modules\n- auto u = init_utils (m); // create the AFF3CT utils\n+ #pragma omp single\n+ {\n+ // get the number of available threads from OpenMP\n+ const size_t n_threads = (size_t)omp_get_num_threads();\n+ u.monitors.resize(n_threads);\n+ u.modules .resize(n_threads);\n+ }\n+ modules m; init_modules_and_utils(p, m, u); // create and initialize the modules and initialize a part of the utils\n+\n+ #pragma omp barrier\n+ #pragma omp single\n+ {\n+ init_utils(p, u); // finalize the utils initialization\n// display the legend in the terminal\nu.terminal->legend();\n-\n- // add a callback to the monitor to call the \"sc_core::sc_stop()\" function\n- m.monitor->add_handler_check([&m, &u]() -> void\n- {\n- if (m.monitor->fe_limit_achieved() || u.terminal->is_interrupt())\n- sc_core::sc_stop();\n- });\n+ }\n+ // sockets binding (connect the sockets of the tasks = fill the input sockets with the output sockets)\n+ using namespace module;\n+ (*m.encoder)[enc::sck::encode ::U_K ].bind((*m.source )[src::sck::generate ::U_K ]);\n+ (*m.modem )[mdm::sck::modulate ::X_N1].bind((*m.encoder)[enc::sck::encode ::X_N ]);\n+ (*m.channel)[chn::sck::add_noise ::X_N ].bind((*m.modem )[mdm::sck::modulate ::X_N2]);\n+ (*m.modem )[mdm::sck::demodulate ::Y_N1].bind((*m.channel)[chn::sck::add_noise ::Y_N ]);\n+ (*m.decoder)[dec::sck::decode_siho ::Y_N ].bind((*m.modem )[mdm::sck::demodulate ::Y_N2]);\n+ (*m.monitor)[mnt::sck::check_errors::U ].bind((*m.encoder)[enc::sck::encode ::U_K ]);\n+ (*m.monitor)[mnt::sck::check_errors::V ].bind((*m.decoder)[dec::sck::decode_siho::V_K ]);\n// a loop over the various SNRs\nfor (auto ebn0 = p.ebn0_min; ebn0 < p.ebn0_max; ebn0 += p.ebn0_step)\n@@ -638,56 +720,144 @@ example illustrates this feature.\nconst auto esn0 = tools::ebn0_to_esn0 (ebn0, p.R);\nconst auto sigma = tools::esn0_to_sigma(esn0 );\n+ #pragma omp single\nu.noise->set_noise(sigma, ebn0, esn0);\n// update the sigma of the modem and the channel\nm.modem ->set_noise(*u.noise);\nm.channel->set_noise(*u.noise);\n- // create \"sc_core::sc_module\" instances for each task\n- using namespace module;\n- m.source ->sc.create_module(+src::tsk::generate );\n- m.encoder->sc.create_module(+enc::tsk::encode );\n- m.modem ->sc.create_module(+mdm::tsk::modulate );\n- m.modem ->sc.create_module(+mdm::tsk::demodulate );\n- m.channel->sc.create_module(+chn::tsk::add_noise );\n- m.decoder->sc.create_module(+dec::tsk::decode_siho );\n- m.monitor->sc.create_module(+mnt::tsk::check_errors);\n-\n- // declare a SystemC duplicator to duplicate the source module output\n- tools::SC_Duplicator duplicator;\n-\n- // bind the sockets between the modules\n- m.source ->sc[+src::tsk::generate ].s_out[+src::sck::generate ::U_K ](duplicator .s_in );\n- duplicator .s_out1 (m.monitor->sc[+mnt::tsk::check_errors].s_in[+mnt::sck::check_errors::U ]);\n- duplicator .s_out2 (m.encoder->sc[+enc::tsk::encode ].s_in[+enc::sck::encode ::U_K ]);\n- m.encoder->sc[+enc::tsk::encode ].s_out[+enc::sck::encode ::X_N ](m.modem ->sc[+mdm::tsk::modulate ].s_in[+mdm::sck::modulate ::X_N1]);\n- m.modem ->sc[+mdm::tsk::modulate ].s_out[+mdm::sck::modulate ::X_N2](m.channel->sc[+chn::tsk::add_noise ].s_in[+chn::sck::add_noise ::X_N ]);\n- m.channel->sc[+chn::tsk::add_noise ].s_out[+chn::sck::add_noise ::Y_N ](m.modem ->sc[+mdm::tsk::demodulate ].s_in[+mdm::sck::demodulate ::Y_N1]);\n- m.modem ->sc[+mdm::tsk::demodulate ].s_out[+mdm::sck::demodulate ::Y_N2](m.decoder->sc[+dec::tsk::decode_siho ].s_in[+dec::sck::decode_siho ::Y_N ]);\n- m.decoder->sc[+dec::tsk::decode_siho].s_out[+dec::sck::decode_siho::V_K ](m.monitor->sc[+mnt::tsk::check_errors].s_in[+mnt::sck::check_errors::V ]);\n-\n+ #pragma omp single\n// display the performance (BER and FER) in real time (in a separate thread)\nu.terminal->start_temp_report();\n- // start the SystemC simulation\n- sc_core::sc_report_handler::set_actions(sc_core::SC_INFO, sc_core::SC_DO_NOTHING);\n- sc_core::sc_start();\n+ // run the simulation chain\n+ while (!u.monitor_red->is_done_all())\n+ {\n+ (*m.source )[src::tsk::generate ].exec();\n+ (*m.encoder)[enc::tsk::encode ].exec();\n+ (*m.modem )[mdm::tsk::modulate ].exec();\n+ (*m.channel)[chn::tsk::add_noise ].exec();\n+ (*m.modem )[mdm::tsk::demodulate ].exec();\n+ (*m.decoder)[dec::tsk::decode_siho ].exec();\n+ (*m.monitor)[mnt::tsk::check_errors].exec();\n+ }\n+\n+ // need to wait all the threads here before to reset the 'monitors' and 'terminal' states\n+ #pragma omp barrier\n+ #pragma omp single\n+ {\n+ // final reduction\n+ u.monitor_red->is_done_all(true, true);\n// display the performance (BER and FER) in the terminal\nu.terminal->final_report();\n// reset the monitor and the terminal for the next SNR\n- m.monitor->reset();\n+ u.monitor_red->reset_all();\nu.terminal->reset();\n-\n- // dirty way to create a new SystemC simulation context\n- sc_core::sc_curr_simcontext = new sc_core::sc_simcontext();\n- sc_core::sc_default_global_context = sc_core::sc_curr_simcontext;\n+ }\n}\n+ #pragma omp single\n+ {\n// display the statistics of the tasks (if enabled)\n- tools::Stats::show(m.list, true);\n-\n+ tools::Stats::show(u.modules_stats, true);\n+ }\n+ }\nreturn 0;\n}\n+\n+.. code-block:: cpp\n+ :caption: OpenMP: modules and utils\n+ :name: lst_factory_modules_utils\n+ :emphasize-lines: 18-21,26-31,37-38,43\n+ :linenos:\n+\n+ struct modules\n+ {\n+ std::unique_ptr<module::Source<>> source;\n+ std::unique_ptr<module::Codec_SIHO<>> codec;\n+ std::unique_ptr<module::Modem<>> modem;\n+ std::unique_ptr<module::Channel<>> channel;\n+ module::Monitor_BFER<>* monitor;\n+ module::Encoder<>* encoder;\n+ module::Decoder_SIHO<>* decoder;\n+ std::vector<const module::Module*> list; // the list of module pointers declared in this structure\n+ };\n+\n+ struct utils\n+ {\n+ std::unique_ptr<tools::Sigma<>> noise; // a sigma noise type\n+ std::vector<std::unique_ptr<tools::Reporter>> reporters; // list of reporters displayed in the terminal\n+ std::unique_ptr<tools::Terminal> terminal; // manage the output text in the terminal\n+ std::vector<std::unique_ptr<module::Monitor_BFER<>>> monitors; // the list of the monitors from all the threads\n+ std::unique_ptr<module::Monitor_BFER_reduction> monitor_red; // the main monitor object that reduce all the thread monitors\n+ std::vector<std::vector<const module::Module*>> modules; // the lists of the allocated modules\n+ std::vector<std::vector<const module::Module*>> modules_stats; // the list of the allocated modules reorganized for the statistics\n+ };\n+\n+ void init_modules_and_utils(const params &p, modules &m, utils &u)\n+ {\n+ // get the thread id from OpenMP\n+ const int tid = omp_get_thread_num();\n+\n+ // set different seeds for different threads when the module use a PRNG\n+ p.source->seed += tid;\n+ p.channel->seed += tid;\n+\n+ m.source = std::unique_ptr<module::Source <>>(p.source ->build());\n+ m.codec = std::unique_ptr<module::Codec_SIHO <>>(p.codec ->build());\n+ m.modem = std::unique_ptr<module::Modem <>>(p.modem ->build());\n+ m.channel = std::unique_ptr<module::Channel <>>(p.channel->build());\n+ u.monitors[tid] = std::unique_ptr<module::Monitor_BFER<>>(p.monitor->build());\n+ m.monitor = u.monitors[tid].get();\n+ m.encoder = m.codec->get_encoder().get();\n+ m.decoder = m.codec->get_decoder_siho().get();\n+\n+ m.list = { m.source.get(), m.modem.get(), m.channel.get(), m.monitor, m.encoder, m.decoder };\n+ u.modules[tid] = m.list;\n+\n+ // configuration of the module tasks\n+ for (auto& mod : m.list)\n+ for (auto& tsk : mod->tasks)\n+ {\n+ tsk->set_autoalloc (true ); // enable the automatic allocation of the data in the tasks\n+ tsk->set_autoexec (false); // disable the auto execution mode of the tasks\n+ tsk->set_debug (false); // disable the debug mode\n+ tsk->set_debug_limit(16 ); // display only the 16 first bits if the debug mode is enabled\n+ tsk->set_stats (true ); // enable the statistics\n+\n+ // enable the fast mode (= disable the useless verifs in the tasks) if there is no debug and stats modes\n+ if (!tsk->is_debug() && !tsk->is_stats())\n+ tsk->set_fast(true);\n+ }\n+ }\n+\n+.. code-block:: cpp\n+ :caption: OpenMP: utils\n+ :name: lst_factory_modules_utils\n+ :emphasize-lines: 3-5,10-13,17-20\n+ :linenos:\n+\n+ void init_utils(const params &p, utils &u)\n+ {\n+ // allocate a common monitor module to reduce all the monitors\n+ u.monitor_red = std::unique_ptr<module::Monitor_BFER_reduction>(new module::Monitor_BFER_reduction(u.monitors));\n+ u.monitor_red->set_reduce_frequency(std::chrono::milliseconds(500));\n+ // create a sigma noise type\n+ u.noise = std::unique_ptr<tools::Sigma<>>(new tools::Sigma<>());\n+ // report the noise values (Es/N0 and Eb/N0)\n+ u.reporters.push_back(std::unique_ptr<tools::Reporter>(new tools::Reporter_noise<>(*u.noise)));\n+ // report the bit/frame error rates\n+ u.reporters.push_back(std::unique_ptr<tools::Reporter>(new tools::Reporter_BFER<>(*u.monitor_red)));\n+ // report the simulation throughputs\n+ u.reporters.push_back(std::unique_ptr<tools::Reporter>(new tools::Reporter_throughput<>(*u.monitor_red)));\n+ // create a terminal that will display the collected data from the reporters\n+ u.terminal = std::unique_ptr<tools::Terminal>(p.terminal->build(u.reporters));\n+\n+ u.modules_stats.resize(u.modules[0].size());\n+ for (size_t m = 0; m < u.modules[0].size(); m++)\n+ for (size_t t = 0; t < u.modules.size(); t++)\n+ u.modules_stats[m].push_back(u.modules[t][m]);\n+ }\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Doc: working on library examples.
8,490
31.07.2019 10:41:21
-7,200
d009b8ea725f7f6089492e0822b2f85eafa49d29
Doc: 80 characters per line + precisions.
[ { "change_type": "MODIFY", "old_path": "doc/sphinx/source/user/library/library.rst", "new_path": "doc/sphinx/source/user/library/library.rst", "diff": "@@ -25,10 +25,10 @@ calculated from 0.0 dB to 10.0 dB with a 1.0 dB step.\nBootstrap\n=========\n-The bootstrap example is the easiest way to start using the |AFF3CT| library. It is based on\n-``C++`` classes and methods that operate on buffers.\n-Keep in mind that this is the simplest way to use |AFF3CT|, but not the\n-most powerful way. More advanced features such as benchmarking, debugging, command line\n+The bootstrap example is the easiest way to start using the |AFF3CT| library. It\n+is based on ``C++`` classes and methods that operate on buffers. Keep in mind\n+that this is the simplest way to use |AFF3CT|, but not the most powerful way.\n+More advanced features such as benchmarking, debugging, command line\ninterfacing, and more are illustrated in the :ref:`user_library_tasks` and\n:ref:`user_library_factory` examples.\n@@ -40,7 +40,8 @@ interfacing, and more are illustrated in the :ref:`user_library_tasks` and\nSimulated communication chain: classes and methods.\n:numref:`fig_simple_chain_code` illustrates the source code: green boxes\n-correspond to classes, blue boxes correspond to methods, and arrows represent buffers.\n+correspond to classes, blue boxes correspond to methods, and arrows represent\n+buffers.\n.. code-block:: cpp\n:caption: Bootstrap: main function\n@@ -108,15 +109,16 @@ the modules, ``m`` contains the modules of the communication chain and ``u`` is\na set of convenient helper objects.\nLine ``15`` loops over the desired |SNRs| range. Lines ``31-40``, the ``while``\n-loop iterates until 100 frame errors have been detected by the monitor. The |AFF3CT|\n-communication chain methods are called inside this loop. Each |AFF3CT| method\n-works on input(s) and/or output(s) buffer(s) that have been declared at line ``8``.\n-Those buffers can be ``std::vector``, or pointers to user-allocated memory areas. The sizes and the types of\n-those buffers have to be set in accordance with the corresponding sizes and types of the |AFF3CT|\n-modules declared at line ``7``. If there is a size and/or type mismatch,\n-the |AFF3CT| library throws an exception. The |AFF3CT| modules are classes\n-that uses the C++ meta-programming technique (e.g. ``C++ templates``). By default\n-those templates are instantiated to ``int32_t`` or ``float``.\n+loop iterates until 100 frame errors have been detected by the monitor. The\n+|AFF3CT| communication chain methods are called inside this loop. Each |AFF3CT|\n+method works on input(s) and/or output(s) buffer(s) that have been declared at\n+line ``8``. Those buffers can be ``std::vector``, or pointers to user-allocated\n+memory areas. The sizes and the types of those buffers have to be set in\n+accordance with the corresponding sizes and types of the |AFF3CT| modules\n+declared at line ``7``. If there is a size and/or type mismatch, the |AFF3CT|\n+library throws an exception. The |AFF3CT| modules are classes that uses the C++\n+meta-programming technique (e.g. ``C++ templates``). By default those templates\n+are instantiated to ``int32_t`` or ``float``.\n.. code-block:: cpp\n:caption: Bootstrap: parameters\n@@ -140,8 +142,8 @@ those templates are instantiated to ``int32_t`` or ``float``.\np.R = (float)p.K / (float)p.N;\n}\n-:numref:`lst_bootstrap_params` describes the ``params1`` simulation\n-structure and the ``init_params1`` function used at line ``6`` in\n+:numref:`lst_bootstrap_params` describes the ``params1`` simulation structure\n+and the ``init_params1`` function used at line ``6`` in\n:numref:`lst_bootstrap_main`.\n.. code-block:: cpp\n@@ -169,13 +171,13 @@ structure and the ``init_params1`` function used at line ``6`` in\nm.monitor = std::unique_ptr<module::Monitor_BFER <>>(new module::Monitor_BFER <>(p.K, p.fe ));\n};\n-:numref:`lst_bootstrap_main` describes the ``modules1`` structure\n-and the ``init_modules1`` function used at line ``7`` in\n-:numref:`lst_bootstrap_main`. The ``init_modules1`` function allocates the\n-modules of the communication chain. Those modules are allocated on the heap and\n-managed by smart pointers (``std::unique_ptr``). Note that the ``init_modules1``\n-function takes a ``params1`` structure from :numref:`lst_bootstrap_params` in\n-parameter. These parameters are used to build the modules.\n+:numref:`lst_bootstrap_main` describes the ``modules1`` structure and the\n+``init_modules1`` function used at line ``7`` in :numref:`lst_bootstrap_main`.\n+The ``init_modules1`` function allocates the modules of the communication chain.\n+Those modules are allocated on the heap and managed by smart pointers\n+(``std::unique_ptr``). Note that the ``init_modules1`` function takes a\n+``params1`` structure from :numref:`lst_bootstrap_params` in parameter. These\n+parameters are used to build the modules.\n.. code-block:: cpp\n:caption: Bootstrap: buffers\n@@ -202,13 +204,13 @@ parameter. These parameters are used to build the modules.\nb.dec_bits = std::vector<int >(p.K);\n}\n-:numref:`lst_bootstrap_buffers` describes the ``buffers1`` structure\n-and the ``init_buffers1`` function used at line ``8`` in\n-:numref:`lst_bootstrap_main`. The ``init_buffers1`` function allocates the\n-buffers of the communication chain. Here, we chose to allocate buffers as\n-instances of the ``std::vector`` C++ standard class. As for the modules in\n-:numref:`lst_bootstrap_modules`, the size of the buffers is obtained from the\n-``params1`` input structure (cf. :numref:`lst_bootstrap_params`).\n+:numref:`lst_bootstrap_buffers` describes the ``buffers1`` structure and the\n+``init_buffers1`` function used at line ``8`` in :numref:`lst_bootstrap_main`.\n+The ``init_buffers1`` function allocates the buffers of the communication chain.\n+Here, we chose to allocate buffers as instances of the ``std::vector`` C++\n+standard class. As for the modules in :numref:`lst_bootstrap_modules`, the size\n+of the buffers is obtained from the ``params1`` input structure (cf.\n+:numref:`lst_bootstrap_params`).\n.. code-block:: cpp\n:caption: Bootstrap: utils\n@@ -237,12 +239,12 @@ instances of the ``std::vector`` C++ standard class. As for the modules in\n}\n:numref:`lst_bootstrap_utils` describes the ``utils1`` structure and the\n-``init_utils1`` function used at line ``9`` in :numref:`lst_bootstrap_main`.\n-The ``init_utils1`` function allocates 1) the ``noise`` object that contains the\n-type of noise we want to simulate (e.g. `sigma`), 2) a ``terminal`` object that takes care of printing\n-the |BFER| to the console. Three reporters are\n-created, one for to print |SNR|, another one to print |BFER|, and the last\n-one to report the simulation throughput in the ``terminal``.\n+``init_utils1`` function used at line ``9`` in :numref:`lst_bootstrap_main`. The\n+``init_utils1`` function allocates 1) the ``noise`` object that contains the\n+type of noise we want to simulate (e.g. `sigma`), 2) a ``terminal`` object that\n+takes care of printing the |BFER| to the console. Three reporters are created,\n+one to print |SNR|, another one to print |BFER|, and the last one to report the\n+simulation throughput in the ``terminal``.\nIf you run the `bootstrap` example, the expected output is shown in\n:numref:`lst_bootstrap_output`.\n@@ -280,12 +282,12 @@ Tasks\n=====\nSome of the |AFF3CT| classes inherit from the ``Module`` abstract class.\n-Generally speaking, any class defining methods for a communication\n-chain is a ``Module``. Inside a module class, there can be many public methods; however,\n-only some of them are directly used in the communication chain. A method\n-usable in a chain is named a ``Task``. A ``Task`` is characterized by its\n-behavior and its data: the input and output data are declared via a collection\n-of ``Socket`` objects.\n+Generally speaking, any class defining methods for a communication chain is a\n+``Module``. Inside a module class, there can be many public methods; however,\n+only some of them are directly used in the communication chain. A method usable\n+in a chain is named a ``Task``. A ``Task`` is characterized by its behavior and\n+its data: the input and output data are declared via a collection of ``Socket``\n+objects.\n.. code-block:: cpp\n:linenos:\n@@ -358,21 +360,22 @@ of ``Socket`` objects.\nreturn 0;\n}\n-:numref:`lst_tasks_main` shows how the ``Module``, ``Task`` and\n-``Socket`` objects work together. Line ``7``, ``modules2`` differs slightly from the\n-previous ``modules1`` structure, and it is also the same for the ``init_modules2``\n-function. :numref:`lst_tasks_modules` details the changes.\n-\n-Thanks to the use of ``Task`` and ``Socket`` objects, it is now possible to\n-skip the buffer allocation part (see line ``8``), which is handled transparently by these objects.\n-For that, the connections between the sockets of successive tasks in\n-the chain have to be established explicitly: this is the binding process shown at lines ``14-22``,\n-using the ``bind`` method. In return, to execute the tasks (lines ``43-49``), you now only\n-need to call the ``exec`` method, without any parameters.\n-\n-Using the ``bind`` and ``exec`` methods bring new useful features\n-for debugging and benchmarking. In :numref:`lst_tasks_main`, some statistics\n-about tasks are collected and reported at lines ``60-61`` (see :ref:`sim-sim-stats` section\n+:numref:`lst_tasks_main` shows how the ``Module``, ``Task`` and ``Socket``\n+objects work together. Line ``7``, ``modules2`` differs slightly from the\n+previous ``modules1`` structure, and it is also the same for the\n+``init_modules2`` function. :numref:`lst_tasks_modules` details the changes.\n+\n+Thanks to the use of ``Task`` and ``Socket`` objects, it is now possible to skip\n+the buffer allocation part (see line ``8``), which is handled transparently by\n+these objects. For that, the connections between the sockets of successive tasks\n+in the chain have to be established explicitly: this is the binding process\n+shown at lines ``14-22``, using the ``bind`` method. In return, to execute the\n+tasks (lines ``43-49``), you now only need to call the ``exec`` method, without\n+any parameters.\n+\n+Using the ``bind`` and ``exec`` methods bring new useful features for debugging\n+and benchmarking. In :numref:`lst_tasks_main`, some statistics about tasks are\n+collected and reported at lines ``60-61`` (see :ref:`sim-sim-stats` section\nfor more informations about the statistics output).\n.. code-block:: cpp\n@@ -411,8 +414,9 @@ The beginning of the ``init_modules2`` function (:numref:`lst_tasks_modules`) is\nthe same as the ``init_module1`` function (:numref:`lst_bootstrap_modules`). At\nlines ``10-24``, each ``Module`` is parsed to get its tasks, each ``Task`` is\nconfigured to automatically allocate its outputs ``Socket`` memory (line ``15``)\n-and collect statistics on the ``Task`` execution (line ``19``). It is also possible\n-to print debug information by toggling boolean to ``true`` at line ``17``.\n+and collect statistics on the ``Task`` execution (line ``19``). It is also\n+possible to print debug information by toggling boolean to ``true`` at line\n+``17``.\n.. note:: The full source code is available here:\nhttps://github.com/aff3ct/my_project_with_aff3ct/blob/master/examples/tasks/src/main.cpp.\n@@ -522,9 +526,8 @@ Factory\nIn the previous :ref:`user_library_bootstrap`, :ref:`user_library_tasks` and\n:ref:`user_library_systemc` examples, the AFF3CT ``Module`` classes were built\n-statically in the source code. In the ``Factory`` example, ``factory``\n-classes are used instead, to build modules dynamically from command line\n-arguments.\n+statically in the source code. In the ``Factory`` example, ``factory`` classes\n+are used instead, to build modules dynamically from command line arguments.\n.. code-block:: cpp\n:caption: Factory: main function\n@@ -548,8 +551,8 @@ arguments.\nreturn 0;\n}\n-The ``main`` function in :numref:`lst_factory_main` is almost unchanged from\n-the ``main`` function in :numref:`lst_tasks_main`.\n+The ``main`` function in :numref:`lst_factory_main` is almost unchanged from the\n+``main`` function in :numref:`lst_tasks_main`.\n.. code-block:: cpp\n:caption: Factory: parameters\n@@ -603,18 +606,18 @@ the ``main`` function in :numref:`lst_tasks_main`.\n}\nThe ``params3`` structure from :numref:`lst_factory_params` contains some\n-pointers to factory objects (lines ``8-13``). |SNR| parameters\n-remain static is this examples.\n+pointers to factory objects (lines ``8-13``). |SNR| parameters remain static is\n+this examples.\nThe ``init_params3`` function takes two new input arguments from the command\nline: ``argc`` and ``argv``. The function first allocates the factories (lines\n-``18-23``) and then those factories are supplied with parameters from the command line\n-(line ``29``) thanks to the ``Command_parser`` class. Lines ``38-41``, the parameters\n-from the factories are printed to the terminal.\n+``18-23``) and then those factories are supplied with parameters from the\n+command line (line ``29``) thanks to the ``factory::Command_parser`` class.\n+Lines ``38-41``, the parameters from the factories are printed to the terminal.\nNote that in this example a repetition code is used, however it is very easy to\n-select another code type, for instance by replacing ``repetition`` line ``9`` and line ``19`` by\n-``polar`` to work with polar code.\n+select another code type, for instance by replacing ``repetition`` line ``9``\n+and line ``19`` by ``polar`` to work with polar code.\n.. code-block:: cpp\n:caption: Factory: modules\n@@ -660,8 +663,8 @@ select another code type, for instance by replacing ``repetition`` line ``9`` an\n}\n}\n-In :numref:`lst_factory_modules` the ``modules3`` structure changes a little\n-bit because a ``Codec`` class is used to aggregate the ``Encoder`` and the\n+In :numref:`lst_factory_modules` the ``modules3`` structure changes a little bit\n+because a ``Codec`` class is used to aggregate the ``Encoder`` and the\n``Decoder`` together. In the ``init_modules3`` the factories allocated in\n:numref:`lst_factory_params` are used to build the modules (lines ``14-18``).\n@@ -689,6 +692,29 @@ In the :numref:`lst_factory_utils`, the ``init_utils3`` changes a little bit\nfrom the ``init_utils1`` function (:numref:`lst_bootstrap_utils`) because at\nline ``12`` a factory is used to build the ``terminal``.\n+To execute the binary it is now required to specify the number of information\n+bits `K` and the frame size `N` as shown in\n+:numref:`lst_factory_binary_execute`.\n+\n+.. code-block:: bash\n+ :caption: Factory: execute the binary\n+ :name: lst_factory_binary_execute\n+\n+ $ ./bin/my_project -K 32 -N 128\n+\n+Be aware that many other parameters can be set from the command line. The\n+parameters list can be seen using ``-h`` as shown in\n+:numref:`lst_factory_binary_help`.\n+\n+.. code-block:: bash\n+ :caption: Factory: execute the binary\n+ :name: lst_factory_binary_help\n+\n+ $ ./bin/my_project -h\n+\n+Those parameters are documented in the :ref:`user_simulation_parameters`\n+section.\n+\n.. note:: The full source code is available here:\nhttps://github.com/aff3ct/my_project_with_aff3ct/blob/master/examples/factory/src/main.cpp.\n@@ -700,10 +726,10 @@ OpenMP\n.. _OpenMP: https://www.openmp.org/\nIn the previous examples the code is mono-threaded. To take advantage of the\n-today multi-core |CPUs| some modifications have to be made. This example\n-starts from the previous :ref:`user_library_factory` example and\n-adapts it to work on multi-threaded architectures using `pragma` directives of the well-known `OpenMP`\n-language.\n+today multi-core |CPUs| some modifications have to be made. This example starts\n+from the previous :ref:`user_library_factory` example and adapts it to work on\n+multi-threaded architectures using `pragma` directives of the well-known\n+`OpenMP`_ language.\n.. code-block:: cpp\n:caption: OpenMP: main function\n@@ -800,8 +826,8 @@ language.\nreturn 0;\n}\n-:numref:`lst_openmp_main` depicts how to use `OpenMP` pragmas to\n-parallelize the whole communication chain. As a remainder:\n+:numref:`lst_openmp_main` depicts how to use `OpenMP`_ pragmas to parallelize\n+the whole communication chain. As a remainder:\n- ``#pragma omp parallel``: all the code after in the braces is executed by all\nthe threads,\n@@ -880,22 +906,22 @@ each threads gets its own local ``m``.\nu.modules[tid] = modules_list;\n}\n-In :numref:`lst_openmp_modules_utils`, there is a change in the\n-``modules4`` structure compared to the ``modules3`` structure\n-(:numref:`lst_factory_modules`): at line ``7`` the ``monitor`` is not\n-allocated in this structure anymore, thus a standard pointer is used instead of a smart\n-pointer. The monitor is now allocated in the ``utils4`` structure at line ``17``,\n-because all the monitors from all the threads have to be passed to build a\n-common aggregated monitor for all of them: the ``monitor_red`` at line ``18``.\n-``monitor_red`` is able to perform the reduction of all the per-thread ``monitors``.\n-In the example, the ``monitor_red`` is the only member from ``u`` called\n-by all the threads, to check whether the simulation has to continue or not (see line\n-``54`` in the ``main`` function, :numref:`lst_openmp_main`).\n+In :numref:`lst_openmp_modules_utils`, there is a change in the ``modules4``\n+structure compared to the ``modules3`` structure\n+(:numref:`lst_factory_modules`): at line ``7`` the ``monitor`` is not allocated\n+in this structure anymore, thus a standard pointer is used instead of a smart\n+pointer. The monitor is now allocated in the ``utils4`` structure at line\n+``17``, because all the monitors from all the threads have to be passed to build\n+a common aggregated monitor for all of them: the ``monitor_red`` at line ``18``.\n+``monitor_red`` is able to perform the reduction of all the per-thread\n+``monitors``. In the example, the ``monitor_red`` is the only member from ``u``\n+called by all the threads, to check whether the simulation has to continue or\n+not (see line ``54`` in the ``main`` function, :numref:`lst_openmp_main`).\nIn the ``init_modules_and_utils4`` function, lines ``25-30``, a different seed\nis assigned to the modules using a |PRNG|. It is important to give a distinct\n-seed to each thread. If the seed is the same for all threads, they\n-all simulate the same frame contents and apply the same noise over it.\n+seed to each thread. If the seed is the same for all threads, they all simulate\n+the same frame contents and apply the same noise over it.\nLines ``36-37``, the ``monitors`` are allocated in ``u`` and the resulting\npointer is assigned to ``m``. At line ``57`` a list of the modules is stored in\n@@ -937,7 +963,9 @@ previously in the ``init_modules_and_utils4`` function\nLines ``17-20``, the ``u.modules`` list is reordered in the ``u.modules_stats``\nto be used for the statistics of the tasks in the ``main`` function\n-(:numref:`lst_openmp_main` line ``84``).\n+(:numref:`lst_openmp_main` line ``84``). In the ``u.modules`` list the first\n+dimension is the number of threads and the second is the different modules while\n+in ``u.modules_stats`` the two dimension are switched.\n.. note:: The full source code is available here:\nhttps://github.com/aff3ct/my_project_with_aff3ct/blob/master/examples/openmp/src/main.cpp.\n" } ]
C++
MIT License
aff3ct/aff3ct
Doc: 80 characters per line + precisions.
8,490
31.07.2019 11:26:27
-7,200
d6ceaca760d6f0b14effeb1511c7b01281e1e0d8
Add the library to the README file.
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "[![DOI](https://zenodo.org/badge/60615913.svg)](https://zenodo.org/badge/latestdoi/60615913)\n[![License: MIT](https://img.shields.io/github/license/aff3ct/aff3ct.svg)](./LICENSE)\n-**AFF3CT** is a simulator dedicated to the Forward Error Correction (FEC or\n-**channel coding**). It is written in **C++** and it supports a large range of\n-codes: from the well-spread **Turbo codes** to the very new **Polar codes**\n-including the **Low-Density Parity-Check (LDPC) codes**. **AFF3CT** is a command\n-line program and it simulates communication chains based on a Monte Carlo\n-method.\n+**AFF3CT** is a simulator and a library dedicated to the Forward Error\n+Correction (FEC or **channel coding**). It is written in **C++** and it supports\n+a large range of codes: from the well-spread **Turbo codes** to the new\n+**Polar codes** including the **Low-Density Parity-Check (LDPC) codes**.\n+**AFF3CT** can be used as a command line program and it simulates communication\n+chains based on a Monte Carlo method.\n![Communication Chain](https://aff3ct.github.io/images/chain.svg)\n@@ -63,10 +63,22 @@ Below, a list of the features that motivated the creation of the simulator:\n![BER/FER Performances](https://aff3ct.github.io/images/bfer/bfer_polar_turbo_ldpc_bch_rs.svg)\n+**AFF3CT** was first intended to be a simulator but as it developed, the need to\n+reuse sub-parts of the code intensified: the library was born. Below is a list\n+of possible applications for the library:\n+\n+1. **build custom communication chains** that are not possible with the\n+ simulator,\n+2. **facilitate hardware prototyping**,\n+3. enable various modules to be used in SDR contexts.\n+\n+If you seek for using **AFF3CT** as a library, please refer to the\n+[dedicated documentation page](https://aff3ct.readthedocs.io/en/latest/user/library/library.html).\n+\n## Installation\n-First make sure to have installed a C++11 compiler, CMake and Git. Then install\n-AFF3CT by running:\n+First make sure to have installed a `C++11 compiler`, `CMake` and `Git`. Then\n+install **AFF3CT** by running:\n```bash\ngit clone --recursive https://github.com/aff3ct/aff3ct.git\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the library to the README file.
8,490
02.08.2019 10:23:33
-7,200
dd10e113a357e2a380f6ee3fbb44851e564aca34
Doc: library typos and fix text.
[ { "change_type": "MODIFY", "old_path": "doc/sphinx/source/user/library/library.rst", "new_path": "doc/sphinx/source/user/library/library.rst", "diff": "@@ -361,9 +361,9 @@ objects.\n}\n:numref:`lst_tasks_main` shows how the ``Module``, ``Task`` and ``Socket``\n-objects work together. Line ``7``, ``modules2`` differs slightly from the\n-previous ``modules1`` structure, and it is also the same for the\n-``init_modules2`` function. :numref:`lst_tasks_modules` details the changes.\n+objects work together. Line ``7``, ``init_modules2`` differs slightly from the\n+previous ``init_modules1`` function, :numref:`lst_tasks_modules` details the\n+changes.\nThanks to the use of ``Task`` and ``Socket`` objects, it is now possible to skip\nthe buffer allocation part (see line ``8``), which is handled transparently by\n@@ -375,7 +375,7 @@ any parameters.\nUsing the ``bind`` and ``exec`` methods bring new useful features for debugging\nand benchmarking. In :numref:`lst_tasks_main`, some statistics about tasks are\n-collected and reported at lines ``60-61`` (see :ref:`sim-sim-stats` section\n+collected and reported at lines ``60-61`` (see the :ref:`sim-sim-stats` section\nfor more informations about the statistics output).\n.. code-block:: cpp\n@@ -526,7 +526,7 @@ Factory\nIn the previous :ref:`user_library_bootstrap`, :ref:`user_library_tasks` and\n:ref:`user_library_systemc` examples, the AFF3CT ``Module`` classes were built\n-statically in the source code. In the ``Factory`` example, ``factory`` classes\n+statically in the source code. In the *Factory* example, ``factory`` classes\nare used instead, to build modules dynamically from command line arguments.\n.. code-block:: cpp\n" } ]
C++
MIT License
aff3ct/aff3ct
Doc: library typos and fix text.
8,490
27.08.2019 13:41:37
-7,200
91414a0d98fa8a0b1906afb239f2e7a67224cbb7
Add a warning message when the G or H matrix look like erroneous.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.cpp", "new_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.cpp", "diff": "#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Documentation/documentation.h\"\n#include \"Tools/Arguments/Splitter/Splitter.hpp\"\n+#include \"Tools/Display/rang_format/rang_format.h\"\n#include \"Tools/Math/max.h\"\n#include \"Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.hpp\"\n@@ -147,7 +148,12 @@ void Decoder_LDPC::parameters\ntools::LDPC_matrix_handler::read_matrix_size(this->H_path, M, this->N_cw);\nif (M > this->N_cw)\n+ {\nstd::swap(M, this->N_cw);\n+ std::clog << rang::tag::warning << \"Be careful, 'M' (the number of check nodes) and 'N' (the number of \"\n+ \"variable nodes) have been switched, the format of the input 'H' parity \"\n+ \"matrix could be wrong!\" << std::endl;\n+ }\nthis->K = this->N_cw - M; // considered as regular so M = N - K\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Encoder/LDPC/Encoder_LDPC.cpp", "new_path": "src/Factory/Module/Encoder/LDPC/Encoder_LDPC.cpp", "diff": "#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Documentation/documentation.h\"\n+#include \"Tools/Display/rang_format/rang_format.h\"\n#include \"Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.hpp\"\n@@ -79,7 +80,11 @@ void Encoder_LDPC::parameters\ntools::LDPC_matrix_handler::read_matrix_size(this->G_path, this->K, this->N_cw);\nif (this->K > this->N_cw)\n+ {\nstd::swap(this->K, this->N_cw);\n+ std::clog << rang::tag::warning << \"Be careful, 'K' and 'N' have been switched, the format of the input \"\n+ \"'G' generator matrix could be wrong!\" << std::endl;\n+ }\n}\nelse if (!this->H_path.empty())\n{\n@@ -87,7 +92,12 @@ void Encoder_LDPC::parameters\ntools::LDPC_matrix_handler::read_matrix_size(this->H_path, M, this->N_cw);\nif (M > this->N_cw)\n+ {\nstd::swap(M, this->N_cw);\n+ std::clog << rang::tag::warning << \"Be careful, 'M' (the number of check nodes) and 'N' (the number of \"\n+ \"variable nodes) have been switched, the format of the input 'H' parity \"\n+ \"matrix could be wrong!\" << std::endl;\n+ }\nthis->K = this->N_cw - M; // considered as regular so M = N - K\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a warning message when the G or H matrix look like erroneous.
8,490
28.08.2019 10:44:21
-7,200
63619518edf20642e3f33f97b410c506031383bf
Remove the automatic swap of M, N and K in the alist G and H matrices.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.cpp", "new_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.cpp", "diff": "@@ -146,15 +146,6 @@ void Decoder_LDPC::parameters\n{\nint M;\ntools::LDPC_matrix_handler::read_matrix_size(this->H_path, M, this->N_cw);\n-\n- if (M > this->N_cw)\n- {\n- std::swap(M, this->N_cw);\n- std::clog << rang::tag::warning << \"Be careful, 'M' (the number of check nodes) and 'N' (the number of \"\n- \"variable nodes) have been switched, the format of the input 'H' parity \"\n- \"matrix could be wrong!\" << std::endl;\n- }\n-\nthis->K = this->N_cw - M; // considered as regular so M = N - K\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Encoder/LDPC/Encoder_LDPC.cpp", "new_path": "src/Factory/Module/Encoder/LDPC/Encoder_LDPC.cpp", "diff": "@@ -78,27 +78,11 @@ void Encoder_LDPC::parameters\nif (!this->G_path.empty())\n{\ntools::LDPC_matrix_handler::read_matrix_size(this->G_path, this->K, this->N_cw);\n-\n- if (this->K > this->N_cw)\n- {\n- std::swap(this->K, this->N_cw);\n- std::clog << rang::tag::warning << \"Be careful, 'K' and 'N' have been switched, the format of the input \"\n- \"'G' generator matrix could be wrong!\" << std::endl;\n- }\n}\nelse if (!this->H_path.empty())\n{\nint M;\ntools::LDPC_matrix_handler::read_matrix_size(this->H_path, M, this->N_cw);\n-\n- if (M > this->N_cw)\n- {\n- std::swap(M, this->N_cw);\n- std::clog << rang::tag::warning << \"Be careful, 'M' (the number of check nodes) and 'N' (the number of \"\n- \"variable nodes) have been switched, the format of the input 'H' parity \"\n- \"matrix could be wrong!\" << std::endl;\n- }\n-\nthis->K = this->N_cw - M; // considered as regular so M = N - K\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Remove the automatic swap of M, N and K in the alist G and H matrices.
8,490
28.08.2019 11:50:50
-7,200
01cf9a1127a90f517eb47ac8d78d1d79b2914a10
CI: remove fake dependencies.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -82,8 +82,7 @@ build-linux-gcc-nointr:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies:\n- - documentation-sphinx\n+ dependencies: []\ntags:\n- linux\n- gcc\n@@ -109,8 +108,7 @@ build-linux-gcc-x64-sse4.2:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies:\n- - documentation-sphinx\n+ dependencies: []\ntags:\n- linux\n- gcc\n@@ -135,8 +133,7 @@ build-linux-gcc-x64-avx2:\nstage: build\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n- dependencies:\n- - documentation-sphinx\n+ dependencies: []\ntags:\n- linux\n- gcc\n@@ -163,8 +160,7 @@ build-linux-gcc-8-bit:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies:\n- - documentation-sphinx\n+ dependencies: []\ntags:\n- linux\n- gcc\n@@ -190,8 +186,7 @@ build-linux-gcc-mpi:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies:\n- - documentation-sphinx\n+ dependencies: []\ntags:\n- linux\n- gcc\n@@ -217,8 +212,7 @@ build-linux-gcc-systemc:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies:\n- - documentation-sphinx\n+ dependencies: []\ntags:\n- linux\n- gcc\n@@ -245,8 +239,7 @@ build-linux-clang:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies:\n- - documentation-sphinx\n+ dependencies: []\ntags:\n- linux\n- clang\n@@ -271,8 +264,7 @@ build-linux-gcc-4.8:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies:\n- - documentation-sphinx\n+ dependencies: []\ntags:\n- linux\n- gcc-4.8\n@@ -297,8 +289,7 @@ build-linux-icpc:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies:\n- - documentation-sphinx\n+ dependencies: []\ntags:\n- linux\n- icpc\n@@ -326,8 +317,7 @@ build-windows-gcc-x86-sse4.2:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies:\n- - documentation-sphinx\n+ dependencies: []\ntags:\n- windows\n- gcc\n@@ -352,8 +342,7 @@ build-windows-gcc-x64-avx2:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies:\n- - documentation-sphinx\n+ dependencies: []\ntags:\n- windows\n- 64-bit\n@@ -378,8 +367,7 @@ build-windows-msvc-avx:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies:\n- - documentation-sphinx\n+ dependencies: []\ntags:\n- windows\n- msvc\n@@ -402,8 +390,7 @@ build-macos-clang-x64-sse4.2:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies:\n- - documentation-sphinx\n+ dependencies: []\ntags:\n- macos\n- apple-clang\n@@ -1137,8 +1124,7 @@ test-build-coverage-regression:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies:\n- - analysis-headers\n+ dependencies: []\ntags:\n- linux\n- gcc\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: remove fake dependencies.
8,490
03.09.2019 11:43:20
-7,200
f661300bf9acc77620bbc7da614612151a535c59
Add an exception when the path to the polar best channels is wrong.
[ { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator.cpp", "new_path": "src/Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator.cpp", "diff": "@@ -124,6 +124,13 @@ void Frozenbits_generator\nstd::ofstream file(dump_channels_full_path);\n+ if (!file.is_open())\n+ {\n+ std::stringstream message;\n+ message << \"Impossible to open the '\" << dump_channels_full_path << \"' file to dump the Polar best channels.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nfile << this->N << std::endl;\nfile << noise_type << std::endl;\nfile << std::fixed << std::setprecision(3) << this->n->get_noise() << std::endl;\n" } ]
C++
MIT License
aff3ct/aff3ct
Add an exception when the path to the polar best channels is wrong.
8,490
05.09.2019 10:48:49
-7,200
c3adfa9b7d59f70b6072fcb8d29f0410f4670835
Fix compilation error in 8-bit mode.
[ { "change_type": "MODIFY", "old_path": "src/Module/Modem/BPSK/Modem_BPSK.cpp", "new_path": "src/Module/Modem/BPSK/Modem_BPSK.cpp", "diff": "@@ -32,34 +32,6 @@ void Modem_BPSK<B,R,Q>\ntwo_on_square_sigma = (R)2.0 / (this->n->get_noise() * this->n->get_noise());\n}\n-template <typename B, typename R, typename Q>\n-bool Modem_BPSK<B,R,Q>\n-::is_complex_mod()\n-{\n- return false;\n-}\n-\n-template <typename B, typename R, typename Q>\n-bool Modem_BPSK<B,R,Q>\n-::is_complex_fil()\n-{\n- return false;\n-}\n-\n-template <typename B, typename R, typename Q>\n-int Modem_BPSK<B,R,Q>\n-::size_mod(const int N)\n-{\n- return Modem<B,R,Q>::get_buffer_size_after_modulation(N, 1, 0, 1, is_complex_mod());\n-}\n-\n-template <typename B, typename R, typename Q>\n-int Modem_BPSK<B,R,Q>\n-::size_fil(const int N)\n-{\n- return Modem<B,R,Q>::get_buffer_size_after_filtering(N, 1, 0, 1, is_complex_fil());\n-}\n-\ntemplate <typename B, typename R, typename Q>\nvoid Modem_BPSK<B,R,Q>\n::_modulate(const B *X_N1, R *X_N2, const int frame_id)\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modem/BPSK/Modem_BPSK.hpp", "new_path": "src/Module/Modem/BPSK/Modem_BPSK.hpp", "diff": "@@ -36,4 +36,6 @@ protected:\n}\n}\n+#include \"Modem_BPSK.hxx\"\n+\n#endif /* MODEM_BPSK_HPP_ */\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Modem/BPSK/Modem_BPSK.hxx", "diff": "+#include \"Modem_BPSK.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B, typename R, typename Q>\n+bool Modem_BPSK<B,R,Q>\n+::is_complex_mod()\n+{\n+ return false;\n+}\n+\n+template <typename B, typename R, typename Q>\n+bool Modem_BPSK<B,R,Q>\n+::is_complex_fil()\n+{\n+ return false;\n+}\n+\n+template <typename B, typename R, typename Q>\n+int Modem_BPSK<B,R,Q>\n+::size_mod(const int N)\n+{\n+ return Modem<B,R,Q>::get_buffer_size_after_modulation(N, 1, 0, 1, is_complex_mod());\n+}\n+\n+template <typename B, typename R, typename Q>\n+int Modem_BPSK<B,R,Q>\n+::size_fil(const int N)\n+{\n+ return Modem<B,R,Q>::get_buffer_size_after_filtering(N, 1, 0, 1, is_complex_fil());\n+}\n+}\n+}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modem/BPSK/Modem_BPSK_fast.cpp", "new_path": "src/Module/Modem/BPSK/Modem_BPSK_fast.cpp", "diff": "@@ -33,34 +33,6 @@ void Modem_BPSK_fast<B,R,Q>\ntwo_on_square_sigma = (R)2.0 / (this->n->get_noise() * this->n->get_noise());\n}\n-template <typename B, typename R, typename Q>\n-bool Modem_BPSK_fast<B,R,Q>\n-::is_complex_mod()\n-{\n- return false;\n-}\n-\n-template <typename B, typename R, typename Q>\n-bool Modem_BPSK_fast<B,R,Q>\n-::is_complex_fil()\n-{\n- return false;\n-}\n-\n-template <typename B, typename R, typename Q>\n-int Modem_BPSK_fast<B,R,Q>\n-::size_mod(const int N)\n-{\n- return Modem<B,R,Q>::get_buffer_size_after_modulation(N, 1, 0, 1, is_complex_mod());\n-}\n-\n-template <typename B, typename R, typename Q>\n-int Modem_BPSK_fast<B,R,Q>\n-::size_fil(const int N)\n-{\n- return Modem<B,R,Q>::get_buffer_size_after_filtering(N, 1, 0, 1, is_complex_fil());\n-}\n-\ntemplate <typename B, typename R, typename Q>\nvoid Modem_BPSK_fast<B,R,Q>\n::_modulate(const B *X_N1, R *X_N2, const int frame_id)\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modem/BPSK/Modem_BPSK_fast.hpp", "new_path": "src/Module/Modem/BPSK/Modem_BPSK_fast.hpp", "diff": "@@ -35,4 +35,6 @@ protected:\n}\n}\n+#include \"Modem_BPSK_fast.hxx\"\n+\n#endif /* MODEM_BPSK_FAST_HPP_ */\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Modem/BPSK/Modem_BPSK_fast.hxx", "diff": "+#include \"Modem_BPSK_fast.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B, typename R, typename Q>\n+bool Modem_BPSK_fast<B,R,Q>\n+::is_complex_mod()\n+{\n+ return false;\n+}\n+\n+template <typename B, typename R, typename Q>\n+bool Modem_BPSK_fast<B,R,Q>\n+::is_complex_fil()\n+{\n+ return false;\n+}\n+\n+template <typename B, typename R, typename Q>\n+int Modem_BPSK_fast<B,R,Q>\n+::size_mod(const int N)\n+{\n+ return Modem<B,R,Q>::get_buffer_size_after_modulation(N, 1, 0, 1, is_complex_mod());\n+}\n+\n+template <typename B, typename R, typename Q>\n+int Modem_BPSK_fast<B,R,Q>\n+::size_fil(const int N)\n+{\n+ return Modem<B,R,Q>::get_buffer_size_after_filtering(N, 1, 0, 1, is_complex_fil());\n+}\n+}\n+}\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix compilation error in 8-bit mode.
8,490
05.09.2019 10:59:16
-7,200
c446c6f07ee667c491310f2a9f2d531dc7e92050
Move non-module CPM classes from 'module' to 'tools' namespace.
[ { "change_type": "MODIFY", "old_path": "src/Module/Modem/CPM/Modem_CPM.hpp", "new_path": "src/Module/Modem/CPM/Modem_CPM.hpp", "diff": "#include <vector>\n#include \"Tools/Math/max.h\"\n+#include \"Tools/Code/CPM/CPM_parameters.hpp\"\n+#include \"Tools/Code/CPM/CPE/Encoder_CPE_Rimoldi.hpp\"\n+#include \"Tools/Code/CPM/BCJR/CPM_BCJR.hpp\"\n#include \"../Modem.hpp\"\n-#include \"CPM_parameters.hpp\"\n-#include \"CPE/Encoder_CPE_Rimoldi.hpp\"\n-#include \"BCJR/CPM_BCJR.hpp\"\n-\nnamespace aff3ct\n{\nnamespace module\n@@ -34,16 +33,16 @@ protected:\nconst bool no_sig2; // no computation of sigma^2\n// modulation data:\n- CPM_parameters<SIN,SOUT> cpm; // all CPM parameters\n+ tools::CPM_parameters<SIN,SOUT> cpm; // all CPM parameters\nR cpm_h; // modulation index = k/p\nR T_samp; // sample duration = 1/s_factor\nstd::vector<R> baseband; // translation of base band vectors\nstd::vector<R> projection; // translation of filtering generator family\nconst int n_sy; // number of symbols for one frame after encoding without tail symbols\nconst int n_sy_tl; // number of symbols to send for one frame after encoding with tail symbols\n- Encoder_CPE_Rimoldi<SIN,SOUT> cpe; // the continuous phase encoder\n+ tools::Encoder_CPE_Rimoldi<SIN,SOUT> cpe; // the continuous phase encoder\n- CPM_BCJR<SIN,SOUT,Q,MAX> bcjr; // demodulator\n+ tools::CPM_BCJR<SIN,SOUT,Q,MAX> bcjr; // demodulator\npublic:\nModem_CPM(const int N,\n" }, { "change_type": "RENAME", "old_path": "src/Module/Modem/CPM/BCJR/CPM_BCJR.hpp", "new_path": "src/Tools/Code/CPM/BCJR/CPM_BCJR.hpp", "diff": "namespace aff3ct\n{\n-namespace module\n+namespace tools\n{\n-template <typename SIN = int, typename SOUT = int, typename Q = float, tools::proto_max<Q> MAX = tools::max_star>\n+template <typename SIN = int, typename SOUT = int, typename Q = float, proto_max<Q> MAX = max_star>\nclass CPM_BCJR\n{\nprotected:\n" }, { "change_type": "RENAME", "old_path": "src/Module/Modem/CPM/BCJR/CPM_BCJR.hxx", "new_path": "src/Tools/Code/CPM/BCJR/CPM_BCJR.hxx", "diff": "namespace aff3ct\n{\n-namespace module\n+namespace tools\n{\ntemplate<typename Q>\ninline Q negative_inf(){return std::numeric_limits<Q>::lowest(); }\n@@ -19,7 +19,7 @@ inline Q negative_inf(){return std::numeric_limits<Q>::lowest(); }\ntemplate<typename Q>\ninline Q positive_inf(){return std::numeric_limits<Q>::max(); }\n-template <typename Q, tools::proto_max<Q> MAX>\n+template <typename Q, proto_max<Q> MAX>\ninline void BCJR_normalize(Q *metrics, const int &n_states)\n{\n// normalization\n@@ -31,7 +31,7 @@ inline void BCJR_normalize(Q *metrics, const int &n_states)\nmetrics[j] -= norm_val;\n}\n-template <typename SIN, typename SOUT, typename Q, tools::proto_max<Q> MAX>\n+template <typename SIN, typename SOUT, typename Q, proto_max<Q> MAX>\nCPM_BCJR<SIN,SOUT,Q,MAX>\n::CPM_BCJR(const CPM_parameters<SIN,SOUT>& _cpm, const int _n_symbols)\n: cpm (_cpm ),\n@@ -49,7 +49,7 @@ CPM_BCJR<SIN,SOUT,Q,MAX>\n{\n}\n-template <typename SIN, typename SOUT, typename Q, tools::proto_max<Q> MAX>\n+template <typename SIN, typename SOUT, typename Q, proto_max<Q> MAX>\nvoid CPM_BCJR<SIN,SOUT,Q,MAX>\n::decode(const std::vector<Q> &Lch_N, std::vector<Q> &Le_N)\n{\n@@ -58,7 +58,7 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\nstd::stringstream message;\nmessage << \"'Lch_N.size()' has to be equal to 'chn_size' ('Lch_N.size()' = \" << Lch_N.size()\n<< \", 'chn_size' = \" << chn_size << \").\";\n- throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n}\nif (Le_N.size() != ext_size)\n@@ -66,13 +66,13 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\nstd::stringstream message;\nmessage << \"'Le_N.size()' has to be equal to 'ext_size' ('Le_N.size()' = \" << Le_N.size()\n<< \", 'ext_size' = \" << ext_size << \").\";\n- throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n}\nthis->decode(Lch_N.data(), Le_N.data());\n}\n-template <typename SIN, typename SOUT, typename Q, tools::proto_max<Q> MAX>\n+template <typename SIN, typename SOUT, typename Q, proto_max<Q> MAX>\nvoid CPM_BCJR<SIN,SOUT,Q,MAX>\n::decode(const Q *Lch_N, Q *Le_N)\n{\n@@ -84,7 +84,7 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\ncompute_ext (Le_N );\n}\n-template <typename SIN, typename SOUT, typename Q, tools::proto_max<Q> MAX>\n+template <typename SIN, typename SOUT, typename Q, proto_max<Q> MAX>\nvoid CPM_BCJR<SIN,SOUT,Q,MAX>\n::decode(const std::vector<Q> &Lch_N, const std::vector<Q> &Ldec_N, std::vector<Q> &Le_N)\n{\n@@ -93,7 +93,7 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\nstd::stringstream message;\nmessage << \"'Lch_N.size()' has to be equal to 'chn_size' ('Lch_N.size()' = \" << Lch_N.size()\n<< \", 'chn_size' = \" << chn_size << \").\";\n- throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n}\nif (Ldec_N.size() != dec_size)\n@@ -101,7 +101,7 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\nstd::stringstream message;\nmessage << \"'Ldec_N.size()' has to be equal to 'dec_size' ('Ldec_N.size()' = \" << Ldec_N.size()\n<< \", 'dec_size' = \" << dec_size << \").\";\n- throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n}\nif (Le_N.size() != ext_size)\n@@ -109,13 +109,13 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\nstd::stringstream message;\nmessage << \"'Le_N.size()' has to be equal to 'ext_size' ('Le_N.size()' = \" << Le_N.size()\n<< \", 'ext_size' = \" << ext_size << \").\";\n- throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n}\nthis->decode(Lch_N.data(), Ldec_N.data(), Le_N.data());\n}\n-template <typename SIN, typename SOUT, typename Q, tools::proto_max<Q> MAX>\n+template <typename SIN, typename SOUT, typename Q, proto_max<Q> MAX>\nvoid CPM_BCJR<SIN,SOUT,Q,MAX>\n::decode(const Q *Lch_N, const Q *Ldec_N, Q *Le_N)\n{\n@@ -126,7 +126,7 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\ncompute_ext (Ldec_N, Le_N);\n}\n-template <typename SIN, typename SOUT, typename Q, tools::proto_max<Q> MAX>\n+template <typename SIN, typename SOUT, typename Q, proto_max<Q> MAX>\nvoid CPM_BCJR<SIN,SOUT,Q,MAX>\n::LLR_to_logsymb_proba(const Q *Ldec_N)\n{\n@@ -144,7 +144,7 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\n}\n}\n-template <typename SIN, typename SOUT, typename Q, tools::proto_max<Q> MAX>\n+template <typename SIN, typename SOUT, typename Q, proto_max<Q> MAX>\nvoid CPM_BCJR<SIN,SOUT,Q,MAX>\n::compute_alpha_beta_gamma(const Q *Lch_N)\n{\n@@ -190,7 +190,7 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\n}\n}\n-template <typename SIN, typename SOUT, typename Q, tools::proto_max<Q> MAX>\n+template <typename SIN, typename SOUT, typename Q, proto_max<Q> MAX>\nvoid CPM_BCJR<SIN,SOUT,Q,MAX>\n::symboles_probas()\n{\n@@ -206,7 +206,7 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\ngamma [(i * cpm.max_st_id + cpm.allowed_states[st]) * cpm.m_order + tr]);\n}\n-template <typename SIN, typename SOUT, typename Q, tools::proto_max<Q> MAX>\n+template <typename SIN, typename SOUT, typename Q, proto_max<Q> MAX>\nvoid CPM_BCJR<SIN,SOUT,Q,MAX>\n::bits_probas()\n{\n@@ -226,7 +226,7 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\n}\n}\n-template <typename SIN, typename SOUT, typename Q, tools::proto_max<Q> MAX>\n+template <typename SIN, typename SOUT, typename Q, proto_max<Q> MAX>\nvoid CPM_BCJR<SIN,SOUT,Q,MAX>\n::compute_ext(Q *Le_N)\n{\n@@ -236,7 +236,7 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\nLe_N[i] = proba_msg_bits[i*2] - proba_msg_bits[i*2 +1];\n}\n-template <typename SIN, typename SOUT, typename Q, tools::proto_max<Q> MAX>\n+template <typename SIN, typename SOUT, typename Q, proto_max<Q> MAX>\nvoid CPM_BCJR<SIN,SOUT,Q,MAX>\n::compute_ext(const Q *Ldec_N, Q *Le_N)\n{\n" }, { "change_type": "RENAME", "old_path": "src/Module/Modem/CPM/CPE/Encoder_CPE.cpp", "new_path": "src/Tools/Code/CPM/CPE/Encoder_CPE.cpp", "diff": "#include \"Encoder_CPE.hpp\"\nusing namespace aff3ct;\n-using namespace aff3ct::module;\n+using namespace aff3ct::tools;\ntemplate<typename SIN, typename SOUT>\nEncoder_CPE<SIN, SOUT>\n@@ -18,7 +18,7 @@ Encoder_CPE<SIN, SOUT>\nstd::stringstream message;\nmessage << \"'cpm.m_order' has to be equal or smaller than 'sizeof(SIN)' * 256 ('cpm.m_order' = \"\n<< cpm.m_order << \", 'sizeof(SIN)' = \" << sizeof(SIN) << \").\";\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n// because V_n can have p values\n@@ -27,7 +27,7 @@ Encoder_CPE<SIN, SOUT>\nstd::stringstream message;\nmessage << \"'cpm.p' has to be equal or smaller than 'sizeof(SIN)' * 256 ('cpm.p' = \" << cpm.p\n<< \", 'sizeof(SIN)' = \" << sizeof(SIN) << \").\";\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n// because X_n can have Nb_xa values\n@@ -36,7 +36,7 @@ Encoder_CPE<SIN, SOUT>\nstd::stringstream message;\nmessage << \"'cpm.n_wa' has to be equal or smaller than 'sizeof(SOUT)' * 256 ('cpm.n_wa' = \" << cpm.n_wa\n<< \", 'sizeof(SOUT)' = \" << sizeof(SOUT) << \").\";\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n}\n@@ -62,7 +62,7 @@ void Encoder_CPE<SIN, SOUT>\n{\nstd::stringstream message;\nmessage << \"'U_N.size()' has to be equal to 'N' ('U_N.size()' = \" << U_N.size() << \", 'N' = \" << N << \").\";\n- throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n}\nif ((int)X_N.size() != (N + cpm.tl))\n@@ -70,7 +70,7 @@ void Encoder_CPE<SIN, SOUT>\nstd::stringstream message;\nmessage << \"'X_N.size()' has to be equal to 'N' + 'cpm.tl' ('X_N.size()' = \" << X_N.size()\n<< \", 'N' = \" << N << \", 'cpm.tl' = \" << cpm.tl << \").\";\n- throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n}\nauto state = 0; // initial (and final) state 0\n@@ -88,7 +88,7 @@ void Encoder_CPE<SIN, SOUT>\n{\nstd::stringstream message;\nmessage << \"'state' should be equal to 0 ('state' = \" << state << \").\";\n- throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n}\n@@ -103,7 +103,7 @@ void Encoder_CPE<SIN, SOUT>\n<< \"('trellis_next_state.size()' = \" << trellis_next_state.size()\n<< \", 'cpm.max_st_id' = \" << cpm.max_st_id\n<< \", 'cpm.m_order' = \" << cpm.m_order << \").\";\n- throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n}\nif ((int)trellis_related_wave_form.size() != cpm.max_st_id * cpm.m_order)\n@@ -113,7 +113,7 @@ void Encoder_CPE<SIN, SOUT>\n<< \" ('trellis_related_wave_form.size()' = \" << trellis_related_wave_form.size()\n<< \", 'cpm.max_st_id' = \" << cpm.max_st_id\n<< \", 'cpm.m_order' = \" << cpm.m_order << \").\";\n- throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n}\nint state;\n@@ -142,7 +142,7 @@ void Encoder_CPE<SIN, SOUT>\n<< \"('anti_trellis_original_state.size()' = \" << anti_trellis_original_state.size()\n<< \", 'cpm.max_st_id' = \" << cpm.max_st_id\n<< \", 'cpm.m_order' = \" << cpm.m_order << \").\";\n- throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n}\nif ((int)anti_trellis_input_transition.size() != cpm.max_st_id * cpm.m_order)\n@@ -152,7 +152,7 @@ void Encoder_CPE<SIN, SOUT>\n<< \"('anti_trellis_input_transition.size()' = \" << anti_trellis_input_transition.size()\n<< \", 'cpm.max_st_id' = \" << cpm.max_st_id\n<< \", 'cpm.m_order' = \" << cpm.m_order << \").\";\n- throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n}\nstd::vector<int> counter(cpm.max_st_id, 0);\n@@ -170,7 +170,7 @@ void Encoder_CPE<SIN, SOUT>\nstd::stringstream message;\nmessage << \"'next_state' should be smaller than 'cpm.max_st_id' ('next_state' = \" << next_state\n<< \", 'cpm.max_st_id' = \" << cpm.max_st_id << \").\";\n- throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\nif (counter[next_state] >= cpm.m_order)\n@@ -179,7 +179,7 @@ void Encoder_CPE<SIN, SOUT>\nmessage << \"'counter[next_state]' should be smaller than 'cpm.m_order' \"\n<< \"('next_state' = \" << next_state << \", 'counter[next_state]' = \" << counter[next_state]\n<< \", 'cpm.m_order' = \" << cpm.m_order << \").\";\n- throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\nanti_trellis_original_state [next_state*cpm.m_order + counter[next_state]] = cpm.allowed_states[st];\n@@ -205,11 +205,11 @@ SIN Encoder_CPE<SIN, SOUT>\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef AFF3CT_MULTI_PREC\n-template class aff3ct::module::Encoder_CPE<B_8, B_8 >;\n-template class aff3ct::module::Encoder_CPE<B_16, B_16>;\n-template class aff3ct::module::Encoder_CPE<B_32, B_32>;\n-template class aff3ct::module::Encoder_CPE<B_64, B_64>;\n+template class aff3ct::tools::Encoder_CPE<B_8, B_8 >;\n+template class aff3ct::tools::Encoder_CPE<B_16, B_16>;\n+template class aff3ct::tools::Encoder_CPE<B_32, B_32>;\n+template class aff3ct::tools::Encoder_CPE<B_64, B_64>;\n#else\n-template class aff3ct::module::Encoder_CPE<B, B>;\n+template class aff3ct::tools::Encoder_CPE<B, B>;\n#endif\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "RENAME", "old_path": "src/Module/Modem/CPM/CPE/Encoder_CPE.hpp", "new_path": "src/Tools/Code/CPM/CPE/Encoder_CPE.hpp", "diff": "namespace aff3ct\n{\n-namespace module\n+namespace tools\n{\ntemplate <typename SIN = int, typename SOUT = int>\nclass Encoder_CPE\n" }, { "change_type": "RENAME", "old_path": "src/Module/Modem/CPM/CPE/Encoder_CPE_Rimoldi.cpp", "new_path": "src/Tools/Code/CPM/CPE/Encoder_CPE_Rimoldi.cpp", "diff": "#include \"Encoder_CPE_Rimoldi.hpp\"\nusing namespace aff3ct;\n-using namespace aff3ct::module;\n+using namespace aff3ct::tools;\ntemplate <typename SIN, typename SOUT>\nEncoder_CPE_Rimoldi<SIN, SOUT>\n@@ -54,7 +54,7 @@ SIN Encoder_CPE_Rimoldi<SIN, SOUT>\nstd::stringstream message;\nmessage << \"'state' has to be smaller than 'cpm.max_st_id' ('state' = \" << state\n<< \", 'cpm.max_st_id' = \" << this->cpm.max_st_id << \").\";\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\nreturn (SIN)tail_symb_transition[state];\n@@ -73,7 +73,7 @@ void Encoder_CPE_Rimoldi<SIN, SOUT>\n<< \"('transition_to_binary.size()' = \" << transition_to_binary.size()\n<< \", 'cpm.m_order' = \" << this->cpm.m_order\n<< \", 'cpm.n_b_per_s' = \" << this->cpm.n_b_per_s << \").\";\n- throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n}\nif ((int)binary_to_transition.size() != this->cpm.m_order)\n@@ -82,7 +82,7 @@ void Encoder_CPE_Rimoldi<SIN, SOUT>\nmessage << \"'binary_to_transition.size()' has to be equal to 'cpm.m_order' \"\n<< \"('binary_to_transition.size()' = \" << binary_to_transition.size()\n<< \", 'cpm.m_order' = \" << this->cpm.m_order << \").\";\n- throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n}\nif (mapping == \"NATURAL\")\n@@ -108,7 +108,7 @@ void Encoder_CPE_Rimoldi<SIN, SOUT>\nthis->cpm.n_b_per_s, true)] = tr;\n}\nelse\n- throw tools::runtime_error(__FILE__, __LINE__, __func__, \"Unknown BCJR mapping scheme ('mapping' = \" + mapping + \").\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"Unknown BCJR mapping scheme ('mapping' = \" + mapping + \").\");\n}\ntemplate<typename SIN, typename SOUT>\n@@ -120,7 +120,7 @@ void Encoder_CPE_Rimoldi<SIN, SOUT>\nstd::stringstream message;\nmessage << \"'allowed_states.size()' has to be equal to 'cpm.n_st' ('allowed_states.size()' = \"\n<< allowed_states.size() << \", 'cpm.n_st' = \" << this->cpm.n_st << \").\";\n- throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n}\nint state_index = 0;\n@@ -152,7 +152,7 @@ void Encoder_CPE_Rimoldi<SIN, SOUT>\nstd::stringstream message;\nmessage << \"'allowed_wave_forms.size()' has to be equal to 'cpm.n_wa' ('allowed_wave_forms.size()' = \"\n<< allowed_wave_forms.size() << \", 'cpm.n_wa' = \" << this->cpm.n_wa << \").\";\n- throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n}\nint wa_index = 0;\n@@ -237,18 +237,18 @@ void Encoder_CPE_Rimoldi<SIN, SOUT>\nstd::stringstream message;\nmessage << \"'n_tail_symb' has to be equal to 'cpm.tl' ('n_tail_symb' = \"\n<< n_tail_symb << \", 'cpm.tl' = \" << this->cpm.tl << \").\";\n- throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n}\n}\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef AFF3CT_MULTI_PREC\n-template class aff3ct::module::Encoder_CPE_Rimoldi<B_8, B_8 >;\n-template class aff3ct::module::Encoder_CPE_Rimoldi<B_16, B_16>;\n-template class aff3ct::module::Encoder_CPE_Rimoldi<B_32, B_32>;\n-template class aff3ct::module::Encoder_CPE_Rimoldi<B_64, B_64>;\n+template class aff3ct::tools::Encoder_CPE_Rimoldi<B_8, B_8 >;\n+template class aff3ct::tools::Encoder_CPE_Rimoldi<B_16, B_16>;\n+template class aff3ct::tools::Encoder_CPE_Rimoldi<B_32, B_32>;\n+template class aff3ct::tools::Encoder_CPE_Rimoldi<B_64, B_64>;\n#else\n-template class aff3ct::module::Encoder_CPE_Rimoldi<B, B>;\n+template class aff3ct::tools::Encoder_CPE_Rimoldi<B, B>;\n#endif\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "RENAME", "old_path": "src/Module/Modem/CPM/CPE/Encoder_CPE_Rimoldi.hpp", "new_path": "src/Tools/Code/CPM/CPE/Encoder_CPE_Rimoldi.hpp", "diff": "namespace aff3ct\n{\n-namespace module\n+namespace tools\n{\ntemplate <typename SIN = int, typename SOUT = int>\nclass Encoder_CPE_Rimoldi : public Encoder_CPE<SIN, SOUT>\n" }, { "change_type": "RENAME", "old_path": "src/Module/Modem/CPM/CPM_parameters.hpp", "new_path": "src/Tools/Code/CPM/CPM_parameters.hpp", "diff": "namespace aff3ct\n{\n-namespace module\n+namespace tools\n{\ntemplate <typename SIN = int, typename SOUT = int>\nclass CPM_parameters\n" } ]
C++
MIT License
aff3ct/aff3ct
Move non-module CPM classes from 'module' to 'tools' namespace.
8,488
06.09.2019 10:12:52
-7,200
0692819effbc2611c79244828cb287d0a39c1f8e
Modify debian packages names, add libaff3ct.
[ { "change_type": "MODIFY", "old_path": "cmake/Modules/UploadPPA.cmake", "new_path": "cmake/Modules/UploadPPA.cmake", "diff": "@@ -59,31 +59,39 @@ foreach(DISTRI ${AFF3CT_PPA_DISTRIB})\n\"Standards-Version: 3.9.7\\n\"\n\"Homepage: ${CPACK_DEBIAN_PACKAGE_HOMEPAGE}\\n\"\n\"\\n\"\n- \"Package: ${CPACK_DEBIAN_PACKAGE_NAME}\\n\"\n+ \"Package: ${CPACK_DEBIAN_PACKAGE_NAME}-bin\\n\"\n\"Architecture: ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}\\n\"\n\"Depends: ${bin_depends}, \\${shlibs:Depends}, \\${misc:Depends}\\n\"\n\"Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}\\n\"\n\"${DEBIAN_LONG_DESCRIPTION}\\n\"\n\"\\n\"\n- \"Package: ${CPACK_DEBIAN_PACKAGE_NAME}-dev\\n\"\n+ \"Package: lib${CPACK_DEBIAN_PACKAGE_NAME}\\n\"\n\"Architecture: ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}\\n\"\n\"Depends: ${bin_depends}, \\${shlibs:Depends}, \\${misc:Depends}\\n\"\n\"Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}\\n\"\n\"${DEBIAN_LONG_DESCRIPTION}\\n\"\n\"\\n\"\n+ \"Package: lib${CPACK_DEBIAN_PACKAGE_NAME}-dev\\n\"\n+ \"Architecture: ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}\\n\"\n+ \"Depends: lib${CPACK_DEBIAN_PACKAGE_NAME}, ${bin_depends}, \\${shlibs:Depends}, \\${misc:Depends}\\n\"\n+ \"Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}\\n\"\n+ \"${DEBIAN_LONG_DESCRIPTION}\\n\"\n+ \"\\n\"\n\"Package: ${CPACK_DEBIAN_PACKAGE_NAME}-doc\\n\"\n\"Architecture: ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}\\n\"\n\"Depends: ${bin_depends}, \\${shlibs:Depends}, \\${misc:Depends}\\n\"\n\"Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}\\n\"\n\"${DEBIAN_LONG_DESCRIPTION}\\n\")\n- file(WRITE \"${DEBIAN_SOURCE_DIR}/debian/${CPACK_DEBIAN_PACKAGE_NAME}.install\"\n+ file(WRITE \"${DEBIAN_SOURCE_DIR}/debian/${CPACK_DEBIAN_PACKAGE_NAME}-bin.install\"\n\"usr/bin/*\\n\"\n\"usr/share/aff3ct-${AFF3CT_VERSION_FULL}/conf/*\\n\"\n\"usr/share/aff3ct-${AFF3CT_VERSION_FULL}/refs/*\\n\")\n- file(WRITE \"${DEBIAN_SOURCE_DIR}/debian/${CPACK_DEBIAN_PACKAGE_NAME}-dev.install\"\n- \"usr/lib/x86_64-linux-gnu/*\\n\"\n+ file(WRITE \"${DEBIAN_SOURCE_DIR}/debian/lib${CPACK_DEBIAN_PACKAGE_NAME}.install\"\n+ \"usr/lib/x86_64-linux-gnu/*\\n\")\n+\n+ file(WRITE \"${DEBIAN_SOURCE_DIR}/debian/lib${CPACK_DEBIAN_PACKAGE_NAME}-dev.install\"\n\"usr/include/aff3ct-${AFF3CT_VERSION_FULL}/*\\n\")\nfile(WRITE \"${DEBIAN_SOURCE_DIR}/debian/${CPACK_DEBIAN_PACKAGE_NAME}-doc.install\"\n" } ]
C++
MIT License
aff3ct/aff3ct
Modify debian packages names, add libaff3ct.
8,488
11.09.2019 10:10:32
-7,200
47f62d20ae40e9ed602112df1ba26f85fd1103f6
Update doc with new package names.
[ { "change_type": "MODIFY", "old_path": "doc/sphinx/source/user/installation/installation/installation.rst", "new_path": "doc/sphinx/source/user/installation/installation/installation.rst", "diff": "@@ -85,11 +85,16 @@ Update package list and install:\n.. code-block:: bash\nsudo apt-get update\n- sudo apt-get install aff3ct aff3ct-dev aff3ct-doc\n+ sudo apt-get install aff3ct-bin aff3ct-doc libaff3ct libaff3ct-dev\n+\n+* The package ``aff3ct-bin`` contains the ``bin/``, ``conf/`` and ``refs/`` folders.\n+\n+* The package ``aff3ct-doc`` contains the ``doc/`` folder.\n+\n+* The package ``libaff3ct`` contains the ``lib/`` folder.\n+\n+* The package ``libaff3ct-dev`` contains the ``include/`` folder and depends on the ``libaff3ct`` package.\n-The package ``aff3ct`` contains the ``bin/``, ``conf/`` and ``refs/`` folders.\n-The package ``aff3ct-dev`` contains the ``include/`` and ``lib/`` folders.\n-The package ``aff3ct-doc`` contains the ``doc/`` folder.\nContents\n--------\n" } ]
C++
MIT License
aff3ct/aff3ct
Update doc with new package names.
8,490
12.09.2019 16:34:17
-7,200
f02018bee63eb5a3bca9c42b5dccbcdceb389b84
Clean headers includes (aff3ct::launcher).
[ { "change_type": "MODIFY", "old_path": "src/Launcher/Code/BCH/BCH.hpp", "new_path": "src/Launcher/Code/BCH/BCH.hpp", "diff": "#ifndef LAUNCHER_BCH_HPP_\n#define LAUNCHER_BCH_HPP_\n+#include <iostream>\n+\n#include \"Factory/Module/Codec/BCH/Codec_BCH.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Code/LDPC/LDPC.hpp", "new_path": "src/Launcher/Code/LDPC/LDPC.hpp", "diff": "#ifndef LAUNCHER_LDPC_HPP_\n#define LAUNCHER_LDPC_HPP_\n+#include <iostream>\n+\n#include \"Factory/Module/Codec/LDPC/Codec_LDPC.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Code/Polar/Polar.hpp", "new_path": "src/Launcher/Code/Polar/Polar.hpp", "diff": "#ifndef LAUNCHER_POLAR_HPP_\n#define LAUNCHER_POLAR_HPP_\n+#include <iostream>\n+\n#include \"Factory/Module/Codec/Polar/Codec_polar.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Code/RA/RA.hpp", "new_path": "src/Launcher/Code/RA/RA.hpp", "diff": "#ifndef LAUNCHER_RA_HPP_\n#define LAUNCHER_RA_HPP_\n+#include <iostream>\n+\n#include \"Factory/Module/Codec/RA/Codec_RA.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Code/RS/RS.hpp", "new_path": "src/Launcher/Code/RS/RS.hpp", "diff": "#ifndef LAUNCHER_RS_HPP_\n#define LAUNCHER_RS_HPP_\n+#include <iostream>\n+\n#include \"Factory/Module/Codec/RS/Codec_RS.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Code/RSC/RSC.hpp", "new_path": "src/Launcher/Code/RSC/RSC.hpp", "diff": "#ifndef LAUNCHER_RSC_HPP_\n#define LAUNCHER_RSC_HPP_\n+#include <iostream>\n+\n#include \"Factory/Module/Codec/RSC/Codec_RSC.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Code/RSC_DB/RSC_DB.hpp", "new_path": "src/Launcher/Code/RSC_DB/RSC_DB.hpp", "diff": "#ifndef LAUNCHER_RSC_DB_HPP_\n#define LAUNCHER_RSC_DB_HPP_\n+#include <iostream>\n+\n#include \"Factory/Module/Codec/RSC_DB/Codec_RSC_DB.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Code/Repetition/Repetition.hpp", "new_path": "src/Launcher/Code/Repetition/Repetition.hpp", "diff": "#ifndef LAUNCHER_REPETITION_HPP_\n#define LAUNCHER_REPETITION_HPP_\n+#include <iostream>\n+\n#include \"Factory/Module/Codec/Repetition/Codec_repetition.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Code/Turbo/Turbo.hpp", "new_path": "src/Launcher/Code/Turbo/Turbo.hpp", "diff": "#ifndef LAUNCHER_TURBO_HPP_\n#define LAUNCHER_TURBO_HPP_\n+#include <iostream>\n+\n#include \"Factory/Module/Codec/Turbo/Codec_turbo.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Code/Turbo_DB/Turbo_DB.hpp", "new_path": "src/Launcher/Code/Turbo_DB/Turbo_DB.hpp", "diff": "#ifndef LAUNCHER_TURBO_DB_HPP_\n#define LAUNCHER_TURBO_DB_HPP_\n+#include <iostream>\n+\n#include \"Factory/Module/Codec/Turbo_DB/Codec_turbo_DB.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Code/Turbo_product/Turbo_product.hpp", "new_path": "src/Launcher/Code/Turbo_product/Turbo_product.hpp", "diff": "#ifndef LAUNCHER_TURBO_PRODUCT_HPP_\n#define LAUNCHER_TURBO_PRODUCT_HPP_\n+#include <iostream>\n+\n#include \"Factory/Module/Codec/Turbo_product/Codec_turbo_product.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Code/Uncoded/Uncoded.hpp", "new_path": "src/Launcher/Code/Uncoded/Uncoded.hpp", "diff": "#ifndef LAUNCHER_UNCODED_HPP_\n#define LAUNCHER_UNCODED_HPP_\n+#include <iostream>\n+\n#include \"Factory/Module/Codec/Uncoded/Codec_uncoded.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.hpp", "new_path": "src/Launcher/Launcher.hpp", "diff": "#ifndef LAUNCHER_HPP_\n#define LAUNCHER_HPP_\n-#include <map>\n+#include <iostream>\n+#include <vector>\n#include <string>\n#include <memory>\n-#include \"Tools/types.h\"\n#include \"Tools/Arguments/Argument_handler.hpp\"\n-\n+#include \"Tools/Arguments/Maps/Argument_map_info.hpp\"\n+#include \"Tools/Arguments/Maps/Argument_map_value.hpp\"\n#include \"Factory/Simulation/Simulation.hpp\"\n-\n#include \"Simulation/Simulation.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Simulation/BFER_ite.hpp", "new_path": "src/Launcher/Simulation/BFER_ite.hpp", "diff": "#ifndef LAUNCHER_BFER_ITE_HPP_\n#define LAUNCHER_BFER_ITE_HPP_\n-#include \"Factory/Simulation/BFER/BFER_ite.hpp\"\n+#include <iostream>\n+#include \"Factory/Simulation/BFER/BFER_ite.hpp\"\n+#include \"Simulation/Simulation.hpp\"\n#include \"Launcher/Launcher.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Simulation/BFER_std.hpp", "new_path": "src/Launcher/Simulation/BFER_std.hpp", "diff": "#ifndef LAUNCHER_BFER_STD_HPP_\n#define LAUNCHER_BFER_STD_HPP_\n-#include \"Factory/Simulation/BFER/BFER_std.hpp\"\n+#include <iostream>\n+#include \"Factory/Simulation/BFER/BFER_std.hpp\"\n+#include \"Simulation/Simulation.hpp\"\n#include \"Launcher/Launcher.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Simulation/EXIT.hpp", "new_path": "src/Launcher/Simulation/EXIT.hpp", "diff": "#ifndef LAUNCHER_EXIT_HPP_\n#define LAUNCHER_EXIT_HPP_\n-#include \"Factory/Simulation/EXIT/EXIT.hpp\"\n+#include <iostream>\n+#include \"Factory/Simulation/EXIT/EXIT.hpp\"\n+#include \"Simulation/Simulation.hpp\"\n#include \"Launcher/Launcher.hpp\"\nnamespace aff3ct\n" } ]
C++
MIT License
aff3ct/aff3ct
Clean headers includes (aff3ct::launcher).
8,490
12.09.2019 17:19:48
-7,200
cdc18e4f5c42b10d62fc96ab1154d6686cfb0ae4
Clean headers includes (aff3ct::simulation).
[ { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.cpp", "new_path": "src/Simulation/BFER/BFER.cpp", "diff": "#include \"Tools/Display/rang_format/rang_format.h\"\n#include \"Tools/Display/Statistics/Statistics.hpp\"\n#include \"Tools/Exception/exception.hpp\"\n-\n+#include \"Tools/Display/Reporter/MI/Reporter_MI.hpp\"\n+#include \"Tools/Display/Reporter/BFER/Reporter_BFER.hpp\"\n+#include \"Tools/Display/Reporter/Noise/Reporter_noise.hpp\"\n+#include \"Tools/Display/Reporter/Throughput/Reporter_throughput.hpp\"\n#include \"Factory/Module/Monitor/Monitor.hpp\"\n#include \"Factory/Tools/Display/Terminal/Terminal.hpp\"\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.hpp", "new_path": "src/Simulation/BFER/BFER.hpp", "diff": "#ifndef SIMULATION_BFER_HPP_\n#define SIMULATION_BFER_HPP_\n-#include <map>\n+#include <mutex>\n#include <chrono>\n#include <vector>\n#include <memory>\n-#include \"Tools/Display/Reporter/BFER/Reporter_BFER.hpp\"\n-#include \"Tools/Display/Reporter/MI/Reporter_MI.hpp\"\n-#include \"Tools/Display/Reporter/Noise/Reporter_noise.hpp\"\n-#include \"Tools/Display/Reporter/Throughput/Reporter_throughput.hpp\"\n-\n+#include \"Factory/Simulation/BFER/BFER.hpp\"\n+#include \"Tools/Display/Reporter/Reporter.hpp\"\n#include \"Tools/Display/Terminal/Terminal.hpp\"\n#include \"Tools/Display/Dumper/Dumper.hpp\"\n#include \"Tools/Display/Dumper/Dumper_reduction.hpp\"\n#include \"Tools/Math/Distribution/Distributions.hpp\"\n#include \"Tools/Noise/Noise.hpp\"\n-\n-#include \"Module/Module.hpp\"\n#include \"Module/Monitor/MI/Monitor_MI.hpp\"\n#include \"Module/Monitor/BFER/Monitor_BFER.hpp\"\n#include \"Module/Monitor/Monitor_reduction.hpp\"\n-\n#ifdef AFF3CT_MPI\n#include \"Module/Monitor/Monitor_reduction_MPI.hpp\"\n#endif\n-\n-#include \"Factory/Simulation/BFER/BFER.hpp\"\n-\n#include \"Simulation/Simulation.hpp\"\nnamespace aff3ct\n@@ -69,7 +60,6 @@ protected:\nstd::vector<std::unique_ptr<Monitor_BFER_type >> monitor_er;\nstd::unique_ptr<Monitor_BFER_reduction_type> monitor_er_red;\n-\n// dump frames into files\nstd::vector<std::unique_ptr<tools::Dumper >> dumper;\nstd::unique_ptr<tools::Dumper_reduction> dumper_red;\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/BFER_ite.hpp", "new_path": "src/Simulation/BFER/Iterative/BFER_ite.hpp", "diff": "#ifndef SIMULATION_BFER_ITE_HPP_\n#define SIMULATION_BFER_ITE_HPP_\n-#include <chrono>\n#include <vector>\n#include <random>\n+#include <memory>\n+#include \"Tools/Interleaver/Interleaver_core.hpp\"\n#include \"Module/Source/Source.hpp\"\n#include \"Module/CRC/CRC.hpp\"\n#include \"Module/Codec/Codec_SISO_SIHO.hpp\"\n#include \"Module/Quantizer/Quantizer.hpp\"\n#include \"Module/Coset/Coset.hpp\"\n#include \"Module/Interleaver/Interleaver.hpp\"\n-\n-#include \"Tools/Interleaver/Interleaver_core.hpp\"\n-\n#include \"Factory/Simulation/BFER/BFER_ite.hpp\"\n-\n#include \"Simulation/BFER/BFER.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/SystemC/SC_BFER_ite.hpp", "new_path": "src/Simulation/BFER/Iterative/SystemC/SC_BFER_ite.hpp", "diff": "#ifndef SC_SIMULATION_BFER_ITE_HPP_\n#define SC_SIMULATION_BFER_ITE_HPP_\n-#include \"Tools/SystemC/SC_Debug.hpp\"\n+#include <vector>\n+#include <memory>\n+\n#include \"Tools/SystemC/SC_Router.hpp\"\n#include \"Tools/SystemC/SC_Funnel.hpp\"\n#include \"Tools/SystemC/SC_Predicate.hpp\"\n#include \"Tools/SystemC/SC_Duplicator.hpp\"\n#include \"Tools/Display/Terminal/Terminal.hpp\"\n-\n+#include \"Factory/Simulation/BFER/BFER_ite.hpp\"\n+#include \"Module/Coset/Coset.hpp\"\n#include \"Simulation/BFER/Iterative/BFER_ite.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/Threads/BFER_ite_threads.hpp", "new_path": "src/Simulation/BFER/Iterative/Threads/BFER_ite_threads.hpp", "diff": "#ifndef SIMULATION_BFER_ITE_THREADS_HPP_\n#define SIMULATION_BFER_ITE_THREADS_HPP_\n+#include \"Factory/Simulation/BFER/BFER_ite.hpp\"\n#include \"Simulation/BFER/Iterative/BFER_ite.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/SystemC/SC_BFER_std.hpp", "new_path": "src/Simulation/BFER/Standard/SystemC/SC_BFER_std.hpp", "diff": "#define SC_SIMULATION_BFER_STD_HPP_\n#include \"Tools/SystemC/SC_Duplicator.hpp\"\n-\n+#include \"Factory/Simulation/BFER/BFER_std.hpp\"\n#include \"Simulation/BFER/Standard/BFER_std.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/Threads/BFER_std_threads.hpp", "new_path": "src/Simulation/BFER/Standard/Threads/BFER_std_threads.hpp", "diff": "#ifndef SIMULATION_BFER_STD_THREADS_HPP_\n#define SIMULATION_BFER_STD_THREADS_HPP_\n+#include \"Factory/Simulation/BFER/BFER_std.hpp\"\n#include \"Simulation/BFER/Standard/BFER_std.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/EXIT/EXIT.cpp", "new_path": "src/Simulation/EXIT/EXIT.cpp", "diff": "#include \"Tools/Display/Statistics/Statistics.hpp\"\n#include \"Tools/general_utils.h\"\n#include \"Tools/Math/utils.h\"\n+#include \"Tools/Display/Reporter/EXIT/Reporter_EXIT.hpp\"\n+#include \"Tools/Display/Reporter/Noise/Reporter_noise.hpp\"\n+#include \"Tools/Display/Reporter/Throughput/Reporter_throughput.hpp\"\n#include \"Simulation/EXIT/EXIT.hpp\"\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/EXIT/EXIT.hpp", "new_path": "src/Simulation/EXIT/EXIT.hpp", "diff": "#define SIMULATION_EXIT_HPP_\n#include <vector>\n+#include <memory>\n+#include \"Tools/Display/Terminal/Terminal.hpp\"\n+#include \"Tools/Noise/Sigma.hpp\"\n+#include \"Tools/Display/Reporter/Reporter.hpp\"\n#include \"Module/Source/Source.hpp\"\n#include \"Module/Codec/Codec_SISO.hpp\"\n#include \"Module/Modem/Modem.hpp\"\n#include \"Module/Decoder/Decoder_SISO.hpp\"\n#include \"Module/Monitor/EXIT/Monitor_EXIT.hpp\"\n-#include \"Tools/Display/Terminal/Terminal.hpp\"\n-#include \"Tools/Noise/Noise.hpp\"\n-\n-#include \"Tools/Display/Reporter/EXIT/Reporter_EXIT.hpp\"\n-#include \"Tools/Display/Reporter/Noise/Reporter_noise.hpp\"\n-#include \"Tools/Display/Reporter/Throughput/Reporter_throughput.hpp\"\n-\n#include \"Factory/Simulation/EXIT/EXIT.hpp\"\n#include \"Simulation/Simulation.hpp\"\n@@ -52,7 +49,6 @@ protected:\nstd::vector<std::unique_ptr<tools::Reporter>> reporters;\nstd::unique_ptr<tools::Terminal> terminal;\n-\npublic:\nexplicit EXIT(const factory::EXIT::parameters &params_EXIT);\nvirtual ~EXIT() = default;\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/Simulation.hpp", "new_path": "src/Simulation/Simulation.hpp", "diff": "#ifndef SIMULATION_HPP_\n#define SIMULATION_HPP_\n+#include <map>\n+#include <string>\n#include <memory>\n+#include <type_traits>\n-#include \"Module/Module.hpp\"\n#include \"Tools/Display/Terminal/Terminal.hpp\"\n#include \"Factory/Simulation/Simulation.hpp\"\n+#include \"Module/Module.hpp\"\nnamespace aff3ct\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/Simulation.hxx", "new_path": "src/Simulation/Simulation.hxx", "diff": "#ifndef SIMULATION_HXX_\n#define SIMULATION_HXX_\n-#include <type_traits>\n-\n#include \"Simulation/Simulation.hpp\"\nnamespace aff3ct\n" } ]
C++
MIT License
aff3ct/aff3ct
Clean headers includes (aff3ct::simulation).
8,490
19.09.2019 10:30:56
-7,200
6224de269cc7792fcc980ab7baf35cf19da9086a
Put 'version()' in 'aff3ct::tools' namespace + clean main.cpp headers.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Launcher/Launcher.cpp", "new_path": "src/Factory/Launcher/Launcher.cpp", "diff": "@@ -230,8 +230,8 @@ void factory::Launcher::parameters\ndate << std::chrono::system_clock::now();\nauto split_date = tools::split(date.str(), '.');\nparams_headers[p].push_back(std::make_pair(\"Date (UTC)\", split_date[0]));\n- if (version() != \"GIT-NOTFOUND\")\n- params_headers[p].push_back(std::make_pair(\"Git version\", version()));\n+ if (tools::version() != \"GIT-NOTFOUND\")\n+ params_headers[p].push_back(std::make_pair(\"Git version\", tools::version()));\nparams_headers[p].push_back(std::make_pair(\"Code type (C)\", this->cde_type));\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments/Types/File_system/File_system.hpp", "new_path": "src/Tools/Arguments/Types/File_system/File_system.hpp", "diff": "@@ -26,7 +26,7 @@ std::string modify_path(const std::string& val)\nstd::string basedir, filename;\nsplit_path(binary_path, basedir, filename);\n- std::string aff3ct_version = aff3ct::version();\n+ std::string aff3ct_version = version();\nif (!aff3ct_version.empty() && aff3ct_version[0] == 'v')\naff3ct_version.erase(0, 1); // rm the 'v'\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Documentation/documentation.cpp", "new_path": "src/Tools/Documentation/documentation.cpp", "diff": "@@ -124,7 +124,7 @@ std::string extract_documentation(const std::string &key)\nstd::string basedir, filename;\nsplit_path(binary_path, basedir, filename);\n- std::string aff3ct_version = aff3ct::version();\n+ std::string aff3ct_version = version();\nif (!aff3ct_version.empty() && aff3ct_version[0] == 'v')\naff3ct_version.erase(0, 1); // rm the 'v'\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/version.cpp.in", "new_path": "src/Tools/version.cpp.in", "diff": "#define GIT_SHA1 \"@GIT_SHA1@\"\n#define GIT_VERSION \"@GIT_VERSION@\"\n-std::string aff3ct::sha1()\n+std::string aff3ct::tools::sha1()\n{\nstd::string sha1(GIT_SHA1);\nreturn sha1;\n}\n-std::string aff3ct::version()\n+std::string aff3ct::tools::version()\n{\nstd::string version(GIT_VERSION);\nreturn version;\n}\n-int aff3ct::version_major()\n+int aff3ct::tools::version_major()\n{\nstd::string version(GIT_VERSION);\n@@ -41,7 +41,7 @@ int aff3ct::version_major()\n}\n}\n-int aff3ct::version_minor()\n+int aff3ct::tools::version_minor()\n{\nstd::string version(GIT_VERSION);\n@@ -67,7 +67,7 @@ int aff3ct::version_minor()\n}\n}\n-int aff3ct::version_release()\n+int aff3ct::tools::version_release()\n{\nstd::string version(GIT_VERSION);\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/version.h", "new_path": "src/Tools/version.h", "diff": "namespace aff3ct\n{\n+namespace tools\n+{\nstd::string sha1 ();\nstd::string version ();\nint version_major ();\nint version_minor ();\nint version_release();\n}\n+}\n#endif\n" }, { "change_type": "MODIFY", "old_path": "src/main.cpp", "new_path": "src/main.cpp", "diff": "-#include <cstdlib>\n-#include <iostream>\n#include <exception>\n+#include <iostream>\n+#include <cstdlib>\n+#include <vector>\n#include <string>\n-#include <map>\n#include <mipp.h>\n-\n#ifdef AFF3CT_MPI\n#include <mpi.h>\n#endif\n-\n#ifdef AFF3CT_SYSTEMC_SIMU\n#include <systemc>\n#endif\n#include \"Tools/version.h\"\n#include \"Tools/Arguments/Argument_handler.hpp\"\n#include \"Tools/Display/rang_format/rang_format.h\"\n-#include \"Tools/system_functions.h\"\n-\n#include \"Launcher/Launcher.hpp\"\n#include \"Factory/Launcher/Launcher.hpp\"\n@@ -69,7 +65,7 @@ void print_version()\nstd::string compiler = \"Unknown compiler\";\nstd::string compiler_version = \"\";\n#endif\n- std::string affect_version = version() == \"GIT-NOTFOUND\" ? \"\" : version();\n+ std::string affect_version = tools::version() == \"GIT-NOTFOUND\" ? \"\" : tools::version();\n#if defined(AFF3CT_MULTI_PREC)\nstd::string precision = \"8/16/32/64-bit\";\n" } ]
C++
MIT License
aff3ct/aff3ct
Put 'version()' in 'aff3ct::tools' namespace + clean main.cpp headers.
8,490
19.09.2019 14:14:41
-7,200
6cc383fa7f88089d997a9d0a7d8f107e775a1ecc
Move C++11 enumerate converter from 'Module' to 'SC_Module'.
[ { "change_type": "MODIFY", "old_path": "src/Module/Module.hpp", "new_path": "src/Module/Module.hpp", "diff": "#include \"Module/SC_Module.hpp\"\n#endif\n-// convert strongly typed enum to integer\n-template <typename E>\n-constexpr typename std::underlying_type<E>::type operator+(E e) noexcept {\n- return static_cast<typename std::underlying_type<E>::type>(e);\n-}\n-\nnamespace aff3ct\n{\nnamespace module\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Module.hxx", "new_path": "src/Module/Module.hxx", "diff": "@@ -4,12 +4,6 @@ namespace aff3ct\n{\nnamespace module\n{\n-// convert strongly typed enum to integer\n-template <typename E>\n-constexpr typename std::underlying_type<E>::type operator+(E e) noexcept {\n- return static_cast<typename std::underlying_type<E>::type>(e);\n-}\n-\ntemplate <typename T>\ninline Socket& Module\n::create_socket_in(Task& task, const std::string &name, const size_t n_elmts)\n" }, { "change_type": "MODIFY", "old_path": "src/Module/SC_Module.hpp", "new_path": "src/Module/SC_Module.hpp", "diff": "#include \"Module/Task.hpp\"\n+// convert strongly typed enum to integer\n+template <typename E>\n+constexpr typename std::underlying_type<E>::type operator+(E e) noexcept;\n+\nnamespace aff3ct\n{\nnamespace module\n" }, { "change_type": "MODIFY", "old_path": "src/Module/SC_Module.hxx", "new_path": "src/Module/SC_Module.hxx", "diff": "#include \"Module/SC_Module.hpp\"\n+// convert strongly typed enum to integer\n+template <typename E>\n+constexpr typename std::underlying_type<E>::type operator+(E e) noexcept {\n+ return static_cast<typename std::underlying_type<E>::type>(e);\n+}\n+\nnamespace aff3ct\n{\nnamespace module\n" } ]
C++
MIT License
aff3ct/aff3ct
Move C++11 enumerate converter from 'Module' to 'SC_Module'.
8,490
23.09.2019 10:36:17
-7,200
bc42b1f990453586c846a2aa1fc7cc323d672fe8
Add a custom name to the abstract 'Module' class + cosmetics.
[ { "change_type": "MODIFY", "old_path": "src/Module/Module.cpp", "new_path": "src/Module/Module.cpp", "diff": "using namespace aff3ct;\nusing namespace aff3ct::module;\n-Module::\n-Module(const int n_frames)\n+Module\n+::Module(const int n_frames)\n: n_frames(n_frames), name(\"Module\"), short_name(\"Module\")\n#ifdef AFF3CT_SYSTEMC_MODULE\n, sc(*this)\n@@ -21,44 +21,62 @@ Module(const int n_frames)\n}\n}\n-int Module::\n-get_n_frames() const\n+int Module\n+::get_n_frames() const\n{\nreturn n_frames;\n}\n-void Module::\n-set_name(const std::string &name)\n+void Module\n+::set_name(const std::string &name)\n{\nthis->name = name;\n}\n-const std::string& Module::\n-get_name() const\n+const std::string& Module\n+::get_name() const\n{\nreturn this->name;\n}\n-void Module::\n-set_short_name(const std::string &short_name)\n+void Module\n+::set_short_name(const std::string &short_name)\n{\nthis->short_name = short_name;\n}\n-const std::string& Module::\n-get_short_name() const\n+const std::string& Module\n+::get_short_name() const\n{\nreturn this->short_name;\n}\n-Task& Module::\n-operator[](const int id)\n+void Module\n+::set_custom_name(const std::string &custom_name)\n+{\n+ this->custom_name = custom_name;\n+}\n+\n+const std::string& Module\n+::get_custom_name() const\n+{\n+ return this->custom_name;\n+}\n+\n+void Module\n+::remove_custom_name()\n+{\n+ this->custom_name = \"\";\n+}\n+\n+Task& Module\n+::operator[](const int id)\n{\nreturn *tasks_with_nullptr[id];\n}\n-Task& Module::\n-create_task(const std::string &name, const int id)\n+Task& Module\n+::create_task(const std::string &name, const int id)\n{\nbool autoalloc = false, autoexec = false, stats = false, fast = false, debug = false;\nauto t = std::make_shared<Task>(*this, name, autoalloc, autoexec, stats, fast, debug);\n@@ -85,14 +103,14 @@ create_task(const std::string &name, const int id)\nreturn *tasks.back();\n}\n-void Module::\n-create_codelet(Task& task, std::function<int(void)> codelet)\n+void Module\n+::create_codelet(Task& task, std::function<int(void)> codelet)\n{\ntask.create_codelet(codelet);\n}\n-void Module::\n-register_timer(Task& task, const std::string &key)\n+void Module\n+::register_timer(Task& task, const std::string &key)\n{\ntask.register_timer(key);\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Module.hpp", "new_path": "src/Module/Module.hpp", "diff": "@@ -36,6 +36,7 @@ protected:\nint n_frames; /*!< Number of frames to process in this Module */\nstd::string name; /*!< Name of the Module. */\nstd::string short_name; /*!< Short name of the Module. */\n+ std::string custom_name; /*!< Custom name of the Module. */\nstd::vector<std::shared_ptr<Task>> tasks_with_nullptr;\npublic:\n@@ -65,17 +66,23 @@ public:\n*/\nvirtual int get_n_frames() const;\n- void set_name(const std::string &name);\n-\nconst std::string& get_name() const;\n- void set_short_name(const std::string &short_name);\n-\nconst std::string& get_short_name() const;\n+ void set_custom_name(const std::string &custom_name);\n+\n+ const std::string& get_custom_name() const;\n+\n+ void remove_custom_name();\n+\nTask& operator[](const int id);\nprotected:\n+ void set_name(const std::string &name);\n+\n+ void set_short_name(const std::string &short_name);\n+\nTask& create_task(const std::string &name, const int id = -1);\ntemplate <typename T>\n" }, { "change_type": "MODIFY", "old_path": "src/Module/SC_Module.cpp", "new_path": "src/Module/SC_Module.cpp", "diff": "using namespace aff3ct;\nusing namespace aff3ct::module;\n-SC_Module::SC_Module(Task &task, sc_core::sc_module_name sc_name)\n+SC_Module\n+::SC_Module(Task &task, sc_core::sc_module_name sc_name)\n: sc_module(sc_name),\ntask(task),\nindirect_sockets_in (task.sockets.size()),\n@@ -102,7 +103,8 @@ SC_Module::SC_Module(Task &task, sc_core::sc_module_name sc_name)\n}\n}\n-void SC_Module::b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t, Socket &socket)\n+void SC_Module\n+::b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t, Socket &socket)\n{\nif (trans.get_data_length() != socket.get_databytes())\n{\n@@ -126,7 +128,8 @@ void SC_Module::b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t\nsocket.bind((void*)trans.get_data_ptr());\n}\n-void SC_Module::b_transport_and_exec(tlm::tlm_generic_payload& trans, sc_core::sc_time& t, Socket &socket)\n+void SC_Module\n+::b_transport_and_exec(tlm::tlm_generic_payload& trans, sc_core::sc_time& t, Socket &socket)\n{\nb_transport(trans, t, socket);\n@@ -146,55 +149,64 @@ void SC_Module::b_transport_and_exec(tlm::tlm_generic_payload& trans, sc_core::s\n}\n}\n-void SC_Module::b_transport1(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n+void SC_Module\n+::b_transport1(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\nif (ptr_input_sockets.size() == 1) b_transport_and_exec(trans, t, *ptr_input_sockets[0]);\nelse b_transport (trans, t, *ptr_input_sockets[0]);\n}\n-void SC_Module::b_transport2(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n+void SC_Module\n+::b_transport2(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\nif (ptr_input_sockets.size() == 2) b_transport_and_exec(trans, t, *ptr_input_sockets[1]);\nelse b_transport (trans, t, *ptr_input_sockets[1]);\n}\n-void SC_Module::b_transport3(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n+void SC_Module\n+::b_transport3(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\nif (ptr_input_sockets.size() == 3) b_transport_and_exec(trans, t, *ptr_input_sockets[2]);\nelse b_transport (trans, t, *ptr_input_sockets[2]);\n}\n-void SC_Module::b_transport4(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n+void SC_Module\n+::b_transport4(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\nif (ptr_input_sockets.size() == 4) b_transport_and_exec(trans, t, *ptr_input_sockets[3]);\nelse b_transport (trans, t, *ptr_input_sockets[3]);\n}\n-void SC_Module::b_transport5(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n+void SC_Module\n+::b_transport5(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\nif (ptr_input_sockets.size() == 5) b_transport_and_exec(trans, t, *ptr_input_sockets[4]);\nelse b_transport (trans, t, *ptr_input_sockets[4]);\n}\n-void SC_Module::b_transport6(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n+void SC_Module\n+::b_transport6(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\nif (ptr_input_sockets.size() == 6) b_transport_and_exec(trans, t, *ptr_input_sockets[5]);\nelse b_transport (trans, t, *ptr_input_sockets[5]);\n}\n-void SC_Module::b_transport7(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n+void SC_Module\n+::b_transport7(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\nif (ptr_input_sockets.size() == 7) b_transport_and_exec(trans, t, *ptr_input_sockets[6]);\nelse b_transport (trans, t, *ptr_input_sockets[6]);\n}\n-void SC_Module::b_transport8(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n+void SC_Module\n+::b_transport8(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\nif (ptr_input_sockets.size() == 8) b_transport_and_exec(trans, t, *ptr_input_sockets[7]);\nelse b_transport (trans, t, *ptr_input_sockets[7]);\n}\n-void SC_Module::start_sc_thread()\n+void SC_Module\n+::start_sc_thread()\n{\n// infinite loop, can be stopped by calling 'sc_core::sc_stop()'\nwhile (true)\n@@ -232,12 +244,14 @@ void SC_Module::start_sc_thread()\n-SC_Module_container::SC_Module_container(Module &module)\n+SC_Module_container\n+::SC_Module_container(Module &module)\n: module(module), sc_modules()\n{\n}\n-void SC_Module_container::create_module(const int id)\n+void SC_Module_container\n+::create_module(const int id)\n{\nif (module.tasks_with_nullptr.size() != sc_modules.size())\n{\n@@ -260,7 +274,8 @@ void SC_Module_container::create_module(const int id)\n}\n}\n-void SC_Module_container::erase_module(const int id)\n+void SC_Module_container\n+::erase_module(const int id)\n{\nif ((size_t)id < sc_modules.size() && sc_modules[id] != nullptr)\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Task.cpp", "new_path": "src/Module/Task.cpp", "diff": "using namespace aff3ct;\nusing namespace aff3ct::module;\n-Task::Task(const Module &module, const std::string &name, const bool autoalloc, const bool autoexec,\n+Task\n+::Task(const Module &module, const std::string &name, const bool autoalloc, const bool autoexec,\nconst bool stats, const bool fast, const bool debug)\n: module(module),\nname(name),\n@@ -36,7 +37,8 @@ Task::Task(const Module &module, const std::string &name, const bool autoalloc,\n{\n}\n-void Task::set_autoalloc(const bool autoalloc)\n+void Task\n+::set_autoalloc(const bool autoalloc)\n{\nif (autoalloc != this->autoalloc)\n{\n@@ -61,12 +63,14 @@ void Task::set_autoalloc(const bool autoalloc)\n}\n}\n-void Task::set_autoexec(const bool autoexec)\n+void Task\n+::set_autoexec(const bool autoexec)\n{\nthis->autoexec = autoexec;\n}\n-void Task::set_stats(const bool stats)\n+void Task\n+::set_stats(const bool stats)\n{\nthis->stats = stats;\n@@ -74,7 +78,8 @@ void Task::set_stats(const bool stats)\nthis->set_fast(false);\n}\n-void Task::set_fast(const bool fast)\n+void Task\n+::set_fast(const bool fast)\n{\nthis->fast = fast;\nif (this->fast)\n@@ -87,7 +92,8 @@ void Task::set_fast(const bool fast)\nsockets[i]->set_fast(this->fast);\n}\n-void Task::set_debug(const bool debug)\n+void Task\n+::set_debug(const bool debug)\n{\nthis->debug = debug;\n@@ -95,22 +101,26 @@ void Task::set_debug(const bool debug)\nthis->set_fast(false);\n}\n-void Task::set_debug_hex(const bool debug_hex)\n+void Task\n+::set_debug_hex(const bool debug_hex)\n{\nthis->debug_hex = debug_hex;\n}\n-void Task::set_debug_limit(const uint32_t limit)\n+void Task\n+::set_debug_limit(const uint32_t limit)\n{\nthis->debug_limit = (int32_t)limit;\n}\n-void Task::set_debug_precision(const uint8_t prec)\n+void Task\n+::set_debug_precision(const uint8_t prec)\n{\nthis->debug_precision = prec;\n}\n-void Task::set_debug_frame_max(const uint32_t limit)\n+void Task\n+::set_debug_frame_max(const uint32_t limit)\n{\nthis->debug_frame_max = limit;\n}\n@@ -204,7 +214,8 @@ static inline void display_data(const T *data,\nstd::cout.flags(f);\n}\n-int Task::exec()\n+int Task\n+::exec()\n{\nif (fast)\n{\n@@ -220,8 +231,10 @@ int Task::exec()\n{\nauto n_fra = (size_t)this->module.get_n_frames();\n+ std::string module_name = module.get_custom_name().empty() ? module.get_name() : module.get_custom_name();\n+\nstd::cout << \"# \";\n- std::cout << rang::style::bold << rang::fg::green << module.get_name() << rang::style::reset\n+ std::cout << rang::style::bold << rang::fg::green << module_name << rang::style::reset\n<< \"::\"\n<< rang::style::bold << rang::fg::magenta << get_name() << rang::style::reset\n<< \"(\";\n@@ -330,7 +343,8 @@ int Task::exec()\n}\ntemplate <typename T>\n-Socket& Task::create_socket(const std::string &name, const size_t n_elmts)\n+Socket& Task\n+::create_socket(const std::string &name, const size_t n_elmts)\n{\nif (name.empty())\n{\n@@ -358,7 +372,8 @@ Socket& Task::create_socket(const std::string &name, const size_t n_elmts)\n}\ntemplate <typename T>\n-Socket& Task::create_socket_in(const std::string &name, const size_t n_elmts)\n+Socket& Task\n+::create_socket_in(const std::string &name, const size_t n_elmts)\n{\nauto &s = create_socket<T>(name, n_elmts);\n@@ -369,7 +384,8 @@ Socket& Task::create_socket_in(const std::string &name, const size_t n_elmts)\n}\ntemplate <typename T>\n-Socket& Task::create_socket_in_out(const std::string &name, const size_t n_elmts)\n+Socket& Task\n+::create_socket_in_out(const std::string &name, const size_t n_elmts)\n{\nauto &s = create_socket<T>(name, n_elmts);\n@@ -380,7 +396,8 @@ Socket& Task::create_socket_in_out(const std::string &name, const size_t n_elmts\n}\ntemplate <typename T>\n-Socket& Task::create_socket_out(const std::string &name, const size_t n_elmts)\n+Socket& Task\n+::create_socket_out(const std::string &name, const size_t n_elmts)\n{\nauto &s = create_socket<T>(name, n_elmts);\n@@ -396,12 +413,14 @@ Socket& Task::create_socket_out(const std::string &name, const size_t n_elmts)\nreturn s;\n}\n-void Task::create_codelet(std::function<int(void)> &codelet)\n+void Task\n+::create_codelet(std::function<int(void)> &codelet)\n{\nthis->codelet = codelet;\n}\n-bool Task::can_exec() const\n+bool Task\n+::can_exec() const\n{\nfor (size_t i = 0; i < sockets.size(); i++)\nif (sockets[i]->dataptr == nullptr)\n@@ -409,52 +428,62 @@ bool Task::can_exec() const\nreturn true;\n}\n-std::chrono::nanoseconds Task::get_duration_total() const\n+std::chrono::nanoseconds Task\n+::get_duration_total() const\n{\nreturn this->duration_total;\n}\n-std::chrono::nanoseconds Task::get_duration_avg() const\n+std::chrono::nanoseconds Task\n+::get_duration_avg() const\n{\nreturn this->duration_total / this->n_calls;\n}\n-std::chrono::nanoseconds Task::get_duration_min() const\n+std::chrono::nanoseconds Task\n+::get_duration_min() const\n{\nreturn this->duration_min;\n}\n-std::chrono::nanoseconds Task::get_duration_max() const\n+std::chrono::nanoseconds Task\n+::get_duration_max() const\n{\nreturn this->duration_max;\n}\n-const std::vector<std::string>& Task::get_timers_name() const\n+const std::vector<std::string>& Task\n+::get_timers_name() const\n{\nreturn this->timers_name;\n}\n-const std::vector<uint32_t>& Task::get_timers_n_calls() const\n+const std::vector<uint32_t>& Task\n+::get_timers_n_calls() const\n{\nreturn this->timers_n_calls;\n}\n-const std::vector<std::chrono::nanoseconds>& Task::get_timers_total() const\n+const std::vector<std::chrono::nanoseconds>& Task\n+::get_timers_total() const\n{\nreturn this->timers_total;\n}\n-const std::vector<std::chrono::nanoseconds>& Task::get_timers_min() const\n+const std::vector<std::chrono::nanoseconds>& Task\n+::get_timers_min() const\n{\nreturn this->timers_min;\n}\n-const std::vector<std::chrono::nanoseconds>& Task::get_timers_max() const\n+const std::vector<std::chrono::nanoseconds>& Task\n+::get_timers_max() const\n{\nreturn this->timers_max;\n}\n-socket_t Task::get_socket_type(const Socket &s) const\n+socket_t Task\n+::get_socket_type(const Socket &s) const\n{\nfor (size_t i = 0; i < sockets.size(); i++)\nif (sockets[i].get() == &s)\n@@ -466,7 +495,8 @@ socket_t Task::get_socket_type(const Socket &s) const\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n-void Task::register_timer(const std::string &name)\n+void Task\n+::register_timer(const std::string &name)\n{\nthis->timers_name .push_back(name );\nthis->timers_n_calls.push_back(0 );\n@@ -475,7 +505,8 @@ void Task::register_timer(const std::string &name)\nthis->timers_min .push_back(std::chrono::nanoseconds(0));\n}\n-void Task::reset_stats()\n+void Task\n+::reset_stats()\n{\nthis->n_calls = 0;\nthis->duration_total = std::chrono::nanoseconds(0);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Task.hxx", "new_path": "src/Module/Task.hxx", "diff": "@@ -6,52 +6,62 @@ namespace aff3ct\n{\nnamespace module\n{\n-bool Task::is_autoalloc() const\n+bool Task\n+::is_autoalloc() const\n{\nreturn this->autoalloc;\n}\n-bool Task::is_autoexec() const\n+bool Task\n+::is_autoexec() const\n{\nreturn this->autoexec;\n}\n-bool Task::is_stats() const\n+bool Task\n+::is_stats() const\n{\nreturn this->stats;\n}\n-bool Task::is_fast() const\n+bool Task\n+::is_fast() const\n{\nreturn this->fast;\n}\n-bool Task::is_debug() const\n+bool Task\n+::is_debug() const\n{\nreturn this->debug;\n}\n-bool Task::is_debug_hex() const\n+bool Task\n+::is_debug_hex() const\n{\nreturn this->debug_hex;\n}\n-bool Task::is_last_input_socket(const Socket &s_in) const\n+bool Task\n+::is_last_input_socket(const Socket &s_in) const\n{\nreturn last_input_socket == &s_in;\n}\n-const Module& Task::get_module() const\n+const Module& Task\n+::get_module() const\n{\nreturn this->module;\n}\n-std::string Task::get_name() const\n+std::string Task\n+::get_name() const\n{\nreturn this->name;\n}\n-uint32_t Task::get_n_calls() const\n+uint32_t Task\n+::get_n_calls() const\n{\nreturn this->n_calls;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Display/Statistics/Statistics.cpp", "new_path": "src/Tools/Display/Statistics/Statistics.cpp", "diff": "@@ -39,7 +39,7 @@ void Statistics\nvoid Statistics\n::show_task(const float total_sec,\n- const std::string& module_sname,\n+ const std::string& module_name,\nconst std::string& task_name,\nconst size_t task_n_elmts,\nconst uint32_t task_n_calls,\n@@ -73,7 +73,7 @@ void Statistics\nstd::stringstream ssavg_thr, ssmin_thr, ssmax_thr;\nstd::stringstream ssavg_lat, ssmin_lat, ssmax_lat;\n- ssmodule << std::setprecision( 2) << std::fixed << std::setw(12) << module_sname;\n+ ssmodule << std::setprecision( 2) << std::fixed << std::setw(12) << module_name;\nssprocess << std::setprecision( 2) << std::fixed << std::setw(17) << task_name;\nsssp << std::setprecision( 2) << std::fixed << std::setw( 7) << \"*\";\nssn_calls << std::setprecision(task_n_calls > l1 ? P : 2) << (task_n_calls > l1 ? std::scientific : std::fixed) << std::setw( 8) << task_n_calls;\n@@ -242,7 +242,8 @@ void Statistics\nfor (auto *t : tasks)\n{\n- auto module_sname = t->get_module().get_short_name();\n+ auto module_name = t->get_module().get_custom_name().empty() ? t->get_module().get_short_name() :\n+ t->get_module().get_custom_name();\nauto task_n_elmts = t->sockets.back()->get_n_elmts();\nauto task_name = t->get_name ();\nauto task_n_calls = t->get_n_calls ();\n@@ -253,7 +254,7 @@ void Statistics\nttask_min_duration += (task_min_duration * task_n_calls) / ttask_n_calls;\nttask_max_duration += (task_max_duration * task_n_calls) / ttask_n_calls;\n- Statistics::show_task(total_sec, module_sname, task_name, task_n_elmts, task_n_calls,\n+ Statistics::show_task(total_sec, module_name, task_name, task_n_elmts, task_n_calls,\ntask_tot_duration, task_min_duration, task_max_duration, stream);\nauto task_total_sec = ((float)task_tot_duration.count()) * 0.000000001f;\n@@ -372,7 +373,10 @@ void Statistics\nfor (auto &vt : tasks)\n{\n- auto module_sname = vt[0]->get_module().get_short_name();\n+\n+ auto module_name = vt[0]->get_module().get_custom_name().empty() ?\n+ vt[0]->get_module().get_short_name() :\n+ vt[0]->get_module().get_custom_name();\nauto task_n_elmts = vt[0]->sockets.back()->get_n_elmts();\nauto task_name = vt[0]->get_name();\nauto task_n_calls = 0;\n@@ -391,7 +395,7 @@ void Statistics\nttask_min_duration += (task_min_duration * task_n_calls) / ttask_n_calls;\nttask_max_duration += (task_max_duration * task_n_calls) / ttask_n_calls;\n- Statistics::show_task(total_sec, module_sname, task_name, task_n_elmts, task_n_calls,\n+ Statistics::show_task(total_sec, module_name, task_name, task_n_elmts, task_n_calls,\ntask_tot_duration, task_min_duration, task_max_duration, stream);\nauto task_total_sec = ((float)task_tot_duration.count()) * 0.000000001f;\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a custom name to the abstract 'Module' class + cosmetics.
8,490
23.09.2019 11:34:41
-7,200
70a2faf3fb84ead5a75304160b526ebb02600145
Fix link issues due to missing 'inline' keywords.
[ { "change_type": "MODIFY", "old_path": "src/Tools/Algo/Histogram.hpp", "new_path": "src/Tools/Algo/Histogram.hpp", "diff": "@@ -28,11 +28,11 @@ public:\n/*\n* @precision the number of decimal took into account in the given values\n*/\n- explicit Histogram(unsigned precision = 3);\n+ inline explicit Histogram(unsigned precision = 3);\n~Histogram() = default;\n- Histogram<R>& operator=(const Histogram<R>& other);\n+ inline Histogram<R>& operator=(const Histogram<R>& other);\ninline void add_values(const Histogram<R>& other);\n@@ -65,7 +65,7 @@ public:\n/*\n* call dump by setting the hist_min and hist_max values as, respectively, get_hist_min() and get_hist_max()\n*/\n- int dump(std::ofstream& hist_file) const;\n+ inline int dump(std::ofstream& hist_file) const;\n/*\n* @hist_file is the output stream where will be dump the histogram with one (x,y) couple per line\n@@ -74,7 +74,7 @@ public:\n* @n_rung is the number of values plotted on the abscissa in the asked range (if 0 then dump directly the values)\n* @return 1 when there is an error in given limits\n*/\n- int dump(std::ofstream& hist_file, R hist_min, R hist_max) const;\n+ inline int dump(std::ofstream& hist_file, R hist_min, R hist_max) const;\n/*\n* Reset histogram values but not the options.\n@@ -92,9 +92,9 @@ public:\ninline size_t get_n_values() const;\nprivate:\n- int dump_all_values(std::ofstream& hist_file, R hist_min, R hist_max) const;\n+ inline int dump_all_values(std::ofstream& hist_file, R hist_min, R hist_max) const;\n- int dump_intervals(std::ofstream& hist_file, R hist_min, R hist_max) const;\n+ inline int dump_intervals(std::ofstream& hist_file, R hist_min, R hist_max) const;\nprivate:\nbool _norm_sum_to_1 = false;\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Algo/Predicate_ite.hpp", "new_path": "src/Tools/Algo/Predicate_ite.hpp", "diff": "@@ -27,13 +27,13 @@ private:\nint cur_ite;\npublic:\n- explicit Predicate_ite(const int n_ite);\n+ inline explicit Predicate_ite(const int n_ite);\nvirtual ~Predicate_ite() = default;\n- bool operator()();\n+ inline bool operator()();\n- void reset();\n+ inline void reset();\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix link issues due to missing 'inline' keywords.
8,490
24.09.2019 10:05:54
-7,200
1ceddfc874f38317e83592b506b1fe78dffe44b4
Remove the outdated completion script.
[ { "change_type": "DELETE", "old_path": "scripts/aff3ct_completion.sh", "new_path": null, "diff": "-# aff3ct completion -*- shell-script -*-\n-\n-_aff3ct() {\n- local cur prev opts codetype simutype\n- COMPREPLY=()\n- cur=\"${COMP_WORDS[COMP_CWORD]}\"\n- prev=\"${COMP_WORDS[COMP_CWORD-1]}\"\n-\n- # determine code type\n- for ((i = 0 ; i < ${#COMP_WORDS[*]}; ++ i))\n- do\n- if [[ ${COMP_WORDS[$i]} == \"--sim-cde-type\" || \\\n- ${COMP_WORDS[$i]} == \"-C\" ]]\n- then\n- codetype=${COMP_WORDS[$i+1]}\n- fi\n- done\n-\n- # determine simu type\n- simutype=\"BFER\" # BFER simu by default\n- for ((i = 0 ; i < ${#COMP_WORDS[*]}; ++ i))\n- do\n- if [[ ${COMP_WORDS[$i]} == \"--sim-type\" ]]; then\n- simutype=${COMP_WORDS[$i+1]}\n- fi\n- done\n-\n- # add base opts\n- opts=\"-C --sim-cde-type --sim-type -v --version -h --help -H --Help\"\n-\n- # add contents of Launcher.cpp\n- if [[ ${codetype} == \"POLAR\" && ${simutype} == \"EXIT\" || \\\n- ${codetype} == \"RSC\" && ${simutype} == \"EXIT\" || \\\n- ${codetype} == \"POLAR\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"RSC\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"BCH\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"TURBO\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"REP\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"RA\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"LDPC\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"UNCODED\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"POLAR\" && ${simutype} == \"BFERI\" || \\\n- ${codetype} == \"RSC\" && ${simutype} == \"BFERI\" || \\\n- ${codetype} == \"LDPC\" && ${simutype} == \"BFERI\" || \\\n- ${codetype} == \"UNCODED\" && ${simutype} == \"BFERI\" || \\\n- ${codetype} == \"POLAR\" && ${simutype} == \"GEN\" ]]\n- then\n- opts=\"$opts --sim-snr-min -m --snr-min-max -M --sim-snr-step -s \\\n- --sim-snr-type -E --sim-stop-time --sim-threads -t \\\n- --sim-prec -p --sim-inter-lvl --enc-info-bits -K \\\n- --enc-cw-size -N \\\n- --src-type --src-path --enc-type --enc-path --mdm-type --mdm-bps\\\n- --mdm-ups --mdm-cpm-ws --mdm-cpm-map --mdm-cpm-L --mdm-cpm-p \\\n- --mdm-cpm-k --mdm-cpm-std --mdm-const-path --mdm-max --mdm-psi \\\n- --mdm-ite --mdm-no-sig2 \\\n- --chn-type --chn-implem --chn-path --chn-blk-fad --qnt-type \\\n- --qnt-dec --qnt-bits --qnt-range --dec-type --dec-implem \\\n- --ter-no --ter-freq --sim-seed --sim-mpi-comm --sim-pyber \\\n- --sim-no-colors --sim-err-trk --sim-err-trk-rev \\\n- --sim-err-trk-path --sim-debug-prec --sim-no-legend --except-a2l\\\n- --except-no-bt\"\n- fi\n-\n- # add contents of Launcher_BFER.cpp\n- if [[ ${codetype} == \"POLAR\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"RSC\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"BCH\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"TURBO\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"REP\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"RA\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"LDPC\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"UNCODED\" && ${simutype} == \"BFER\" ]]\n- then\n- opts=\"$opts --sim-debug -d --sim-debug-fe --sim-debug-limit \\\n- --snr-sim-trace-path --sim-stats --sim-coset -c --mnt-max-fe -e \\\n- --ter-type \"\n- fi\n-\n- # add contents of Launcher_EXIT.cpp\n- if [[ ${codetype} == \"POLAR\" && ${simutype} == \"EXIT\" || \\\n- ${codetype} == \"RSC\" && ${simutype} == \"EXIT\" ]]\n- then\n- opts=\"$opts --sim-siga-min -a --sim-siga-max -A --sim-siga-step\"\n- fi\n-\n- # add contents of Launcher_BFERI.cpp\n- if [[ ${codetype} == \"POLAR\" && ${simutype} == \"BFERI\" || \\\n- ${codetype} == \"RSC\" && ${simutype} == \"BFERI\" || \\\n- ${codetype} == \"LDPC\" && ${simutype} == \"BFERI\" || \\\n- ${codetype} == \"UNCODED\" && ${simutype} == \"BFERI\" ]]\n- then\n- opts=\"$opts --sim-debug -d --sim-debug-fe --sim-debug-limit \\\n- --snr-sim-trace-path --sim-stats --sim-coset -c --itl-type \\\n- --itl-path --itl-cols --itl-uni --sim-ite -I --mnt-max-fe -e \\\n- --ter-type\"\n- fi\n-\n- # add contents of Launcher_GEN_polar.cpp\n- if [[ ${codetype} == \"POLAR\" && ${simutype} == \"GEN\" ]]\n- then\n- opts=\"$opts --enc-fb-awgn-path --enc-fb-gen-method --dec-snr \\\n- --dec-gen-path --sim-pb-path\"\n- fi\n-\n- # add contents of Launcher_BFER_RA.cpp\n- if [[ ${codetype} == \"RA\" && ${simutype} == \"BFER\" ]]\n- then\n- opts=\"$opts --dec-ite -i --itl-type --itl-path --itl-cols --itl-uni\"\n- fi\n-\n- # add contents of Launcher_BFER_BCH.cpp\n- if [[ ${codetype} == \"BCH\" && ${simutype} == \"BFER\" ]]\n- then\n- opts=\"$opts --dec-corr-pow -T\"\n- fi\n-\n- # add contents of Launcher_BFER_RSC.cpp\n- if [[ ${codetype} == \"RSC\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"RSC\" && ${simutype} == \"BFERI\" ]]\n- then\n- opts=\"$opts --enc-no-buff --enc-poly --dec-type -D --dec-implem \\\n- --dec-simd --dec-max\"\n- fi\n-\n- # add contents of Launcher_BFER_RSC.cpp\n- if [[ ${codetype} == \"POLAR\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"POLAR\" && ${simutype} == \"BFERI\" ]]\n- then\n- opts=\"$opts --sim-pb-path --enc-fb-awgn-path --enc-fb-gen-method \\\n- --enc-fb-sigma --dec-type -D --dec-ite -i --dec-implem\"\n- fi\n-\n- # add contents of Launcher_BFER_polar.cpp\n- if [[ ${codetype} == \"POLAR\" && ${simutype} == \"BFER\" ]]\n- then\n- opts=\"$opts --crc-type --crc-poly --crc-rate --enc-no-sys \\\n- --dec-lists -L --dec-simd --dec-polar-nodes \\\n- --dec-partial-adaptive\"\n- fi\n-\n- # add contents of Launcher_BFER_repetition.cpp\n- if [[ ${codetype} == \"REP\" && ${simutype} == \"BFER\" ]]\n- then\n- opts=\"$opts --enc-no-buff --dec-type -D --dec-implem\"\n- fi\n-\n- # add contents of Launcher_BFER_turbo.cpp\n- if [[ ${codetype} == \"TURBO\" && ${simutype} == \"BFER\" ]]\n- then\n- opts=\"$opts --enc-json-path --crc-type --crc-poly --crc-rate \\\n- --enc-no-buff --enc-type --enc-poly --itl-type --itl-path \\\n- --itl-cols --itl-uni --dec-type -D --dec-implem --dec-ite -i \\\n- --dec-sf-type --dec-simd --dec-max --dec-sc --dec-fnc \\\n- --dec-fnc-q --dec-fnc-ite-m --dec-fnc-ite-M --dec-fnc-ite-s \\\n- --pct-pattern\"\n- fi\n-\n- # add contents of Launcher_EXIT_RSC.cpp\n- if [[ ${codetype} == \"RSC\" && ${simutype} == \"EXIT\" ]]\n- then\n- opts=\"$opts --dec-type -D --dec-implem --dec-max\"\n- fi\n-\n- # add contents of Launcher_EXIT_polar.cpp\n- if [[ ${codetype} == \"POLAR\" && ${simutype} == \"EXIT\" ]]\n- then\n- opts=\"$opts --sim-pb-path --enc-fb-sigma --enc-fb-awgn-path \\\n- --enc-fb-gen-method --dec-type -D --dec-implem --dec-ite -i \\\n- --dec-lists -L\"\n- fi\n-\n- # add contents of Launcher_BFER_LDPC.cpp\n- if [[ ${codetype} == \"LDPC\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"LDPC\" && ${simutype} == \"BFERI\" ]]\n- then\n- opts=\"$opts --dec-type -D --dec-implem --dec-ite -i --dec-h-path \\\n- --dec-no-synd --dec-off --dec-norm --dec-synd-depth --dec-simd\"\n- fi\n-\n- # add contents of Launcher_BFER_uncoded.cpp\n- if [[ ${codetype} == \"UNCODED\" && ${simutype} == \"BFER\" ]]\n- then\n- opts=\"$opts \"\n- fi\n-\n- # add contents of Launcher_BFERI_uncoded.cpp\n- if [[ ${codetype} == \"UNCODED\" && ${simutype} == \"BFERI\" ]]\n- then\n- opts=\"$opts \"\n- fi\n-\n- if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] || \\\n- [[ ${prev} == @(-q|--quiet) ]] ; then\n- COMPREPLY=( $(compgen -W \"${opts}\" -- ${cur}) )\n- return 0\n- fi\n-\n- case \"${prev}\" in\n- # awaiting random number or strings\n- --sim-snr-min | -m | --snr-min-max | -M | --sim-snr-min | -m | \\\n- --snr-min-max | -M | --sim-snr-step | -s | --sim-stop-time | \\\n- --sim-threads | -t | --sim-inter-lvl | --enc-info-bits | -K | \\\n- --enc-cw-size | -N | --mdm-ite | --chn-gain-occur | \\\n- --mdm-bps | --mdm-ups | --mdm-cpm-L | --mdm-cpm-p | --mdm-cpm-k | \\\n- --qnt-dec | --qnt-bits | --qnt-range | --qnt-type | \\\n- --sim-benchs | -b | --sim-debug-limit | --sim-debug-prec | \\\n- --mnt-max-fe | -e | -d | \\\n- --sim-siga-min | -a | --sim-siga-max | -A | --sim-siga-step | -I | \\\n- --sim-ite | --enc-fb-sigma | --dec-snr | --dec-ite |-i | --dec-lists | \\\n- -L | --enc-json-path | --dec-off | --dec-norm | --ter-freq | \\\n- --sim-seed | --sim-mpi-comm | --sim-pyber | --dec-polar-nodes | \\\n- --itl-cols | --dec-synd-depth | --pct-pattern | \\\n- --dec-fnc-q | --dec-fnc-ite-m | --dec-fnc-ite-M | --dec-fnc-ite-s )\n- COMPREPLY=()\n- ;;\n-\n- # awaiting nothing\n- -v | --version | -h | --help | -H | --Help | --mdm-no-sig2 | \\\n- --sim-debug | --sim-debug-fe | --sim-stats | --sim-no-legend | \\\n- --sim-coset | -c | enc-no-buff | --enc-no-sys | --dec-no-synd | \\\n- --crc-rate | --sim-err-trk | --sim-err-trk-rev | --itl-uni | \\\n- --dec-partial-adaptive | --dec-fnc | --dec-sc | --except-a2l | \\\n- --except-no-bt | --ter-no )\n- COMPREPLY=( $(compgen -W \"${opts}\" -- ${cur}) )\n- ;;\n-\n- # awaiting something special\n- --sim-prec | -p)\n- local params=\"8 16 32 64\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --sim-snr-type | -E)\n- local params=\"EB ES\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --sim-cde-type)\n- local params=\"POLAR TURBO LDPC REP RA RSC BCH UNCODED\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --sim-type)\n- local params\n- case \"${codetype}\" in\n- POLAR) params=\"BFER EXIT\" ;;\n- TURBO) params=\"BFER\" ;;\n- LDPC) params=\"BFER BFERI\" ;;\n- REP) params=\"BFER\" ;;\n- RA) params=\"BFER\" ;;\n- BCH) params=\"BFER\" ;;\n- RSC) params=\"BFER BFERI EXIT\" ;;\n- UNCODED) params=\"BFER BFERI\" ;;\n- *) params=\"BFER BFERI EXIT\" ;;\n-\n- esac\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --enc-type)\n- local params\n- case \"${codetype}\" in\n- POLAR) params=\"AZCW COSET USER POLAR\" ;;\n- RSC) params=\"AZCW COSET USER RSC\" ;;\n- REP) params=\"AZCW COSET USER REP\" ;;\n- RA) params=\"AZCW COSET USER RA\" ;;\n- BCH) params=\"AZCW COSET USER BCH\" ;;\n- TURBO) params=\"AZCW COSET USER TURBO\" ;;\n- LDPC) params=\"AZCW COSET USER LDPC LDPC_H LDPC_DVBS2\" ;;\n- esac\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --dec-type | -D)\n- local params\n- case \"${codetype}\" in\n- POLAR) params=\"SC SCL SCAN\" ;;\n- RSC) params=\"BCJR BCJR4 LTE CCSDS\" ;;\n- REP) params=\"STD\" ;;\n- RA) params=\"STD\" ;;\n- BCH) params=\"ALGEBRAIC\" ;;\n- TURBO) params=\"LTE CCSDS\" ;;\n- LDPC) params=\"BP BP_FLOODING BP_LAYERED\";;\n- esac\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --dec-implem)\n- local params=\"NAIVE GENERIC STD FAST VERY_FAST\"\n- if [ \"${codetype}\" == 'LDPC' ]; then\n- params=\"ONMS SPA LSPA GALA\"\n- fi\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --dec-simd)\n- local params=\"INTER INTRA\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --enc-fb-awgn-path | --dec-gen-path | --sim-pb-path | --itl-path | \\\n- --mdm-const-path | --src-path | --enc-path | --chn-path | \\\n- --dec-h-path | --sim-err-trk-path)\n- _filedir\n- ;;\n-\n- --src-type)\n- local params=\"RAND RAND_FAST AZCW USER\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --itl-type)\n- local params\n- case \"${simutype}\" in\n- BFER) params=\"LTE CCSDS RANDOM RAND_COL ROW_COL COL_ROW GOLDEN USER NO\" ;;\n- BFERI) params=\"LTE CCSDS RANDOM RAND_COL ROW_COL COL_ROW GOLDEN USER NO\" ;;\n- esac\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --chn-type)\n- local params=\"NO AWGN RAYLEIGH RAYLEIGH_USER USER\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --chn-implem)\n- local params=\"STD FAST GSL MKL\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --chn-blk-fad)\n- local params=\"NO FRAME ONETAP\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --crc-type)\n- local params=\"STD FAST INTER\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --crc-poly)\n- local params=\"1-PAR 4-ITU 5-USB 5-EPC 5-ITU 6-ITU 6-DARC 6-CDMA2000-B 6-CDMA2000-A \\\n- 7-MMC 7-MVB 8-DVB-S2 8-AUTOSAR 8-CCITT 8-DALLAS 8-DARC 8-SAE-J1850 \\\n- 8-WCDMA 10-ATM 10-CDMA2000 11-FLEXRAY 12-TELECOM 12-CDMA2000 13-BBC \\\n- 14-DARC 15-CAN 15-MPT1327 16-CHAKRAVARTY 16-ARINC 16-CDMA2000 \\\n- 16-DECT 16-T10-DIF 16-DNP 16-OPENSAFETY-A 16-OPENSAFETY-B 16-PROFIBUS \\\n- 16-CCITT 16-IBM 17-CAN 21-CAN 24-FLEXRAY 24-RADIX-64 24-LTEA 30-CDMA \\\n- 32-KOOPMAN 32-AIXM 32-CASTAGNOLI 32-GZIP\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --dec-sf-type)\n- local params=\"LTE LTE_VEC ARRAY\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --mdm-cpm-std)\n- local params=\"GSM\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --mdm-cpm-map)\n- local params=\"NATURAL GRAY\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --mdm-cpm-ws)\n- local params=\"GMSK REC RCOS\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --mdm-type)\n- local params=\"BPSK BPSK_FAST OOK PSK PAM QAM CPM SCMA USER\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --mdm-max)\n- local params=\"MAX MAXL MAXS MAXSS\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --mdm-psi)\n- local params=\"PSI0 PSI1 PSI2 PSI3\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --dec-max)\n- local params=\"MAX MAXL MAXS\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --qnt-type)\n- local params=\"STD STD_FAST TRICKY\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --ter-type)\n- local params=\"STD LEGACY\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- --enc-fb-gen-method)\n- local params=\"GA FILE TV\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n- *)\n- if [[ ${cur} == * || ${COMP_CWORD} -eq 1 ]] || \\\n- [[ ${prev} == @(-q|--quiet) ]] ; then\n- COMPREPLY=( $(compgen -W \"${opts}\" -- ${cur}) )\n- return 0\n- else\n- _minimal\n- fi\n- ;;\n- esac\n-} &&\n-complete -F _aff3ct aff3ct\n" } ]
C++
MIT License
aff3ct/aff3ct
Remove the outdated completion script.
8,490
26.09.2019 14:07:24
-7,200
ff2d1e71c3ba01463eaa86424759bda221b756fa
CI: add include directories to SonarQube + add clang static analyses.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -28,6 +28,34 @@ analysis-cppcheck:\nscript:\n- ./ci/analysis-cppcheck.sh\n+analysis-clang:\n+ stage: analysis\n+ variables:\n+ GIT_SUBMODULE_STRATEGY: recursive\n+ except:\n+ - schedules\n+ artifacts:\n+ name: analysis-clang-reports\n+ when: always\n+ paths:\n+ - clang_reports/\n+ only:\n+ - master\n+ - development\n+ tags:\n+ - linux\n+ - clang\n+ - scan-build\n+ - clang-tidy\n+ - python\n+ script:\n+ - export CFLAGS=\"-pedantic -fdiagnostics-show-option -Wall -Wno-overloaded-virtual\"\n+ - export CMAKE_OPT=\"-DAFF3CT_COMPILE_EXE=ON -DAFF3CT_COMPILE_STATIC_LIB=OFF -DAFF3CT_COMPILE_SHARED_LIB=OFF -DAFF3CT_PREC=MULTI -DAFF3CT_EXT_STRINGS=OFF\"\n+ - export NAME=\"build_analysis_clang\"\n+ - export REPORTS_DIR=\"clang_reports\"\n+ - source ./ci/tools/threads.sh\n+ - ./ci/analysis-clang.sh\n+\nanalysis-headers:\nstage: analysis\nexcept:\n@@ -1162,18 +1190,24 @@ coverage-linux:\ndeploy-sonarqube-linux:\nstage: deploy\n+ variables:\n+ GIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\ndependencies:\n- analysis-cppcheck\n- coverage-linux\n+ - analysis-clang\ntags:\n+ - linux\n- sonarqube\n+ - gcc\nonly:\n- master\n- development\nallow_failure: true\nscript:\n+ - export REPORTS_DIR=\"clang_reports\"\n- source ./ci/tools/git-tag.sh\n- source ./ci/tools/git-branch.sh\n- ./ci/deploy-sonarqube-linux.sh\n" }, { "change_type": "ADD", "old_path": null, "new_path": "ci/analysis-clang.sh", "diff": "+#!/bin/bash\n+set -x\n+\n+if [ -z \"$THREADS\" ]\n+then\n+ echo \"The 'THREADS' environment variable is not set, default value = 1.\"\n+ THREADS=1\n+fi\n+\n+if [ -z \"$NAME\" ]\n+then\n+ echo \"The 'NAME' environment variable is not set, default value = 'build_analysis_clang'.\"\n+ NAME=\"build_analysis_clang\"\n+fi\n+\n+if [ -z \"$REPORTS_DIR\" ]\n+then\n+ echo \"The 'REPORTS_DIR' environment variable is not set, default value = 'clang_reports'.\"\n+ REPORTS_DIR=\"clang_reports\"\n+fi\n+\n+mkdir -p $NAME\n+cd $NAME\n+\n+scan-build -v -plist --intercept-first --analyze-headers -o $REPORTS_DIR \\\n+ cmake .. -G\"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug \\\n+ -DCMAKE_CXX_FLAGS=\"$CFLAGS\" -DCMAKE_VERBOSE_MAKEFILE=ON \\\n+ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \\\n+ -DCMAKE_EXE_LINKER_FLAGS=\"$LFLAGS\" $CMAKE_OPT\n+rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\n+\n+scan-build -v -plist --intercept-first --analyze-headers -o $REPORTS_DIR \\\n+ make -j $THREADS -k 2>&1 | tee aff3ct-build.log\n+rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\n+\n+mv aff3ct-build.log $REPORTS_DIR\n+\n+CLANG_TIDY_MAJOR=$(clang-tidy --version | grep version | awk -F \" \" '{print $3}' | awk -F \".\" '{print $1}')\n+CLANG_TIDY_MINOR=$(clang-tidy --version | grep version | awk -F \" \" '{print $3}' | awk -F \".\" '{print $2}')\n+\n+run-clang-tidy-$CLANG_TIDY_MAJOR.$CLANG_TIDY_MINOR.py -checks='*' -header-filter=.. -p . -j$THREADS > clang-tidy-report.txt\n+rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\n+\n+mv clang-tidy-report.txt $REPORTS_DIR\n+\n+mv $REPORTS_DIR ../\n+cd ..\n+sed -i \"s:$PWD:{{ROOT_DIR}}:g\" $REPORTS_DIR/aff3ct-build.log\n+sed -i \"s:$PWD:{{ROOT_DIR}}:g\" $REPORTS_DIR/clang-tidy-report.txt\n+sed -i \"s:$PWD:{{ROOT_DIR}}:g\" $REPORTS_DIR/scan-build-*/*.plist\n+\n+exit 0;\n" }, { "change_type": "MODIFY", "old_path": "ci/analysis-cppcheck.sh", "new_path": "ci/analysis-cppcheck.sh", "diff": "@@ -6,8 +6,6 @@ cppcheck --version\nmkdir cppcheck\n#cppcheck --suppress=missingIncludeSystem -I./src/ --force --enable=all --std=c++11 -U_MSC_VER ./src/ 2> cppcheck_all.log\nfind .\\/src\\/ -type f -follow -print | grep \"[.]h$\\|[.]hpp$\\|[.]hxx$\\|[.]cpp$\" > src_files.txt\n-sed -i -e 's/.\\/src\\/Tools\\/date.h//g' src_files.txt\n-sed -i -e 's/.\\/src\\/Tools\\/MSVC\\/dirent.h//g' src_files.txt\n# cppcheck for sonarqube\ncppcheck --language=c++ --suppress=missingIncludeSystem --force --enable=all --std=c++11 -U_MSC_VER --file-list=src_files.txt --xml --xml-version=2 2> cppcheck/cppcheck.xml\ncppcheck --language=c++ --suppress=missingIncludeSystem --force --enable=all --std=c++11 -U_MSC_VER --file-list=src_files.txt 2> cppcheck/cppcheck_all.log\n" }, { "change_type": "MODIFY", "old_path": "ci/build-linux-macos.sh", "new_path": "ci/build-linux-macos.sh", "diff": "@@ -23,19 +23,11 @@ then\nNAME=\"build_linux_macos\"\nfi\n-if [ -z \"$LFLAGS\" ]\n-then\n- cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=$CXX \\\n- -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"$CFLAGS\" \\\n- $CMAKE_OPT -DCMAKE_INSTALL_PREFIX=\"$NAME\"\n- rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\n-else\ncmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=$CXX \\\n-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"$CFLAGS\" \\\n-DCMAKE_EXE_LINKER_FLAGS=\"$LFLAGS\" \\\n$CMAKE_OPT -DCMAKE_INSTALL_PREFIX=\"$NAME\"\nrc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\n-fi\nmake -j $THREADS -k\nrc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\n" }, { "change_type": "MODIFY", "old_path": "ci/deploy-sonarqube-linux.sh", "new_path": "ci/deploy-sonarqube-linux.sh", "diff": "@@ -25,19 +25,41 @@ then\nexit 1\nfi\n+if [ -z \"$REPORTS_DIR\" ]\n+then\n+ echo \"The 'REPORTS_DIR' environment variable is not set, default value = 'clang_reports'.\"\n+ REPORTS_DIR=\"clang_reports\"\n+fi\n+\n+sed -i \"s:{{ROOT_DIR}}:$PWD:g\" $REPORTS_DIR/aff3ct-build.log\n+sed -i \"s:{{ROOT_DIR}}:$PWD:g\" $REPORTS_DIR/clang-tidy-report.txt\n+sed -i \"s:{{ROOT_DIR}}:$PWD:g\" $REPORTS_DIR/scan-build-*/*.plist\n+\n+# list of standard C++ includes in the system\n+STD_CXX_INC=$(echo | gcc -xc++ -E -Wp,-v - 2>&1 | grep \"^ \" | sed -e :a -e '$!N; s/\\n/,/; ta')\n+PROJECT_CXX_INC=\"./src/, ./lib/date/include/date, ./lib/MIPP/src/, ./lib/MSVC/include/, ./lib/rang/include/\"\n+GCC_REGEX='(?<file>.*):(?<line>[0-9]+):[0-9]+:\\\\x20warning:\\\\x20(?<message>.*)\\\\x20\\\\[(?<id>.*)\\\\]'\n+\n# Create the sonar config file on the fly\nGIT_SHORT_TAG=$(echo $GIT_TAG | cut -d $'v' -f2-)\necho \"sonar.projectKey=storm:aff3ct:gitlab:$GIT_BRANCH\" > sonar-project.properties\n-#echo \"sonar.projectName=AFF3CT\" >> sonar-project.properties\necho \"sonar.projectVersion=$GIT_SHORT_TAG\" >> sonar-project.properties\n+echo \"sonar.scm.disabled=false\" >> sonar-project.properties\n+echo \"sonar.scm.provider=git\" >> sonar-project.properties\necho \"sonar.login=$SONARQUBE_TOKEN\" >> sonar-project.properties\necho \"sonar.sources=./src/\" >> sonar-project.properties\n-echo \"sonar.exclusions=**/date.h, **/dirent.h\" >> sonar-project.properties\necho \"sonar.links.homepage=https://aff3ct.github.io/\" >> sonar-project.properties\necho \"sonar.links.scm=https://github.com/aff3ct/aff3ct/tree/$GIT_BRANCH\" >> sonar-project.properties\necho \"sonar.links.ci=https://gitlab.com/aff3ct/aff3ct/pipelines\" >> sonar-project.properties\necho \"sonar.links.issue=https://github.com/aff3ct/aff3ct/issues\" >> sonar-project.properties\necho \"sonar.language=c++\" >> sonar-project.properties\n+echo \"sonar.cxx.includeDirectories=$STD_CXX_INC, $PROJECT_CXX_INC\" >> sonar-project.properties\n+echo \"sonar.cxx.errorRecoveryEnabled=true\" >> sonar-project.properties\n+echo \"sonar.cxx.gcc.reportPath=$REPORTS_DIR/aff3ct-build.log\" >> sonar-project.properties\n+echo \"sonar.cxx.gcc.charset=UTF-8\" >> sonar-project.properties\n+echo \"sonar.cxx.gcc.regex=$GCC_REGEX\" >> sonar-project.properties\n+echo \"sonar.cxx.clangsa.reportPath=$REPORTS_DIR/*/*.plist\" >> sonar-project.properties\n+echo \"sonar.cxx.clangtidy.reportPath=$REPORTS_DIR/clang-tidy-report.txt\" >> sonar-project.properties\necho \"sonar.cxx.cppcheck.reportPath=cppcheck/cppcheck.xml\" >> sonar-project.properties\necho \"sonar.cxx.coverage.reportPath=code_coverage_report/aff3ct.xml\" >> sonar-project.properties\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: add include directories to SonarQube + add clang static analyses.
8,490
10.10.2019 16:40:55
-7,200
bc4c88d87f1c4eadab8403c3e428b237da81b8c1
Simplify the interleavers usage.
[ { "change_type": "MODIFY", "old_path": "src/Module/Interleaver/Interleaver.hxx", "new_path": "src/Module/Interleaver/Interleaver.hxx", "diff": "@@ -168,12 +168,6 @@ _interleave(const D *in_vec, D *out_vec,\nconst int n_frames,\nconst int frame_id) const\n{\n- if (!core.is_initialized())\n- {\n- std::string message = \"'init' method has to be called first, before trying to (de)interleave something.\";\n- throw tools::length_error(__FILE__, __LINE__, __func__, message);\n- }\n-\nif (frame_reordering)\n{\nif (!this->core.is_uniform())\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/BFER_ite.cpp", "new_path": "src/Simulation/BFER/Iterative/BFER_ite.cpp", "diff": "@@ -82,7 +82,6 @@ void BFER_ite<B,R,Q>\nthis->monitor_er[tid]->add_handler_check(std::bind(&module::Codec_SISO_SIHO<B,Q>::reset, codec[tid].get()));\n- interleaver_core[tid]->init();\nif (interleaver_core[tid]->is_uniform())\nthis->monitor_er[tid]->add_handler_check(std::bind(&tools::Interleaver_core<>::refresh,\nthis->interleaver_core[tid].get()));\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/BFER_std.cpp", "new_path": "src/Simulation/BFER/Standard/BFER_std.cpp", "diff": "@@ -71,7 +71,6 @@ void BFER_std<B,R,Q>\ntry\n{\nauto& interleaver = codec[tid]->get_interleaver(); // can raise an exceptions\n- interleaver->init();\nif (interleaver->is_uniform())\nthis->monitor_er[tid]->add_handler_check(std::bind(&tools::Interleaver_core<>::refresh, interleaver.get()));\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Interleaver/ARP/Interleaver_core_ARP_DVB_RCS1.cpp", "new_path": "src/Tools/Interleaver/ARP/Interleaver_core_ARP_DVB_RCS1.cpp", "diff": "@@ -92,6 +92,8 @@ Interleaver_core_ARP_DVB_RCS1<T>\nthrow runtime_error(__FILE__, __LINE__, __func__, message.str());\nbreak;\n}\n+\n+ this->init();\n}\ntemplate <typename T>\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Interleaver/ARP/Interleaver_core_ARP_DVB_RCS2.cpp", "new_path": "src/Tools/Interleaver/ARP/Interleaver_core_ARP_DVB_RCS2.cpp", "diff": "@@ -146,6 +146,8 @@ Interleaver_core_ARP_DVB_RCS2<T>\nthrow runtime_error(__FILE__, __LINE__, __func__, message.str());\nbreak;\n}\n+\n+ this->init();\n}\ntemplate <typename T>\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Interleaver/CCSDS/Interleaver_core_CCSDS.cpp", "new_path": "src/Tools/Interleaver/CCSDS/Interleaver_core_CCSDS.cpp", "diff": "@@ -12,6 +12,7 @@ Interleaver_core_CCSDS<T>\n::Interleaver_core_CCSDS(const int size, const int n_frames)\n: Interleaver_core<T>(size, \"CCSDS\", false, n_frames)\n{\n+ this->init();\n}\ntemplate <typename T>\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Interleaver/Column_row/Interleaver_core_column_row.cpp", "new_path": "src/Tools/Interleaver/Column_row/Interleaver_core_column_row.cpp", "diff": "@@ -42,6 +42,8 @@ Interleaver_core_column_row<T>\n<< \", 'n_rows' = \" << n_rows << \", 'n_cols' = \" << n_cols << \").\";\nthrow invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n+\n+ this->init();\n}\ntemplate <typename T>\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Interleaver/Golden/Interleaver_core_golden.cpp", "new_path": "src/Tools/Interleaver/Golden/Interleaver_core_golden.cpp", "diff": "@@ -14,6 +14,8 @@ Interleaver_core_golden<T>\n: Interleaver_core<T>(size, \"golden\", uniform, n_frames), gen(), dist(0.0, size * 0.1)\n{\ngen.seed(seed);\n+\n+ this->init();\n}\ntemplate <typename T>\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Interleaver/Interleaver_core.hxx", "new_path": "src/Tools/Interleaver/Interleaver_core.hxx", "diff": "@@ -40,6 +40,12 @@ template <typename T>\nconst std::vector<T>& Interleaver_core<T>\n::get_lut() const\n{\n+ if (!this->is_initialized())\n+ {\n+ std::string message = \"The 'init()' method has to be called before trying to get the lookup table.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message);\n+ }\n+\nreturn pi;\n}\n@@ -47,6 +53,12 @@ template <typename T>\nconst std::vector<T>& Interleaver_core<T>\n::get_lut_inv() const\n{\n+ if (!this->is_initialized())\n+ {\n+ std::string message = \"The 'init()' method has to be called before trying to get the inverse lookup table.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message);\n+ }\n+\nreturn pi_inv;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Interleaver/LTE/Interleaver_core_LTE.cpp", "new_path": "src/Tools/Interleaver/LTE/Interleaver_core_LTE.cpp", "diff": "@@ -12,6 +12,7 @@ Interleaver_core_LTE<T>\n::Interleaver_core_LTE(const int size, const int n_frames)\n: Interleaver_core<T>(size, \"LTE\", false, n_frames)\n{\n+ this->init();\n}\ntemplate <typename T>\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Interleaver/NO/Interleaver_core_NO.cpp", "new_path": "src/Tools/Interleaver/NO/Interleaver_core_NO.cpp", "diff": "@@ -10,6 +10,7 @@ Interleaver_core_NO<T>\n::Interleaver_core_NO(const int size, const int n_frames)\n: Interleaver_core<T>(size, \"NO\", false, n_frames)\n{\n+ this->init();\n}\ntemplate <typename T>\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Interleaver/Random/Interleaver_core_random.cpp", "new_path": "src/Tools/Interleaver/Random/Interleaver_core_random.cpp", "diff": "@@ -12,6 +12,8 @@ Interleaver_core_random<T>\n: Interleaver_core<T>(size, \"random\", uniform, n_frames), rd_engine()\n{\nrd_engine.seed(seed);\n+\n+ this->init();\n}\ntemplate <typename T>\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Interleaver/Random_column/Interleaver_core_random_column.cpp", "new_path": "src/Tools/Interleaver/Random_column/Interleaver_core_random_column.cpp", "diff": "@@ -23,6 +23,8 @@ Interleaver_core_random_column<T>\n}\nrd_engine.seed(seed);\n+\n+ this->init();\n}\ntemplate <typename T>\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Interleaver/Row_column/Interleaver_core_row_column.cpp", "new_path": "src/Tools/Interleaver/Row_column/Interleaver_core_row_column.cpp", "diff": "@@ -42,6 +42,8 @@ Interleaver_core_row_column<T>\n<< \", 'n_rows' = \" << n_rows << \", 'n_cols' = \" << n_cols << \").\";\nthrow invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n+\n+ this->init();\n}\ntemplate <typename T>\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Interleaver/User/Interleaver_core_user.cpp", "new_path": "src/Tools/Interleaver/User/Interleaver_core_user.cpp", "diff": "@@ -105,6 +105,8 @@ Interleaver_core_user<T>\nmessage << \"Can't open '\" + filename + \"' file.\";\nthrow invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n+\n+ this->init();\n}\ntemplate <typename T>\n" } ]
C++
MIT License
aff3ct/aff3ct
Simplify the interleavers usage.
8,490
10.10.2019 17:24:50
-7,200
6fd2dafab1052aaf3ec48114c605f3f3f260f610
Make 'init' method protected in the 'Interleaver_core' class.
[ { "change_type": "MODIFY", "old_path": "src/Tools/Interleaver/Interleaver_core.hpp", "new_path": "src/Tools/Interleaver/Interleaver_core.hpp", "diff": "@@ -44,15 +44,15 @@ public:\nbool is_uniform() const;\n- bool is_initialized() const;\n-\nstd::string get_name() const;\n- void init();\n-\nvoid refresh();\nprotected:\n+ bool is_initialized() const;\n+\n+ void init();\n+\nvirtual void gen_lut(T *lut, const int frame_id) = 0;\n};\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Make 'init' method protected in the 'Interleaver_core' class.
8,490
15.10.2019 11:45:43
-7,200
9ad9205efd72472cbf1d9ae4812da79d2d5ad659
Add the 'cli' objects directly in the AFF3CT binaries.
[ { "change_type": "MODIFY", "old_path": "CMakeLists.txt", "new_path": "CMakeLists.txt", "diff": "@@ -180,6 +180,22 @@ endfunction(assign_source_group)\nassign_source_group(${source_files})\n+# ---------------------------------------------------------------------------------------------------------------------\n+# --------------------------------------------------------------------------------------------------------- SUB-PROJECT\n+# ---------------------------------------------------------------------------------------------------------------------\n+\n+# cli\n+if(EXISTS \"${CMAKE_CURRENT_SOURCE_DIR}/lib/cli/src/cli.hpp\")\n+ option(CLI_COMPILE_STATIC_LIB \"\" OFF)\n+ option(CLI_COMPILE_SHARED_LIB \"\" OFF)\n+ option(CLI_STATUS_MESSAGE_QUIET \"\" ON)\n+ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/cli/ EXCLUDE_FROM_ALL)\n+ message(STATUS \"AFF3CT - Sub-project found: cli\")\n+else()\n+ message(FATAL_ERROR \"AFF3CT - cli can't be found, try to init the submodule with the following cmd:\\n\"\n+ \"$ git submodule update --init --recursive\")\n+endif()\n+\n# ---------------------------------------------------------------------------------------------------------------------\n# ---------------------------------------------------------------------------------------------------- OBJECTS/LIBS/EXE\n# ---------------------------------------------------------------------------------------------------------------------\n@@ -198,7 +214,7 @@ endif()\n# Binary\nif(AFF3CT_COMPILE_EXE)\n- add_executable(aff3ct-bin $<TARGET_OBJECTS:aff3ct-obj>)\n+ add_executable(aff3ct-bin $<TARGET_OBJECTS:aff3ct-obj> $<TARGET_OBJECTS:cli-obj>)\nset_target_properties(aff3ct-bin PROPERTIES\nOUTPUT_NAME aff3ct-${AFF3CT_VERSION_FULL}\nPOSITION_INDEPENDENT_CODE ON) # set -fpie\n@@ -207,14 +223,14 @@ endif(AFF3CT_COMPILE_EXE)\n# Library\nif(AFF3CT_COMPILE_SHARED_LIB)\n- add_library(aff3ct-shared-lib SHARED $<TARGET_OBJECTS:aff3ct-obj>)\n+ add_library(aff3ct-shared-lib SHARED $<TARGET_OBJECTS:aff3ct-obj> $<TARGET_OBJECTS:cli-obj>)\nset_target_properties(aff3ct-shared-lib PROPERTIES\nOUTPUT_NAME aff3ct-${AFF3CT_VERSION_FULL}\nPOSITION_INDEPENDENT_CODE ON) # set -fpic\nmessage(STATUS \"AFF3CT - Compile: shared library\")\nendif(AFF3CT_COMPILE_SHARED_LIB)\nif(AFF3CT_COMPILE_STATIC_LIB)\n- add_library(aff3ct-static-lib STATIC $<TARGET_OBJECTS:aff3ct-obj>)\n+ add_library(aff3ct-static-lib STATIC $<TARGET_OBJECTS:aff3ct-obj> $<TARGET_OBJECTS:cli-obj>)\nset_target_properties(aff3ct-static-lib PROPERTIES\nOUTPUT_NAME aff3ct-${AFF3CT_VERSION_FULL}\nPOSITION_INDEPENDENT_CODE ON) # set -fpic\n@@ -338,6 +354,9 @@ endmacro()\n# AFF3CT headers\naff3ct_target_include_directories(PUBLIC \"src\" \"aff3ct\")\n+# cli headers\n+aff3ct_target_include_directories(PUBLIC \"lib/cli/src\" \"cli\")\n+\n# MSVC dirent.h\nif(MSVC)\naff3ct_target_include_directories(PUBLIC \"lib/MSVC/include\" \"dirent\")\n@@ -485,23 +504,6 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)\nfind_package(Threads REQUIRED)\naff3ct_target_link_libraries(PUBLIC Threads::Threads)\n-# ---------------------------------------------------------------------------------------------------------------------\n-# --------------------------------------------------------------------------------------------------------- SUB-PROJECT\n-# ---------------------------------------------------------------------------------------------------------------------\n-\n-# cli\n-if(EXISTS \"${CMAKE_CURRENT_SOURCE_DIR}/lib/cli/src/cli.hpp\")\n- option(CLI_COMPILE_STATIC_LIB \"\" ON)\n- option(CLI_STATUS_MESSAGE_QUIET \"\" ON)\n- add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/cli/ EXCLUDE_FROM_ALL)\n- aff3ct_target_include_directories(PUBLIC \"lib/cli/src\" \"cli\")\n- aff3ct_target_link_libraries(PRIVATE cli-static-lib)\n- message(STATUS \"AFF3CT - Sub-project found: cli\")\n-else()\n- message(FATAL_ERROR \"AFF3CT - cli can't be found, try to init the submodule with the following cmd:\\n\"\n- \"$ git submodule update --init --recursive\")\n-endif()\n-\n# ---------------------------------------------------------------------------------------------------------------------\n# -------------------------------------------------------------------------------------------------------------- EXPORT\n# ---------------------------------------------------------------------------------------------------------------------\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the 'cli' objects directly in the AFF3CT binaries.
8,490
15.10.2019 11:58:44
-7,200
c73be087e37dc9d4e98352d471eff92345bbf3a4
Put 'dirent.h' as private header.
[ { "change_type": "MODIFY", "old_path": "CMakeLists.txt", "new_path": "CMakeLists.txt", "diff": "@@ -351,6 +351,21 @@ macro(aff3ct_target_include_directories privacy dir_build dir_install)\nendif()\nendmacro()\n+macro(aff3ct_target_include_directories2 privacy dir)\n+ if(AFF3CT_COMPILE_OBJ)\n+ target_include_directories(aff3ct-obj ${privacy} $<BUILD_INTERFACE:${dir}> $<INSTALL_INTERFACE:${dir}>)\n+ endif()\n+ if(AFF3CT_COMPILE_EXE)\n+ target_include_directories(aff3ct-bin ${privacy} $<BUILD_INTERFACE:${dir}> $<INSTALL_INTERFACE:${dir}>)\n+ endif()\n+ if(AFF3CT_COMPILE_SHARED_LIB)\n+ target_include_directories(aff3ct-shared-lib ${privacy} $<BUILD_INTERFACE:${dir}> $<INSTALL_INTERFACE:${dir}>)\n+ endif()\n+ if(AFF3CT_COMPILE_STATIC_LIB)\n+ target_include_directories(aff3ct-static-lib ${privacy} $<BUILD_INTERFACE:${dir}> $<INSTALL_INTERFACE:${dir}>)\n+ endif()\n+endmacro()\n+\n# AFF3CT headers\naff3ct_target_include_directories(PUBLIC \"src\" \"aff3ct\")\n@@ -359,7 +374,7 @@ aff3ct_target_include_directories(PUBLIC \"lib/cli/src\" \"cli\")\n# MSVC dirent.h\nif(MSVC)\n- aff3ct_target_include_directories(PUBLIC \"lib/MSVC/include\" \"dirent\")\n+ aff3ct_target_include_directories2(PRIVATE \"lib/MSVC/include\")\nendif()\n# MIPP\n@@ -406,21 +421,6 @@ macro(aff3ct_target_link_libraries privacy lib)\nendif(AFF3CT_COMPILE_STATIC_LIB)\nendmacro()\n-macro(aff3ct_target_include_directories2 privacy dir)\n- if(AFF3CT_COMPILE_OBJ)\n- target_include_directories(aff3ct-obj ${privacy} $<BUILD_INTERFACE:${dir}> $<INSTALL_INTERFACE:${dir}>)\n- endif()\n- if(AFF3CT_COMPILE_EXE)\n- target_include_directories(aff3ct-bin ${privacy} $<BUILD_INTERFACE:${dir}> $<INSTALL_INTERFACE:${dir}>)\n- endif()\n- if(AFF3CT_COMPILE_SHARED_LIB)\n- target_include_directories(aff3ct-shared-lib ${privacy} $<BUILD_INTERFACE:${dir}> $<INSTALL_INTERFACE:${dir}>)\n- endif()\n- if(AFF3CT_COMPILE_STATIC_LIB)\n- target_include_directories(aff3ct-static-lib ${privacy} $<BUILD_INTERFACE:${dir}> $<INSTALL_INTERFACE:${dir}>)\n- endif()\n-endmacro()\n-\n# SystemC (it is very important to have SystemC linked before the other libraries !!!)\nif(AFF3CT_SYSTEMC_SIMU OR AFF3CT_SYSTEMC_MODULE)\nif(AFF3CT_SYSTEMC_SIMU)\n@@ -601,10 +601,6 @@ if (AFF3CT_COMPILE_SHARED_LIB OR AFF3CT_COMPILE_STATIC_LIB)\nDESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/aff3ct-${AFF3CT_VERSION_FULL}/MIPP\nCOMPONENT headers\nFILES_MATCHING PATTERN \"*.hxx\")\n- install(DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}/lib/MSVC/include/\"\n- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/aff3ct-${AFF3CT_VERSION_FULL}/dirent\n- COMPONENT headers\n- FILES_MATCHING PATTERN \"*.h\")\ninstall(DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}/lib/rang/include/\"\nDESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/aff3ct-${AFF3CT_VERSION_FULL}/rang\nCOMPONENT headers\n" } ]
C++
MIT License
aff3ct/aff3ct
Put 'dirent.h' as private header.
8,490
15.10.2019 14:10:06
-7,200
28ffd42c7044f10a533f9c75929cd3efda0c5a96
Fix MSVC CMake error.
[ { "change_type": "MODIFY", "old_path": "CMakeLists.txt", "new_path": "CMakeLists.txt", "diff": "@@ -374,7 +374,7 @@ aff3ct_target_include_directories(PUBLIC \"lib/cli/src\" \"cli\")\n# MSVC dirent.h\nif(MSVC)\n- aff3ct_target_include_directories2(PRIVATE \"lib/MSVC/include\")\n+ aff3ct_target_include_directories(PRIVATE \"lib/MSVC/include\" \"dirent\")\nendif()\n# MIPP\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix MSVC CMake error.
8,490
16.10.2019 15:21:05
-7,200
5709d2b206331b5b46767203dcc21d4102104335
Put headers from 'src' in private.
[ { "change_type": "MODIFY", "old_path": "CMakeLists.txt", "new_path": "CMakeLists.txt", "diff": "@@ -367,7 +367,7 @@ macro(aff3ct_target_include_directories2 privacy dir)\nendmacro()\n# AFF3CT headers\n-aff3ct_target_include_directories(PUBLIC \"src\" \"aff3ct\")\n+aff3ct_target_include_directories(PRIVATE \"src\" \"aff3ct\")\naff3ct_target_include_directories(PUBLIC \"include\" \"aff3ct\")\n# cli headers\n" } ]
C++
MIT License
aff3ct/aff3ct
Put headers from 'src' in private.
8,490
16.10.2019 16:10:30
-7,200
9917896dfa5ddccdfa48f1330a051a60944b1569
Put SystemC tools in public headers.
[ { "change_type": "RENAME", "old_path": "src/Tools/SystemC/SC_Debug.hpp", "new_path": "include/Tools/SystemC/SC_Debug.hpp", "diff": "" }, { "change_type": "RENAME", "old_path": "src/Tools/SystemC/SC_Debug.hxx", "new_path": "include/Tools/SystemC/SC_Debug.hxx", "diff": "" }, { "change_type": "RENAME", "old_path": "src/Tools/SystemC/SC_Dummy.hpp", "new_path": "include/Tools/SystemC/SC_Dummy.hpp", "diff": "" }, { "change_type": "RENAME", "old_path": "src/Tools/SystemC/SC_Duplicator.hpp", "new_path": "include/Tools/SystemC/SC_Duplicator.hpp", "diff": "" }, { "change_type": "RENAME", "old_path": "src/Tools/SystemC/SC_Funnel.hpp", "new_path": "include/Tools/SystemC/SC_Funnel.hpp", "diff": "" }, { "change_type": "RENAME", "old_path": "src/Tools/SystemC/SC_Predicate.hpp", "new_path": "include/Tools/SystemC/SC_Predicate.hpp", "diff": "" }, { "change_type": "RENAME", "old_path": "src/Tools/SystemC/SC_Router.hpp", "new_path": "include/Tools/SystemC/SC_Router.hpp", "diff": "" }, { "change_type": "MODIFY", "old_path": "include/aff3ct.hpp", "new_path": "include/aff3ct.hpp", "diff": "#ifndef TRANSPOSE_SELECTOR_H\n#include <Tools/Perf/Transpose/transpose_selector.h>\n#endif\n+#ifndef SC_DEBUG_HPP_\n+#include <Tools/SystemC/SC_Debug.hpp>\n+#endif\n+#ifndef SC_DUMMY_HPP_\n+#include <Tools/SystemC/SC_Dummy.hpp>\n+#endif\n+#ifndef SC_DUPLICATOR_HPP_\n+#include <Tools/SystemC/SC_Duplicator.hpp>\n+#endif\n+#ifndef SC_FUNNEL_HPP_\n+#include <Tools/SystemC/SC_Funnel.hpp>\n+#endif\n+#ifndef SC_PREDICATE_HPP_\n+#include <Tools/SystemC/SC_Predicate.hpp>\n+#endif\n+#ifndef SC_ROUTER_HPP_\n+#include <Tools/SystemC/SC_Router.hpp>\n+#endif\n#ifndef TYPES_H_\n#include <Tools/types.h>\n#endif\n" } ]
C++
MIT License
aff3ct/aff3ct
Put SystemC tools in public headers.
8,490
20.10.2019 13:36:49
-7,200
cbd4f86aaa00816aba639aa414c6cac83e19fc63
Mv 'Monitor_reduction' in tools.
[ { "change_type": "RENAME", "old_path": "include/Module/Monitor/Monitor_reduction.hpp", "new_path": "include/Tools/Monitor/Monitor_reduction.hpp", "diff": "namespace aff3ct\n{\n-namespace module\n+namespace tools\n{\nclass Monitor_reduction\n@@ -120,7 +120,7 @@ private:\ntemplate <class M> // M is the monitor on which must be applied the reduction\nclass Monitor_reduction_M : public Monitor_reduction, public M\n{\n- static_assert(std::is_base_of<Monitor, M>::value, \"M have to be based on a module::Monitor class.\");\n+ static_assert(std::is_base_of<module::Monitor, M>::value, \"M have to be based on a module::Monitor class.\");\nprivate:\nconst std::vector<std::unique_ptr<M>>& monitors;\n@@ -154,7 +154,7 @@ protected:\n}\n#ifndef DOXYGEN_SHOULD_SKIP_THIS\n-#include \"Module/Monitor/Monitor_reduction.hxx\"\n+#include \"Tools/Monitor/Monitor_reduction.hxx\"\n#endif\n#endif /* MONITOR_REDUCTION_HPP_ */\n" }, { "change_type": "RENAME", "old_path": "include/Module/Monitor/Monitor_reduction.hxx", "new_path": "include/Tools/Monitor/Monitor_reduction.hxx", "diff": "#include <numeric>\n#include \"Tools/Exception/exception.hpp\"\n-#include \"Module/Monitor/Monitor_reduction.hpp\"\n+#include \"Tools/Monitor/Monitor_reduction.hpp\"\nnamespace aff3ct\n{\n-namespace module\n+namespace tools\n{\ntemplate <class M>\n" }, { "change_type": "RENAME", "old_path": "include/Module/Monitor/Monitor_reduction_MPI.hpp", "new_path": "include/Tools/Monitor/Monitor_reduction_MPI.hpp", "diff": "#include <memory>\n#include <mpi.h>\n-#include \"Module/Monitor/Monitor_reduction.hpp\"\n+#include \"Tools/Monitor/Monitor_reduction.hpp\"\nnamespace aff3ct\n{\n-namespace module\n+namespace tools\n{\ntemplate <class M> // M is the monitor on which must be applied the reduction\nclass Monitor_reduction_MPI : public Monitor_reduction_M<M>\n@@ -43,7 +43,7 @@ private:\n}\n#ifndef DOXYGEN_SHOULD_SKIP_THIS\n-#include \"Module/Monitor/Monitor_reduction_MPI.hxx\"\n+#include \"Tools/Monitor/Monitor_reduction_MPI.hxx\"\n#endif\n#endif /* MONITOR_REDUCTION_MPI_HPP_ */\n" }, { "change_type": "RENAME", "old_path": "include/Module/Monitor/Monitor_reduction_MPI.hxx", "new_path": "include/Tools/Monitor/Monitor_reduction_MPI.hxx", "diff": "#include <sstream>\n#include \"Tools/Exception/exception.hpp\"\n-#include \"Module/Monitor/Monitor_reduction_MPI.hpp\"\n+#include \"Tools/Monitor/Monitor_reduction_MPI.hpp\"\nnamespace aff3ct\n{\n-namespace module\n+namespace tools\n{\ntemplate <class M>\n" }, { "change_type": "MODIFY", "old_path": "include/aff3ct.hpp", "new_path": "include/aff3ct.hpp", "diff": "#ifndef MONITOR_HPP_\n#include <Module/Monitor/Monitor.hpp>\n#endif\n-#ifndef MONITOR_REDUCTION_HPP_\n-#include <Module/Monitor/Monitor_reduction.hpp>\n-#endif\n-#ifndef MONITOR_REDUCTION_MPI_HPP_\n-#include <Module/Monitor/Monitor_reduction_MPI.hpp>\n-#endif\n#ifndef PUNCTURER_LDPC_HPP_\n#include <Module/Puncturer/LDPC/Puncturer_LDPC.hpp>\n#endif\n#ifndef MATH_UTILS_H\n#include <Tools/Math/utils.h>\n#endif\n+#ifndef MONITOR_REDUCTION_HPP_\n+#include <Tools/Monitor/Monitor_reduction.hpp>\n+#endif\n+#ifndef MONITOR_REDUCTION_MPI_HPP_\n+#include <Tools/Monitor/Monitor_reduction_MPI.hpp>\n+#endif\n#ifndef ERASED_PROBABILITY_HPP_\n#include <Tools/Noise/Event_probability.hpp>\n#endif\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.cpp", "new_path": "src/Simulation/BFER/BFER.cpp", "diff": "@@ -170,11 +170,11 @@ void BFER<B,R,Q>\ntry\n{\nthis->_launch();\n- module::Monitor_reduction::is_done_all(true, true); // final reduction\n+ tools::Monitor_reduction::is_done_all(true, true); // final reduction\n}\ncatch (std::exception const& e)\n{\n- module::Monitor_reduction::is_done_all(true, true); // final reduction\n+ tools::Monitor_reduction::is_done_all(true, true); // final reduction\nterminal->final_report(std::cout); // display final report to not lost last line overwritten by the error\n// messages\n@@ -270,7 +270,7 @@ void BFER<B,R,Q>\nfor (auto &t : mm->tasks)\nt->reset_stats();\n- module::Monitor_reduction::reset_all();\n+ tools::Monitor_reduction::reset_all();\ntools::Terminal::reset();\n}\n}\n@@ -352,9 +352,9 @@ void BFER<B,R,Q>\nthis->monitor_mi_red.reset(new Monitor_MI_reduction_type(this->monitor_mi));\n}\n- module::Monitor_reduction::set_master_thread_id(std::this_thread::get_id());\n+ tools::Monitor_reduction::set_master_thread_id(std::this_thread::get_id());\n#ifdef AFF3CT_MPI\n- module::Monitor_reduction::set_reduce_frequency(params_BFER.mnt_mpi_comm_freq);\n+ tools::Monitor_reduction::set_reduce_frequency(params_BFER.mnt_mpi_comm_freq);\n#else\nauto freq = std::chrono::milliseconds(0);\nif (params_BFER.mnt_red_lazy)\n@@ -364,11 +364,11 @@ void BFER<B,R,Q>\nelse\nfreq = std::chrono::milliseconds(1000); // default value when lazy reduction and no terminal refresh\n}\n- module::Monitor_reduction::set_reduce_frequency(freq);\n+ tools::Monitor_reduction::set_reduce_frequency(freq);\n#endif\n- module::Monitor_reduction::reset_all();\n- module::Monitor_reduction::check_reducible();\n+ tools::Monitor_reduction::reset_all();\n+ tools::Monitor_reduction::check_reducible();\n}\ntemplate <typename B, typename R, typename Q>\n@@ -415,7 +415,7 @@ bool BFER<B,R,Q>\n{\n// communication chain execution\nreturn !(tools::Terminal::is_interrupt() // if user stopped the simulation\n- || module::Monitor_reduction::is_done_all() // while any monitor criteria is not reached -> do reduction\n+ || tools::Monitor_reduction::is_done_all() // while any monitor criteria is not reached -> do reduction\n|| this->stop_time_reached());\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.hpp", "new_path": "src/Simulation/BFER/BFER.hpp", "diff": "#include \"Tools/Display/Dumper/Dumper.hpp\"\n#include \"Tools/Display/Dumper/Dumper_reduction.hpp\"\n#include \"Tools/Math/Distribution/Distributions.hpp\"\n+#include \"Tools/Monitor/Monitor_reduction.hpp\"\n+#ifdef AFF3CT_MPI\n+#include \"Tools/Monitor/Monitor_reduction_MPI.hpp\"\n+#endif\n#include \"Tools/Noise/Noise.hpp\"\n#include \"Module/Monitor/MI/Monitor_MI.hpp\"\n#include \"Module/Monitor/BFER/Monitor_BFER.hpp\"\n-#include \"Module/Monitor/Monitor_reduction.hpp\"\n-#ifdef AFF3CT_MPI\n-#include \"Module/Monitor/Monitor_reduction_MPI.hpp\"\n-#endif\n#include \"Simulation/Simulation.hpp\"\nnamespace aff3ct\n@@ -47,11 +47,11 @@ protected:\nusing Monitor_MI_type = module::Monitor_MI<B,R>;\n#ifdef AFF3CT_MPI\n- using Monitor_BFER_reduction_type = module::Monitor_reduction_MPI<Monitor_BFER_type>;\n- using Monitor_MI_reduction_type = module::Monitor_reduction_MPI<Monitor_MI_type >;\n+ using Monitor_BFER_reduction_type = tools::Monitor_reduction_MPI<Monitor_BFER_type>;\n+ using Monitor_MI_reduction_type = tools::Monitor_reduction_MPI<Monitor_MI_type >;\n#else\n- using Monitor_BFER_reduction_type = module::Monitor_reduction_M<Monitor_BFER_type>;\n- using Monitor_MI_reduction_type = module::Monitor_reduction_M<Monitor_MI_type >;\n+ using Monitor_BFER_reduction_type = tools::Monitor_reduction_M<Monitor_BFER_type>;\n+ using Monitor_MI_reduction_type = tools::Monitor_reduction_M<Monitor_MI_type >;\n#endif\nstd::vector<std::unique_ptr<Monitor_MI_type >> monitor_mi;\n" }, { "change_type": "RENAME", "old_path": "src/Module/Monitor/Monitor_reduction.cpp", "new_path": "src/Tools/Monitor/Monitor_reduction.cpp", "diff": "#endif\n#include \"Tools/Exception/exception.hpp\"\n-#include \"Module/Monitor/Monitor_reduction.hpp\"\n+#include \"Tools/Monitor/Monitor_reduction.hpp\"\nusing namespace aff3ct;\n-using namespace aff3ct::module;\n+using namespace aff3ct::tools;\n-bool aff3ct::module::Monitor_reduction::stop_loop = false;\n-std::vector<aff3ct::module::Monitor_reduction*> aff3ct::module::Monitor_reduction::monitors;\n-std::thread::id aff3ct::module::Monitor_reduction::master_thread_id = std::this_thread::get_id();\n-std::chrono::nanoseconds aff3ct::module::Monitor_reduction::d_reduce_frequency = std::chrono::milliseconds(1000);\n-std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> aff3ct::module::Monitor_reduction::t_last_reduction;\n+bool aff3ct::tools::Monitor_reduction::stop_loop = false;\n+std::vector<aff3ct::tools::Monitor_reduction*> aff3ct::tools::Monitor_reduction::monitors;\n+std::thread::id aff3ct::tools::Monitor_reduction::master_thread_id = std::this_thread::get_id();\n+std::chrono::nanoseconds aff3ct::tools::Monitor_reduction::d_reduce_frequency = std::chrono::milliseconds(1000);\n+std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> aff3ct::tools::Monitor_reduction::t_last_reduction;\nMonitor_reduction\n::Monitor_reduction()\n" } ]
C++
MIT License
aff3ct/aff3ct
Mv 'Monitor_reduction' in tools.
8,490
21.10.2019 11:13:11
-7,200
b9f36ff451f4efb43cb4b63fcf936ac171ac3f40
Doc: ignore `friend` keyword in Doxygen.
[ { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hpp", "new_path": "include/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hpp", "diff": "@@ -34,8 +34,10 @@ template <typename B = int, typename R = float,\ntools::xo_STD<B >>>\nclass Decoder_polar_SC_fast_sys : public Decoder_SIHO<B,R>, public tools::Frozenbits_notifier\n{\n+#ifndef DOXYGEN_SHOULD_SKIP_THIS\nfriend Decoder_polar_ASCL_fast_CA_sys <B,R,API_polar>;\nfriend Decoder_polar_ASCL_MEM_fast_CA_sys<B,R,API_polar>;\n+#endif\nprotected:\nconst int m; // graph depth\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Encoder/RSC_DB/Encoder_RSC_DB.hpp", "new_path": "include/Module/Encoder/RSC_DB/Encoder_RSC_DB.hpp", "diff": "@@ -21,7 +21,9 @@ class Encoder_turbo_DB;\ntemplate <typename B = int>\nclass Encoder_RSC_DB: public Encoder<B>\n{\n+#ifndef DOXYGEN_SHOULD_SKIP_THIS\nfriend Encoder_turbo_DB<B>;\n+#endif\nprivate:\nstatic const std::string default_std;\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Module.hpp", "new_path": "include/Module/Module.hpp", "diff": "@@ -39,7 +39,9 @@ protected:\npublic:\nstd::vector<std::shared_ptr<Task>> tasks;\n#ifdef AFF3CT_SYSTEMC_MODULE\n+#ifndef DOXYGEN_SHOULD_SKIP_THIS\nfriend SC_Module_container;\n+#endif\nSC_Module_container sc;\n#endif\n" }, { "change_type": "MODIFY", "old_path": "include/Module/SC_Module.hpp", "new_path": "include/Module/SC_Module.hpp", "diff": "@@ -31,7 +31,9 @@ class SC_Module;\ntemplate <class C>\nclass SC_Socket_in\n{\n+#ifndef DOXYGEN_SHOULD_SKIP_THIS\nfriend SC_Module;\n+#endif\nprotected:\nstd::vector<std::unique_ptr<tlm_utils::simple_target_socket<C>>> &sockets;\nconst Task &task;\n@@ -47,7 +49,9 @@ public:\ntemplate <class C>\nclass SC_Socket_out\n{\n+#ifndef DOXYGEN_SHOULD_SKIP_THIS\nfriend SC_Module;\n+#endif\nprotected:\nstd::vector<std::unique_ptr<tlm_utils::simple_initiator_socket<C>>> &sockets;\nconst Task &task;\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Socket.hpp", "new_path": "include/Module/Socket.hpp", "diff": "@@ -19,7 +19,9 @@ namespace module\n{\nclass Socket\n{\n+#ifndef DOXYGEN_SHOULD_SKIP_THIS\nfriend Task;\n+#endif\nprotected:\nTask &task;\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Task.hpp", "new_path": "include/Module/Task.hpp", "diff": "@@ -24,8 +24,10 @@ enum class socket_t : uint8_t { SIN, SIN_SOUT, SOUT };\nclass Task\n{\n+#ifndef DOXYGEN_SHOULD_SKIP_THIS\nfriend Socket;\nfriend Module;\n+#endif\nprotected:\nconst Module &module;\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Algo/Sort/LC_sorter.hpp", "new_path": "include/Tools/Algo/Sort/LC_sorter.hpp", "diff": "@@ -18,7 +18,9 @@ class LC_sorter_simd;\ntemplate <typename T>\nclass LC_sorter\n{\n+#ifndef DOXYGEN_SHOULD_SKIP_THIS\nfriend LC_sorter_simd<T>;\n+#endif\nprivate:\nint max_elmts;\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Algo/Tree/Binary_node.hpp", "new_path": "include/Tools/Algo/Tree/Binary_node.hpp", "diff": "@@ -22,7 +22,9 @@ class Binary_tree;\ntemplate <typename T = float>\nclass Binary_node\n{\n+#ifndef DOXYGEN_SHOULD_SKIP_THIS\nfriend Binary_tree<T>;\n+#endif\nprivate:\nBinary_node<T>* father; /*!< Pointer to the father node (nullptr if this node is the root). */\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Code/LDPC/Update_rule/MS/Update_rule_MS.hpp", "new_path": "include/Tools/Code/LDPC/Update_rule/MS/Update_rule_MS.hpp", "diff": "@@ -17,8 +17,10 @@ template <typename R> class Update_rule_NMS;\ntemplate <typename R = float>\nclass Update_rule_MS // Min Sum\n{\n+#ifndef DOXYGEN_SHOULD_SKIP_THIS\nfriend Update_rule_OMS<R>;\nfriend Update_rule_NMS<R>;\n+#endif\nprotected:\nconst std::string name;\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Code/LDPC/Update_rule/MS/Update_rule_MS_simd.hpp", "new_path": "include/Tools/Code/LDPC/Update_rule/MS/Update_rule_MS_simd.hpp", "diff": "@@ -19,6 +19,7 @@ template <typename R, int N> class Update_rule_NMS_simd;\ntemplate <typename R = float>\nclass Update_rule_MS_simd // Min Sum\n{\n+#ifndef DOXYGEN_SHOULD_SKIP_THIS\nfriend Update_rule_OMS_simd<R >;\nfriend Update_rule_NMS_simd<R,0>;\nfriend Update_rule_NMS_simd<R,1>;\n@@ -29,6 +30,7 @@ class Update_rule_MS_simd // Min Sum\nfriend Update_rule_NMS_simd<R,6>;\nfriend Update_rule_NMS_simd<R,7>;\nfriend Update_rule_NMS_simd<R,8>;\n+#endif\nprotected:\nconst std::string name;\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Display/Dumper/Dumper.hpp", "new_path": "include/Tools/Display/Dumper/Dumper.hpp", "diff": "@@ -18,7 +18,9 @@ namespace tools\nclass Dumper_reduction;\nclass Dumper\n{\n+#ifndef DOXYGEN_SHOULD_SKIP_THIS\nfriend Dumper_reduction;\n+#endif\nprotected:\nstatic const std::string default_ext;\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/auto_cloned_unique_ptr.hpp", "new_path": "include/Tools/auto_cloned_unique_ptr.hpp", "diff": "@@ -54,6 +54,7 @@ public:\ninline const pointer get() const;\ninline void reset(pointer __p = pointer()) noexcept;\n+#ifndef DOXYGEN_SHOULD_SKIP_THIS\nprotected:\ntemplate <typename T>\nfriend bool operator==(const auto_cloned_unique_ptr<T>& x, const auto_cloned_unique_ptr<T>& y);\n@@ -63,6 +64,7 @@ public:\nfriend bool operator!=(const auto_cloned_unique_ptr<T>& x, const auto_cloned_unique_ptr<T>& y);\ntemplate <typename T>\nfriend bool operator!=(const auto_cloned_unique_ptr<T>& x, std::nullptr_t) noexcept;\n+#endif\n};\ntemplate <typename D>\n" } ]
C++
MIT License
aff3ct/aff3ct
Doc: ignore `friend` keyword in Doxygen.
8,490
21.10.2019 11:39:40
-7,200
22cc054dcca0eeb96904a60ed1233221adede01a
Fix paths to the doc.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -94,13 +94,15 @@ documentation-sphinx:\nname: documentation-sphinx\nwhen: always\npaths:\n- - doc/sphinx/build/html\n- - doc/sphinx/build/latex\n+ - doc/build/html\n+ - doc/build/latex\n+ - doc/build/doxygen\ntags:\n- sphinx\n- latex\nscript:\n- - cd doc/sphinx\n+ - cd doc/\n+ - pip3 install -r requirements.txt\n- make html\n- make latexpdf\n" }, { "change_type": "MODIFY", "old_path": "CMakeLists.txt", "new_path": "CMakeLists.txt", "diff": "@@ -616,13 +616,13 @@ if (AFF3CT_COMPILE_SHARED_LIB OR AFF3CT_COMPILE_STATIC_LIB)\nFILES_MATCHING PATTERN \"*.hxx\")\nendif()\n-if(EXISTS \"${CMAKE_CURRENT_SOURCE_DIR}/doc/sphinx/build/latex/AFF3CT.pdf\")\n- install(FILES \"${CMAKE_CURRENT_SOURCE_DIR}/doc/sphinx/build/latex/AFF3CT.pdf\"\n+if(EXISTS \"${CMAKE_CURRENT_SOURCE_DIR}/doc/build/latex/AFF3CT.pdf\")\n+ install(FILES \"${CMAKE_CURRENT_SOURCE_DIR}/doc/build/latex/AFF3CT.pdf\"\nDESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/aff3ct-${AFF3CT_VERSION_FULL}/doc/pdf\nCOMPONENT documentation)\nendif()\n-if(EXISTS \"${CMAKE_CURRENT_SOURCE_DIR}/doc/sphinx/build/html/\")\n- install(DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}/doc/sphinx/build/html/\"\n+if(EXISTS \"${CMAKE_CURRENT_SOURCE_DIR}/doc/build/html/\")\n+ install(DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}/doc/build/html/\"\nDESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/aff3ct-${AFF3CT_VERSION_FULL}/doc/html\nCOMPONENT documentation)\nendif()\n" }, { "change_type": "MODIFY", "old_path": "ci/check-documentation.py", "new_path": "ci/check-documentation.py", "diff": "@@ -165,7 +165,7 @@ if __name__ == \"__main__\":\nparser = argparse.ArgumentParser()\nparser.add_argument('--keys', action='store', dest='keys_file', type=str, default='doc/strings.rst')\nparser.add_argument('--aff3ct', action='store', dest='aff3ct_path', type=str, default='build/bin/aff3ct')\n- parser.add_argument('--doc', action='store', dest='doc_path', type=str, default='doc/sphinx/source/user/simulation/parameters/')\n+ parser.add_argument('--doc', action='store', dest='doc_path', type=str, default='doc/source/user/simulation/parameters/')\nargs = parser.parse_args()\n" }, { "change_type": "MODIFY", "old_path": "ci/deploy-upload-ppa.sh", "new_path": "ci/deploy-upload-ppa.sh", "diff": "@@ -9,7 +9,7 @@ fi\ncmake --version\nmkdir build\n-mv doc/sphinx/build doc/sphinx/built\n+mv doc/build doc/built\ncd build\nif [ -z \"DISTRIBS\" ]\n" }, { "change_type": "MODIFY", "old_path": "cmake/Modules/UploadPPA.cmake", "new_path": "cmake/Modules/UploadPPA.cmake", "diff": "@@ -95,8 +95,8 @@ foreach(DISTRI ${AFF3CT_PPA_DISTRIB})\n\"usr/include/aff3ct-${AFF3CT_VERSION_FULL}/*\\n\")\nfile(WRITE \"${DEBIAN_SOURCE_DIR}/debian/${CPACK_DEBIAN_PACKAGE_NAME}-doc.install\"\n- \"doc/sphinx/built/html/* usr/share/aff3ct-${AFF3CT_VERSION_FULL}/doc/html\\n\"\n- \"doc/sphinx/built/latex/AFF3CT.pdf usr/share/aff3ct-${AFF3CT_VERSION_FULL}/doc/pdf/\\n\")\n+ \"doc/built/html/* usr/share/aff3ct-${AFF3CT_VERSION_FULL}/doc/html\\n\"\n+ \"doc/built/latex/AFF3CT.pdf usr/share/aff3ct-${AFF3CT_VERSION_FULL}/doc/pdf/\\n\")\n##############################################################################\n# debian/copyright\n" }, { "change_type": "MODIFY", "old_path": "scripts/generate_sphinx_usage.py", "new_path": "scripts/generate_sphinx_usage.py", "diff": "@@ -8,7 +8,7 @@ import aff3ct_help_reader as ahr\nparser = argparse.ArgumentParser(prog='aff3ct-command-conversion', formatter_class=argparse.ArgumentDefaultsHelpFormatter)\nparser.add_argument('--build', action='store', dest='buildPath', type=str, default=\"build/\", help='Build path to aff3ct.')\n-parser.add_argument('--dest', action='store', dest='destPath', default=\"doc/sphinx/source/simulation/parameters\", type=str, help='Destination path.')\n+parser.add_argument('--dest', action='store', dest='destPath', default=\"doc/source/simulation/parameters\", type=str, help='Destination path.')\nargs = parser.parse_args()\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix paths to the doc.
8,490
21.10.2019 11:44:30
-7,200
9f685f1818ee304705c28fe60fdc93fdaab56778
CI: fix missing doc in the builds.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -138,7 +138,8 @@ build-linux-gcc-x64-sse4.2:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies: []\n+ dependencies:\n+ - documentation-sphinx\ntags:\n- linux\n- gcc\n@@ -163,7 +164,8 @@ build-linux-gcc-x64-avx2:\nstage: build\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n- dependencies: []\n+ dependencies:\n+ - documentation-sphinx\ntags:\n- linux\n- gcc\n@@ -347,7 +349,8 @@ build-windows-gcc-x86-sse4.2:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies: []\n+ dependencies:\n+ - documentation-sphinx\ntags:\n- windows\n- gcc\n@@ -372,7 +375,8 @@ build-windows-gcc-x64-avx2:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies: []\n+ dependencies:\n+ - documentation-sphinx\ntags:\n- windows\n- 64-bit\n@@ -420,7 +424,8 @@ build-macos-clang-x64-sse4.2:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies: []\n+ dependencies:\n+ - documentation-sphinx\ntags:\n- macos\n- apple-clang\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: fix missing doc in the builds.
8,490
21.10.2019 15:54:03
-7,200
fd3eb239e041774a17f04b42ccc7f7d69f26d970
CI: automatically update the Python modules with pip for the doc. gen.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -97,10 +97,11 @@ documentation-sphinx:\n- doc/sphinx/build/html\n- doc/sphinx/build/latex\ntags:\n- - sphinx\n- latex\n+ - pip3\nscript:\n- cd doc/sphinx\n+ - pip3 install --user -r requirements.txt\n- make html\n- make latexpdf\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: automatically update the Python modules with pip for the doc. gen.
8,490
21.10.2019 14:02:27
-7,200
108d3888b75ba0dff6af3086467d8ac4af7d53f4
CI: reduce the compilation time of the documentation in LaTeX.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -86,25 +86,25 @@ analysis-git-submodules:\n- source ./ci/tools/git-branch.sh\n- ./ci/analysis-git-submodule.sh\n-documentation-sphinx:\n+analysis-documentation:\nstage: analysis\nexcept:\n- schedules\nartifacts:\n- name: documentation-sphinx\n+ name: analysis-documentation\nwhen: always\npaths:\n- doc/build/html\n- doc/build/latex\n- doc/build/doxygen\ntags:\n- - sphinx\n+ - pip3\n+ - doxygen\n- latex\n+ - powerful\nscript:\n- - cd doc/\n- - pip3 install -r requirements.txt\n- - make html\n- - make latexpdf\n+ - export THREADS=\"1\"\n+ - ./ci/analysis-documentation.sh\nbuild-linux-gcc-nointr:\nstage: build\n@@ -139,7 +139,7 @@ build-linux-gcc-x64-sse4.2:\nexcept:\n- schedules\ndependencies:\n- - documentation-sphinx\n+ - analysis-documentation\ntags:\n- linux\n- gcc\n@@ -165,7 +165,7 @@ build-linux-gcc-x64-avx2:\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\ndependencies:\n- - documentation-sphinx\n+ - analysis-documentation\ntags:\n- linux\n- gcc\n@@ -350,7 +350,7 @@ build-windows-gcc-x86-sse4.2:\nexcept:\n- schedules\ndependencies:\n- - documentation-sphinx\n+ - analysis-documentation\ntags:\n- windows\n- gcc\n@@ -376,7 +376,7 @@ build-windows-gcc-x64-avx2:\nexcept:\n- schedules\ndependencies:\n- - documentation-sphinx\n+ - analysis-documentation\ntags:\n- windows\n- 64-bit\n@@ -425,7 +425,7 @@ build-macos-clang-x64-sse4.2:\nexcept:\n- schedules\ndependencies:\n- - documentation-sphinx\n+ - analysis-documentation\ntags:\n- macos\n- apple-clang\n@@ -1258,7 +1258,7 @@ deploy-upload-ppa:\nexcept:\n- schedules\ndependencies:\n- - documentation-sphinx\n+ - analysis-documentation\nallow_failure: true\ntags:\n- linux\n" }, { "change_type": "ADD", "old_path": null, "new_path": "ci/analysis-documentation.sh", "diff": "+#!/bin/bash\n+set -x\n+\n+if [ -z \"$THREADS\" ]\n+then\n+ echo \"The 'THREADS' environment variable is not set, default value = 1.\"\n+ THREADS=1\n+fi\n+\n+cd doc/\n+pip3 install --user -r requirements.txt\n+rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\n+\n+export SPHINX_BUILDERNAME=\"latex\"\n+make clean\n+sphinx-build -M latexpdf source build -j $THREADS\n+rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\n+\n+export SPHINX_BUILDERNAME=\"html\"\n+sphinx-build -M html source build -j $THREADS\n+rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\n" }, { "change_type": "MODIFY", "old_path": "doc/README.md", "new_path": "doc/README.md", "diff": "@@ -6,7 +6,7 @@ Install Sphinx, Doxygen and Sphinx extensions:\n```bash\nsudo apt install python3 python3-pip librsvg2-bin doxygen\n-sudo pip3 install -r requirements.txt\n+pip3 install --user -r requirements.txt\n```\nGenerate the HTML documentation:\n" }, { "change_type": "MODIFY", "old_path": "doc/source/conf.py", "new_path": "doc/source/conf.py", "diff": "@@ -18,6 +18,12 @@ import textwrap\n# import sys\n# sys.path.insert(0, os.path.abspath('.'))\n+# This is an homemade environment variable set by the user to reduce the\n+# compilation time if 'SPHINX_BUILDERNAME' == 'latex'. It that case, the\n+# 'breathe' and 'exhale' extensions are disabled since the final LaTeX PDF do\n+# not include the API documentation.\n+buildername = str(os.getenv('SPHINX_BUILDERNAME'))\n+\n# -- Project information -----------------------------------------------------\nproject = 'AFF3CT'\n@@ -47,11 +53,13 @@ extensions = [\n'sphinx.ext.mathjax',\n'sphinxcontrib.bibtex',\n'sphinxcontrib.rsvgconverter',\n- 'breathe',\n- 'exhale',\n# 'm2r',\n]\n+if buildername != \"latex\":\n+ extensions.append('breathe')\n+ extensions.append('exhale')\n+\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n@@ -84,6 +92,8 @@ pygments_style = None\n# -- Configure Breathe (Developer doc from Doxygen XML files) ----------------\n+if buildername != \"latex\":\n+\n# # Uncomment the following lines to enable the Doxygen compilation\n# # Are we on a Readthedocs server ?\n# read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'\n@@ -97,6 +107,8 @@ breathe_default_project = \"AFF3CT\"\n# -- Configure Exhale (Required the previous Breathe config) -----------------\n+if buildername != \"latex\":\n+\n# Setup the exhale extension\nexhale_args = {\n# These arguments are required\n" }, { "change_type": "MODIFY", "old_path": "doc/source/others/license/license.rst", "new_path": "doc/source/others/license/license.rst", "diff": "License\n=======\n-.. include:: ../../../../../LICENSE\n\\ No newline at end of file\n+.. include:: ../../../../LICENSE\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: reduce the compilation time of the documentation in LaTeX.
8,490
21.10.2019 16:17:25
-7,200
e691a027a34bad395470179fe06b376582a1c3c1
CI: fix missing doc. in the builds.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -137,7 +137,8 @@ build-linux-gcc-x64-sse4.2:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies: []\n+ dependencies:\n+ - documentation-sphinx\ntags:\n- linux\n- gcc\n@@ -162,7 +163,8 @@ build-linux-gcc-x64-avx2:\nstage: build\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n- dependencies: []\n+ dependencies:\n+ - documentation-sphinx\ntags:\n- linux\n- gcc\n@@ -346,7 +348,8 @@ build-windows-gcc-x86-sse4.2:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies: []\n+ dependencies:\n+ - documentation-sphinx\ntags:\n- windows\n- gcc\n@@ -371,7 +374,8 @@ build-windows-gcc-x64-avx2:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies: []\n+ dependencies:\n+ - documentation-sphinx\ntags:\n- windows\n- 64-bit\n@@ -419,7 +423,8 @@ build-macos-clang-x64-sse4.2:\nGIT_SUBMODULE_STRATEGY: recursive\nexcept:\n- schedules\n- dependencies: []\n+ dependencies:\n+ - documentation-sphinx\ntags:\n- macos\n- apple-clang\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: fix missing doc. in the builds.
8,490
21.10.2019 16:43:30
-7,200
90e14f109849168fdaab3ee1300c87635d3bfd05
Doc: update the OpenMP library example.
[ { "change_type": "MODIFY", "old_path": "doc/source/user/library/examples.rst", "new_path": "doc/source/user/library/examples.rst", "diff": "@@ -864,7 +864,7 @@ each threads gets its own local ``m``.\nstd::vector<std::unique_ptr<tools::Reporter>> reporters; // list of reporters displayed in the terminal\nstd::unique_ptr<tools::Terminal> terminal; // manage the output text in the terminal\nstd::vector<std::unique_ptr<module::Monitor_BFER<>>> monitors; // list of the monitors from all the threads\n- std::unique_ptr<module::Monitor_BFER_reduction> monitor_red; // main monitor object that reduce all the thread monitors\n+ std::unique_ptr<tools::Monitor_BFER_reduction> monitor_red; // main monitor object that reduce all the thread monitors\nstd::vector<std::vector<const module::Module*>> modules; // list of the allocated modules\nstd::vector<std::vector<const module::Module*>> modules_stats; // list of the allocated modules reorganized for the statistics\n};\n@@ -936,7 +936,7 @@ pointer is assigned to ``m``. At line ``57`` a list of the modules is stored in\nvoid init_utils4(const params3 &p, utils4 &u)\n{\n// allocate a common monitor module to reduce all the monitors\n- u.monitor_red = std::unique_ptr<module::Monitor_BFER_reduction>(new module::Monitor_BFER_reduction(u.monitors));\n+ u.monitor_red = std::unique_ptr<tools::Monitor_BFER_reduction>(new tools::Monitor_BFER_reduction(u.monitors));\nu.monitor_red->set_reduce_frequency(std::chrono::milliseconds(500));\n// create a sigma noise type\nu.noise = std::unique_ptr<tools::Sigma<>>(new tools::Sigma<>());\n" } ]
C++
MIT License
aff3ct/aff3ct
Doc: update the OpenMP library example.
8,490
22.10.2019 23:19:24
-7,200
85e34229eab4117d40d9de306fe8a80d694ee7de
Throw exceptions to avoid segmentation faults in 'operator[]' functions.
[ { "change_type": "MODIFY", "old_path": "include/Module/Task.hxx", "new_path": "include/Module/Task.hxx", "diff": "#include <algorithm>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Module/Task.hpp\"\nnamespace aff3ct\n@@ -69,6 +71,20 @@ uint32_t Task\nSocket& Task\n::operator[](const int id)\n{\n+ if (id < 0 || (size_t)id >= this->sockets.size())\n+ {\n+ std::stringstream message;\n+ message << \"'id' has to be positive and smaller than 'sockets.size()' ('id' = \" << id\n+ << \", 'sockets.size()' = \" << sockets.size() << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+ if (this->sockets[id] == nullptr)\n+ {\n+ std::stringstream message;\n+ message << \"'sockets[id]' can't be nullptr ('id' = \" << id << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nreturn *this->sockets[id];\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Module.cpp", "new_path": "src/Module/Module.cpp", "diff": "@@ -72,6 +72,20 @@ void Module\nTask& Module\n::operator[](const int id)\n{\n+ if (id < 0 || (size_t)id >= tasks_with_nullptr.size())\n+ {\n+ std::stringstream message;\n+ message << \"'id' has to be positive and smaller than 'tasks_with_nullptr.size()' ('id' = \" << id\n+ << \", 'tasks_with_nullptr.size()' = \" << tasks_with_nullptr.size() << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+ if (tasks_with_nullptr[id] == nullptr)\n+ {\n+ std::stringstream message;\n+ message << \"'tasks_with_nullptr[id]' can't be nullptr ('id' = \" << id << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nreturn *tasks_with_nullptr[id];\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Throw exceptions to avoid segmentation faults in 'operator[]' functions.
8,490
23.10.2019 14:13:26
-7,200
15e11cd2c4f7c5906adb976a17f4bbadaf9bb2cc
Add a 'size' method to get the number of elements in a matrix.
[ { "change_type": "MODIFY", "old_path": "src/Tools/Algo/Matrix/Matrix.hpp", "new_path": "src/Tools/Algo/Matrix/Matrix.hpp", "diff": "@@ -40,6 +40,8 @@ public:\ninline size_t get_n_cols() const;\n+ inline size_t size() const;\n+\ninline size_t get_rows_max_degree() const;\ninline size_t get_cols_max_degree() const;\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Algo/Matrix/Matrix.hxx", "new_path": "src/Tools/Algo/Matrix/Matrix.hxx", "diff": "@@ -16,6 +16,12 @@ size_t Matrix\nreturn this->n_cols;\n}\n+size_t Matrix\n+::size() const\n+{\n+ return this->n_rows * this->n_cols;\n+}\n+\nsize_t Matrix\n::get_rows_max_degree() const\n{\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a 'size' method to get the number of elements in a matrix.
8,490
23.10.2019 14:13:39
-7,200
c2c49e75d59b5c1dd5eeafd5eddf2438fcb03103
Add getters in the LDPC codec to access 'G', 'H' and 'info_bits_pos'.
[ { "change_type": "MODIFY", "old_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp", "new_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp", "diff": "@@ -153,6 +153,55 @@ Codec_LDPC<B,Q>\n}\n}\n+template <typename B, typename Q>\n+const tools::Sparse_matrix& Codec_LDPC<B,Q>\n+::get_H() const\n+{\n+ if (this->H.size() == 0)\n+ {\n+ std::stringstream message;\n+ message << \"'H.size()' has to be strictly greater than 0 ('H.size()' = \" << H.size() << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ return this->H;\n+}\n+\n+template <typename B, typename Q>\n+const tools::Sparse_matrix& Codec_LDPC<B,Q>\n+::get_G() const\n+{\n+ if (this->G.size() == 0)\n+ {\n+ std::stringstream message;\n+ message << \"'G.size()' has to be strictly greater than 0 ('G.size()' = \" << G.size() << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ return this->G;\n+}\n+\n+template <typename B, typename Q>\n+const tools::LDPC_matrix_handler::Positions_vector& Codec_LDPC<B,Q>\n+::get_info_bits_pos() const\n+{\n+ return info_bits_pos;\n+}\n+\n+template <typename B, typename Q>\n+const tools::dvbs2_values& Codec_LDPC<B,Q>\n+::get_DVBS2() const\n+{\n+ if (this->dvbs2 == nullptr)\n+ {\n+ std::stringstream message;\n+ message << \"'dvbs2' can't be nullptr.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ return *this->dvbs2.get();\n+}\n+\ntemplate <typename B, typename Q>\nvoid Codec_LDPC<B,Q>\n::_extract_sys_par(const Q *Y_N, Q *sys, Q *par, const int frame_id)\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/LDPC/Codec_LDPC.hpp", "new_path": "src/Module/Codec/LDPC/Codec_LDPC.hpp", "diff": "@@ -23,7 +23,6 @@ protected:\ntools::Sparse_matrix H;\ntools::Sparse_matrix G;\ntools::LDPC_matrix_handler::Positions_vector info_bits_pos;\n- std::vector<bool> pctPattern;\nstd::unique_ptr<tools::dvbs2_values> dvbs2;\npublic:\n@@ -32,6 +31,11 @@ public:\nfactory::Puncturer_LDPC::parameters *pct_params);\nvirtual ~Codec_LDPC() = default;\n+ const tools::Sparse_matrix& get_H() const;\n+ const tools::Sparse_matrix& get_G() const;\n+ const tools::LDPC_matrix_handler::Positions_vector& get_info_bits_pos() const;\n+ const tools::dvbs2_values& get_DVBS2() const;\n+\nprotected:\nvoid _extract_sys_par(const Q *Y_N, Q *sys, Q *par, const int frame_id);\nvoid _extract_sys_llr(const Q *Y_N, Q *Y_K, const int frame_id);\n" } ]
C++
MIT License
aff3ct/aff3ct
Add getters in the LDPC codec to access 'G', 'H' and 'info_bits_pos'.
8,490
23.10.2019 15:12:19
-7,200
12105e4a0032fc9a33cab424c4465203cc956c2a
Add getters in the codecs.
[ { "change_type": "MODIFY", "old_path": "src/Module/Codec/BCH/Codec_BCH.cpp", "new_path": "src/Module/Codec/BCH/Codec_BCH.cpp", "diff": "@@ -71,6 +71,13 @@ Codec_BCH<B,Q>\nthis->set_decoder_siho_hiho(factory::Decoder_BCH::build_hiho<B,Q>(dec_params, GF_poly, this->get_encoder()));\n}\n+template <typename B, typename Q>\n+const tools::BCH_polynomial_generator<B>& Codec_BCH<B,Q>\n+::get_GF_poly() const\n+{\n+ return this->GF_poly;\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef AFF3CT_MULTI_PREC\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/BCH/Codec_BCH.hpp", "new_path": "src/Module/Codec/BCH/Codec_BCH.hpp", "diff": "@@ -20,6 +20,8 @@ public:\nCodec_BCH(const factory::Encoder_BCH::parameters &enc_params,\nconst factory::Decoder_BCH::parameters &dec_params);\nvirtual ~Codec_BCH() = default;\n+\n+ const tools::BCH_polynomial_generator<B>& get_GF_poly() const;\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/Polar/Codec_polar.cpp", "new_path": "src/Module/Codec/Polar/Codec_polar.cpp", "diff": "@@ -203,12 +203,40 @@ void Codec_polar<B,Q>\n}\ntemplate <typename B, typename Q>\n-std::vector<bool>& Codec_polar<B,Q>\n-::get_frozen_bits()\n+const std::vector<bool>& Codec_polar<B,Q>\n+::get_frozen_bits() const\n{\nreturn this->frozen_bits;\n}\n+template <typename B, typename Q>\n+bool Codec_polar<B,Q>\n+::is_adaptive_frozen_bits() const\n+{\n+ return this->adaptive_fb;\n+}\n+\n+template <typename B, typename Q>\n+bool Codec_polar<B,Q>\n+::is_generated_decoder() const\n+{\n+ return this->generated_decoder;\n+}\n+\n+template <typename B, typename Q>\n+const tools::Frozenbits_generator& Codec_polar<B,Q>\n+::get_frozen_bits_generator() const\n+{\n+ if (this->fb_generator == nullptr)\n+ {\n+ std::stringstream message;\n+ message << \"'fb_generator' can't be nullptr.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ return *this->fb_generator.get();\n+}\n+\ntemplate <typename B, typename Q>\nvoid Codec_polar<B,Q>\n::_extract_sys_par(const Q* Y_N, Q* sys, Q* par, const int frame_id)\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/Polar/Codec_polar.hpp", "new_path": "src/Module/Codec/Polar/Codec_polar.hpp", "diff": "@@ -44,7 +44,10 @@ public:\nvirtual void set_noise(const tools::Noise<float>& noise);\nvirtual void set_noise(const tools::Noise<double>& noise);\n- std::vector<bool>& get_frozen_bits();\n+ const std::vector<bool>& get_frozen_bits() const;\n+ bool is_adaptive_frozen_bits() const;\n+ bool is_generated_decoder() const;\n+ const tools::Frozenbits_generator& get_frozen_bits_generator() const;\nvirtual void notify_frozenbits_update();\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/RS/Codec_RS.cpp", "new_path": "src/Module/Codec/RS/Codec_RS.cpp", "diff": "@@ -71,6 +71,13 @@ Codec_RS<B,Q>\nthis->set_decoder_siho_hiho(factory::Decoder_RS::build_hiho<B,Q>(dec_params, GF_poly, this->get_encoder()));\n}\n+template <typename B, typename Q>\n+const tools::RS_polynomial_generator& Codec_RS<B,Q>\n+::get_GF_poly() const\n+{\n+ return this->GF_poly;\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef AFF3CT_MULTI_PREC\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/RS/Codec_RS.hpp", "new_path": "src/Module/Codec/RS/Codec_RS.hpp", "diff": "@@ -20,6 +20,8 @@ public:\nCodec_RS(const factory::Encoder_RS::parameters &enc_params,\nconst factory::Decoder_RS::parameters &dec_params);\nvirtual ~Codec_RS() = default;\n+\n+ const tools::RS_polynomial_generator& get_GF_poly() const;\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/RSC/Codec_RSC.cpp", "new_path": "src/Module/Codec/RSC/Codec_RSC.cpp", "diff": "@@ -84,6 +84,20 @@ Codec_RSC<B,Q>\n}\n}\n+template <typename B, typename Q>\n+bool Codec_RSC<B,Q>\n+::is_buffered_encoding() const\n+{\n+ return this->buffered_encoding;\n+}\n+\n+template <typename B, typename Q>\n+const std::vector<std::vector<int>>& Codec_RSC<B,Q>\n+::get_trellis() const\n+{\n+ return this->trellis;\n+}\n+\ntemplate <typename B, typename Q>\nvoid Codec_RSC<B,Q>\n::_extract_sys_par(const Q* Y_N, Q* sys, Q* par, const int frame_id)\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/RSC/Codec_RSC.hpp", "new_path": "src/Module/Codec/RSC/Codec_RSC.hpp", "diff": "@@ -23,6 +23,9 @@ public:\nconst factory::Decoder_RSC::parameters &dec_params);\nvirtual ~Codec_RSC() = default;\n+ bool is_buffered_encoding() const;\n+ const std::vector<std::vector<int>>& get_trellis() const;\n+\nprotected:\nvoid _extract_sys_par(const Q *Y_N, Q *sys, Q *par, const int frame_id);\nvoid _extract_sys_llr(const Q *Y_N, Q *sys, const int frame_id);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/RSC_DB/Codec_RSC_DB.cpp", "new_path": "src/Module/Codec/RSC_DB/Codec_RSC_DB.cpp", "diff": "@@ -82,6 +82,20 @@ Codec_RSC_DB<B,Q>\n}\n}\n+template <typename B, typename Q>\n+bool Codec_RSC_DB<B,Q>\n+::is_buffered_encoding() const\n+{\n+ return this->buffered_encoding;\n+}\n+\n+template <typename B, typename Q>\n+const std::vector<std::vector<int>>& Codec_RSC_DB<B,Q>\n+::get_trellis() const\n+{\n+ return this->trellis;\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef AFF3CT_MULTI_PREC\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/RSC_DB/Codec_RSC_DB.hpp", "new_path": "src/Module/Codec/RSC_DB/Codec_RSC_DB.hpp", "diff": "@@ -22,6 +22,9 @@ public:\nCodec_RSC_DB(const factory::Encoder_RSC_DB::parameters &enc_params,\nconst factory::Decoder_RSC_DB::parameters &dec_params);\nvirtual ~Codec_RSC_DB() = default;\n+\n+ bool is_buffered_encoding() const;\n+ const std::vector<std::vector<int>>& get_trellis() const;\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/Turbo/Codec_turbo.cpp", "new_path": "src/Module/Codec/Turbo/Codec_turbo.cpp", "diff": "@@ -118,22 +118,22 @@ Codec_turbo<B,Q>\nif (decoder_turbo)\n{\nif (dec_params.sf->enable)\n- add_post_pro(factory::Scaling_factor::build<B,Q>(*dec_params.sf));\n+ add_post_processings(factory::Scaling_factor::build<B,Q>(*dec_params.sf));\nif (dec_params.fnc->enable)\n{\nif (crc == nullptr || crc->get_size() == 0)\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, \"The Flip aNd Check requires a CRC.\");\n- add_post_pro(factory::Flip_and_check::build<B,Q>(*dec_params.fnc, *crc));\n+ add_post_processings(factory::Flip_and_check::build<B,Q>(*dec_params.fnc, *crc));\n}\nelse if (crc != nullptr && crc->get_size() > 0)\n- add_post_pro(new tools::CRC_checker<B,Q>(*crc,\n+ add_post_processings(new tools::CRC_checker<B,Q>(*crc,\ndec_params.crc_start_ite,\ndecoder_turbo->get_simd_inter_frame_level()));\nif (dec_params.self_corrected)\n- add_post_pro(new tools::Self_corrected<B,Q>(dec_params.K,\n+ add_post_processings(new tools::Self_corrected<B,Q>(dec_params.K,\ndec_params.n_ite,\n4,\ndec_params.n_ite,\n@@ -163,9 +163,51 @@ Codec_turbo<B,Q>\n}\n}\n+template <typename B, typename Q>\n+const std::vector<std::vector<int>>& Codec_turbo<B,Q>\n+::get_trellis() const\n+{\n+ return this->trellis;\n+}\n+\n+template <typename B, typename Q>\n+const module::Encoder_RSC_sys<B>& Codec_turbo<B,Q>\n+::get_sub_encoder() const\n+{\n+ if (this->sub_enc == nullptr)\n+ {\n+ std::stringstream message;\n+ message << \"'sub_enc' can't be nullptr.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ return *this->sub_enc.get();\n+}\n+\n+template <typename B, typename Q>\n+const module::Decoder_SISO<Q>& Codec_turbo<B,Q>\n+::get_sub_decoder() const\n+{\n+ if (this->sub_dec == nullptr)\n+ {\n+ std::stringstream message;\n+ message << \"'sub_dec' can't be nullptr.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ return *this->sub_dec.get();\n+}\n+\n+template <typename B, typename Q>\n+const std::vector<std::shared_ptr<tools::Post_processing_SISO<B,Q>>>& Codec_turbo<B,Q>\n+::get_post_processings() const\n+{\n+ return this->post_pros;\n+}\n+\ntemplate <typename B, typename Q>\nvoid Codec_turbo<B,Q>\n-::add_post_pro(tools::Post_processing_SISO<B,Q>* p)\n+::add_post_processings(tools::Post_processing_SISO<B,Q>* p)\n{\npost_pros.push_back(std::shared_ptr<tools::Post_processing_SISO<B,Q>>(p));\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/Turbo/Codec_turbo.hpp", "new_path": "src/Module/Codec/Turbo/Codec_turbo.hpp", "diff": "@@ -37,8 +37,13 @@ public:\nCRC<B>* crc = nullptr);\nvirtual ~Codec_turbo();\n+ const std::vector<std::vector<int>>& get_trellis() const;\n+ const module::Encoder_RSC_sys<B>& get_sub_encoder() const;\n+ const module::Decoder_SISO<Q>& get_sub_decoder() const;\n+ const std::vector<std::shared_ptr<tools::Post_processing_SISO<B,Q>>>& get_post_processings() const;\n+\nprotected:\n- void add_post_pro(tools::Post_processing_SISO<B,Q>* p);\n+ void add_post_processings(tools::Post_processing_SISO<B,Q>* p);\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/Turbo_DB/Codec_turbo_DB.cpp", "new_path": "src/Module/Codec/Turbo_DB/Codec_turbo_DB.cpp", "diff": "@@ -113,17 +113,17 @@ Codec_turbo_DB<B,Q>\n{\n// then add post processing modules\nif (dec_params.sf->enable)\n- add_post_pro(factory::Scaling_factor::build<B,Q>(*dec_params.sf));\n+ add_post_processings(factory::Scaling_factor::build<B,Q>(*dec_params.sf));\nif (dec_params.fnc->enable)\n{\nif (crc == nullptr || crc->get_size() == 0)\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, \"The Flip aNd Check requires a CRC.\");\n- add_post_pro(factory::Flip_and_check_DB::build<B,Q>(*dec_params.fnc, *crc));\n+ add_post_processings(factory::Flip_and_check_DB::build<B,Q>(*dec_params.fnc, *crc));\n}\nelse if (crc != nullptr && crc->get_size() > 0)\n- add_post_pro(new tools::CRC_checker_DB<B,Q>(*crc,\n+ add_post_processings(new tools::CRC_checker_DB<B,Q>(*crc,\ndec_params.crc_start_ite,\ndecoder_turbo->get_simd_inter_frame_level()));\n@@ -142,9 +142,65 @@ Codec_turbo_DB<B,Q>\n}\n}\n+template <typename B, typename Q>\n+const std::vector<std::vector<int>>& Codec_turbo_DB<B,Q>\n+::get_trellis() const\n+{\n+ return this->trellis;\n+}\n+\n+template <typename B, typename Q>\n+const module::Encoder_RSC_DB<B>& Codec_turbo_DB<B,Q>\n+::get_sub_encoder() const\n+{\n+ if (this->sub_enc == nullptr)\n+ {\n+ std::stringstream message;\n+ message << \"'sub_enc' can't be nullptr.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ return *this->sub_enc.get();\n+}\n+\n+template <typename B, typename Q>\n+const module::Decoder_RSC_DB_BCJR<B,Q>& Codec_turbo_DB<B,Q>\n+::get_sub_decoder_n() const\n+{\n+ if (this->sub_dec_n == nullptr)\n+ {\n+ std::stringstream message;\n+ message << \"'sub_dec_n' can't be nullptr.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ return *this->sub_dec_n.get();\n+}\n+\n+template <typename B, typename Q>\n+const module::Decoder_RSC_DB_BCJR<B,Q>& Codec_turbo_DB<B,Q>\n+::get_sub_decoder_i() const\n+{\n+ if (this->sub_dec_i == nullptr)\n+ {\n+ std::stringstream message;\n+ message << \"'sub_dec_i' can't be nullptr.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ return *this->sub_dec_i.get();\n+}\n+\n+template <typename B, typename Q>\n+const std::vector<std::shared_ptr<tools::Post_processing_SISO<B,Q>>>& Codec_turbo_DB<B,Q>\n+::get_post_processings() const\n+{\n+ return this->post_pros;\n+}\n+\ntemplate <typename B, typename Q>\nvoid Codec_turbo_DB<B,Q>\n-::add_post_pro(tools::Post_processing_SISO<B,Q>* p)\n+::add_post_processings(tools::Post_processing_SISO<B,Q>* p)\n{\npost_pros.push_back(std::shared_ptr<tools::Post_processing_SISO<B,Q>>(p));\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/Turbo_DB/Codec_turbo_DB.hpp", "new_path": "src/Module/Codec/Turbo_DB/Codec_turbo_DB.hpp", "diff": "@@ -36,8 +36,14 @@ public:\nCRC<B>* crc = nullptr);\nvirtual ~Codec_turbo_DB() = default;\n+ const std::vector<std::vector<int>>& get_trellis() const;\n+ const module::Encoder_RSC_DB<B>& get_sub_encoder() const;\n+ const module::Decoder_RSC_DB_BCJR<B,Q>& get_sub_decoder_n() const;\n+ const module::Decoder_RSC_DB_BCJR<B,Q>& get_sub_decoder_i() const;\n+ const std::vector<std::shared_ptr<tools::Post_processing_SISO<B,Q>>>& get_post_processings() const;\n+\nprotected:\n- void add_post_pro(tools::Post_processing_SISO<B,Q>* p);\n+ void add_post_processings(tools::Post_processing_SISO<B,Q>* p);\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/Turbo_product/Codec_turbo_product.cpp", "new_path": "src/Module/Codec/Turbo_product/Codec_turbo_product.cpp", "diff": "@@ -93,14 +93,14 @@ Codec_turbo_product<B,Q>\nif (dec_params.implem == \"FAST\")\n{\n- cp_rows.reset(new Decoder_chase_pyndiah_fast<B,Q>(dec_bch_rows->get_K(), N_cw_p, N_cw_p,\n+ dec_cp_rows.reset(new Decoder_chase_pyndiah_fast<B,Q>(dec_bch_rows->get_K(), N_cw_p, N_cw_p,\n*dec_bch_rows, *enc_bch_rows,\ndec_params.n_least_reliable_positions,\ndec_params.n_test_vectors,\ndec_params.n_competitors,\ndec_params.cp_coef));\n- cp_cols.reset(new Decoder_chase_pyndiah_fast<B,Q>(dec_bch_cols->get_K(), N_cw_p, N_cw_p,\n+ dec_cp_cols.reset(new Decoder_chase_pyndiah_fast<B,Q>(dec_bch_cols->get_K(), N_cw_p, N_cw_p,\n*dec_bch_cols, *enc_bch_cols,\ndec_params.n_least_reliable_positions,\ndec_params.n_test_vectors,\n@@ -109,14 +109,14 @@ Codec_turbo_product<B,Q>\n}\nelse\n{\n- cp_rows.reset(new Decoder_chase_pyndiah<B,Q>(dec_bch_rows->get_K(), N_cw_p, N_cw_p,\n+ dec_cp_rows.reset(new Decoder_chase_pyndiah<B,Q>(dec_bch_rows->get_K(), N_cw_p, N_cw_p,\n*dec_bch_rows, *enc_bch_rows,\ndec_params.n_least_reliable_positions,\ndec_params.n_test_vectors,\ndec_params.n_competitors,\ndec_params.cp_coef));\n- cp_cols.reset(new Decoder_chase_pyndiah<B,Q>(dec_bch_cols->get_K(), N_cw_p, N_cw_p,\n+ dec_cp_cols.reset(new Decoder_chase_pyndiah<B,Q>(dec_bch_cols->get_K(), N_cw_p, N_cw_p,\n*dec_bch_cols, *enc_bch_cols,\ndec_params.n_least_reliable_positions,\ndec_params.n_test_vectors,\n@@ -137,14 +137,105 @@ Codec_turbo_product<B,Q>\ntry\n{\n- this->set_decoder_siso_siho(factory::Decoder_turbo_product::build_siso<B,Q>(dec_params, this->get_interleaver_llr(), *cp_rows, *cp_cols));\n+ this->set_decoder_siso_siho(factory::Decoder_turbo_product::build_siso<B,Q>(dec_params, this->get_interleaver_llr(), *dec_cp_rows, *dec_cp_cols));\n}\ncatch (tools::cannot_allocate const&)\n{\n- this->set_decoder_siho(factory::Decoder_turbo_product::build<B,Q>(dec_params, this->get_interleaver_llr(), *cp_rows, *cp_cols));\n+ this->set_decoder_siho(factory::Decoder_turbo_product::build<B,Q>(dec_params, this->get_interleaver_llr(), *dec_cp_rows, *dec_cp_cols));\n}\n}\n+template <typename B, typename Q>\n+const tools::BCH_polynomial_generator<B>& Codec_turbo_product<B,Q>\n+::get_GF_poly() const\n+{\n+ return this->GF_poly;\n+}\n+\n+template <typename B, typename Q>\n+const Encoder_BCH<B>& Codec_turbo_product<B,Q>\n+::get_encoder_BCH_rows() const\n+{\n+ if (this->enc_bch_rows == nullptr)\n+ {\n+ std::stringstream message;\n+ message << \"'enc_bch_rows' can't be nullptr.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ return *this->enc_bch_rows.get();\n+}\n+\n+template <typename B, typename Q>\n+const Encoder_BCH<B>& Codec_turbo_product<B,Q>\n+::get_encoder_BCH_cols() const\n+{\n+ if (this->enc_bch_cols == nullptr)\n+ {\n+ std::stringstream message;\n+ message << \"'enc_bch_cols' can't be nullptr.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ return *this->enc_bch_cols.get();\n+}\n+\n+template <typename B, typename Q>\n+const Decoder_BCH<B,Q>& Codec_turbo_product<B,Q>\n+::get_decoder_BCH_rows() const\n+{\n+ if (this->dec_bch_rows == nullptr)\n+ {\n+ std::stringstream message;\n+ message << \"'dec_bch_rows' can't be nullptr.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ return *this->dec_bch_rows.get();\n+}\n+\n+template <typename B, typename Q>\n+const Decoder_BCH<B,Q>& Codec_turbo_product<B,Q>\n+::get_decoder_BCH_cols() const\n+{\n+ if (this->dec_bch_cols == nullptr)\n+ {\n+ std::stringstream message;\n+ message << \"'dec_bch_cols' can't be nullptr.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ return *this->dec_bch_cols.get();\n+}\n+\n+template <typename B, typename Q>\n+const Decoder_chase_pyndiah<B,Q>& Codec_turbo_product<B,Q>\n+::get_decoder_chase_pyndiah_rows() const\n+{\n+ if (this->dec_cp_rows == nullptr)\n+ {\n+ std::stringstream message;\n+ message << \"'dec_cp_rows' can't be nullptr.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ return *this->dec_cp_rows.get();\n+}\n+\n+template <typename B, typename Q>\n+const Decoder_chase_pyndiah<B,Q>& Codec_turbo_product<B,Q>\n+::get_decoder_chase_pyndiah_cols() const\n+{\n+ if (this->dec_cp_cols == nullptr)\n+ {\n+ std::stringstream message;\n+ message << \"'dec_cp_cols' can't be nullptr.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ return *this->dec_cp_cols.get();\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef AFF3CT_MULTI_PREC\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/Turbo_product/Codec_turbo_product.hpp", "new_path": "src/Module/Codec/Turbo_product/Codec_turbo_product.hpp", "diff": "@@ -24,14 +24,22 @@ protected:\nstd::unique_ptr<Encoder_BCH<B >> enc_bch_cols;\nstd::unique_ptr<Decoder_BCH<B,Q>> dec_bch_rows;\nstd::unique_ptr<Decoder_BCH<B,Q>> dec_bch_cols;\n- std::unique_ptr<Decoder_chase_pyndiah<B,Q>> cp_rows;\n- std::unique_ptr<Decoder_chase_pyndiah<B,Q>> cp_cols;\n+ std::unique_ptr<Decoder_chase_pyndiah<B,Q>> dec_cp_rows;\n+ std::unique_ptr<Decoder_chase_pyndiah<B,Q>> dec_cp_cols;\npublic:\nCodec_turbo_product(const factory::Encoder_turbo_product::parameters &enc_params,\nconst factory::Decoder_turbo_product::parameters &dec_params,\nconst factory::Interleaver ::parameters &itl_params);\nvirtual ~Codec_turbo_product() = default;\n+\n+ const tools::BCH_polynomial_generator<B>& get_GF_poly() const;\n+ const Encoder_BCH<B>& get_encoder_BCH_rows() const;\n+ const Encoder_BCH<B>& get_encoder_BCH_cols() const;\n+ const Decoder_BCH<B,Q>& get_decoder_BCH_rows() const;\n+ const Decoder_BCH<B,Q>& get_decoder_BCH_cols() const;\n+ const Decoder_chase_pyndiah<B,Q>& get_decoder_chase_pyndiah_rows() const;\n+ const Decoder_chase_pyndiah<B,Q>& get_decoder_chase_pyndiah_cols() const;\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Add getters in the codecs.
8,490
24.10.2019 19:17:07
-7,200
44e81996ac8778c060f552a34d7d0380696eb5c9
Fix GalA decoder for parity matrices with variable nodes of degree 1.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.cpp", "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.cpp", "diff": "@@ -170,21 +170,22 @@ void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\nfor (auto v = 0; v < n_var_nodes; v++)\n{\nconst auto var_degree = (int)this->H.get_row_to_cols()[v].size();\n+ const auto cur_state = (int8_t)Y_N[v];\n- for (auto c = 0; c < var_degree; c++)\n+ if (first_ite)\n+ {\n+ std::fill(var_to_chk_ptr, var_to_chk_ptr + var_degree, cur_state);\n+ }\n+ else\n{\n- auto cur_state = Y_N[v];\n- if (!first_ite)\n+ for (auto c = 0; c < var_degree; c++)\n{\nauto count = 0;\nfor (auto cc = 0; cc < var_degree; cc++)\n- if (cc != c && chk_to_var_ptr[cc] != cur_state)\n- count++;\n-\n- cur_state = count == (var_degree -1) ? !cur_state : cur_state;\n+ count += (cc != c && chk_to_var_ptr[cc] != cur_state) ? 1 : 0;\n+ const auto new_state = (count == (var_degree -1)) && var_degree != 1 ? !cur_state : cur_state;\n+ var_to_chk_ptr[c] = new_state;\n}\n-\n- var_to_chk_ptr[c] = (int8_t)cur_state;\n}\nchk_to_var_ptr += var_degree;\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix GalA decoder for parity matrices with variable nodes of degree 1.
8,490
25.10.2019 13:23:26
-7,200
ca76357161f3470ddaf1bb81beeaa70f7ace1b84
Optimize a little bit the Gallager A decoder.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.cpp", "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.cpp", "diff": "#include <string>\n#include <sstream>\n+#include <numeric>\n#include \"Tools/Perf/common/hard_decide.h\"\n#include \"Tools/Exception/exception.hpp\"\n+#include \"Tools/Math/utils.h\"\n#include \"Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.hpp\"\nusing namespace aff3ct;\n@@ -178,12 +180,14 @@ void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n}\nelse\n{\n+ // algorithm from the Ryan & Lin book, \"Channel codes: Classical and modern\", sec. 5.7.3\n+ const auto n_ones = std::accumulate(chk_to_var_ptr, chk_to_var_ptr + var_degree, 0);\n+ const auto n_zeros = var_degree - n_ones;\nfor (auto c = 0; c < var_degree; c++)\n{\n- auto count = 0;\n- for (auto cc = 0; cc < var_degree; cc++)\n- count += (cc != c && chk_to_var_ptr[cc] != cur_state) ? 1 : 0;\n- const auto new_state = (count == (var_degree -1)) && var_degree != 1 ? !cur_state : cur_state;\n+ auto diff = cur_state ? n_zeros : n_ones;\n+ diff = cur_state != chk_to_var_ptr[c] ? diff -1 : diff;\n+ const auto new_state = diff == var_degree -1 && var_degree != 1 ? !cur_state : cur_state;\nvar_to_chk_ptr[c] = new_state;\n}\n}\n@@ -227,18 +231,22 @@ void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\nfor (auto v = 0; v < n_var_nodes; v++)\n{\nconst auto var_degree = (int)this->H.get_row_to_cols()[v].size();\n- auto count = 0;\n-\n- for (auto c = 0; c < var_degree; c++)\n- count += chk_to_var_ptr[c] ? 1 : -1;\n-\n- if (var_degree % 2 == 0)\n- count += Y_N[v] ? 1 : -1;\n-\n- // take the hard decision\n- V_N[v] = count > 0 ? 1 : 0;\n-\n+ const auto cur_state = Y_N[v];\n+ const auto n_ones = std::accumulate(chk_to_var_ptr, chk_to_var_ptr + var_degree, (int)0);\n+ const auto n_zero = var_degree - n_ones;\n+ const auto n_z_m_o = n_zero - n_ones;\n+ V_N[v] = n_z_m_o == 0 ? (int8_t)cur_state : (int8_t)tools::signbit(n_z_m_o);\nchk_to_var_ptr += var_degree;\n+\n+ // // naive version of the majority vote\n+ // const auto var_degree = (int)this->H.get_row_to_cols()[v].size();\n+ // auto count = 0;\n+ // for (auto c = 0; c < var_degree; c++)\n+ // count += chk_to_var_ptr[c] ? 1 : -1;\n+ // if (var_degree % 2 == 0)\n+ // count += Y_N[v] ? 1 : -1;\n+ // V_N[v] = count > 0 ? 1 : 0;\n+ // chk_to_var_ptr += var_degree;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.hpp", "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.hpp", "diff": "@@ -39,8 +39,8 @@ protected:\nvoid _decode_siho_cw(const R *Y_N, B *V_K, const int frame_id);\nvoid _decode (const B *Y_N);\n- void _initialize_var_to_chk(const B *Y_N, const std::vector<int8_t> &chk_to_var, std::vector<int8_t> &var_to_chk,\n- const bool first_ite);\n+ virtual void _initialize_var_to_chk(const B *Y_N, const std::vector<int8_t> &chk_to_var,\n+ std::vector<int8_t> &var_to_chk, const bool first_ite);\nvoid _decode_single_ite (const std::vector<int8_t> &var_to_chk, std::vector<int8_t> &chk_to_var);\nvoid _make_majority_vote (const B *Y_N, std::vector<int8_t> &V_N);\n};\n" } ]
C++
MIT License
aff3ct/aff3ct
Optimize a little bit the Gallager A decoder.
8,490
25.10.2019 13:24:49
-7,200
626f792ed2f8a6e611f35971c75a9dbda1f908f6
Fix the Gallager B majority vote & inherit from Gallager A class.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_B.cpp", "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_B.cpp", "diff": "#include <algorithm>\n#include <numeric>\n-#include <sstream>\n#include <string>\n-#include \"Tools/Perf/common/hard_decide.h\"\n-#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Math/utils.h\"\n#include \"Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_B.hpp\"\n@@ -17,147 +14,10 @@ Decoder_LDPC_BP_flooding_Gallager_B<B,R>\nconst std::vector<unsigned> &info_bits_pos, const bool enable_syndrome,\nconst int syndrome_depth, const int n_frames)\n: Decoder(K, N, n_frames, 1),\n- Decoder_SIHO_HIHO<B,R>(K, N, n_frames, 1 ),\n- Decoder_LDPC_BP (K, N, n_ite, _H, enable_syndrome, syndrome_depth),\n- info_bits_pos (info_bits_pos ),\n- HY_N (N ),\n- V_N (N ),\n- chk_to_var (this->H.get_n_connections(), 0 ),\n- var_to_chk (this->H.get_n_connections(), 0 ),\n- transpose (this->H.get_n_connections() )\n+ Decoder_LDPC_BP_flooding_Gallager_A<B,R>(K, N, n_ite, _H, info_bits_pos, enable_syndrome, syndrome_depth, n_frames)\n{\nconst std::string name = \"Decoder_LDPC_BP_flooding_Gallager_B\";\nthis->set_name(name);\n-\n- std::vector<unsigned char> connections(this->H.get_n_rows(), 0);\n-\n- const auto &chk_to_var_id = this->H.get_col_to_rows();\n- const auto &var_to_chk_id = this->H.get_row_to_cols();\n-\n- auto k = 0;\n- for (auto i = 0; i < (int)chk_to_var_id.size(); i++)\n- {\n- for (auto j = 0; j < (int)chk_to_var_id[i].size(); j++)\n- {\n- auto var_id = chk_to_var_id[i][j];\n-\n- auto branch_id = 0;\n- for (auto ii = 0; ii < (int)var_id; ii++)\n- branch_id += (int)var_to_chk_id[ii].size();\n- branch_id += connections[var_id];\n- connections[var_id]++;\n-\n- if (connections[var_id] > (int)var_to_chk_id[var_id].size())\n- {\n- std::stringstream message;\n- message << \"'connections[var_id]' has to be equal or smaller than 'var_to_chk_id[var_id].size()' \"\n- << \"('var_id' = \" << var_id << \", 'connections[var_id]' = \" << connections[var_id]\n- << \", 'var_to_chk_id[var_id].size()' = \" << var_to_chk_id[var_id].size() << \").\";\n- throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n-\n- transpose[k] = branch_id;\n- k++;\n- }\n- }\n-}\n-\n-template <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_B<B,R>\n-::_decode_hiho(const B *Y_N, B *V_K, const int frame_id)\n-{\n-// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n- this->_decode(Y_N);\n-// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n-\n-// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n- for (auto i = 0; i < this->K; i++)\n- V_K[i] = (B)this->V_N[this->info_bits_pos[i]];\n-// auto d_store = std::chrono::steady_clock::now() - t_store;\n-\n-// (*this)[dec::tsk::decode_hiho].update_timer(dec::tm::decode_hiho::decode, d_decod);\n-// (*this)[dec::tsk::decode_hiho].update_timer(dec::tm::decode_hiho::store, d_store);\n-}\n-\n-template <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_B<B,R>\n-::_decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id)\n-{\n-// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n- this->_decode(Y_N);\n-// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n-\n-// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n- std::copy(this->V_N.begin(), this->V_N.begin() + this->N, V_N);\n-// auto d_store = std::chrono::steady_clock::now() - t_store;\n-\n-// (*this)[dec::tsk::decode_hiho_cw].update_timer(dec::tm::decode_hiho_cw::decode, d_decod);\n-// (*this)[dec::tsk::decode_hiho_cw].update_timer(dec::tm::decode_hiho_cw::store, d_store);\n-}\n-\n-template <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_B<B,R>\n-::_decode_siho(const R *Y_N, B *V_K, const int frame_id)\n-{\n-// auto t_load = std::chrono::steady_clock::now(); // ---------------------------------------------------------- LOAD\n- tools::hard_decide(Y_N, HY_N.data(), this->N);\n-// auto d_load = std::chrono::steady_clock::now() - t_load;\n-\n-// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n- this->_decode(HY_N.data());\n-// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n-\n-// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n- for (auto i = 0; i < this->K; i++)\n- V_K[i] = (B)this->V_N[this->info_bits_pos[i]];\n-// auto d_store = std::chrono::steady_clock::now() - t_store;\n-\n-// (*this)[dec::tsk::decode_siho].update_timer(dec::tm::decode_siho::load, d_load);\n-// (*this)[dec::tsk::decode_siho].update_timer(dec::tm::decode_siho::decode, d_decod);\n-// (*this)[dec::tsk::decode_siho].update_timer(dec::tm::decode_siho::store, d_store);\n-}\n-\n-template <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_B<B,R>\n-::_decode_siho_cw(const R *Y_N, B *V_N, const int frame_id)\n-{\n-// auto t_load = std::chrono::steady_clock::now(); // ---------------------------------------------------------- LOAD\n- tools::hard_decide(Y_N, HY_N.data(), this->N);\n-// auto d_load = std::chrono::steady_clock::now() - t_load;\n-\n-// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n- this->_decode(HY_N.data());\n-// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n-\n-// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n- std::copy(this->V_N.begin(), this->V_N.begin() + this->N, V_N);\n-// auto d_store = std::chrono::steady_clock::now() - t_store;\n-\n-// (*this)[dec::tsk::decode_siho_cw].update_timer(dec::tm::decode_siho_cw::load, d_load);\n-// (*this)[dec::tsk::decode_siho_cw].update_timer(dec::tm::decode_siho_cw::decode, d_decod);\n-// (*this)[dec::tsk::decode_siho_cw].update_timer(dec::tm::decode_siho_cw::store, d_store);\n-}\n-\n-template <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_B<B,R>\n-::_decode(const B *Y_N)\n-{\n- auto ite = 0;\n- for (; ite < this->n_ite; ite++)\n- {\n- this->_initialize_var_to_chk(Y_N, chk_to_var, var_to_chk, ite == 0);\n- this->_decode_single_ite(var_to_chk, chk_to_var);\n-\n- if (this->enable_syndrome && ite != this->n_ite -1)\n- {\n- // for the K variable nodes (make a majority vote with the entering messages)\n- this->_make_majority_vote(Y_N, this->V_N);\n- if (this->check_syndrome_hard(this->V_N.data()))\n- break;\n- }\n- }\n- if (ite == this->n_ite)\n- this->_make_majority_vote(Y_N, this->V_N);\n}\ntemplate <typename B, typename R>\n@@ -181,69 +41,35 @@ void Decoder_LDPC_BP_flooding_Gallager_B<B,R>\n}\nelse\n{\n+ // algorithm from the Ryan & Lin book, \"Channel codes: Classical and modern\", sec. 5.7.3\nconst auto sum = std::accumulate(chk_to_var_ptr, chk_to_var_ptr + var_degree, (int)0);\nconst auto n_ones = sum + cur_state;\nconst auto n_zero = var_degree - sum;\nconst auto n_z_m_o = n_zero - n_ones;\n-\n- // majority vote on each node\nfor (auto c = 0; c < var_degree; c++)\n{\nconst auto diff = n_z_m_o + chk_to_var_ptr[c];\nvar_to_chk_ptr[c] = diff == 0 ? cur_state : (int8_t)tools::signbit(diff);\n}\n- }\n-\n- chk_to_var_ptr += var_degree;\n- var_to_chk_ptr += var_degree;\n- }\n-}\n-\n-template <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_B<B,R>\n-::_decode_single_ite(const std::vector<int8_t> &var_to_chk, std::vector<int8_t> &chk_to_var)\n-{\n- auto transpose_ptr = this->transpose.data();\n- // for each check nodes\n- const auto n_chk_nodes = (int)this->H.get_n_cols();\n- for (auto c = 0; c < n_chk_nodes; c++)\n- {\n- const auto chk_degree = (int)this->H.get_col_to_rows()[c].size();\n-\n- auto acc = 0;\n- for (auto v = 0; v < chk_degree; v++)\n- acc ^= var_to_chk[transpose_ptr[v]];\n-\n- for (auto v = 0; v < chk_degree; v++)\n- chk_to_var[transpose_ptr[v]] = acc ^ var_to_chk[transpose_ptr[v]];\n-\n- transpose_ptr += chk_degree;\n- }\n+ // // naive version of the variable to check node messages computations\n+ // const auto n_ones = std::accumulate(chk_to_var_ptr, chk_to_var_ptr + var_degree, 0);\n+ // const auto n_zeros = var_degree - n_ones;\n+ // for (auto c = 0; c < var_degree; c++)\n+ // {\n+ // const auto n_ones_up = !cur_state && chk_to_var_ptr[c] ? n_ones -1 : n_ones;\n+ // const auto n_zeros_up = cur_state && !chk_to_var_ptr[c] ? n_zeros -1 : n_zeros;\n+ // auto new_state = 0;\n+ // if (cur_state)\n+ // new_state = n_zeros_up > n_ones_up ? !cur_state : cur_state;\n+ // else\n+ // new_state = n_zeros_up < n_ones_up ? !cur_state : cur_state;\n+ // var_to_chk_ptr[c] = new_state;\n+ // }\n}\n-template <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_B<B,R>\n-::_make_majority_vote(const B *Y_N, std::vector<int8_t> &V_N)\n-{\n- auto chk_to_var_ptr = this->chk_to_var.data();\n-\n- // for the K variable nodes (make a majority vote with the entering messages)\n- const auto n_var_nodes = (int)this->H.get_n_rows();\n- for (auto v = 0; v < n_var_nodes; v++)\n- {\n- const auto var_degree = (int)this->H.get_row_to_cols()[v].size();\n- const auto cur_state = Y_N[v];\n-\n- const auto sum = std::accumulate(chk_to_var_ptr, chk_to_var_ptr + var_degree, (int)0);\n- const auto n_ones = sum + cur_state;\n- const auto n_zero = var_degree - sum;\n- const auto n_z_m_o = n_zero - n_ones;\n-\n- // take the hard decision\n- V_N[v] = n_z_m_o == 0 ? (int8_t)cur_state : (int8_t)tools::signbit(n_z_m_o);\n-\nchk_to_var_ptr += var_degree;\n+ var_to_chk_ptr += var_degree;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_B.hpp", "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_B.hpp", "diff": "#include <vector>\n#include \"Tools/Algo/Matrix/Sparse_matrix/Sparse_matrix.hpp\"\n-#include \"Module/Decoder/Decoder_SIHO_HIHO.hpp\"\n-#include \"Module/Decoder/LDPC/BP/Decoder_LDPC_BP.hpp\"\n+#include \"Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.hpp\"\nnamespace aff3ct\n{\nnamespace module\n{\ntemplate <typename B = int, typename R = float>\n-class Decoder_LDPC_BP_flooding_Gallager_B : public Decoder_SIHO_HIHO<B,R>, public Decoder_LDPC_BP\n+class Decoder_LDPC_BP_flooding_Gallager_B : public Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n{\n-protected:\n- const std::vector<uint32_t> &info_bits_pos;\n-\n- std::vector<B > HY_N; // input LLRs (transformed in bit)\n- std::vector<int8_t > V_N; // decoded bits\n- std::vector<int8_t > chk_to_var; // check nodes to variable nodes messages\n- std::vector<int8_t > var_to_chk; // variable nodes to check nodes messages\n- std::vector<unsigned> transpose;\n-\npublic:\nDecoder_LDPC_BP_flooding_Gallager_B(const int K, const int N, const int n_ite, const tools::Sparse_matrix &H,\nconst std::vector<unsigned> &info_bits_pos,\n@@ -33,16 +23,8 @@ public:\nvirtual ~Decoder_LDPC_BP_flooding_Gallager_B() = default;\nprotected:\n- void _decode_hiho (const B *Y_N, B *V_K, const int frame_id);\n- void _decode_hiho_cw(const B *Y_N, B *V_K, const int frame_id);\n- void _decode_siho (const R *Y_N, B *V_K, const int frame_id);\n- void _decode_siho_cw(const R *Y_N, B *V_K, const int frame_id);\n-\n- void _decode (const B *Y_N);\n- void _initialize_var_to_chk(const B *Y_N, const std::vector<int8_t> &chk_to_var, std::vector<int8_t> &var_to_chk,\n- const bool first_ite);\n- void _decode_single_ite (const std::vector<int8_t> &var_to_chk, std::vector<int8_t> &chk_to_var);\n- void _make_majority_vote (const B *Y_N, std::vector<int8_t> &V_N);\n+ void _initialize_var_to_chk(const B *Y_N, const std::vector<int8_t> &chk_to_var,\n+ std::vector<int8_t> &var_to_chk, const bool first_ite);\n};\ntemplate <typename B = int, typename R = float>\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the Gallager B majority vote & inherit from Gallager A class.
8,490
25.10.2019 14:33:32
-7,200
999d32b0758cab3ff5954cea79ca965004280683
Speedup Gallager E (~x2) & factorize code with Gallager A.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.cpp", "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.cpp", "diff": "@@ -13,11 +13,12 @@ using namespace aff3ct::module;\ntemplate <typename B, typename R>\nDecoder_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 tools::Sparse_matrix &_H,\n- const std::vector<unsigned> &info_bits_pos, const bool enable_syndrome,\n- const int syndrome_depth, const int n_frames)\n+ const std::vector<unsigned> &info_bits_pos, const bool transform_HY_N,\n+ const bool enable_syndrome, const int syndrome_depth, const int n_frames)\n: Decoder (K, N, n_frames, 1 ),\nDecoder_SIHO_HIHO<B,R>(K, N, n_frames, 1 ),\nDecoder_LDPC_BP (K, N, n_ite, _H, enable_syndrome, syndrome_depth),\n+ transform_HY_N (transform_HY_N ),\ninfo_bits_pos (info_bits_pos ),\nHY_N (N ),\nV_N (N ),\n@@ -61,11 +62,32 @@ Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n}\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, const tools::Sparse_matrix &_H,\n+ const std::vector<unsigned> &info_bits_pos, const bool enable_syndrome,\n+ const int syndrome_depth, const int n_frames)\n+: Decoder_LDPC_BP_flooding_Gallager_A<B,R>(K, N, n_ite, _H, info_bits_pos, false, enable_syndrome, syndrome_depth, n_frames)\n+{\n+}\n+\ntemplate <typename B, typename R>\nvoid Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n::_decode_hiho(const B *Y_N, B *V_K, const int frame_id)\n{\n+// auto t_load = std::chrono::steady_clock::now(); // ---------------------------------------------------------- LOAD\n+ if (this->transform_HY_N)\n+ // useful for the Gallager E\n+ std::transform(Y_N, Y_N + this->N, HY_N.begin(), [&](const B& in)\n+ {\n+ return B(1) - (in + in);\n+ });\n+// auto d_load = std::chrono::steady_clock::now() - t_load;\n+\n// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n+ if (this->transform_HY_N)\n+ this->_decode(HY_N.data());\n+ else\nthis->_decode(Y_N);\n// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n@@ -74,6 +96,7 @@ void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\nV_K[i] = (B)this->V_N[this->info_bits_pos[i]];\n// auto d_store = std::chrono::steady_clock::now() - t_store;\n+// (*this)[dec::tsk::decode_siho].update_timer(dec::tm::decode_siho::load, d_load);\n// (*this)[dec::tsk::decode_hiho].update_timer(dec::tm::decode_hiho::decode, d_decod);\n// (*this)[dec::tsk::decode_hiho].update_timer(dec::tm::decode_hiho::store, d_store);\n}\n@@ -82,7 +105,19 @@ template <typename B, typename R>\nvoid Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n::_decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id)\n{\n+// auto t_load = std::chrono::steady_clock::now(); // ---------------------------------------------------------- LOAD\n+ if (this->transform_HY_N)\n+ // useful for the Gallager E\n+ std::transform(Y_N, Y_N + this->N, HY_N.begin(), [&](const B& in)\n+ {\n+ return B(1) - (in + in);\n+ });\n+// auto d_load = std::chrono::steady_clock::now() - t_load;\n+\n// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n+ if (this->transform_HY_N)\n+ this->_decode(HY_N.data());\n+ else\nthis->_decode(Y_N);\n// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n@@ -90,6 +125,7 @@ void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\nstd::copy(this->V_N.begin(), this->V_N.begin() + this->N, V_N);\n// auto d_store = std::chrono::steady_clock::now() - t_store;\n+// (*this)[dec::tsk::decode_siho ].update_timer(dec::tm::decode_siho::load, d_load);\n// (*this)[dec::tsk::decode_hiho_cw].update_timer(dec::tm::decode_hiho_cw::decode, d_decod);\n// (*this)[dec::tsk::decode_hiho_cw].update_timer(dec::tm::decode_hiho_cw::store, d_store);\n}\n@@ -100,6 +136,12 @@ void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n{\n// auto t_load = std::chrono::steady_clock::now(); // ---------------------------------------------------------- LOAD\ntools::hard_decide(Y_N, HY_N.data(), this->N);\n+ if (this->transform_HY_N)\n+ // useful for the Gallager E\n+ std::transform(HY_N.begin(), HY_N.end(), HY_N.begin(), [&](const B& in)\n+ {\n+ return B(1) - (in + in);\n+ });\n// auto d_load = std::chrono::steady_clock::now() - t_load;\n// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n@@ -122,6 +164,12 @@ void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n{\n// auto t_load = std::chrono::steady_clock::now(); // ---------------------------------------------------------- LOAD\ntools::hard_decide(Y_N, HY_N.data(), this->N);\n+ if (this->transform_HY_N)\n+ // useful for the Gallager E\n+ std::transform(HY_N.begin(), HY_N.end(), HY_N.begin(), [&](const B& in)\n+ {\n+ return B(1) - (in + in);\n+ });\n// auto d_load = std::chrono::steady_clock::now() - t_load;\n// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n@@ -144,7 +192,7 @@ void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\nauto ite = 0;\nfor (; ite < this->n_ite; ite++)\n{\n- this->_initialize_var_to_chk(Y_N, chk_to_var, var_to_chk, ite == 0);\n+ this->_initialize_var_to_chk(Y_N, chk_to_var, var_to_chk, ite);\nthis->_decode_single_ite(this->var_to_chk, this->chk_to_var);\nif (this->enable_syndrome && ite != this->n_ite -1)\n@@ -162,11 +210,13 @@ void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n::_initialize_var_to_chk(const B *Y_N, const std::vector<int8_t> &chk_to_var, std::vector<int8_t> &var_to_chk,\n- const bool first_ite)\n+ const int ite)\n{\nauto chk_to_var_ptr = chk_to_var.data();\nauto var_to_chk_ptr = var_to_chk.data();\n+ const bool first_ite = ite == 0;\n+\n// for each variable nodes\nconst auto n_var_nodes = (int)this->H.get_n_rows();\nfor (auto v = 0; v < n_var_nodes; v++)\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.hpp", "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.hpp", "diff": "@@ -16,6 +16,7 @@ template <typename B = int, typename R = float>\nclass Decoder_LDPC_BP_flooding_Gallager_A : public Decoder_SIHO_HIHO<B,R>, public Decoder_LDPC_BP\n{\nprotected:\n+ const bool transform_HY_N;\nconst std::vector<uint32_t> &info_bits_pos;\nstd::vector<B > HY_N; // input LLRs (transformed in bit)\n@@ -24,6 +25,14 @@ protected:\nstd::vector<int8_t > var_to_chk; // variable nodes to check nodes messages\nstd::vector<unsigned> transpose;\n+protected:\n+ Decoder_LDPC_BP_flooding_Gallager_A(const int K, const int N, const int n_ite, const tools::Sparse_matrix &H,\n+ const std::vector<unsigned> &info_bits_pos,\n+ const bool transform_HY_N,\n+ const bool enable_syndrome = true,\n+ const int syndrome_depth = 1,\n+ const int n_frames = 1);\n+\npublic:\nDecoder_LDPC_BP_flooding_Gallager_A(const int K, const int N, const int n_ite, const tools::Sparse_matrix &H,\nconst std::vector<unsigned> &info_bits_pos,\n@@ -37,12 +46,12 @@ protected:\nvoid _decode_hiho_cw(const B *Y_N, B *V_K, const int frame_id);\nvoid _decode_siho (const R *Y_N, B *V_K, const int frame_id);\nvoid _decode_siho_cw(const R *Y_N, B *V_K, const int frame_id);\n-\nvoid _decode (const B *Y_N);\n+\nvirtual void _initialize_var_to_chk(const B *Y_N, const std::vector<int8_t> &chk_to_var,\n- std::vector<int8_t> &var_to_chk, const bool first_ite);\n- void _decode_single_ite (const std::vector<int8_t> &var_to_chk, std::vector<int8_t> &chk_to_var);\n- void _make_majority_vote (const B *Y_N, std::vector<int8_t> &V_N);\n+ std::vector<int8_t> &var_to_chk, const int ite);\n+ virtual void _decode_single_ite (const std::vector<int8_t> &var_to_chk, std::vector<int8_t> &chk_to_var);\n+ virtual void _make_majority_vote (const B *Y_N, std::vector<int8_t> &V_N);\n};\ntemplate <typename B = int, typename R = float>\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_B.cpp", "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_B.cpp", "diff": "@@ -23,11 +23,13 @@ Decoder_LDPC_BP_flooding_Gallager_B<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_LDPC_BP_flooding_Gallager_B<B,R>\n::_initialize_var_to_chk(const B *Y_N, const std::vector<int8_t> &chk_to_var, std::vector<int8_t> &var_to_chk,\n- const bool first_ite)\n+ const int ite)\n{\nauto chk_to_var_ptr = chk_to_var.data();\nauto var_to_chk_ptr = var_to_chk.data();\n+ const bool first_ite = ite == 0;\n+\n// for each variable nodes\nconst auto n_var_nodes = (int)this->H.get_n_rows();\nfor (auto v = 0; v < n_var_nodes; v++)\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_B.hpp", "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_B.hpp", "diff": "@@ -24,7 +24,7 @@ public:\nprotected:\nvoid _initialize_var_to_chk(const B *Y_N, const std::vector<int8_t> &chk_to_var,\n- std::vector<int8_t> &var_to_chk, const bool first_ite);\n+ std::vector<int8_t> &var_to_chk, const int ite);\n};\ntemplate <typename B = int, typename R = float>\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_E.cpp", "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_E.cpp", "diff": "#include <type_traits>\n#include <algorithm>\n#include <numeric>\n-#include <sstream>\n#include <string>\n-#include \"Tools/Perf/common/hard_decide.h\"\n-#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Math/utils.h\"\n#include \"Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_E.hpp\"\n@@ -18,159 +15,12 @@ Decoder_LDPC_BP_flooding_Gallager_E<B,R>\nconst std::vector<unsigned> &info_bits_pos, const bool enable_syndrome,\nconst int syndrome_depth, const int n_frames)\n: Decoder(K, N, n_frames, 1),\n- Decoder_SIHO_HIHO<B,R>(K, N, n_frames, 1 ),\n- Decoder_LDPC_BP (K, N, n_ite, _H, enable_syndrome, syndrome_depth),\n- info_bits_pos (info_bits_pos ),\n- HY_N (N ),\n- V_N (N ),\n- chk_to_var (this->H.get_n_connections(), 0 ),\n- var_to_chk (this->H.get_n_connections(), 0 ),\n- transpose (this->H.get_n_connections() )\n+ Decoder_LDPC_BP_flooding_Gallager_A<B,R>(K, N, n_ite, _H, info_bits_pos, true, enable_syndrome, syndrome_depth, n_frames)\n{\nconst std::string name = \"Decoder_LDPC_BP_flooding_Gallager_E\";\nthis->set_name(name);\n-\n- std::vector<unsigned char> connections(this->H.get_n_rows(), 0);\n-\n- const auto &chk_to_var_id = this->H.get_col_to_rows();\n- const auto &var_to_chk_id = this->H.get_row_to_cols();\n-\n- auto k = 0;\n- for (auto i = 0; i < (int)chk_to_var_id.size(); i++)\n- {\n- for (auto j = 0; j < (int)chk_to_var_id[i].size(); j++)\n- {\n- auto var_id = chk_to_var_id[i][j];\n-\n- auto branch_id = 0;\n- for (auto ii = 0; ii < (int)var_id; ii++)\n- branch_id += (int)var_to_chk_id[ii].size();\n- branch_id += connections[var_id];\n- connections[var_id]++;\n-\n- if (connections[var_id] > (int)var_to_chk_id[var_id].size())\n- {\n- std::stringstream message;\n- message << \"'connections[var_id]' has to be equal or smaller than 'var_to_chk_id[var_id].size()' \"\n- << \"('var_id' = \" << var_id << \", 'connections[var_id]' = \" << connections[var_id]\n- << \", 'var_to_chk_id[var_id].size()' = \" << var_to_chk_id[var_id].size() << \").\";\n- throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n-\n- transpose[k] = branch_id;\n- k++;\n- }\n- }\n-}\n-\n-template <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_E<B,R>\n-::_decode_hiho(const B *Y_N, B *V_K, const int frame_id)\n-{\n- std::transform(Y_N, Y_N + this->N, HY_N.begin(), [&](const B& in){ return B(1) - (in + in);});\n-\n-// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n- this->_decode(HY_N.data());\n-// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n-\n-// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n- for (auto i = 0; i < this->K; i++)\n- V_K[i] = (B)this->V_N[this->info_bits_pos[i]];\n-// auto d_store = std::chrono::steady_clock::now() - t_store;\n-\n-// (*this)[dec::tsk::decode_hiho].update_timer(dec::tm::decode_hiho::decode, d_decod);\n-// (*this)[dec::tsk::decode_hiho].update_timer(dec::tm::decode_hiho::store, d_store);\n}\n-template <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_E<B,R>\n-::_decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id)\n-{\n- std::transform(Y_N, Y_N + this->N, HY_N.begin(), [&](const B& in){ return B(1) - (in + in);});\n-\n-// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n- this->_decode(HY_N.data());\n-// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n-\n-// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n- std::copy(this->V_N.begin(), this->V_N.begin() + this->N, V_N);\n-// auto d_store = std::chrono::steady_clock::now() - t_store;\n-\n-// (*this)[dec::tsk::decode_hiho_cw].update_timer(dec::tm::decode_hiho_cw::decode, d_decod);\n-// (*this)[dec::tsk::decode_hiho_cw].update_timer(dec::tm::decode_hiho_cw::store, d_store);\n-}\n-\n-template <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_E<B,R>\n-::_decode_siho(const R *Y_N, B *V_K, const int frame_id)\n-{\n-// auto t_load = std::chrono::steady_clock::now(); // ---------------------------------------------------------- LOAD\n- tools::hard_decide(Y_N, HY_N.data(), this->N);\n- std::transform(HY_N.begin(), HY_N.end(), HY_N.begin(), [&](const B& in){ return B(1) - (in + in);});\n-// auto d_load = std::chrono::steady_clock::now() - t_load;\n-\n-// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n- this->_decode(HY_N.data());\n-// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n-\n-// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n- for (auto i = 0; i < this->K; i++)\n- V_K[i] = (B)this->V_N[this->info_bits_pos[i]];\n-// auto d_store = std::chrono::steady_clock::now() - t_store;\n-\n-// (*this)[dec::tsk::decode_siho].update_timer(dec::tm::decode_siho::load, d_load);\n-// (*this)[dec::tsk::decode_siho].update_timer(dec::tm::decode_siho::decode, d_decod);\n-// (*this)[dec::tsk::decode_siho].update_timer(dec::tm::decode_siho::store, d_store);\n-}\n-\n-template <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_E<B,R>\n-::_decode_siho_cw(const R *Y_N, B *V_N, const int frame_id)\n-{\n-// auto t_load = std::chrono::steady_clock::now(); // ---------------------------------------------------------- LOAD\n- tools::hard_decide(Y_N, HY_N.data(), this->N);\n- std::transform(HY_N.begin(), HY_N.end(), HY_N.begin(), [&](const B& in){ return B(1) - (in + in);});\n-// auto d_load = std::chrono::steady_clock::now() - t_load;\n-\n-\n-// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n- this->_decode(HY_N.data());\n-// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n-\n-// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n- std::copy(this->V_N.begin(), this->V_N.begin() + this->N, V_N);\n-// auto d_store = std::chrono::steady_clock::now() - t_store;\n-\n-// (*this)[dec::tsk::decode_siho_cw].update_timer(dec::tm::decode_siho_cw::load, d_load);\n-// (*this)[dec::tsk::decode_siho_cw].update_timer(dec::tm::decode_siho_cw::decode, d_decod);\n-// (*this)[dec::tsk::decode_siho_cw].update_timer(dec::tm::decode_siho_cw::store, d_store);\n-}\n-\n-template <typename B, typename R>\n-void Decoder_LDPC_BP_flooding_Gallager_E<B,R>\n-::_decode(const B *Y_N)\n-{\n- auto ite = 0;\n- for (; ite < this->n_ite; ite++)\n- {\n- scaling = ite < 2 ? 2 : 1;\n-\n- this->_initialize_var_to_chk(Y_N, chk_to_var, var_to_chk, ite == 0);\n- this->_decode_single_ite(var_to_chk, chk_to_var);\n-\n- if (this->enable_syndrome && ite != this->n_ite -1)\n- {\n- // for the K variable nodes (make a majority vote with the entering messages)\n- this->_make_majority_vote(Y_N, this->V_N);\n- if (this->check_syndrome_hard(this->V_N.data()))\n- break;\n- }\n- }\n- if (ite == this->n_ite)\n- this->_make_majority_vote(Y_N, this->V_N);\n-}\n-\n-\ntemplate <typename T> inline constexpr\nT signum(T x, std::false_type is_signed) {\nreturn T(0) < x;\n@@ -189,8 +39,11 @@ T signum(T x) {\ntemplate <typename B, typename R>\nvoid Decoder_LDPC_BP_flooding_Gallager_E<B,R>\n::_initialize_var_to_chk(const B *Y_N, const std::vector<int8_t> &chk_to_var, std::vector<int8_t> &var_to_chk,\n- const bool first_ite)\n+ const int ite)\n{\n+ const auto scaling = ite < 2 ? 2 : 1;\n+ const bool first_ite = ite == 0;\n+\nauto chk_to_var_ptr = chk_to_var.data();\nauto var_to_chk_ptr = var_to_chk.data();\n@@ -239,8 +92,7 @@ void Decoder_LDPC_BP_flooding_Gallager_E<B,R>\n{\nauto acc = (int8_t)1;\nfor (auto vv = 0; vv < chk_degree; vv++)\n- if (v != vv)\n- acc *= var_to_chk[transpose_ptr[vv]];\n+ acc = (v != vv) ? acc * var_to_chk[transpose_ptr[vv]] : acc;\nchk_to_var[transpose_ptr[v]] = acc;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_E.hpp", "new_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_E.hpp", "diff": "#include <vector>\n#include \"Tools/Algo/Matrix/Sparse_matrix/Sparse_matrix.hpp\"\n-#include \"Module/Decoder/Decoder_SIHO_HIHO.hpp\"\n-#include \"Module/Decoder/LDPC/BP/Decoder_LDPC_BP.hpp\"\n+#include \"Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.hpp\"\nnamespace aff3ct\n{\nnamespace module\n{\ntemplate <typename B = int, typename R = float>\n-class Decoder_LDPC_BP_flooding_Gallager_E : public Decoder_SIHO_HIHO<B,R>, public Decoder_LDPC_BP\n+class Decoder_LDPC_BP_flooding_Gallager_E : public Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n{\n-protected:\n- const std::vector<uint32_t> &info_bits_pos;\n-\n- std::vector<B > HY_N; // input LLRs (transformed in bit)\n- std::vector<int8_t > V_N; // decoded bits\n- std::vector<int8_t > chk_to_var; // check nodes to variable nodes messages\n- std::vector<int8_t > var_to_chk; // variable nodes to check nodes messages\n- std::vector<unsigned> transpose;\n-\n- int scaling;\n-\npublic:\nDecoder_LDPC_BP_flooding_Gallager_E(const int K, const int N, const int n_ite, const tools::Sparse_matrix &H,\nconst std::vector<unsigned> &info_bits_pos,\n@@ -35,14 +23,8 @@ public:\nvirtual ~Decoder_LDPC_BP_flooding_Gallager_E() = default;\nprotected:\n- void _decode_hiho (const B *Y_N, B *V_K, const int frame_id);\n- void _decode_hiho_cw(const B *Y_N, B *V_K, const int frame_id);\n- void _decode_siho (const R *Y_N, B *V_K, const int frame_id);\n- void _decode_siho_cw(const R *Y_N, B *V_K, const int frame_id);\n-\n- void _decode (const B *Y_N);\nvoid _initialize_var_to_chk(const B *Y_N, const std::vector<int8_t> &chk_to_var, std::vector<int8_t> &var_to_chk,\n- const bool first_ite);\n+ const int ite);\nvoid _decode_single_ite (const std::vector<int8_t> &var_to_chk, std::vector<int8_t> &chk_to_var);\nvoid _make_majority_vote (const B *Y_N, std::vector<int8_t> &V_N);\n};\n" } ]
C++
MIT License
aff3ct/aff3ct
Speedup Gallager E (~x2) & factorize code with Gallager A.
8,490
26.10.2019 12:02:37
-7,200
49085b34f46b16949e57dbda5690adfef294aa2f
Change the versions to work with Read the doc.
[ { "change_type": "MODIFY", "old_path": "doc/requirements.txt", "new_path": "doc/requirements.txt", "diff": "-Sphinx==2.0\n+#Sphinx==2.0\n+#sphinx-rtd-theme==0.4.3\n+#sphinxcontrib-bibtex==1.0.0\n+#sphinxcontrib-websupport==1.1.0\n+#sphinxcontrib-svg2pdfconverter==0.1.0\n+#breathe==4.13.0\n+#m2r==0.2.1\n+#docutils==0.14\n+#exhale==0.2.3\n+\n+Sphinx==1.7.9\nsphinx-rtd-theme==0.4.3\n-sphinxcontrib-bibtex==1.0.0\n+sphinxcontrib-bibtex==0.4.0\nsphinxcontrib-websupport==1.1.0\nsphinxcontrib-svg2pdfconverter==0.1.0\n-breathe==4.13.0\n+breathe==4.11.0\nm2r==0.2.1\ndocutils==0.14\nexhale==0.2.3\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Change the versions to work with Read the doc.
8,490
27.10.2019 12:17:19
-3,600
08edc0a506cb1aad33647ee1bea464036ed2c9d4
Try to start doxygen manually on RTD.
[ { "change_type": "MODIFY", "old_path": "doc/source/conf.py", "new_path": "doc/source/conf.py", "diff": "@@ -90,58 +90,19 @@ numfig = True\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = None\n-# -- Configure Breathe (Developer doc from Doxygen XML files) ----------------\n-\n-if buildername != \"latex\":\n-\n- # # Uncomment the following lines to enable the Doxygen compilation\n- # # Are we on a Readthedocs server ?\n- # read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'\n- # # If we are on a Readthedocs server\n- # if read_the_docs_build:\n- # # Generate the Doxygen XML files\n- # subprocess.call('cd ../../doxygen; doxygen config.txt', shell=True)\n-\n- breathe_projects = { \"AFF3CT\": \"../build/doxygen/xml/\" }\n- breathe_default_project = \"AFF3CT\"\n-\n-# -- Configure Exhale (Required the previous Breathe config) -----------------\n-\n-if buildername != \"latex\":\n-\n- # Setup the exhale extension\n- exhale_args = {\n- # These arguments are required\n- \"containmentFolder\": \"./api\",\n- \"rootFileName\": \"library_root.rst\",\n- \"rootFileTitle\": \"Library API\",\n- \"doxygenStripFromPath\": \"../../include\",\n- # Suggested optional arguments\n- \"createTreeView\": True,\n- # TIP: if using the sphinx-bootstrap-theme, you need\n- # \"treeViewIsBootstrap\": True,\n- \"exhaleExecutesDoxygen\": True,\n- # \"verboseBuild\": True,\n- \"exhaleUseDoxyfile\": True,\n- # \"exhaleDoxygenStdin\": textwrap.dedent('''\n- # INPUT = ../../include\n- # # Using `=` instead of `+=` overrides\n- # PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS=\"1\"\n- # ''')\n- }\n-\n- # Tell sphinx what the primary language being documented is.\n- primary_domain = 'cpp'\n-\n- # Tell sphinx what the pygments highlight language should be.\n- highlight_language = 'cpp'\n-\n# -- Options for HTML output -------------------------------------------------\n+# 'read_the_docs_build' is whether we are on readthedocs.org, this line of code\n+# grabbed from docs.readthedocs.org\n+read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'\n+\n+if not read_the_docs_build: # only import and set the theme if we're building docs locally\n+ import sphinx_rtd_theme\n# The theme to use for HTML and HTML Help pages. See the documentation for\n# a list of builtin themes.\n-#\nhtml_theme = 'sphinx_rtd_theme'\n+ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]\n+\n# Theme options are theme-specific and customize the look and feel of a theme\n# further. For a list of options available for each theme, see the\n@@ -422,3 +383,47 @@ with open(\"../strings.rst\", \"r\") as ins:\nrst_epilog = rst_epilog + line;\n# -- Extension configuration -------------------------------------------------\n+\n+# -- Configure Breathe (Developer doc from Doxygen XML files)\n+\n+if buildername != \"latex\":\n+\n+ # Uncomment the following lines to enable the Doxygen compilation\n+ # If we are on a Readthedocs server\n+ if read_the_docs_build:\n+ # Generate the Doxygen XML files\n+ subprocess.call('cd source; doxygen Doxyfile', shell=True)\n+\n+ breathe_projects = { \"AFF3CT\": \"../build/doxygen/xml/\" }\n+ breathe_default_project = \"AFF3CT\"\n+\n+# -- Configure Exhale (Require the previous Breathe config)\n+\n+if buildername != \"latex\":\n+\n+ # Setup the exhale extension\n+ exhale_args = {\n+ # These arguments are required\n+ \"containmentFolder\": \"./api\",\n+ \"rootFileName\": \"library_root.rst\",\n+ \"rootFileTitle\": \"Library API\",\n+ \"doxygenStripFromPath\": \"../../include\",\n+ # Suggested optional arguments\n+ \"createTreeView\": True,\n+ # TIP: if using the sphinx-bootstrap-theme, you need\n+ # \"treeViewIsBootstrap\": True,\n+ \"exhaleExecutesDoxygen\": True,\n+ # \"verboseBuild\": True,\n+ \"exhaleUseDoxyfile\": True,\n+ # \"exhaleDoxygenStdin\": textwrap.dedent('''\n+ # INPUT = ../../include\n+ # # Using `=` instead of `+=` overrides\n+ # PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS=\"1\"\n+ # ''')\n+ }\n+\n+ # Tell sphinx what the primary language being documented is.\n+ primary_domain = 'cpp'\n+\n+ # Tell sphinx what the pygments highlight language should be.\n+ highlight_language = 'cpp'\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Try to start doxygen manually on RTD.
8,490
27.10.2019 12:21:17
-3,600
9ee31b545c5cba1bcc87c1f91f32c5600e8a114a
Create the 'build/doxygen' folder.
[ { "change_type": "MODIFY", "old_path": "doc/source/conf.py", "new_path": "doc/source/conf.py", "diff": "@@ -392,7 +392,7 @@ if buildername != \"latex\":\n# If we are on a Readthedocs server\nif read_the_docs_build:\n# Generate the Doxygen XML files\n- subprocess.call('cd source; doxygen Doxyfile', shell=True)\n+ subprocess.call('mkdir build/doxygen/; cd source; doxygen Doxyfile', shell=True)\nbreathe_projects = { \"AFF3CT\": \"../build/doxygen/xml/\" }\nbreathe_default_project = \"AFF3CT\"\n" } ]
C++
MIT License
aff3ct/aff3ct
Create the 'build/doxygen' folder.
8,490
27.10.2019 12:23:51
-3,600
318fa2ce22c73f337dbb50e8c165ea6829c54ecf
Try to fix prev. commit.
[ { "change_type": "MODIFY", "old_path": "doc/source/conf.py", "new_path": "doc/source/conf.py", "diff": "@@ -392,7 +392,7 @@ if buildername != \"latex\":\n# If we are on a Readthedocs server\nif read_the_docs_build:\n# Generate the Doxygen XML files\n- subprocess.call('mkdir build/doxygen/; cd source; doxygen Doxyfile', shell=True)\n+ subprocess.call('mkdir build; mkdir build/doxygen; cd source; doxygen Doxyfile', shell=True)\nbreathe_projects = { \"AFF3CT\": \"../build/doxygen/xml/\" }\nbreathe_default_project = \"AFF3CT\"\n" } ]
C++
MIT License
aff3ct/aff3ct
Try to fix prev. commit.
8,490
27.10.2019 12:47:26
-3,600
3a786dffbef1da7c32a867748a2b3581077ba2a4
Add the RTD conf. file.
[ { "change_type": "ADD", "old_path": null, "new_path": ".readthedocs.yml", "diff": "+# .readthedocs.yml\n+# Read the Docs configuration file\n+# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details\n+\n+# Required\n+version: 2\n+\n+# Build documentation in the doc/ directory with Sphinx\n+sphinx:\n+ configuration: doc/source/conf.py\n+\n+# Optionally build your docs in additional formats such as PDF and ePub\n+formats:\n+ - epub\n+ - pdf\n+\n+# Optionally set the version of Python and requirements required to build your docs\n+python:\n+ version: 3.7\n+ install:\n+ - requirements: doc/requirements.txt\n+ - method: pip\n+\n+# disable submodules\n+submodules:\n+ exclude: all\n+ recursive: false\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the RTD conf. file.
8,488
29.10.2019 13:51:53
0
28c3faa0364dd894fd442a55de2595979ed13a99
Add Source_User_Binary.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Source/Source.cpp", "new_path": "src/Factory/Module/Source/Source.cpp", "diff": "#include \"Module/Source/Random/Source_random.hpp\"\n#include \"Module/Source/Random/Source_random_fast.hpp\"\n#include \"Module/Source/User/Source_user.hpp\"\n+#include \"Module/Source/User/Source_user_binary.hpp\"\n#include \"Factory/Module/Source/Source.hpp\"\nusing namespace aff3ct;\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Source/User/Source_user_binary.cpp", "diff": "+#include <fstream>\n+#include <sstream>\n+\n+#include \"Tools/Algo/Bit_packer.hpp\"\n+#include \"Tools/Exception/exception.hpp\"\n+#include \"Module/Source/User/Source_user_binary.hpp\"\n+\n+using namespace aff3ct;\n+using namespace aff3ct::module;\n+\n+template <typename B>\n+Source_user_binary<B>\n+::Source_user_binary(const int K, const std::string filename, const int n_frames)\n+: Source<B>(K, n_frames), source(), src_counter(0)\n+{\n+ const std::string name = \"Source_user_binary\";\n+ this->set_name(name);\n+\n+ if (filename.empty())\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"'filename' should not be empty.\");\n+\n+ std::ifstream file(filename.c_str(), std::ios::in | std::ios::binary | std::ios::ate);\n+\n+ if (file.is_open())\n+ {\n+ auto size = file.tellg();\n+ auto n_src = size / K;\n+ std::vector<char> packed_vec(K);\n+ file.seekg (0, std::ios::beg);\n+\n+ this->source.resize(n_src);\n+ for (auto i = 0; i < n_src; i++)\n+ this->source[i].resize(K);\n+\n+ for (auto i = 0; i < n_src; i++)\n+ {\n+ this->source[i].resize(K);\n+ file.read (packed_vec.data(), K);\n+ tools::Bit_packer::unpack(packed_vec, this->source[i]);\n+ }\n+ std::fill(this->source[n_src - 1].begin() + (size % K), this->source[n_src - 1].end(), 0);\n+\n+ for (auto i = 0; i < 32; i++)\n+ std::cout << this->source[0][i] << \" | \";\n+ std::cout << std::endl;\n+\n+ file.close();\n+ }\n+ else\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"Can't open '\" + filename + \"' file.\");\n+}\n+\n+template <typename B>\n+void Source_user_binary<B>\n+::_generate(B *U_K, const int frame_id)\n+{\n+ std::copy(this->source[this->src_counter].begin(),\n+ this->source[this->src_counter].end (),\n+ U_K);\n+\n+ this->src_counter = (this->src_counter +1) % (int)this->source.size();\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef AFF3CT_MULTI_PREC\n+template class aff3ct::module::Source_user_binary<B_8>;\n+template class aff3ct::module::Source_user_binary<B_16>;\n+template class aff3ct::module::Source_user_binary<B_32>;\n+template class aff3ct::module::Source_user_binary<B_64>;\n+#else\n+template class aff3ct::module::Source_user_binary<B>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Source/User/Source_user_binary.hpp", "diff": "+#ifndef SOURCE_USER_BINARY_HPP_\n+#define SOURCE_USER_BINARY_HPP_\n+\n+#include <string>\n+#include <vector>\n+\n+#include \"Module/Source/Source.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B>\n+class Source_user_binary : public Source<B>\n+{\n+private:\n+ std::vector<std::vector<B>> source;\n+ int src_counter;\n+\n+public:\n+ Source_user_binary(const int K, std::string filename, const int n_frames = 1);\n+ virtual ~Source_user_binary() = default;\n+\n+protected:\n+ void _generate(B *U_K, const int frame_id);\n+};\n+}\n+}\n+\n+#endif /* SOURCE_USER_BINARY_HPP_ */\n" }, { "change_type": "MODIFY", "old_path": "src/aff3ct.hpp", "new_path": "src/aff3ct.hpp", "diff": "#ifndef SOURCE_HPP_\n#include <Module/Source/Source.hpp>\n#endif\n+#ifndef SOURCE_USER_BINARY_HPP_\n+#include <Module/Source/User/Source_user_binary.hpp>\n+#endif\n#ifndef SOURCE_USER_HPP_\n#include <Module/Source/User/Source_user.hpp>\n#endif\n" } ]
C++
MIT License
aff3ct/aff3ct
Add Source_User_Binary.
8,490
29.10.2019 11:48:55
-3,600
607479d2ec72a24cb2185b93beda6e82053d211b
Doc: disable library API on RTD.
[ { "change_type": "MODIFY", "old_path": "doc/requirements.txt", "new_path": "doc/requirements.txt", "diff": "-#Sphinx==2.0\n-#sphinx-rtd-theme==0.4.3\n-#sphinxcontrib-bibtex==1.0.0\n-#sphinxcontrib-websupport==1.1.0\n-#sphinxcontrib-svg2pdfconverter==0.1.0\n-#breathe==4.13.0\n-#m2r==0.2.1\n-#docutils==0.14\n-#exhale==0.2.3\n-\n-Sphinx==1.7.9\n+Sphinx==1.8.2\nsphinx-rtd-theme==0.4.3\nsphinxcontrib-bibtex==0.4.0\nsphinxcontrib-websupport==1.1.0\n" }, { "change_type": "MODIFY", "old_path": "doc/source/conf.py", "new_path": "doc/source/conf.py", "diff": "@@ -24,6 +24,15 @@ import textwrap\n# not include the API documentation.\nbuildername = str(os.getenv('SPHINX_BUILDERNAME'))\n+# 'read_the_docs_build' is whether we are on readthedocs.org, this line of code\n+# grabbed from docs.readthedocs.org\n+read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'\n+\n+# this is a hack to disable the library API doc on Read the docs until time\n+# limit can be extended\n+if (read_the_docs_build):\n+ buildername = \"latex\"\n+\n# -- Project information -----------------------------------------------------\nproject = 'AFF3CT'\n@@ -92,10 +101,6 @@ pygments_style = None\n# -- Options for HTML output -------------------------------------------------\n-# 'read_the_docs_build' is whether we are on readthedocs.org, this line of code\n-# grabbed from docs.readthedocs.org\n-read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'\n-\nif not read_the_docs_build: # only import and set the theme if we're building docs locally\nimport sphinx_rtd_theme\n# The theme to use for HTML and HTML Help pages. See the documentation for\n" } ]
C++
MIT License
aff3ct/aff3ct
Doc: disable library API on RTD.
8,490
29.10.2019 13:36:46
-3,600
20b7fbd30a4ed362dd53f0f69bf2fb7976276aca
Doc: put back readme and contributing section from markdown.
[ { "change_type": "MODIFY", "old_path": "doc/source/index.rst", "new_path": "doc/source/index.rst", "diff": "@@ -18,6 +18,8 @@ AFF3CT Documentation\n:maxdepth: 1\n:numbered:\n+ others/readme/readme\n+ others/contributing/contributing\nothers/license/license\n.. Indices and tables\n" }, { "change_type": "ADD", "old_path": null, "new_path": "doc/source/others/contributing/contributing.rst", "diff": "+.. only:: html\n+\n+ .. _others_contributing:\n+\n+ .. mdinclude:: ../../../../CONTRIBUTING.md\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "doc/source/others/readme/readme.rst", "diff": "+.. only:: html\n+\n+ Readme\n+ ^^^^^^\n+\n+ .. _others_readme:\n+\n+ .. mdinclude:: ../../../../README.md\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "doc/source/user/library/api.rst", "new_path": "doc/source/user/library/api.rst", "diff": "about\n../../api/library_root\n-\n-.. only:: latex\n-\n- ***********\n- Library API\n- ***********\n-\n- This part of the documentation is not available in the PDF, please refer to\n- the HTML version instead.\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Doc: put back readme and contributing section from markdown.
8,490
29.10.2019 16:00:31
-3,600
96427b06ca50ef881bedcbc76c4fb15c3f81fd39
Doc: update the factory library example accordingly to the code.
[ { "change_type": "MODIFY", "old_path": "doc/source/user/library/examples.rst", "new_path": "doc/source/user/library/examples.rst", "diff": "@@ -567,28 +567,28 @@ The ``main`` function in :numref:`lst_factory_main` is almost unchanged from the\nfloat ebn0_step = 1.00f; // SNR step\nfloat R; // code rate (R=K/N)\n- std::unique_ptr<factory::Source ::parameters> source;\n- std::unique_ptr<factory::Codec_repetition::parameters> codec;\n- std::unique_ptr<factory::Modem ::parameters> modem;\n- std::unique_ptr<factory::Channel ::parameters> channel;\n- std::unique_ptr<factory::Monitor_BFER ::parameters> monitor;\n- std::unique_ptr<factory::Terminal ::parameters> terminal;\n+ std::unique_ptr<factory::Source > source;\n+ std::unique_ptr<factory::Codec_repetition> codec;\n+ std::unique_ptr<factory::Modem > modem;\n+ std::unique_ptr<factory::Channel > channel;\n+ std::unique_ptr<factory::Monitor_BFER > monitor;\n+ std::unique_ptr<factory::Terminal > terminal;\n};\nvoid init_params3(int argc, char** argv, params3 &p)\n{\n- p.source = std::unique_ptr<factory::Source ::parameters>(new factory::Source ::parameters());\n- p.codec = std::unique_ptr<factory::Codec_repetition::parameters>(new factory::Codec_repetition::parameters());\n- p.modem = std::unique_ptr<factory::Modem ::parameters>(new factory::Modem ::parameters());\n- p.channel = std::unique_ptr<factory::Channel ::parameters>(new factory::Channel ::parameters());\n- p.monitor = std::unique_ptr<factory::Monitor_BFER ::parameters>(new factory::Monitor_BFER ::parameters());\n- p.terminal = std::unique_ptr<factory::Terminal ::parameters>(new factory::Terminal ::parameters());\n+ p.source = std::unique_ptr<factory::Source >(new factory::Source ());\n+ p.codec = std::unique_ptr<factory::Codec_repetition>(new factory::Codec_repetition());\n+ p.modem = std::unique_ptr<factory::Modem >(new factory::Modem ());\n+ p.channel = std::unique_ptr<factory::Channel >(new factory::Channel ());\n+ p.monitor = std::unique_ptr<factory::Monitor_BFER >(new factory::Monitor_BFER ());\n+ p.terminal = std::unique_ptr<factory::Terminal >(new factory::Terminal ());\n- std::vector<factory::Factory::parameters*> params_list = { p.source .get(), p.codec .get(), p.modem .get(),\n+ std::vector<factory::Factory*> params_list = { p.source .get(), p.codec .get(), p.modem .get(),\np.channel.get(), p.monitor.get(), p.terminal.get() };\n// parse command line arguments for the given parameters and fill them\n- factory::Command_parser cp(argc, argv, params_list, true);\n+ tools::Command_parser cp(argc, argv, params_list, true);\nif (cp.parsing_failed())\n{\ncp.print_help ();\n@@ -598,7 +598,7 @@ The ``main`` function in :numref:`lst_factory_main` is almost unchanged from the\n}\nstd::cout << \"# Simulation parameters: \" << std::endl;\n- factory::Header::print_parameters(params_list); // display the headers (= print the AFF3CT parameters on the screen)\n+ tools::Header::print_parameters(params_list); // display the headers (= print the AFF3CT parameters on the screen)\nstd::cout << \"#\" << std::endl;\ncp.print_warnings();\n@@ -612,7 +612,7 @@ this examples.\nThe ``init_params3`` function takes two new input arguments from the command\nline: ``argc`` and ``argv``. The function first allocates the factories (lines\n``18-23``) and then those factories are supplied with parameters from the\n-command line (line ``29``) thanks to the ``factory::Command_parser`` class.\n+command line (line ``29``) thanks to the ``tools::Command_parser`` class.\nLines ``38-41``, the parameters from the factories are printed to the terminal.\nNote that in this example a repetition code is used, however it is very easy to\n" } ]
C++
MIT License
aff3ct/aff3ct
Doc: update the factory library example accordingly to the code.
8,488
29.10.2019 18:33:09
0
93198d4b7cd7e8f481a4a7243caef9affd5cddad
Fix Source_user_binary.
[ { "change_type": "MODIFY", "old_path": "src/Module/Source/User/Source_user_binary.cpp", "new_path": "src/Module/Source/User/Source_user_binary.cpp", "diff": "@@ -24,27 +24,24 @@ Source_user_binary<B>\nif (file.is_open())\n{\nauto size = file.tellg();\n- auto n_src = size / K;\n- std::vector<char> packed_vec(K);\n- file.seekg (0, std::ios::beg);\n+ auto n_src = (size * CHAR_BIT + K - 1) / K;\nthis->source.resize(n_src);\nfor (auto i = 0; i < n_src; i++)\nthis->source[i].resize(K);\n- for (auto i = 0; i < n_src; i++)\n- {\n- this->source[i].resize(K);\n- file.read (packed_vec.data(), K);\n- tools::Bit_packer::unpack(packed_vec, this->source[i]);\n- }\n- std::fill(this->source[n_src - 1].begin() + (size % K), this->source[n_src - 1].end(), 0);\n+ std::vector<char> full_source_char(size );\n+ std::vector<B> full_source_B (size * CHAR_BIT);\n+ file.seekg (0, std::ios::beg);\n+ file.read (full_source_char.data(), size);\n+ file.close();\n- for (auto i = 0; i < 32; i++)\n- std::cout << this->source[0][i] << \" | \";\n- std::cout << std::endl;\n+ tools::Bit_packer::unpack(full_source_char, full_source_B);\n- file.close();\n+ for (auto i = 0; i < n_src -1; i++)\n+ std::copy(full_source_B.begin() + i * K, full_source_B.begin() + (i +1) * K, this->source[i].begin());\n+\n+ std::copy(full_source_B.begin() + (n_src - 1) * K, full_source_B.end(), this->source[n_src -1].begin());\n}\nelse\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, \"Can't open '\" + filename + \"' file.\");\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix Source_user_binary.
8,490
30.10.2019 13:09:17
-3,600
406e38fe9c00e79af8fa7eb6f51ef92c412ec4f6
Mv '#ifdef __cpp_aligned_new'.
[ { "change_type": "MODIFY", "old_path": "include/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_inter.hpp", "new_path": "include/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_inter.hpp", "diff": "* \\brief Class module::Decoder_LDPC_BP_flooding_inter.\n*/\n#ifndef DECODER_LDPC_BP_FLOODING_INTER_HPP_\n-#ifdef __cpp_aligned_new\n#define DECODER_LDPC_BP_FLOODING_INTER_HPP_\n+#ifdef __cpp_aligned_new\n#include <cstdint>\n#include <vector>\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/LDPC/BP/Horizontal_layered/Decoder_LDPC_BP_horizontal_layered_inter.hpp", "new_path": "include/Module/Decoder/LDPC/BP/Horizontal_layered/Decoder_LDPC_BP_horizontal_layered_inter.hpp", "diff": "* \\brief Class module::Decoder_LDPC_BP_horizontal_layered_inter.\n*/\n#ifndef DECODER_LDPC_BP_HORIZONTAL_LAYERED_INTER_HPP_\n-#ifdef __cpp_aligned_new\n#define DECODER_LDPC_BP_HORIZONTAL_LAYERED_INTER_HPP_\n+#ifdef __cpp_aligned_new\n#include <vector>\n#include <mipp.h>\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/LDPC/BP/Vertical_layered/Decoder_LDPC_BP_vertical_layered_inter.hpp", "new_path": "include/Module/Decoder/LDPC/BP/Vertical_layered/Decoder_LDPC_BP_vertical_layered_inter.hpp", "diff": "* \\brief Class module::Decoder_LDPC_BP_vertical_layered_inter.\n*/\n#ifndef DECODER_LDPC_BP_VERTICAL_LAYERED_INTER_HPP_\n-#ifdef __cpp_aligned_new\n#define DECODER_LDPC_BP_VERTICAL_LAYERED_INTER_HPP_\n+#ifdef __cpp_aligned_new\n#include <cstdint>\n#include <vector>\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Code/LDPC/Update_rule/AMS/Update_rule_AMS_simd.hpp", "new_path": "include/Tools/Code/LDPC/Update_rule/AMS/Update_rule_AMS_simd.hpp", "diff": "* \\brief Class tools::Update_rule_AMS_simd.\n*/\n#ifndef UPDATE_RULE_AMS_SIMD_HPP\n-#ifdef __cpp_aligned_new\n#define UPDATE_RULE_AMS_SIMD_HPP\n+#ifdef __cpp_aligned_new\n#include <string>\n#include <mipp.h>\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Code/LDPC/Update_rule/LSPA/Update_rule_LSPA_simd.hpp", "new_path": "include/Tools/Code/LDPC/Update_rule/LSPA/Update_rule_LSPA_simd.hpp", "diff": "* \\brief Class tools::Update_rule_LSPA_simd.\n*/\n#ifndef UPDATE_RULE_LSPA_SIMD_HPP\n-#ifdef __cpp_aligned_new\n#define UPDATE_RULE_LSPA_SIMD_HPP\n+#ifdef __cpp_aligned_new\n#include <vector>\n#include <string>\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Code/LDPC/Update_rule/MS/Update_rule_MS_simd.hpp", "new_path": "include/Tools/Code/LDPC/Update_rule/MS/Update_rule_MS_simd.hpp", "diff": "* \\brief Class tools::Update_rule_MS_simd.\n*/\n#ifndef UPDATE_RULE_MS_SIMD_HPP\n-#ifdef __cpp_aligned_new\n#define UPDATE_RULE_MS_SIMD_HPP\n+#ifdef __cpp_aligned_new\n#include <string>\n#include <mipp.h>\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Code/LDPC/Update_rule/NMS/Update_rule_NMS_simd.hpp", "new_path": "include/Tools/Code/LDPC/Update_rule/NMS/Update_rule_NMS_simd.hpp", "diff": "* \\brief Class tools::Update_rule_NMS_simd.\n*/\n#ifndef UPDATE_RULE_NMS_SIMD_HPP\n-#ifdef __cpp_aligned_new\n#define UPDATE_RULE_NMS_SIMD_HPP\n+#ifdef __cpp_aligned_new\n#include <string>\n#include <mipp.h>\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Code/LDPC/Update_rule/OMS/Update_rule_OMS_simd.hpp", "new_path": "include/Tools/Code/LDPC/Update_rule/OMS/Update_rule_OMS_simd.hpp", "diff": "* \\brief Class tools::Update_rule_OMS_simd.\n*/\n#ifndef UPDATE_RULE_OMS_SIMD_HPP\n-#ifdef __cpp_aligned_new\n#define UPDATE_RULE_OMS_SIMD_HPP\n+#ifdef __cpp_aligned_new\n#include <string>\n#include <mipp.h>\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Code/LDPC/Update_rule/SPA/Update_rule_SPA_simd.hpp", "new_path": "include/Tools/Code/LDPC/Update_rule/SPA/Update_rule_SPA_simd.hpp", "diff": "* \\brief Class tools::Update_rule_SPA_simd.\n*/\n#ifndef UPDATE_RULE_SPA_SIMD_HPP\n-#ifdef __cpp_aligned_new\n#define UPDATE_RULE_SPA_SIMD_HPP\n+#ifdef __cpp_aligned_new\n#include <vector>\n#include <string>\n" } ]
C++
MIT License
aff3ct/aff3ct
Mv '#ifdef __cpp_aligned_new'.
8,490
30.10.2019 13:09:48
-3,600
089aaa2af0abc73de95e961aad78f56f7b4b76a2
Skip 'AFF3CT_32BIT_PREC' definition in Doxygen.
[ { "change_type": "MODIFY", "old_path": "include/Tools/types.h", "new_path": "include/Tools/types.h", "diff": "@@ -42,10 +42,12 @@ using Q_64 = double;\nusing B = B_32;\nusing R = R_32;\nusing Q = Q_32;\n+#ifndef DOXYGEN_SHOULD_SKIP_THIS\n#ifndef AFF3CT_32BIT_PREC\n#define AFF3CT_32BIT_PREC\n#endif\n#endif\n+#endif\nnamespace aff3ct\n{\n" } ]
C++
MIT License
aff3ct/aff3ct
Skip 'AFF3CT_32BIT_PREC' definition in Doxygen.
8,488
30.10.2019 14:22:33
0
eec95f2d7bf3e1526b0cfaafb9ac666630838960
Modify Source_user_binary to capture bits on the fly.
[ { "change_type": "MODIFY", "old_path": "src/Module/Source/User/Source_user_binary.cpp", "new_path": "src/Module/Source/User/Source_user_binary.cpp", "diff": "-#include <fstream>\n-#include <sstream>\n-\n#include \"Tools/Algo/Bit_packer.hpp\"\n#include \"Tools/Exception/exception.hpp\"\n#include \"Module/Source/User/Source_user_binary.hpp\"\n@@ -11,51 +8,65 @@ using namespace aff3ct::module;\ntemplate <typename B>\nSource_user_binary<B>\n::Source_user_binary(const int K, const std::string filename, const int n_frames)\n-: Source<B>(K, n_frames), source(), src_counter(0)\n+: Source<B>(K, n_frames), source_file(filename.c_str(), std::ios::in | std::ios::binary)\n{\nconst std::string name = \"Source_user_binary\";\nthis->set_name(name);\n- if (filename.empty())\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"'filename' should not be empty.\");\n-\n- std::ifstream file(filename.c_str(), std::ios::in | std::ios::binary | std::ios::ate);\n+ if (source_file.fail())\n+ {\n+ std::stringstream message;\n+ message << \"'filename' file name is not valid: sink file failbit is set.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+}\n- if (file.is_open())\n+template <typename B>\n+void Source_user_binary<B>\n+::_generate(B *U_K, const int frame_id)\n{\n- auto size = file.tellg();\n- auto n_src = (size * CHAR_BIT + K - 1) / K;\n+ static int n_left = 0; // number of bits that have been left by last call\n- this->source.resize(n_src);\n- for (auto i = 0; i < n_src; i++)\n- this->source[i].resize(K);\n+ int n_bytes_read = 0;\n+ const int n_bytes_needed = (this->K - n_left + CHAR_BIT - 1) / CHAR_BIT; // number of bytes needed\n+ std::vector<char> memblk (n_bytes_needed);\n+ std::vector<B> left_bits(CHAR_BIT ); // to store bits that are left by last call (n_left & n_completing)\n- std::vector<char> full_source_char(size );\n- std::vector<B> full_source_B (size * CHAR_BIT);\n- file.seekg (0, std::ios::beg);\n- file.read (full_source_char.data(), size);\n- file.close();\n- tools::Bit_packer::unpack(full_source_char, full_source_B);\n+ for (auto i = 0; i < n_left; i++)\n+ U_K[i] = left_bits[i];\n- for (auto i = 0; i < n_src -1; i++)\n- std::copy(full_source_B.begin() + i * K, full_source_B.begin() + (i +1) * K, this->source[i].begin());\n+ while (n_bytes_read < n_bytes_needed)\n+ {\n+ source_file.read(memblk.data() + n_bytes_read, n_bytes_needed - n_bytes_read);\n+ n_bytes_read += source_file.gcount();\n- std::copy(full_source_B.begin() + (n_src - 1) * K, full_source_B.end(), this->source[n_src -1].begin());\n+ if (source_file.fail())\n+ {\n+ if (source_file.eof())\n+ {\n+ source_file.clear();\n+ source_file.seekg (0, std::ios::beg);\n+ if (source_file.fail())\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, \"Could not go back to the beginning of the file.\");\n+ }\n+\n+ if (source_file.fail())\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, \"Unknown error during file reading.\");\n}\n- else\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"Can't open '\" + filename + \"' file.\");\n}\n-template <typename B>\n-void Source_user_binary<B>\n-::_generate(B *U_K, const int frame_id)\n-{\n- std::copy(this->source[this->src_counter].begin(),\n- this->source[this->src_counter].end (),\n- U_K);\n+ tools::Bit_packer::unpack(memblk.data(), U_K + n_left, this->K - n_left);\n+\n+ // (total number of bits read from file) - (bits written into U_K)\n+ n_left = (n_bytes_needed * CHAR_BIT) - (this->K - n_left);\n+\n+ // re-unpack last byte && store into left_bits\n+ tools::Bit_packer::unpack(memblk.data() + n_bytes_needed - 1, left_bits.data(), 1);\n- this->src_counter = (this->src_counter +1) % (int)this->source.size();\n+ // shift the left bits to the beginning of the array\n+ for(auto i = 0; i < n_left; i++)\n+ left_bits[i] = left_bits[i + CHAR_BIT - n_left];\n}\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Source/User/Source_user_binary.hpp", "new_path": "src/Module/Source/User/Source_user_binary.hpp", "diff": "#include <string>\n#include <vector>\n+#include <fstream>\n#include \"Module/Source/Source.hpp\"\n@@ -14,8 +15,7 @@ template <typename B>\nclass Source_user_binary : public Source<B>\n{\nprivate:\n- std::vector<std::vector<B>> source;\n- int src_counter;\n+ std::ifstream source_file;\npublic:\nSource_user_binary(const int K, std::string filename, const int n_frames = 1);\n" } ]
C++
MIT License
aff3ct/aff3ct
Modify Source_user_binary to capture bits on the fly.
8,488
30.10.2019 16:01:21
0
daf68d868fadb4b126b7d19cda6aa3787c54f5a7
Add binary source in factory, doc and tests.
[ { "change_type": "MODIFY", "old_path": "conf", "new_path": "conf", "diff": "-Subproject commit ccc3111fba49e48fca67a19caf347148e1139ddf\n+Subproject commit 0e5fcc041a9b6ba0e0e942e307fe34fcc399f942\n" }, { "change_type": "MODIFY", "old_path": "doc/sphinx/source/user/simulation/parameters/source/source.rst", "new_path": "doc/sphinx/source/user/simulation/parameters/source/source.rst", "diff": "@@ -25,7 +25,7 @@ point.\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n:Type: text\n- :Allowed values: ``AZCW`` ``RAND`` ``USER``\n+ :Allowed values: ``AZCW`` ``RAND`` ``USER`` ``USER_BIN``\n:Default: ``RAND``\n:Examples: ``--src-type AZCW``\n@@ -33,22 +33,29 @@ point.\nDescription of the allowed values:\n-+----------+-------------------------------------------------------------------+\n++--------------+---------------------------------------------------------------+\n| Value | Description |\n-+==========+===================================================================+\n++==============+===============================================================+\n| ``AZCW`` | Set all the information bits to 0. |\n-+----------+-------------------------------------------------------------------+\n++--------------+---------------------------------------------------------------+\n| ``RAND`` | Generate randomly the information bits based on the |MT 19937||\n| | |PRNG| :cite:`Matsumoto1998`. |\n-+----------+-------------------------------------------------------------------+\n-| ``USER`` | Read the information bits from a given file, the path can be set |\n-| | with the :ref:`src-src-path` parameter. |\n-+----------+-------------------------------------------------------------------+\n++--------------+---------------------------------------------------------------+\n+| ``USER`` | Read the information bits from a given file, the path can be |\n+| | set with the :ref:`src-src-path` parameter. |\n++--------------+---------------------------------------------------------------+\n+| ``USER_BIN`` | Read the information bits from a given file in binary mode |\n+| | , the path can be set with the :ref:`src-src-path` parameter. |\n++--------------+---------------------------------------------------------------+\n.. note:: For the ``USER`` type, when the number of simulated frames exceeds the\nnumber of frames contained in the files, the frames are replayed from the\nbeginning of the file and this is repeated until the end of the simulation.\n+.. note:: For the ``USER_BIN`` type, raw data is read from the file that is open\n+ in binary mode. When the end of the file is reached, the source goes back to\n+ the beginning of the file and continues to generate bits from there.\n+\n.. _src-src-implem:\n``--src-implem``\n@@ -133,7 +140,10 @@ modulation (see the :ref:`mdm-mdm-type` ``SCMA`` parameter).\n|factory::Source::parameters::p+path|\n-An |ASCII| file is expected:\n+With the ``USER_BIN`` source type, raw binary data is directly read from the\n+file.\n+\n+With the ``USER`` source type, an |ASCII| file is expected:\n.. code-block:: bash\n" }, { "change_type": "MODIFY", "old_path": "doc/sphinx/strings.rst", "new_path": "doc/sphinx/strings.rst", "diff": ".. |factory::Source::parameters::p+path| replace::\nSet the path to a file containing one or more frames (informations bits), to\n- use with the ``USER`` source type.\n+ use with the ``USER`` or ``USER_BIN`` source type.\n.. |factory::Source::parameters::p+start-idx| replace::\nGive the start index to use in the ``USER`` source type. It is the index of\n" }, { "change_type": "MODIFY", "old_path": "refs", "new_path": "refs", "diff": "-Subproject commit 1d8ba69eae32f73923b025de175f6bd4392ac9e9\n+Subproject commit f19ef42b161760a8a776082a859db91237ae4a68\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Source/Source.cpp", "new_path": "src/Factory/Module/Source/Source.cpp", "diff": "@@ -41,7 +41,7 @@ void Source::parameters\ncli::Integer(cli::Positive(), cli::Non_zero()));\ntools::add_arg(args, p, class_name+\"p+type\",\n- cli::Text(cli::Including_set(\"RAND\", \"AZCW\", \"USER\")));\n+ cli::Text(cli::Including_set(\"RAND\", \"AZCW\", \"USER\", \"USER_BIN\")));\ntools::add_arg(args, p, class_name+\"p+implem\",\ncli::Text(cli::Including_set(\"STD\", \"FAST\")));\n@@ -79,7 +79,7 @@ void Source::parameters\nheaders[p].push_back(std::make_pair(\"Implementation\", this->implem));\nheaders[p].push_back(std::make_pair(\"Info. bits (K_info)\", std::to_string(this->K)));\nif (full) headers[p].push_back(std::make_pair(\"Inter frame level\", std::to_string(this->n_frames)));\n- if (this->type == \"USER\")\n+ if (this->type == \"USER\" || this->type == \"USER_BIN\")\nheaders[p].push_back(std::make_pair(\"Path\", this->path));\nif (this->type == \"RAND\" && full)\nheaders[p].push_back(std::make_pair(\"Seed\", std::to_string(this->seed)));\n@@ -100,6 +100,9 @@ module::Source<B>* Source::parameters\nif (this->type == \"AZCW\") return new module::Source_AZCW<B>(this->K, this->n_frames);\nif (this->type == \"USER\") return new module::Source_user<B>(this->K, this->path, this->n_frames, this->start_idx);\n+ if (this->type == \"USER_BIN\")\n+ return new module::Source_user_binary<B>(this->K, this->path, this->n_frames);\n+\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Source/User/Source_user_binary.cpp", "new_path": "src/Module/Source/User/Source_user_binary.cpp", "diff": "using namespace aff3ct;\nusing namespace aff3ct::module;\n+template <typename B>\n+std::thread::id aff3ct::module::Source_user_binary<B>::master_thread_id = std::this_thread::get_id();\n+\ntemplate <typename B>\nSource_user_binary<B>\n::Source_user_binary(const int K, const std::string filename, const int n_frames)\n@@ -13,6 +16,13 @@ Source_user_binary<B>\nconst std::string name = \"Source_user_binary\";\nthis->set_name(name);\n+ if(this->master_thread_id != std::this_thread::get_id())\n+ {\n+ std::stringstream message;\n+ message << name << \" is not thread safe.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (source_file.fail())\n{\nstd::stringstream message;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Source/User/Source_user_binary.hpp", "new_path": "src/Module/Source/User/Source_user_binary.hpp", "diff": "#include <string>\n#include <vector>\n#include <fstream>\n+#include <thread>\n#include \"Module/Source/Source.hpp\"\n@@ -16,6 +17,7 @@ class Source_user_binary : public Source<B>\n{\nprivate:\nstd::ifstream source_file;\n+ static std::thread::id master_thread_id;\npublic:\nSource_user_binary(const int K, std::string filename, const int n_frames = 1);\n" } ]
C++
MIT License
aff3ct/aff3ct
Add binary source in factory, doc and tests.
8,490
30.10.2019 23:08:04
-3,600
cf673563ad84f5ced1b3f5bd7125eafb480e6147
Fix performance issue in 'Task' 'operator[]'.
[ { "change_type": "MODIFY", "old_path": "include/Module/Task.hxx", "new_path": "include/Module/Task.hxx", "diff": "#include <algorithm>\n#include <sstream>\n+#include <cassert>\n-#include \"Tools/Exception/exception.hpp\"\n#include \"Module/Task.hpp\"\nnamespace aff3ct\n@@ -71,19 +71,8 @@ uint32_t Task\nSocket& Task\n::operator[](const size_t id)\n{\n- if ((size_t)id >= this->sockets.size())\n- {\n- std::stringstream message;\n- message << \"'id' has to be smaller than 'sockets.size()' ('id' = \" << id\n- << \", 'sockets.size()' = \" << sockets.size() << \").\";\n- throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n- if (this->sockets[id] == nullptr)\n- {\n- std::stringstream message;\n- message << \"'sockets[id]' can't be nullptr ('id' = \" << id << \").\";\n- throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n+ assert((size_t)id < this->sockets.size());\n+ assert(this->sockets[id] != nullptr);\nreturn *this->sockets[id];\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix performance issue in 'Task' 'operator[]'.
8,490
31.10.2019 10:48:40
-3,600
0e64db80f4725e36069707f535b34bf64a33a812
Enable inlining of the 'Module' 'operator[]' method.
[ { "change_type": "MODIFY", "old_path": "include/Module/Module.hpp", "new_path": "include/Module/Module.hpp", "diff": "@@ -74,7 +74,7 @@ public:\nvoid remove_custom_name();\n- Task& operator[](const int id);\n+ inline Task& operator[](const size_t id);\nprotected:\nvoid set_name(const std::string &name);\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Module.hxx", "new_path": "include/Module/Module.hxx", "diff": "+#include <cassert>\n+\n#include \"Module/Module.hpp\"\nnamespace aff3ct\n{\nnamespace module\n{\n+Task& Module\n+::operator[](const size_t id)\n+{\n+ assert(id < tasks_with_nullptr.size());\n+ assert(tasks_with_nullptr[id] != nullptr);\n+\n+ return *tasks_with_nullptr[id];\n+}\n+\ntemplate <typename T>\ninline size_t Module\n::create_socket_in(Task& task, const std::string &name, const size_t n_elmts)\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Module.cpp", "new_path": "src/Module/Module.cpp", "diff": "@@ -69,26 +69,6 @@ void Module\nthis->custom_name = \"\";\n}\n-Task& Module\n-::operator[](const int id)\n-{\n- if (id < 0 || (size_t)id >= tasks_with_nullptr.size())\n- {\n- std::stringstream message;\n- message << \"'id' has to be positive and smaller than 'tasks_with_nullptr.size()' ('id' = \" << id\n- << \", 'tasks_with_nullptr.size()' = \" << tasks_with_nullptr.size() << \").\";\n- throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n- if (tasks_with_nullptr[id] == nullptr)\n- {\n- std::stringstream message;\n- message << \"'tasks_with_nullptr[id]' can't be nullptr ('id' = \" << id << \").\";\n- throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n-\n- return *tasks_with_nullptr[id];\n-}\n-\nTask& Module\n::create_task(const std::string &name, const int id)\n{\n" } ]
C++
MIT License
aff3ct/aff3ct
Enable inlining of the 'Module' 'operator[]' method.
8,490
31.10.2019 10:49:55
-3,600
7d3392e130697abc5fb3d4578c04fe80819c0497
Add an inline 'exec_fast' method in the 'Task' class.
[ { "change_type": "MODIFY", "old_path": "include/Module/Task.hpp", "new_path": "include/Module/Task.hpp", "diff": "@@ -110,6 +110,8 @@ public:\nconst std::vector<std::chrono::nanoseconds>& get_timers_min () const;\nconst std::vector<std::chrono::nanoseconds>& get_timers_max () const;\n+ inline int exec_fast();\n+\nint exec();\ninline Socket& operator[](const size_t id);\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Task.hxx", "new_path": "include/Module/Task.hxx", "diff": "@@ -68,6 +68,14 @@ uint32_t Task\nreturn this->n_calls;\n}\n+int Task\n+::exec_fast()\n+{\n+ auto exec_status = this->codelet(*this);\n+ this->n_calls++;\n+ return exec_status;\n+}\n+\nSocket& Task\n::operator[](const size_t id)\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Task.cpp", "new_path": "src/Module/Task.cpp", "diff": "@@ -219,9 +219,7 @@ int Task\n{\nif (fast)\n{\n- auto exec_status = this->codelet(*this);\n- this->n_calls++;\n- return exec_status;\n+ return this->exec_fast();\n}\nif (can_exec())\n" } ]
C++
MIT License
aff3ct/aff3ct
Add an inline 'exec_fast' method in the 'Task' class.
8,486
31.10.2019 12:24:52
-3,600
a6fc26369c50aebe4925aecdcae28682fdffbe41
Add Task Clone with pointers
[ { "change_type": "MODIFY", "old_path": "include/Module/Task.hpp", "new_path": "include/Module/Task.hpp", "diff": "@@ -118,6 +118,7 @@ public:\ninline void update_timer(const size_t id, const std::chrono::nanoseconds &duration);\n+ Task* clone() const;\nprotected:\nvoid register_timer(const std::string &key);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Task.cpp", "new_path": "src/Module/Task.cpp", "diff": "@@ -519,6 +519,40 @@ void Task\nfor (auto &x : this->timers_max ) x = std::chrono::nanoseconds(0);\n}\n+Task* Task\n+::clone() const\n+{\n+ Task* t = new Task(*this);\n+ t->sockets.clear();\n+ t->last_input_socket = nullptr;\n+\n+ size_t out_buffers_counter = 0;\n+ int sckt_nbr = this->sockets.size();\n+ for (int i=0; i<sckt_nbr ; i++)\n+ {\n+ auto s = this->sockets[i];\n+ void *dataptr = nullptr;\n+ if ((this->get_socket_type(*s) == aff3ct::module::socket_t::SOUT || this->get_socket_type(*s) == aff3ct::module::socket_t::SIN_SOUT) && this->is_autoalloc())\n+ {\n+ dataptr = (void*)t->out_buffers[out_buffers_counter].data();\n+ out_buffers_counter++;\n+ }\n+\n+ Socket * s_new = new Socket(*t,\n+ s->get_name(),\n+ s->get_datatype(),\n+ s->get_databytes(),\n+ s->is_fast(),\n+ dataptr);\n+\n+ if (t->get_socket_type(*s_new) == aff3ct::module::socket_t::SIN)\n+ t->last_input_socket = s_new;\n+ }\n+\n+ return t;\n+}\n+\n+\n// ==================================================================================== explicit template instantiation\ntemplate size_t Task::create_socket_in<int8_t >(const std::string&, const size_t);\ntemplate size_t Task::create_socket_in<int16_t>(const std::string&, const size_t);\n" } ]
C++
MIT License
aff3ct/aff3ct
Add Task Clone with pointers
8,488
31.10.2019 14:01:40
-3,600
9976b0b96f3c4940e7d61020538c23767acf8fb6
Modify test-regression script to make it possible to override it in ref files.
[ { "change_type": "MODIFY", "old_path": "ci/test-regression.py", "new_path": "ci/test-regression.py", "diff": "@@ -29,7 +29,7 @@ parser.add_argument('--build-path', action='store', dest='buildPath', ty\nparser.add_argument('--binary-path', action='store', dest='binaryPath', type=str, default=\"bin/aff3ct\", help='Path to the AFF3CT binary.')\nparser.add_argument('--start-id', action='store', dest='startId', type=int, default=1, help='Starting id to avoid computing results one again.') # choices=xrange(1, +inf)\nparser.add_argument('--sensibility', action='store', dest='sensibility', type=float, default=1.0, help='Sensibility on the difference between new vs ref to verify a noise point.') # choices=xrange(1.0, +inf)\n-parser.add_argument('--n-threads', action='store', dest='nThreads', type=int, default=0, help='Number of threads to use in the simulation (0 = all available).') # choices=xrange(0, +ing)\n+parser.add_argument('--n-threads', action='store', dest='nThreads', type=int, default=0, help='Max number of threads to use in the simulation (0 = all available).') # choices=xrange(0, +ing)\nparser.add_argument('--recursive-scan', action='store', dest='recursiveScan', type=bool, default=True, help='If enabled, scan the path of refs recursively.')\nparser.add_argument('--max-fe', action='store', dest='maxFE', type=int, default=100, help='Maximum number of frames errors to simulate per noise point.') # choices=xrange(0, +inf)\nparser.add_argument('--min-fe', action='store', dest='minFE', type=int, default=50, help='Minimum number of frames errors to take into account the simulated noise point.') # choices=xrange(0, +inf)\n@@ -370,6 +370,17 @@ for fn in fileNames:\nargsAFFECT = argsAFFECTcommand[:] # hard copy\nargsAFFECT += simuRef.getSplitCommand()\nargsAFFECT[len(argsAFFECTcommand)] = args.binaryPath;\n+\n+ # overrides nThreads if the ref specifies an inferior number\n+ if \"-t\" in argsAFFECT and argsAFFECT.index(\"-t\") +1 < len(argsAFFECT):\n+ try:\n+ refsNThreads = int(argsAFFECT[argsAFFECT.index(\"-t\") + 1])\n+ except (ValueError, TypeError):\n+ refsNThreads = args.nThreads\n+\n+ if args.nThreads == 0 or refsNThreads < args.nThreads:\n+ args.nThreads = refsNThreads\n+\nargsAFFECT += [\"--ter-freq\", \"0\", \"-t\", str(args.nThreads), \"--sim-meta\", simuRef.getMetadata(\"title\")]\nif args.maxFE:\nargsAFFECT += [\"-e\", str(args.maxFE)]\n" } ]
C++
MIT License
aff3ct/aff3ct
Modify test-regression script to make it possible to override it in ref files.
8,490
31.10.2019 14:45:32
-3,600
0dae655573025993a5a3ef4d7d5d9be87bb510a4
Fix the 'Task' 'clone' method.
[ { "change_type": "MODIFY", "old_path": "src/Module/Task.cpp", "new_path": "src/Module/Task.cpp", "diff": "@@ -527,32 +527,34 @@ Task* Task\nt->last_input_socket = nullptr;\nsize_t out_buffers_counter = 0;\n- int sckt_nbr = this->sockets.size();\n- for (int i=0; i<sckt_nbr ; i++)\n+ for (auto s : this->sockets)\n{\n- auto s = this->sockets[i];\nvoid *dataptr = nullptr;\n- if ((this->get_socket_type(*s) == aff3ct::module::socket_t::SOUT || this->get_socket_type(*s) == aff3ct::module::socket_t::SIN_SOUT) && this->is_autoalloc())\n+ if (this->get_socket_type(*s) == socket_t::SOUT && this->is_autoalloc())\n{\ndataptr = (void*)t->out_buffers[out_buffers_counter].data();\nout_buffers_counter++;\n}\n+ else if (this->get_socket_type(*s) == socket_t::SIN)\n+ {\n+ dataptr = s->get_dataptr();\n+ }\n- Socket * s_new = new Socket(*t,\n+ auto s_new = std::shared_ptr<Socket>(new Socket(*t,\ns->get_name(),\ns->get_datatype(),\ns->get_databytes(),\ns->is_fast(),\n- dataptr);\n+ dataptr));\n+ t->sockets.push_back(s_new);\n- if (t->get_socket_type(*s_new) == aff3ct::module::socket_t::SIN)\n- t->last_input_socket = s_new;\n+ if (t->get_socket_type(*s_new) == socket_t::SIN || t->get_socket_type(*s_new) == socket_t::SIN_SOUT)\n+ t->last_input_socket = s_new.get();\n}\nreturn t;\n}\n-\n// ==================================================================================== explicit template instantiation\ntemplate size_t Task::create_socket_in<int8_t >(const std::string&, const size_t);\ntemplate size_t Task::create_socket_in<int16_t>(const std::string&, const size_t);\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the 'Task' 'clone' method.
8,488
31.10.2019 14:56:04
-3,600
481cf9312b34fca571a2eac81215290c3ebf8e2f
Add rang_format.h as public header.
[ { "change_type": "RENAME", "old_path": "src/Tools/Display/rang_format/rang_format.h", "new_path": "include/Tools/Display/rang_format/rang_format.h", "diff": "+/*!\n+ * \\file\n+ * \\brief Functions for overloading rang.\n+ */\n#ifndef RANG_FORMAT_H_\n#define RANG_FORMAT_H_\n" }, { "change_type": "MODIFY", "old_path": "include/aff3ct.hpp", "new_path": "include/aff3ct.hpp", "diff": "#ifndef FRAME_TRACE_HPP\n#include <Tools/Display/Frame_trace/Frame_trace.hpp>\n#endif\n+#ifndef RANG_FORMAT_H_\n+#include <Tools/Display/rang_format/rang_format.h>\n+#endif\n#ifndef Reporter_BFER_HPP_\n#include <Tools/Display/Reporter/BFER/Reporter_BFER.hpp>\n#endif\n" } ]
C++
MIT License
aff3ct/aff3ct
Add rang_format.h as public header.
8,490
01.11.2019 13:34:00
-3,600
7a9dddf1b2b89f27e5c4c50feb29f81785ee33ef
Simplify the threads management.
[ { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/Threads/BFER_ite_threads.cpp", "new_path": "src/Simulation/BFER/Iterative/Threads/BFER_ite_threads.cpp", "diff": "@@ -35,10 +35,10 @@ void BFER_ite_threads<B,R,Q>\nstd::vector<std::thread> threads(this->params_BFER_ite.n_threads -1);\n// launch a group of slave threads (there is \"n_threads -1\" slave threads)\nfor (auto tid = 1; tid < this->params_BFER_ite.n_threads; tid++)\n- threads[tid -1] = std::thread(BFER_ite_threads<B,R,Q>::start_thread, this, tid);\n+ threads[tid -1] = std::thread(&BFER_ite_threads<B,R,Q>::start_thread, this, tid);\n// launch the master thread\n- BFER_ite_threads<B,R,Q>::start_thread(this, 0);\n+ BFER_ite_threads<B,R,Q>::start_thread(0);\n// join the slave threads with the master thread\nfor (auto tid = 1; tid < this->params_BFER_ite.n_threads; tid++)\n@@ -50,32 +50,32 @@ void BFER_ite_threads<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nvoid BFER_ite_threads<B,R,Q>\n-::start_thread(BFER_ite_threads<B,R,Q> *simu, const int tid)\n+::start_thread(const int tid)\n{\ntry\n{\n- simu->sockets_binding(tid);\n- simu->simulation_loop(tid);\n+ this->sockets_binding(tid);\n+ this->simulation_loop(tid);\n}\ncatch (std::exception const& e)\n{\ntools::Terminal::stop();\n- simu->mutex_exception.lock();\n+ this->mutex_exception.lock();\nauto save = tools::exception::no_backtrace;\ntools::exception::no_backtrace = true;\nstd::string msg = e.what(); // get only the function signature\ntools::exception::no_backtrace = save;\n- if (std::find(simu->prev_err_messages.begin(), simu->prev_err_messages.end(), msg) ==\n- simu->prev_err_messages.end())\n+ if (std::find(this->prev_err_messages.begin(), this->prev_err_messages.end(), msg) ==\n+ this->prev_err_messages.end())\n{\n- simu->prev_err_messages.push_back(msg); // save only the function signature\n- simu->prev_err_messages_to_display.push_back(e.what()); // with backtrace if debug mode\n+ this->prev_err_messages.push_back(msg); // save only the function signature\n+ this->prev_err_messages_to_display.push_back(e.what()); // with backtrace if debug mode\n}\n- simu->mutex_exception.unlock();\n+ this->mutex_exception.unlock();\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/Threads/BFER_ite_threads.hpp", "new_path": "src/Simulation/BFER/Iterative/Threads/BFER_ite_threads.hpp", "diff": "@@ -21,8 +21,7 @@ protected:\nprivate:\nvoid sockets_binding(const int tid = 0);\nvoid simulation_loop(const int tid = 0);\n-\n- static void start_thread(BFER_ite_threads<B,R,Q> *simu, const int tid = 0);\n+ void start_thread (const int tid = 0);\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/Threads/BFER_std_threads.cpp", "new_path": "src/Simulation/BFER/Standard/Threads/BFER_std_threads.cpp", "diff": "@@ -34,10 +34,10 @@ void BFER_std_threads<B,R,Q>\nstd::vector<std::thread> threads(this->params_BFER_std.n_threads -1);\n// launch a group of slave threads (there is \"n_threads -1\" slave threads)\nfor (auto tid = 1; tid < this->params_BFER_std.n_threads; tid++)\n- threads[tid -1] = std::thread(BFER_std_threads<B,R,Q>::start_thread, this, tid);\n+ threads[tid -1] = std::thread(&BFER_std_threads<B,R,Q>::start_thread, this, tid);\n// launch the master thread\n- BFER_std_threads<B,R,Q>::start_thread(this, 0);\n+ BFER_std_threads<B,R,Q>::start_thread(0);\n// join the slave threads with the master thread\nfor (auto tid = 1; tid < this->params_BFER_std.n_threads; tid++)\n@@ -49,32 +49,32 @@ void BFER_std_threads<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nvoid BFER_std_threads<B,R,Q>\n-::start_thread(BFER_std_threads<B,R,Q> *simu, const int tid)\n+::start_thread(const int tid)\n{\ntry\n{\n- simu->sockets_binding(tid);\n- simu->simulation_loop(tid);\n+ this->sockets_binding(tid);\n+ this->simulation_loop(tid);\n}\ncatch (std::exception const& e)\n{\ntools::Terminal::stop();\n- simu->mutex_exception.lock();\n+ this->mutex_exception.lock();\nauto save = tools::exception::no_backtrace;\ntools::exception::no_backtrace = true;\nstd::string msg = e.what(); // get only the function signature\ntools::exception::no_backtrace = save;\n- if (std::find(simu->prev_err_messages.begin(), simu->prev_err_messages.end(), msg) ==\n- simu->prev_err_messages.end())\n+ if (std::find(this->prev_err_messages.begin(), this->prev_err_messages.end(), msg) ==\n+ this->prev_err_messages.end())\n{\n- simu->prev_err_messages.push_back(msg); // save only the function signature\n- simu->prev_err_messages_to_display.push_back(e.what()); // with backtrace if debug mode\n+ this->prev_err_messages.push_back(msg); // save only the function signature\n+ this->prev_err_messages_to_display.push_back(e.what()); // with backtrace if debug mode\n}\n- simu->mutex_exception.unlock();\n+ this->mutex_exception.unlock();\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/Threads/BFER_std_threads.hpp", "new_path": "src/Simulation/BFER/Standard/Threads/BFER_std_threads.hpp", "diff": "@@ -21,8 +21,7 @@ protected:\nprivate:\nvoid sockets_binding(const int tid = 0);\nvoid simulation_loop(const int tid = 0);\n-\n- static void start_thread(BFER_std_threads<B,R,Q> *simu, const int tid = 0);\n+ void start_thread (const int tid = 0);\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Simplify the threads management.
8,490
01.11.2019 21:35:30
-3,600
2052f0d4a6d5f4420d211579b2758d285d4cbdb5
Return refs in 'Socket' getters.
[ { "change_type": "MODIFY", "old_path": "include/Module/Socket.hpp", "new_path": "include/Module/Socket.hpp", "diff": "@@ -35,9 +35,9 @@ public:\ninline Socket(Task &task, const std::string &name, const std::type_index datatype, const size_t databytes,\nconst bool fast = false, void *dataptr = nullptr);\n- inline std::string get_name () const;\n- inline std::type_index get_datatype () const;\n- inline std::string get_datatype_string() const;\n+ inline const std::string& get_name () const;\n+ inline const std::type_index& get_datatype () const;\n+ inline const std::string& get_datatype_string() const;\ninline uint8_t get_datatype_size () const;\ninline size_t get_databytes () const;\ninline size_t get_n_elmts () const;\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Socket.hxx", "new_path": "include/Module/Socket.hxx", "diff": "@@ -28,19 +28,19 @@ Socket\n{\n}\n-std::string Socket\n+const std::string& Socket\n::get_name() const\n{\nreturn name;\n}\n-std::type_index Socket\n+const std::type_index& Socket\n::get_datatype() const\n{\nreturn datatype;\n}\n-std::string Socket\n+const std::string& Socket\n::get_datatype_string() const\n{\nreturn type_to_string[datatype];\n" } ]
C++
MIT License
aff3ct/aff3ct
Return refs in 'Socket' getters.
8,490
04.11.2019 15:50:58
-3,600
d111e0052979ad3b55e3b837390abf3d7785919e
Create a 'exec_chain' method on 'Task'.
[ { "change_type": "MODIFY", "old_path": "include/Module/Socket.hpp", "new_path": "include/Module/Socket.hpp", "diff": "@@ -30,6 +30,7 @@ protected:\nconst size_t databytes;\nbool fast;\nvoid* dataptr;\n+ std::vector<Socket*> bound_sockets;\npublic:\ninline Socket(Task &task, const std::string &name, const std::type_index datatype, const size_t databytes,\n@@ -43,6 +44,8 @@ public:\ninline size_t get_n_elmts () const;\ninline void* get_dataptr () const;\ninline bool is_fast () const;\n+ inline Task& get_task () const;\n+ inline const std::vector<Socket*> get_bound_sockets () const;\ninline void set_fast(const bool fast);\n@@ -65,6 +68,8 @@ public:\ninline int bind(void* dataptr);\ninline int operator()(void* dataptr);\n+\n+ inline void reset();\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Socket.hxx", "new_path": "include/Module/Socket.hxx", "diff": "@@ -76,6 +76,18 @@ bool Socket\nreturn fast;\n}\n+Task& Socket\n+::get_task() const\n+{\n+ return this->task;\n+}\n+\n+const std::vector<Socket*> Socket\n+::get_bound_sockets() const\n+{\n+ return this->bound_sockets;\n+}\n+\nvoid Socket\n::set_fast(const bool fast)\n{\n@@ -125,6 +137,8 @@ int Socket\n}\n}\n+ this->bound_sockets.push_back(&s);\n+ s.bound_sockets.push_back(this);\nthis->dataptr = s.dataptr;\nif (this->task.is_autoexec() && this->task.is_last_input_socket(*this))\n@@ -226,5 +240,13 @@ int Socket\n{\nreturn bind(dataptr);\n}\n+\n+inline void Socket\n+::reset()\n+{\n+ this->dataptr = nullptr;\n+ this->bound_sockets.clear();\n+}\n+\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Source/User/Source_user.hpp", "new_path": "include/Module/Source/User/Source_user.hpp", "diff": "@@ -14,7 +14,7 @@ namespace aff3ct\n{\nnamespace module\n{\n-template <typename B>\n+template <typename B = int>\nclass Source_user : public Source<B>\n{\nprivate:\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Task.hpp", "new_path": "include/Module/Task.hpp", "diff": "@@ -110,16 +110,27 @@ public:\nconst std::vector<std::chrono::nanoseconds>& get_timers_min () const;\nconst std::vector<std::chrono::nanoseconds>& get_timers_max () const;\n- inline int exec_fast();\n-\nint exec();\n+ void exec_chain(std::function<bool(const std::vector<int>&)> &stop_condition);\n+\n+ void exec_chain(std::function<bool(const std::vector<int>&)> &stop_condition, const size_t n_threads);\n+\ninline Socket& operator[](const size_t id);\ninline void update_timer(const size_t id, const std::chrono::nanoseconds &duration);\nTask* clone() const;\n+\nprotected:\n+ void _exec_chain(std::function<bool(const std::vector<int>&)> &stop_condition, std::vector<Task*> &tasks_chain);\n+\n+ void build_tasks_chain(std::vector<Task*> &tasks_chain);\n+\n+ void duplicate_tasks_chain(const std::vector<Task*> &tasks_chain,\n+ const size_t n_threads,\n+ std::vector<std::vector<Task*>> &tasks_chains);\n+\nvoid register_timer(const std::string &key);\ntemplate <typename T>\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Task.hxx", "new_path": "include/Module/Task.hxx", "diff": "@@ -68,14 +68,6 @@ uint32_t Task\nreturn this->n_calls;\n}\n-int Task\n-::exec_fast()\n-{\n- auto exec_status = this->codelet(*this);\n- this->n_calls++;\n- return exec_status;\n-}\n-\nSocket& Task\n::operator[](const size_t id)\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Task.cpp", "new_path": "src/Module/Task.cpp", "diff": "#include <iostream>\n#include <sstream>\n#include <iomanip>\n+#include <thread>\n#include <ios>\n#include <rang.hpp>\n@@ -342,6 +343,136 @@ int Task\n}\n}\n+void Task\n+::exec_chain(std::function<bool(const std::vector<int>&)> &stop_condition)\n+{\n+ std::vector<Task*> tasks_chain;\n+ this->build_tasks_chain(tasks_chain);\n+ this->_exec_chain(stop_condition, tasks_chain);\n+}\n+\n+void Task\n+::_exec_chain(std::function<bool(const std::vector<int>&)> &stop_condition, std::vector<Task*> &tasks_chain)\n+{\n+ std::vector<int> statuses(tasks_chain.size(), 0);\n+ while (!stop_condition(statuses))\n+ for (size_t ta = 0; ta < tasks_chain.size(); ta++)\n+ statuses[ta] = tasks_chain[ta]->exec();\n+}\n+\n+void Task\n+::exec_chain(std::function<bool(const std::vector<int>&)> &stop_condition, const size_t n_threads)\n+{\n+ if (n_threads == 0)\n+ {\n+ std::stringstream message;\n+ message << \"'n_threads' has to be strictly greater than 0.\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ std::vector<Task*> tasks_chain;\n+ this->build_tasks_chain(tasks_chain);\n+ std::vector<int> statuses(tasks_chain.size(), 0);\n+\n+ std::vector<std::vector<Task*>> tasks_chains;\n+ this->duplicate_tasks_chain(tasks_chain, n_threads, tasks_chains);\n+\n+ std::vector<std::thread> threads(n_threads);\n+ for (size_t tid = 0; tid < n_threads; tid++)\n+ threads[tid] = std::thread(&Task::_exec_chain, this, std::ref(stop_condition), std::ref(tasks_chains[tid]));\n+\n+ for (size_t tid = 0; tid < n_threads; tid++)\n+ threads[tid].join();\n+\n+ for (auto &c : tasks_chains)\n+ for (auto &ta : c)\n+ delete[] ta;\n+}\n+\n+void Task\n+::build_tasks_chain(std::vector<Task*> &tasks)\n+{\n+ if (this->can_exec())\n+ {\n+ tasks.push_back(this);\n+ }\n+ else\n+ {\n+ std::stringstream message;\n+ message << \"'this->can_exec()' has to be true.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ for (auto &s : this->sockets)\n+ {\n+ if (this->get_socket_type(*s) == socket_t::SIN_SOUT ||\n+ this->get_socket_type(*s) == socket_t::SOUT)\n+ {\n+ auto bss = s->get_bound_sockets();\n+ for (auto &bs : bss)\n+ {\n+ if (bs != nullptr)\n+ {\n+ auto &t = bs->get_task();\n+ if (t.is_last_input_socket(*bs))\n+ t.build_tasks_chain(tasks);\n+ }\n+ }\n+ }\n+ else if (this->get_socket_type(*s) == socket_t::SIN)\n+ {\n+ if (s->get_bound_sockets().size() > 1)\n+ {\n+ std::stringstream message;\n+ message << \"'s->get_bound_sockets().size()' has to be smaller or equal to 1 (\"\n+ << \"'s->get_bound_sockets().size()'\" << \" = \" << s->get_bound_sockets().size() << \", \"\n+ << \"'get_socket_type(*s)'\" << \" = \" << \"socket_t::SIN\" << \", \"\n+ << \"'s->get_name()'\" << \" = \" << s->get_name() << \", \"\n+ << \"'s->get_task().get_name()'\" << \" = \" << s->get_task().get_name() << \", \"\n+ << \"'s->get_task().get_module().get_name()'\" << \" = \" << s->get_task().get_module().get_name()\n+ << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+ }\n+ }\n+}\n+\n+void Task\n+::duplicate_tasks_chain(const std::vector<Task*> &tasks_chain,\n+ const size_t n_threads,\n+ std::vector<std::vector<Task*>> &tasks_chains)\n+{\n+ // clone the tasks\n+ for (size_t t = 0; t < n_threads; t++)\n+ {\n+ auto &tasks_chain_cpy = tasks_chains[t];\n+ for (auto &t : tasks_chain)\n+ {\n+ auto t_clone = t->clone();\n+ t_clone->set_autoalloc(true);\n+ tasks_chain_cpy.push_back(t_clone);\n+ }\n+ }\n+\n+ // bind the tasks\n+ for (size_t tid = 0; tid < n_threads; tid++)\n+ {\n+ auto &tasks_chain_cpy = tasks_chains[tid];\n+ for (size_t tc = 0; tc < tasks_chain.size(); tc++)\n+ {\n+ auto &ta = tasks_chain[tc];\n+ for (auto &s : this->sockets)\n+ {\n+ if (this->get_socket_type(*s) == socket_t::SIN_SOUT ||\n+ this->get_socket_type(*s) == socket_t::SOUT)\n+ {\n+\n+ }\n+ }\n+ }\n+ }\n+}\n+\ntemplate <typename T>\nSocket& Task\n::create_socket(const std::string &name, const size_t n_elmts)\n@@ -376,7 +507,6 @@ size_t Task\n::create_socket_in(const std::string &name, const size_t n_elmts)\n{\nauto &s = create_socket<T>(name, n_elmts);\n-\nsocket_type.push_back(socket_t::SIN);\nlast_input_socket = &s;\n@@ -388,7 +518,6 @@ size_t Task\n::create_socket_in_out(const std::string &name, const size_t n_elmts)\n{\nauto &s = create_socket<T>(name, n_elmts);\n-\nsocket_type.push_back(socket_t::SIN_SOUT);\nlast_input_socket = &s;\n@@ -400,7 +529,6 @@ size_t Task\n::create_socket_out(const std::string &name, const size_t n_elmts)\n{\nauto &s = create_socket<T>(name, n_elmts);\n-\nsocket_type.push_back(socket_t::SOUT);\n// memory allocation\n" } ]
C++
MIT License
aff3ct/aff3ct
Create a 'exec_chain' method on 'Task'.
8,490
04.11.2019 18:19:34
-3,600
fe54307640956d533bc4d2cc2927f0d02d84e103
Working on chain.
[ { "change_type": "MODIFY", "old_path": "src/Module/Task.cpp", "new_path": "src/Module/Task.cpp", "diff": "@@ -374,7 +374,7 @@ void Task\nthis->build_tasks_chain(tasks_chain);\nstd::vector<int> statuses(tasks_chain.size(), 0);\n- std::vector<std::vector<Task*>> tasks_chains;\n+ std::vector<std::vector<Task*>> tasks_chains(n_threads);\nthis->duplicate_tasks_chain(tasks_chain, n_threads, tasks_chains);\nstd::vector<std::thread> threads(n_threads);\n@@ -443,30 +443,70 @@ void Task\nstd::vector<std::vector<Task*>> &tasks_chains)\n{\n// clone the tasks\n- for (size_t t = 0; t < n_threads; t++)\n+ for (size_t tid = 0; tid < n_threads; tid++)\n+ {\n+ auto &tasks_chain_cpy = tasks_chains[tid];\n+ for (auto &ta : tasks_chain)\n+ {\n+ auto ta_clone = ta->clone();\n+ ta_clone->set_autoalloc(true);\n+ tasks_chain_cpy.push_back(ta_clone);\n+ }\n+ }\n+\n+ std::function<int(const Task&)> get_task_id = [&tasks_chain](const Task &ta) -> int {\n+ std::cout << \"ta = \" << +(&ta) << std::endl;\n+ std::cout << \" ta.get_name() = \" << ta.get_name() << std::endl;\n+ for (size_t t = 0; t < tasks_chain.size(); t++)\n{\n- auto &tasks_chain_cpy = tasks_chains[t];\n- for (auto &t : tasks_chain)\n+ std::cout << \"tasks_chain[t] = \" << +tasks_chain[t] << \" - t = \" << t << std::endl;\n+ std::cout << \" tasks_chain[t]->get_name() = \" << tasks_chain[t]->get_name() << std::endl;\n+ if (&ta == tasks_chain[t])\n{\n- auto t_clone = t->clone();\n- t_clone->set_autoalloc(true);\n- tasks_chain_cpy.push_back(t_clone);\n+ std::cout << \"Match -> salut !\" << std::endl << std::endl;\n+ return t;\n}\n}\n+ std::cout << \"Pas match :-(\" << std::endl << std::endl;\n+ return -1;\n+ };\n+\n+ std::function<int(const Task&, const Socket&)> get_socket_id = [](const Task &ta, const Socket& so) {\n+ for (size_t s = 0; s < ta.sockets.size(); s++)\n+ if (&so == ta.sockets[s].get())\n+ return (int)s;\n+ return -1;\n+ };\n// bind the tasks\n- for (size_t tid = 0; tid < n_threads; tid++)\n+ for (size_t tout_id = 0; tout_id < tasks_chain.size(); tout_id++)\n{\n- auto &tasks_chain_cpy = tasks_chains[tid];\n- for (size_t tc = 0; tc < tasks_chain.size(); tc++)\n+ auto &tout = tasks_chain[tout_id];\n+ for (size_t sout_id = 0; sout_id < tout->sockets.size(); sout_id++)\n{\n- auto &ta = tasks_chain[tc];\n- for (auto &s : this->sockets)\n+ auto &sout = tout->sockets[sout_id];\n+ if (tout->get_socket_type(*sout) == socket_t::SIN_SOUT ||\n+ tout->get_socket_type(*sout) == socket_t::SOUT)\n{\n- if (this->get_socket_type(*s) == socket_t::SIN_SOUT ||\n- this->get_socket_type(*s) == socket_t::SOUT)\n+ for (auto &sin : sout->get_bound_sockets())\n+ {\n+ if (sin != nullptr)\n{\n+ std::cout << \"sin->get_name() = \" << sin->get_name() << std::endl;\n+\n+ auto &tin = sin->get_task();\n+ auto tin_id = get_task_id(tin);\n+ assert(tin_id != -1);\n+ auto sin_id = get_socket_id(tin, *sin);\n+ assert(sin_id != -1);\n+\n+ for (size_t tid = 0; tid < n_threads; tid++)\n+ {\n+ auto &tasks_chain_cpy = tasks_chains[tid];\n+ (*tasks_chain_cpy[tout_id])[sout_id].bind((*tasks_chain_cpy[tin_id])[sin_id]);\n+ }\n+ }\n}\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Working on chain.
8,490
04.11.2019 20:57:59
-3,600
ec272338f93d01340d067f993a974b1ce2c0444d
Fix chain duplication.
[ { "change_type": "MODIFY", "old_path": "src/Module/Task.cpp", "new_path": "src/Module/Task.cpp", "diff": "@@ -386,7 +386,7 @@ void Task\nfor (auto &c : tasks_chains)\nfor (auto &ta : c)\n- delete[] ta;\n+ delete ta;\n}\nvoid Task\n@@ -455,19 +455,9 @@ void Task\n}\nstd::function<int(const Task&)> get_task_id = [&tasks_chain](const Task &ta) -> int {\n- std::cout << \"ta = \" << +(&ta) << std::endl;\n- std::cout << \" ta.get_name() = \" << ta.get_name() << std::endl;\nfor (size_t t = 0; t < tasks_chain.size(); t++)\n- {\n- std::cout << \"tasks_chain[t] = \" << +tasks_chain[t] << \" - t = \" << t << std::endl;\n- std::cout << \" tasks_chain[t]->get_name() = \" << tasks_chain[t]->get_name() << std::endl;\nif (&ta == tasks_chain[t])\n- {\n- std::cout << \"Match -> salut !\" << std::endl << std::endl;\nreturn t;\n- }\n- }\n- std::cout << \"Pas match :-(\" << std::endl << std::endl;\nreturn -1;\n};\n@@ -492,8 +482,6 @@ void Task\n{\nif (sin != nullptr)\n{\n- std::cout << \"sin->get_name() = \" << sin->get_name() << std::endl;\n-\nauto &tin = sin->get_task();\nauto tin_id = get_task_id(tin);\nassert(tin_id != -1);\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix chain duplication.
8,490
04.11.2019 22:56:36
-3,600
79cc43d49240d57785df1727a1f0d7c9ab3e6139
Add the 'Chain' class.
[ { "change_type": "ADD", "old_path": null, "new_path": "include/Module/Chain.hpp", "diff": "+/*!\n+ * \\file\n+ * \\brief Class module::Chain.\n+ */\n+#ifndef CHAIN_HPP_\n+#define CHAIN_HPP_\n+\n+#include <functional>\n+#include <vector>\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+class Task;\n+\n+class Chain\n+{\n+protected:\n+ size_t n_threads;\n+ std::vector<Task*> tasks_sequence;\n+ std::vector<std::vector<Task*>> tasks_sequences;\n+\n+public:\n+ Chain(Task &bootstrap, const size_t n_threads = 1);\n+ virtual ~Chain();\n+\n+ void exec(std::function<bool(const std::vector<int>&)> &stop_condition);\n+ inline size_t get_n_threads() const;\n+\n+protected:\n+ void init_recursive(Task& current_task);\n+ void _exec(std::function<bool(const std::vector<int>&)> &stop_condition, std::vector<Task*> &tasks_sequence);\n+ void duplicate();\n+\n+};\n+}\n+}\n+\n+#ifndef DOXYGEN_SHOULD_SKIP_THIS\n+#include \"Module/Chain.hxx\"\n+#endif\n+\n+#endif /* CHAIN_HPP_ */\n" }, { "change_type": "ADD", "old_path": null, "new_path": "include/Module/Chain.hxx", "diff": "+#include \"Module/Chain.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+size_t Chain\n+::get_n_threads() const\n+{\n+ return this->n_threads;\n+}\n+}\n+}\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Task.hpp", "new_path": "include/Module/Task.hpp", "diff": "#include <vector>\n#include <mipp.h>\n+#include \"Module/Chain.hpp\"\n+\nnamespace aff3ct\n{\nnamespace module\n@@ -92,7 +94,7 @@ public:\ninline bool is_debug ( ) const;\ninline bool is_debug_hex ( ) const;\ninline bool is_last_input_socket(const Socket &s_in) const;\n- inline bool can_exec ( ) const;\n+ bool can_exec ( ) const;\ninline const Module& get_module ( ) const;\ninline std::string get_name ( ) const;\n@@ -112,10 +114,6 @@ public:\nint exec();\n- void exec_chain(std::function<bool(const std::vector<int>&)> &stop_condition);\n-\n- void exec_chain(std::function<bool(const std::vector<int>&)> &stop_condition, const size_t n_threads);\n-\ninline Socket& operator[](const size_t id);\ninline void update_timer(const size_t id, const std::chrono::nanoseconds &duration);\n@@ -123,14 +121,6 @@ public:\nTask* clone() const;\nprotected:\n- void _exec_chain(std::function<bool(const std::vector<int>&)> &stop_condition, std::vector<Task*> &tasks_chain);\n-\n- void build_tasks_chain(std::vector<Task*> &tasks_chain);\n-\n- void duplicate_tasks_chain(const std::vector<Task*> &tasks_chain,\n- const size_t n_threads,\n- std::vector<std::vector<Task*>> &tasks_chains);\n-\nvoid register_timer(const std::string &key);\ntemplate <typename T>\n" }, { "change_type": "MODIFY", "old_path": "include/aff3ct.hpp", "new_path": "include/aff3ct.hpp", "diff": "#ifndef FACTORY_NOISE_HPP\n#include <Factory/Tools/Noise/Noise.hpp>\n#endif\n+#ifndef CHAIN_HPP_\n+#include <Module/Chain.hpp>\n+#endif\n#ifndef CHANNEL_AWGN_LLR_HPP_\n#include <Module/Channel/AWGN/Channel_AWGN_LLR.hpp>\n#endif\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Chain.cpp", "diff": "+#include <thread>\n+\n+#include \"Tools/Exception/exception.hpp\"\n+#include \"Module/Module.hpp\"\n+#include \"Module/Task.hpp\"\n+#include \"Module/Socket.hpp\"\n+#include \"Module/Chain.hpp\"\n+\n+using namespace aff3ct;\n+using namespace aff3ct::module;\n+\n+Chain\n+::Chain(Task &bootstrap, const size_t n_threads)\n+: n_threads(n_threads)\n+{\n+ if (n_threads == 0)\n+ {\n+ std::stringstream message;\n+ message << \"'n_threads' has to be strictly greater than 0.\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ this->init_recursive(bootstrap);\n+\n+ if (n_threads > 1)\n+ {\n+ this->tasks_sequences.resize(n_threads);\n+ this->duplicate();\n+ }\n+}\n+\n+Chain\n+::~Chain()\n+{\n+ for (auto &s : this->tasks_sequences)\n+ for (auto &ta : s)\n+ delete ta;\n+}\n+\n+void Chain\n+::init_recursive(Task& current_task)\n+{\n+ if (current_task.can_exec())\n+ {\n+ tasks_sequence.push_back(&current_task);\n+ }\n+ else\n+ {\n+ std::stringstream message;\n+ message << \"'this->can_exec()' has to be true.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ for (auto &s : current_task.sockets)\n+ {\n+ if (current_task.get_socket_type(*s) == socket_t::SIN_SOUT ||\n+ current_task.get_socket_type(*s) == socket_t::SOUT)\n+ {\n+ auto bss = s->get_bound_sockets();\n+ for (auto &bs : bss)\n+ {\n+ if (bs != nullptr)\n+ {\n+ auto &t = bs->get_task();\n+ if (t.is_last_input_socket(*bs))\n+ this->init_recursive(t);\n+ }\n+ }\n+ }\n+ else if (current_task.get_socket_type(*s) == socket_t::SIN)\n+ {\n+ if (s->get_bound_sockets().size() > 1)\n+ {\n+ std::stringstream message;\n+ message << \"'s->get_bound_sockets().size()' has to be smaller or equal to 1 (\"\n+ << \"'s->get_bound_sockets().size()'\" << \" = \" << s->get_bound_sockets().size() << \", \"\n+ << \"'get_socket_type(*s)'\" << \" = \" << \"socket_t::SIN\" << \", \"\n+ << \"'s->get_name()'\" << \" = \" << s->get_name() << \", \"\n+ << \"'s->get_task().get_name()'\" << \" = \" << s->get_task().get_name() << \", \"\n+ << \"'s->get_task().get_module().get_name()'\" << \" = \" << s->get_task().get_module().get_name()\n+ << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+ }\n+ }\n+}\n+\n+void Chain\n+::_exec(std::function<bool(const std::vector<int>&)> &stop_condition, std::vector<Task*> &tasks_sequence)\n+{\n+ std::vector<int> statuses(tasks_sequence.size(), 0);\n+ while (!stop_condition(statuses))\n+ for (size_t ta = 0; ta < tasks_sequence.size(); ta++)\n+ statuses[ta] = tasks_sequence[ta]->exec();\n+}\n+\n+void Chain\n+::exec(std::function<bool(const std::vector<int>&)> &stop_condition)\n+{\n+ if (this->get_n_threads() == 1)\n+ this->_exec(stop_condition, this->tasks_sequence);\n+ else\n+ {\n+ std::vector<std::thread> threads(n_threads);\n+ for (size_t tid = 0; tid < n_threads; tid++)\n+ threads[tid] = std::thread(&Chain::_exec, this, std::ref(stop_condition), std::ref(this->tasks_sequences[tid]));\n+\n+ for (size_t tid = 0; tid < n_threads; tid++)\n+ threads[tid].join();\n+ }\n+}\n+\n+void Chain\n+::duplicate()\n+{\n+ // clone the tasks\n+ for (size_t tid = 0; tid < this->n_threads; tid++)\n+ {\n+ auto &tasks_chain_cpy = this->tasks_sequences[tid];\n+ for (auto &ta : this->tasks_sequence)\n+ {\n+ auto ta_clone = ta->clone();\n+ ta_clone->set_autoalloc(true);\n+ tasks_chain_cpy.push_back(ta_clone);\n+ }\n+ }\n+\n+ std::function<int(const Task&)> get_task_id = [this](const Task &ta) -> int {\n+ for (size_t t = 0; t < this->tasks_sequence.size(); t++)\n+ if (&ta == this->tasks_sequence[t])\n+ return t;\n+ return -1;\n+ };\n+\n+ std::function<int(const Task&, const Socket&)> get_socket_id = [](const Task &ta, const Socket& so) {\n+ for (size_t s = 0; s < ta.sockets.size(); s++)\n+ if (&so == ta.sockets[s].get())\n+ return (int)s;\n+ return -1;\n+ };\n+\n+ // bind the tasks\n+ for (size_t tout_id = 0; tout_id < this->tasks_sequence.size(); tout_id++)\n+ {\n+ auto &tout = this->tasks_sequence[tout_id];\n+ for (size_t sout_id = 0; sout_id < tout->sockets.size(); sout_id++)\n+ {\n+ auto &sout = tout->sockets[sout_id];\n+ if (tout->get_socket_type(*sout) == socket_t::SIN_SOUT ||\n+ tout->get_socket_type(*sout) == socket_t::SOUT)\n+ {\n+ for (auto &sin : sout->get_bound_sockets())\n+ {\n+ if (sin != nullptr)\n+ {\n+ auto &tin = sin->get_task();\n+ auto tin_id = get_task_id(tin);\n+ assert(tin_id != -1);\n+\n+ auto sin_id = get_socket_id(tin, *sin);\n+ assert(sin_id != -1);\n+\n+ for (size_t tid = 0; tid < this->n_threads; tid++)\n+ {\n+ auto &tasks_chain_cpy = this->tasks_sequences[tid];\n+ (*tasks_chain_cpy[tout_id])[sout_id].bind((*tasks_chain_cpy[tin_id])[sin_id]);\n+ }\n+ }\n+ }\n+ }\n+ }\n+ }\n+}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Task.cpp", "new_path": "src/Module/Task.cpp", "diff": "#include <iostream>\n#include <sstream>\n#include <iomanip>\n-#include <thread>\n#include <ios>\n#include <rang.hpp>\n@@ -343,164 +342,6 @@ int Task\n}\n}\n-void Task\n-::exec_chain(std::function<bool(const std::vector<int>&)> &stop_condition)\n-{\n- std::vector<Task*> tasks_chain;\n- this->build_tasks_chain(tasks_chain);\n- this->_exec_chain(stop_condition, tasks_chain);\n-}\n-\n-void Task\n-::_exec_chain(std::function<bool(const std::vector<int>&)> &stop_condition, std::vector<Task*> &tasks_chain)\n-{\n- std::vector<int> statuses(tasks_chain.size(), 0);\n- while (!stop_condition(statuses))\n- for (size_t ta = 0; ta < tasks_chain.size(); ta++)\n- statuses[ta] = tasks_chain[ta]->exec();\n-}\n-\n-void Task\n-::exec_chain(std::function<bool(const std::vector<int>&)> &stop_condition, const size_t n_threads)\n-{\n- if (n_threads == 0)\n- {\n- std::stringstream message;\n- message << \"'n_threads' has to be strictly greater than 0.\";\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n- }\n-\n- std::vector<Task*> tasks_chain;\n- this->build_tasks_chain(tasks_chain);\n- std::vector<int> statuses(tasks_chain.size(), 0);\n-\n- std::vector<std::vector<Task*>> tasks_chains(n_threads);\n- this->duplicate_tasks_chain(tasks_chain, n_threads, tasks_chains);\n-\n- std::vector<std::thread> threads(n_threads);\n- for (size_t tid = 0; tid < n_threads; tid++)\n- threads[tid] = std::thread(&Task::_exec_chain, this, std::ref(stop_condition), std::ref(tasks_chains[tid]));\n-\n- for (size_t tid = 0; tid < n_threads; tid++)\n- threads[tid].join();\n-\n- for (auto &c : tasks_chains)\n- for (auto &ta : c)\n- delete ta;\n-}\n-\n-void Task\n-::build_tasks_chain(std::vector<Task*> &tasks)\n-{\n- if (this->can_exec())\n- {\n- tasks.push_back(this);\n- }\n- else\n- {\n- std::stringstream message;\n- message << \"'this->can_exec()' has to be true.\";\n- throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n-\n- for (auto &s : this->sockets)\n- {\n- if (this->get_socket_type(*s) == socket_t::SIN_SOUT ||\n- this->get_socket_type(*s) == socket_t::SOUT)\n- {\n- auto bss = s->get_bound_sockets();\n- for (auto &bs : bss)\n- {\n- if (bs != nullptr)\n- {\n- auto &t = bs->get_task();\n- if (t.is_last_input_socket(*bs))\n- t.build_tasks_chain(tasks);\n- }\n- }\n- }\n- else if (this->get_socket_type(*s) == socket_t::SIN)\n- {\n- if (s->get_bound_sockets().size() > 1)\n- {\n- std::stringstream message;\n- message << \"'s->get_bound_sockets().size()' has to be smaller or equal to 1 (\"\n- << \"'s->get_bound_sockets().size()'\" << \" = \" << s->get_bound_sockets().size() << \", \"\n- << \"'get_socket_type(*s)'\" << \" = \" << \"socket_t::SIN\" << \", \"\n- << \"'s->get_name()'\" << \" = \" << s->get_name() << \", \"\n- << \"'s->get_task().get_name()'\" << \" = \" << s->get_task().get_name() << \", \"\n- << \"'s->get_task().get_module().get_name()'\" << \" = \" << s->get_task().get_module().get_name()\n- << \").\";\n- throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n- }\n- }\n-}\n-\n-void Task\n-::duplicate_tasks_chain(const std::vector<Task*> &tasks_chain,\n- const size_t n_threads,\n- std::vector<std::vector<Task*>> &tasks_chains)\n-{\n- // clone the tasks\n- for (size_t tid = 0; tid < n_threads; tid++)\n- {\n- auto &tasks_chain_cpy = tasks_chains[tid];\n- for (auto &ta : tasks_chain)\n- {\n- auto ta_clone = ta->clone();\n- ta_clone->set_autoalloc(true);\n- tasks_chain_cpy.push_back(ta_clone);\n- }\n- }\n-\n- std::function<int(const Task&)> get_task_id = [&tasks_chain](const Task &ta) -> int {\n- for (size_t t = 0; t < tasks_chain.size(); t++)\n- if (&ta == tasks_chain[t])\n- return t;\n- return -1;\n- };\n-\n- std::function<int(const Task&, const Socket&)> get_socket_id = [](const Task &ta, const Socket& so) {\n- for (size_t s = 0; s < ta.sockets.size(); s++)\n- if (&so == ta.sockets[s].get())\n- return (int)s;\n- return -1;\n- };\n-\n- // bind the tasks\n- for (size_t tout_id = 0; tout_id < tasks_chain.size(); tout_id++)\n- {\n- auto &tout = tasks_chain[tout_id];\n- for (size_t sout_id = 0; sout_id < tout->sockets.size(); sout_id++)\n- {\n- auto &sout = tout->sockets[sout_id];\n- if (tout->get_socket_type(*sout) == socket_t::SIN_SOUT ||\n- tout->get_socket_type(*sout) == socket_t::SOUT)\n- {\n- for (auto &sin : sout->get_bound_sockets())\n- {\n- if (sin != nullptr)\n- {\n- auto &tin = sin->get_task();\n- auto tin_id = get_task_id(tin);\n- assert(tin_id != -1);\n-\n- auto sin_id = get_socket_id(tin, *sin);\n- assert(sin_id != -1);\n-\n- for (size_t tid = 0; tid < n_threads; tid++)\n- {\n- auto &tasks_chain_cpy = tasks_chains[tid];\n- (*tasks_chain_cpy[tout_id])[sout_id].bind((*tasks_chain_cpy[tin_id])[sin_id]);\n- }\n- }\n- }\n- }\n- }\n- }\n-}\n-\ntemplate <typename T>\nSocket& Task\n::create_socket(const std::string &name, const size_t n_elmts)\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the 'Chain' class.
8,490
05.11.2019 08:49:37
-3,600
85dd33573404f5415726cf617e760a67c376cc7b
Working on 'Modules' 'clone' method.
[ { "change_type": "MODIFY", "old_path": "include/Module/Module.hpp", "new_path": "include/Module/Module.hpp", "diff": "@@ -52,6 +52,8 @@ public:\n*/\nexplicit Module(const int n_frames = 1);\n+ virtual Module* clone() const;\n+\n/*!\n* \\brief Destructor.\n*/\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Module.cpp", "new_path": "src/Module/Module.cpp", "diff": "@@ -21,6 +21,34 @@ Module\n}\n}\n+Module* Module\n+::clone() const\n+{\n+#ifdef AFF3CT_SYSTEMC_MODULE\n+ std::stringstream message;\n+ message << \"SystemC is not supported.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+#endif\n+\n+ auto m = new Module(*this);\n+ m->tasks_with_nullptr.clear();\n+ m->tasks.clear();\n+\n+ for (auto &t : this->tasks_with_nullptr)\n+ {\n+ if (t == nullptr)\n+ m->tasks_with_nullptr.push_back(nullptr);\n+ else\n+ {\n+ auto t_new = std::make_shared<Task>(t->clone());\n+ m->tasks_with_nullptr.push_back(t_new);\n+ m->tasks.push_back(std::move(t_new));\n+ }\n+ }\n+\n+ return m;\n+}\n+\nint Module\n::get_n_frames() const\n{\n" } ]
C++
MIT License
aff3ct/aff3ct
Working on 'Modules' 'clone' method.
8,490
05.11.2019 17:32:17
-3,600
07f5ef08065bc3d9a2caff2dec5580bb40fb7157
Fix compilation error with SystemC.
[ { "change_type": "MODIFY", "old_path": "include/Module/Module.hpp", "new_path": "include/Module/Module.hpp", "diff": "@@ -52,7 +52,9 @@ public:\n*/\nexplicit Module(const int n_frames = 1);\n+#ifndef AFF3CT_SYSTEMC_MODULE\nvirtual Module* clone() const;\n+#endif\n/*!\n* \\brief Destructor.\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Module.cpp", "new_path": "src/Module/Module.cpp", "diff": "@@ -21,15 +21,10 @@ Module\n}\n}\n+#ifndef AFF3CT_SYSTEMC_MODULE\nModule* Module\n::clone() const\n{\n-#ifdef AFF3CT_SYSTEMC_MODULE\n- std::stringstream message;\n- message << \"SystemC is not supported.\";\n- throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n-#endif\n-\nauto m = new Module(*this);\nm->tasks_with_nullptr.clear();\nm->tasks.clear();\n@@ -48,6 +43,7 @@ Module* Module\nreturn m;\n}\n+#endif\nint Module\n::get_n_frames() const\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix compilation error with SystemC.
8,490
11.11.2019 09:50:23
-3,600
053149784de7f17e5b09b889a8e4c5ee2bffc60d
Add the 'const' qualifier to string for CRC.
[ { "change_type": "MODIFY", "old_path": "include/Module/CRC/Polynomial/CRC_polynomial.hpp", "new_path": "include/Module/CRC/Polynomial/CRC_polynomial.hpp", "diff": "@@ -26,12 +26,12 @@ protected:\nstd::vector<B> buff_crc;\npublic:\n- CRC_polynomial(const int K, std::string poly_key, const int size = 0, const int n_frames = 1);\n+ CRC_polynomial(const int K, const std::string &poly_key, const int size = 0, const int n_frames = 1);\nvirtual ~CRC_polynomial() = default;\n- static int get_size (std::string poly_key);\n- static std::string get_name (std::string poly_key);\n- static unsigned get_value(std::string poly_key);\n+ static int get_size (const std::string &poly_key);\n+ static std::string get_name (const std::string &poly_key);\n+ static unsigned get_value(const std::string &poly_key);\nprotected:\nvirtual void _build (const B *U_K1, B *U_K2, const int frame_id);\n" }, { "change_type": "MODIFY", "old_path": "include/Module/CRC/Polynomial/CRC_polynomial_fast.hpp", "new_path": "include/Module/CRC/Polynomial/CRC_polynomial_fast.hpp", "diff": "@@ -22,7 +22,7 @@ protected:\nunsigned polynomial_packed_rev;\npublic:\n- CRC_polynomial_fast(const int K, std::string poly_key, const int size = 0, const int n_frames = 1);\n+ CRC_polynomial_fast(const int K, const std::string &poly_key, const int size = 0, const int n_frames = 1);\nvirtual ~CRC_polynomial_fast() = default;\nprotected:\n" }, { "change_type": "MODIFY", "old_path": "include/Module/CRC/Polynomial/CRC_polynomial_inter.hpp", "new_path": "include/Module/CRC/Polynomial/CRC_polynomial_inter.hpp", "diff": "@@ -18,7 +18,7 @@ template <typename B = int>\nclass CRC_polynomial_inter : public CRC_polynomial<B>\n{\npublic:\n- CRC_polynomial_inter(const int K, std::string poly_key, const int size, const int n_frames);\n+ CRC_polynomial_inter(const int K, const std::string &poly_key, const int size, const int n_frames);\nvirtual ~CRC_polynomial_inter() = default;\nvirtual bool check(const B *V_K, const int n_frames = -1, const int frame_id = -1); using CRC<B>::check;\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the 'const' qualifier to string for CRC.
8,490
12.11.2019 10:25:27
-3,600
3f83e6c63b4919a1956c415102a11f23283c11f6
Simplify the memory management of codebooks and constellations.
[ { "change_type": "MODIFY", "old_path": "include/Factory/Module/Modem/Modem.hpp", "new_path": "include/Factory/Module/Modem/Modem.hpp", "diff": "@@ -73,10 +73,13 @@ public:\n// builder\ntemplate <typename B = int, typename R = float, typename Q = R>\n- module::Modem<B,R,Q>* build() const;\n+ module::Modem<B,R,Q>* build(const tools::Constellation<R>* cstl = nullptr) const;\ntemplate <typename B = int, typename R = float, typename Q = R>\nmodule::Modem<B,R,Q>* build(const tools::Distributions<R>& dist) const;\n+ template <typename R = float>\n+ tools::Constellation<R>* build_constellation() const;\n+\nstatic bool has_constellation(const std::string &type);\nstatic bool is_complex_mod(const std::string &type, const int bps = 1, const tools::Constellation<float>* c = nullptr);\n@@ -99,13 +102,10 @@ public:\nprivate:\ntemplate <typename B = int, typename R = float, typename Q = R, tools::proto_max<Q> MAX>\n- inline module::Modem<B,R,Q>* _build() const;\n+ inline module::Modem<B,R,Q>* _build(const tools::Constellation<R>* cstl) const;\ntemplate <typename B = int, typename R = float, typename Q = R>\ninline module::Modem<B,R,Q>* _build_scma() const;\n-\n- template <typename R = float>\n- tools::Constellation<R>* build_constellation() const;\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Modem/Generic/Modem_generic.hpp", "new_path": "include/Module/Modem/Generic/Modem_generic.hpp", "diff": "@@ -19,7 +19,7 @@ template <typename B = int, typename R = float, typename Q = R, tools::proto_max\nclass Modem_generic : public Modem<B,R,Q>\n{\nprivate:\n- std::unique_ptr<const tools::Constellation<R>> cstl;\n+ const tools::Constellation<R> &cstl;\nconst int bits_per_symbol;\nconst int nbr_symbols;\n@@ -27,7 +27,7 @@ private:\nR inv_sigma2;\npublic:\n- Modem_generic(const int N, std::unique_ptr<const tools::Constellation<R>>&& cstl, const bool disable_sig2 = false,\n+ Modem_generic(const int N, const tools::Constellation<R> &cstl, const bool disable_sig2 = false,\nconst int n_frames = 1);\nvirtual ~Modem_generic() = default;\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Modem/Generic/Modem_generic.hxx", "new_path": "include/Module/Modem/Generic/Modem_generic.hxx", "diff": "@@ -19,22 +19,19 @@ namespace module\n{\ntemplate <typename B, typename R, typename Q, tools::proto_max<Q> MAX>\nModem_generic<B,R,Q,MAX>\n-::Modem_generic(const int N, std::unique_ptr<const tools::Constellation<R>>&& _cstl, const bool disable_sig2,\n+::Modem_generic(const int N, const tools::Constellation<R>& _cstl, const bool disable_sig2,\nconst int n_frames)\n: Modem<B,R,Q>(N,\n- (int)(std::ceil((float)N / (float)_cstl->get_n_bits_per_symbol()) * (is_complex_mod(*_cstl) ? 2 : 1)), // N_mod\n+ (int)(std::ceil((float)N / (float)_cstl.get_n_bits_per_symbol()) * (is_complex_mod(_cstl) ? 2 : 1)), // N_mod\nn_frames),\n- cstl (std::move(_cstl)),\n- bits_per_symbol(cstl->get_n_bits_per_symbol()),\n- nbr_symbols (cstl->get_n_symbols()),\n+ cstl (_cstl),\n+ bits_per_symbol(cstl.get_n_bits_per_symbol()),\n+ nbr_symbols (cstl.get_n_symbols()),\ndisable_sig2 (disable_sig2),\ninv_sigma2 ((R)1.)\n{\n- const std::string name = \"Modem_generic<\" + cstl->get_name() + \">\";\n+ const std::string name = \"Modem_generic<\" + cstl.get_name() + \">\";\nthis->set_name(name);\n-\n- if (cstl == nullptr)\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"No constellation given ('cstl' = nullptr).\");\n}\ntemplate <typename B, typename R, typename Q, tools::proto_max<Q> MAX>\n@@ -85,7 +82,7 @@ template <typename B,typename R, typename Q, tools::proto_max<Q> MAX>\nvoid Modem_generic<B,R,Q,MAX>\n::_modulate(const B *X_N1, R *X_N2, const int frame_id)\n{\n- if (this->cstl->is_complex())\n+ if (this->cstl.is_complex())\n_modulate_complex(X_N1, X_N2, frame_id);\nelse\n_modulate_real(X_N1, X_N2, frame_id);\n@@ -95,7 +92,7 @@ template <typename B,typename R, typename Q, tools::proto_max<Q> MAX>\nvoid Modem_generic<B,R,Q,MAX>\n::_tmodulate(const Q *X_N1, R *X_N2, const int frame_id)\n{\n- if (this->cstl->is_complex())\n+ if (this->cstl.is_complex())\n_tmodulate_complex(X_N1, X_N2, frame_id);\nelse\n_tmodulate_real(X_N1, X_N2, frame_id);\n@@ -112,7 +109,7 @@ template <typename B,typename R, typename Q, tools::proto_max<Q> MAX>\nvoid Modem_generic<B,R,Q,MAX>\n::_demodulate(const Q *Y_N1, Q *Y_N2, const int frame_id)\n{\n- if (this->cstl->is_complex())\n+ if (this->cstl.is_complex())\n_demodulate_complex(Y_N1, Y_N2, frame_id);\nelse\n_demodulate_real(Y_N1, Y_N2, frame_id);\n@@ -122,7 +119,7 @@ template <typename B,typename R, typename Q, tools::proto_max<Q> MAX>\nvoid Modem_generic<B,R,Q,MAX>\n::_demodulate_wg(const R *H_N, const Q *Y_N1, Q *Y_N2, const int frame_id)\n{\n- if (this->cstl->is_complex())\n+ if (this->cstl.is_complex())\n_demodulate_wg_complex(H_N, Y_N1, Y_N2, frame_id);\nelse\n_demodulate_wg_real(H_N, Y_N1, Y_N2, frame_id);\n@@ -132,7 +129,7 @@ template <typename B,typename R, typename Q, tools::proto_max<Q> MAX>\nvoid Modem_generic<B,R,Q,MAX>\n::_tdemodulate(const Q *Y_N1, const Q *Y_N2, Q *Y_N3, const int frame_id)\n{\n- if (this->cstl->is_complex())\n+ if (this->cstl.is_complex())\n_tdemodulate_complex(Y_N1, Y_N2, Y_N3, frame_id);\nelse\n_tdemodulate_real(Y_N1, Y_N2, Y_N3, frame_id);\n@@ -142,7 +139,7 @@ template <typename B,typename R, typename Q, tools::proto_max<Q> MAX>\nvoid Modem_generic<B,R,Q,MAX>\n::_tdemodulate_wg(const R *H_N, const Q *Y_N1, const Q *Y_N2, Q *Y_N3, const int frame_id)\n{\n- if (this->cstl->is_complex())\n+ if (this->cstl.is_complex())\n_tdemodulate_wg_complex(H_N, Y_N1, Y_N2, Y_N3, frame_id);\nelse\n_tdemodulate_wg_real(H_N, Y_N1, Y_N2, Y_N3, frame_id);\n@@ -161,7 +158,7 @@ void Modem_generic<B,R,Q,MAX>\nunsigned idx = 0;\nfor (auto j = 0; j < this->bits_per_symbol; j++)\nidx += unsigned(unsigned(1 << j) * X_N1[i * this->bits_per_symbol +j]);\n- auto symbol = (*cstl)[idx];\n+ auto symbol = cstl[idx];\nX_N2[2*i ] = symbol.real();\nX_N2[2*i +1] = symbol.imag();\n@@ -173,7 +170,7 @@ void Modem_generic<B,R,Q,MAX>\nunsigned idx = 0;\nfor (auto j = 0; j < size_in - (loop_size * this->bits_per_symbol); j++)\nidx += unsigned(unsigned(1 << j) * X_N1[loop_size * this->bits_per_symbol +j]);\n- auto symbol = (*cstl)[idx];\n+ auto symbol = cstl[idx];\nX_N2[size_out -2] = symbol.real();\nX_N2[size_out -1] = symbol.imag();\n@@ -206,11 +203,11 @@ void Modem_generic<B,R,Q,MAX>\nfor (auto j = 0; j < this->nbr_symbols; j++)\nif (((j>>b) & 1) == 0)\n- L0 = MAX(L0, -std::norm(complex_Yk - std::complex<Q>((Q)(*cstl)[j].real(),\n- (Q)(*cstl)[j].imag())) * (Q)inv_sigma2);\n+ L0 = MAX(L0, -std::norm(complex_Yk - std::complex<Q>((Q)cstl[j].real(),\n+ (Q)cstl[j].imag())) * (Q)inv_sigma2);\nelse\n- L1 = MAX(L1, -std::norm(complex_Yk - std::complex<Q>((Q)(*cstl)[j].real(),\n- (Q)(*cstl)[j].imag())) * (Q)inv_sigma2);\n+ L1 = MAX(L1, -std::norm(complex_Yk - std::complex<Q>((Q)cstl[j].real(),\n+ (Q)cstl[j].imag())) * (Q)inv_sigma2);\nY_N2[n] = (L0 - L1);\n}\n@@ -244,12 +241,12 @@ void Modem_generic<B,R,Q,MAX>\nfor (auto j = 0; j < this->nbr_symbols; j++)\nif (((j>>b) & 1) == 0)\nL0 = MAX(L0, -std::norm(complex_Yk -\n- complex_Hk * std::complex<Q>((Q)(*cstl)[j].real(),\n- (Q)(*cstl)[j].imag())) * (Q)inv_sigma2);\n+ complex_Hk * std::complex<Q>((Q)cstl[j].real(),\n+ (Q)cstl[j].imag())) * (Q)inv_sigma2);\nelse\nL1 = MAX(L1, -std::norm(complex_Yk -\n- complex_Hk * std::complex<Q>((Q)(*cstl)[j].real(),\n- (Q)(*cstl)[j].imag())) * (Q)inv_sigma2);\n+ complex_Hk * std::complex<Q>((Q)cstl[j].real(),\n+ (Q)cstl[j].imag())) * (Q)inv_sigma2);\nY_N2[n] = (L0 - L1);\n}\n@@ -281,8 +278,8 @@ void Modem_generic<B,R,Q,MAX>\nfor (auto j = 0; j < this->nbr_symbols; j++)\n{\n- auto tempL = (Q)(std::norm(complex_Yk - std::complex<Q>((Q)(*cstl)[j].real(),\n- (Q)(*cstl)[j].imag())) * (Q)inv_sigma2);\n+ auto tempL = (Q)(std::norm(complex_Yk - std::complex<Q>((Q)cstl[j].real(),\n+ (Q)cstl[j].imag())) * (Q)inv_sigma2);\nfor (auto l = 0; l < this->bits_per_symbol; l++)\n{\n@@ -338,8 +335,8 @@ void Modem_generic<B,R,Q,MAX>\nfor (auto j = 0; j < this->nbr_symbols; j++)\n{\nauto tempL = (Q)(std::norm(complex_Yk -\n- complex_Hk * std::complex<Q>((Q)(*cstl)[j].real(),\n- (Q)(*cstl)[j].imag())) * (Q)inv_sigma2);\n+ complex_Hk * std::complex<Q>((Q)cstl[j].real(),\n+ (Q)cstl[j].imag())) * (Q)inv_sigma2);\nfor (auto l = 0; l < this->bits_per_symbol; l++)\n{\n@@ -382,7 +379,7 @@ void Modem_generic<B, R, Q, MAX>\nfor (auto m = 0; m < this->nbr_symbols; m++)\n{\n- const auto& soft_symbol = (*cstl)[m];\n+ const auto& soft_symbol = cstl[m];\nauto p = (R)1.0;\nfor (auto j = 0; j < this->bits_per_symbol; j++)\n{\n@@ -403,7 +400,7 @@ void Modem_generic<B, R, Q, MAX>\nfor (auto m = 0; m < (1<<r); m++)\n{\n- const auto& soft_symbol = (*cstl)[m];\n+ const auto& soft_symbol = cstl[m];\nauto p = (R)1.0;\nfor (auto j = 0; j < r; j++)\n{\n@@ -431,7 +428,7 @@ void Modem_generic<B,R,Q,MAX>\nunsigned idx = 0;\nfor (auto j = 0; j < bps; j++)\nidx += unsigned(unsigned(1 << j) * X_N1[i * bps +j]);\n- auto symbol = cstl->get_real(idx);\n+ auto symbol = cstl.get_real(idx);\nX_N2[i] = symbol;\n}\n@@ -442,7 +439,7 @@ void Modem_generic<B,R,Q,MAX>\nunsigned idx = 0;\nfor (auto j = 0; j < size_in - (main_loop_size * bps); j++)\nidx += unsigned(unsigned(1 << j) * X_N1[main_loop_size * bps +j]);\n- auto symbol = cstl->get_real(idx);\n+ auto symbol = cstl.get_real(idx);\nX_N2[size_out -1] = symbol;\n}\n@@ -472,11 +469,11 @@ void Modem_generic<B,R,Q,MAX>\nfor (auto j = 0; j < this->nbr_symbols; j++)\nif (((j>>b) & 1) == 0)\n- L0 = MAX(L0, -(Y_N1[k] - (Q)cstl->get_real(j)) *\n- (Y_N1[k] - (Q)cstl->get_real(j)) * (Q)inv_sigma2);\n+ L0 = MAX(L0, -(Y_N1[k] - (Q)cstl.get_real(j)) *\n+ (Y_N1[k] - (Q)cstl.get_real(j)) * (Q)inv_sigma2);\nelse\n- L1 = MAX(L1, -(Y_N1[k] - (Q)cstl->get_real(j)) *\n- (Y_N1[k] - (Q)cstl->get_real(j)) * (Q)inv_sigma2);\n+ L1 = MAX(L1, -(Y_N1[k] - (Q)cstl.get_real(j)) *\n+ (Y_N1[k] - (Q)cstl.get_real(j)) * (Q)inv_sigma2);\nY_N2[n] = (L0 - L1);\n}\n@@ -506,11 +503,11 @@ void Modem_generic<B,R,Q,MAX>\nfor (auto j = 0; j < this->nbr_symbols; j++)\nif (((j>>b) & 1) == 0)\n- L0 = MAX(L0, -(Y_N1[k] - (Q)H_N[k] * (Q)cstl->get_real(j)) *\n- (Y_N1[k] - (Q)H_N[k] * (Q)cstl->get_real(j)) * (Q)inv_sigma2);\n+ L0 = MAX(L0, -(Y_N1[k] - (Q)H_N[k] * (Q)cstl.get_real(j)) *\n+ (Y_N1[k] - (Q)H_N[k] * (Q)cstl.get_real(j)) * (Q)inv_sigma2);\nelse\n- L1 = MAX(L1, -(Y_N1[k] - (Q)H_N[k] * (Q)cstl->get_real(j)) *\n- (Y_N1[k] - (Q)H_N[k] * (Q)cstl->get_real(j)) * (Q)inv_sigma2);\n+ L1 = MAX(L1, -(Y_N1[k] - (Q)H_N[k] * (Q)cstl.get_real(j)) *\n+ (Y_N1[k] - (Q)H_N[k] * (Q)cstl.get_real(j)) * (Q)inv_sigma2);\nY_N2[n] = (L0 - L1);\n}\n@@ -540,8 +537,8 @@ void Modem_generic<B,R,Q,MAX>\nfor (auto j = 0; j < this->nbr_symbols; j++)\n{\n- auto tempL = (Q)((Y_N1[k] - cstl->get_real(j)) *\n- (Y_N1[k] - cstl->get_real(j)) * (Q)inv_sigma2);\n+ auto tempL = (Q)((Y_N1[k] - cstl.get_real(j)) *\n+ (Y_N1[k] - cstl.get_real(j)) * (Q)inv_sigma2);\nfor (auto l = 0; l < this->bits_per_symbol; l++)\n{\n@@ -593,8 +590,8 @@ void Modem_generic<B,R,Q,MAX>\nfor (auto j = 0; j < this->nbr_symbols; j++)\n{\n- auto tempL = (Q)((Y_N1[k] - (Q)H_N[k] * cstl->get_real(j)) *\n- (Y_N1[k] - (Q)H_N[k] * cstl->get_real(j)) * (Q)inv_sigma2);\n+ auto tempL = (Q)((Y_N1[k] - (Q)H_N[k] * cstl.get_real(j)) *\n+ (Y_N1[k] - (Q)H_N[k] * cstl.get_real(j)) * (Q)inv_sigma2);\nfor (auto l = 0; l < this->bits_per_symbol; l++)\n{\n@@ -636,7 +633,7 @@ void Modem_generic<B, R, Q, MAX>\nfor (auto m = 0; m < this->nbr_symbols; m++)\n{\n- R soft_symbol = (*cstl).get_real(m);\n+ R soft_symbol = cstl.get_real(m);\nR p = 1.0;\nfor (auto j = 0; j < this->bits_per_symbol; j++)\n{\n@@ -655,7 +652,7 @@ void Modem_generic<B, R, Q, MAX>\nfor (auto m = 0; m < (1<<r); m++)\n{\n- R soft_symbol =(*cstl).get_real(m);\n+ R soft_symbol = cstl.get_real(m);\nauto p = (R)1.0;\nfor (auto j = 0; j < r; j++)\n{\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Modem/SCMA/Modem_SCMA.hpp", "new_path": "include/Module/Modem/SCMA/Modem_SCMA.hpp", "diff": "#define MODEM_SCMA_HPP_\n#include <memory>\n+#include <string>\n#include \"Tools/Code/SCMA/Codebook.hpp\"\n#include \"Tools/Code/SCMA/modem_SCMA_functions.hpp\"\n@@ -23,8 +24,7 @@ template <typename B = int, typename R = float, typename Q = R, tools::proto_psi\nclass Modem_SCMA : public Modem<B,R,Q>\n{\nprivate:\n- std::unique_ptr<const tools::Codebook<R>> CB_ptr;\n- const tools::Codebook<R>& CB;\n+ const tools::Codebook<R> CB;\ntools::Vector_4D<Q> arr_phi;\ntools::Vector_3D<Q> msg_user_to_resources;\n@@ -35,7 +35,7 @@ private:\nconst int n_ite;\npublic:\n- Modem_SCMA(const int N, std::unique_ptr<const tools::Codebook<R>>&& CB, const bool disable_sig2 = false,\n+ Modem_SCMA(const int N, const std::string &codebook_path, const bool disable_sig2 = false,\nconst int n_ite = 1, const int n_frames = 6);\nvirtual ~Modem_SCMA() = default;\n@@ -48,6 +48,8 @@ public:\nstatic bool is_complex_fil();\nstatic int size_mod(const int N, const int bps);\nstatic int size_fil(const int N, const int bps);\n+ static int size_mod(const int N, const std::string &codebook_path);\n+ static int size_fil(const int N, const std::string &codebook_path);\nprotected:\nvoid check_noise();\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Modem/SCMA/Modem_SCMA.hxx", "new_path": "include/Module/Modem/SCMA/Modem_SCMA.hxx", "diff": "@@ -18,14 +18,13 @@ namespace module\n{\ntemplate <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\nModem_SCMA<B,R,Q,PSI>\n-::Modem_SCMA(const int N, std::unique_ptr<const tools::Codebook<R>>&& _CB, const bool disable_sig2, const int n_ite,\n+::Modem_SCMA(const int N, const std::string &codebook_path, const bool disable_sig2, const int n_ite,\nconst int n_frames)\n: Modem<B,R,Q>(N,\n- Modem_SCMA<B,R,Q,PSI>::size_mod(N, (int)_CB->get_system_bps()),\n- Modem_SCMA<B,R,Q,PSI>::size_fil(N, (int)_CB->get_system_bps()),\n+ Modem_SCMA<B,R,Q,PSI>::size_mod(N, codebook_path),\n+ Modem_SCMA<B,R,Q,PSI>::size_fil(N, codebook_path),\nn_frames),\n- CB_ptr (std::move(_CB)),\n- CB (*CB_ptr),\n+ CB (codebook_path),\narr_phi (CB.get_number_of_resources(), CB.get_codebook_size(), CB.get_codebook_size(), CB.get_codebook_size(), (Q)0),\nmsg_user_to_resources(CB.get_number_of_users(), CB.get_number_of_resources(), CB.get_codebook_size(), (Q)0),\nmsg_resource_to_users(CB.get_number_of_resources(), CB.get_number_of_users(), CB.get_codebook_size(), (Q)0),\n@@ -389,5 +388,23 @@ int Modem_SCMA<B,R,Q,PSI>\nreturn size_mod(N, bps);\n}\n+template <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\n+int Modem_SCMA<B,R,Q,PSI>\n+::size_mod(const int N, const std::string &codebook_path)\n+{\n+ const tools::Codebook<R> CB(codebook_path);\n+ int bps = (int)CB.get_system_bps();\n+ return ((int)std::pow(2, bps) * ((N + 1) / 2));\n+}\n+\n+template <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\n+int Modem_SCMA<B,R,Q,PSI>\n+::size_fil(const int N, const std::string &codebook_path)\n+{\n+ const tools::Codebook<R> CB(codebook_path);\n+ int bps = (int)CB.get_system_bps();\n+ return size_mod(N, bps);\n+}\n+\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Modem/Modem.cpp", "new_path": "src/Factory/Module/Modem/Modem.cpp", "diff": "#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Documentation/documentation.h\"\n#include \"Tools/Code/SCMA/modem_SCMA_functions.hpp\"\n+#include \"Tools/Code/SCMA/Codebook.hpp\"\n#include \"Module/Modem/OOK/Modem_OOK_BSC.hpp\"\n#include \"Module/Modem/OOK/Modem_OOK_BEC.hpp\"\n#include \"Module/Modem/OOK/Modem_OOK_AWGN.hpp\"\n@@ -164,7 +165,12 @@ void Modem\nif (this->type == \"BPSK\" || this->type == \"OOK\")\nthis->bps = 1;\n- std::unique_ptr<tools::Constellation<float>> cstl(this->build_constellation<float>());\n+ std::unique_ptr<tools::Constellation<float>> cstl;\n+ try\n+ {\n+ cstl.reset(this->build_constellation<float>());\n+ }\n+ catch(tools::cannot_allocate &) {}\nif (cstl != nullptr && this->type == \"USER\")\nthis->bps = cstl->get_n_bits_per_symbol();\n@@ -257,19 +263,19 @@ tools::Constellation<R>* Modem\nif (this->type == \"PSK\" ) return new tools::Constellation_PSK <R>(this->bps);\nif (this->type == \"USER\") return new tools::Constellation_user<R>(this->const_path);\n- return nullptr;\n+ throw tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\ntemplate <typename B, typename R, typename Q, tools::proto_max<Q> MAX>\nmodule::Modem<B,R,Q>* Modem\n-::_build() const\n+::_build(const tools::Constellation<R>* cstl) const\n{\nif (this->type == \"BPSK\" && this->implem == \"STD\" ) return new module::Modem_BPSK <B,R,Q >(this->N, this->no_sig2, this->n_frames);\nif (this->type == \"BPSK\" && this->implem == \"FAST\") return new module::Modem_BPSK_fast<B,R,Q >(this->N, this->no_sig2, this->n_frames);\nif (this->type == \"CPM\" && this->implem == \"STD\" ) return new module::Modem_CPM <B,R,Q,MAX>(this->N, this->bps, this->cpm_upf, this->cpm_L, this->cpm_k, this->cpm_p, this->cpm_mapping, this->cpm_wave_shape, this->no_sig2, this->n_frames);\n- std::unique_ptr<tools::Constellation<R>> cstl(this->build_constellation<R>());\n- if (cstl != nullptr) return new module::Modem_generic<B,R,Q,MAX>(N, std::move(cstl), this->no_sig2, this->n_frames);\n+ if (cstl != nullptr)\n+ return new module::Modem_generic<B,R,Q,MAX>(N, *cstl, this->no_sig2, this->n_frames);\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n@@ -278,18 +284,17 @@ template <typename B, typename R, typename Q>\nmodule::Modem<B,R,Q>* Modem\n::_build_scma() const\n{\n- std::unique_ptr<tools::Codebook<R>> CB(new tools::Codebook<R>(this->codebook));\n- if (this->psi == \"PSI0\") return new module::Modem_SCMA<B,R,Q,tools::psi_0<Q>>(this->N, std::move(CB), this->no_sig2, this->n_ite, this->n_frames);\n- if (this->psi == \"PSI1\") return new module::Modem_SCMA<B,R,Q,tools::psi_1<Q>>(this->N, std::move(CB), this->no_sig2, this->n_ite, this->n_frames);\n- if (this->psi == \"PSI2\") return new module::Modem_SCMA<B,R,Q,tools::psi_2<Q>>(this->N, std::move(CB), this->no_sig2, this->n_ite, this->n_frames);\n- if (this->psi == \"PSI3\") return new module::Modem_SCMA<B,R,Q,tools::psi_3<Q>>(this->N, std::move(CB), this->no_sig2, this->n_ite, this->n_frames);\n+ if (this->psi == \"PSI0\") return new module::Modem_SCMA<B,R,Q,tools::psi_0<Q>>(this->N, this->codebook, this->no_sig2, this->n_ite, this->n_frames);\n+ if (this->psi == \"PSI1\") return new module::Modem_SCMA<B,R,Q,tools::psi_1<Q>>(this->N, this->codebook, this->no_sig2, this->n_ite, this->n_frames);\n+ if (this->psi == \"PSI2\") return new module::Modem_SCMA<B,R,Q,tools::psi_2<Q>>(this->N, this->codebook, this->no_sig2, this->n_ite, this->n_frames);\n+ if (this->psi == \"PSI3\") return new module::Modem_SCMA<B,R,Q,tools::psi_3<Q>>(this->N, this->codebook, this->no_sig2, this->n_ite, this->n_frames);\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\ntemplate <typename B, typename R, typename Q>\nmodule::Modem<B,R,Q>* Modem\n-::build() const\n+::build(const tools::Constellation<R>* cstl) const\n{\nif (this->type == \"SCMA\" && this->implem == \"STD\")\n{\n@@ -303,10 +308,10 @@ module::Modem<B,R,Q>* Modem\n}\nelse\n{\n- if (this->max == \"MAX\" ) return _build<B,R,Q,tools::max <Q>>();\n- if (this->max == \"MAXL\" ) return _build<B,R,Q,tools::max_linear <Q>>();\n- if (this->max == \"MAXS\" ) return _build<B,R,Q,tools::max_star <Q>>();\n- if (this->max == \"MAXSS\") return _build<B,R,Q,tools::max_star_safe<Q>>();\n+ if (this->max == \"MAX\" ) return _build<B,R,Q,tools::max <Q>>(cstl);\n+ if (this->max == \"MAXL\" ) return _build<B,R,Q,tools::max_linear <Q>>(cstl);\n+ if (this->max == \"MAXS\" ) return _build<B,R,Q,tools::max_star <Q>>(cstl);\n+ if (this->max == \"MAXSS\") return _build<B,R,Q,tools::max_star_safe<Q>>(cstl);\n}\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n@@ -402,12 +407,12 @@ bool Modem\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef AFF3CT_MULTI_PREC\n-template aff3ct::module::Modem<B_8 ,R_8 ,Q_8 >* aff3ct::factory::Modem::build<B_8 ,R_8 ,Q_8 >() const;\n-template aff3ct::module::Modem<B_8 ,R_8 ,R_8 >* aff3ct::factory::Modem::build<B_8 ,R_8 ,R_8 >() const;\n-template aff3ct::module::Modem<B_16,R_16,Q_16>* aff3ct::factory::Modem::build<B_16,R_16,Q_16>() const;\n-template aff3ct::module::Modem<B_16,R_16,R_16>* aff3ct::factory::Modem::build<B_16,R_16,R_16>() const;\n-template aff3ct::module::Modem<B_32,R_32,Q_32>* aff3ct::factory::Modem::build<B_32,R_32,Q_32>() const;\n-template aff3ct::module::Modem<B_64,R_64,Q_64>* aff3ct::factory::Modem::build<B_64,R_64,Q_64>() const;\n+template aff3ct::module::Modem<B_8 ,R_8 ,Q_8 >* aff3ct::factory::Modem::build<B_8 ,R_8 ,Q_8 >(const tools::Constellation<R_8 >*) const;\n+template aff3ct::module::Modem<B_8 ,R_8 ,R_8 >* aff3ct::factory::Modem::build<B_8 ,R_8 ,R_8 >(const tools::Constellation<R_8 >*) const;\n+template aff3ct::module::Modem<B_16,R_16,Q_16>* aff3ct::factory::Modem::build<B_16,R_16,Q_16>(const tools::Constellation<R_16>*) const;\n+template aff3ct::module::Modem<B_16,R_16,R_16>* aff3ct::factory::Modem::build<B_16,R_16,R_16>(const tools::Constellation<R_16>*) const;\n+template aff3ct::module::Modem<B_32,R_32,Q_32>* aff3ct::factory::Modem::build<B_32,R_32,Q_32>(const tools::Constellation<R_32>*) const;\n+template aff3ct::module::Modem<B_64,R_64,Q_64>* aff3ct::factory::Modem::build<B_64,R_64,Q_64>(const tools::Constellation<R_64>*) const;\ntemplate aff3ct::module::Modem<B_8 ,R_8 ,Q_8 >* aff3ct::factory::Modem::build<B_8 ,R_8 ,Q_8 >(const tools::Distributions<R_8 >&) const;\ntemplate aff3ct::module::Modem<B_8 ,R_8 ,R_8 >* aff3ct::factory::Modem::build<B_8 ,R_8 ,R_8 >(const tools::Distributions<R_8 >&) const;\n@@ -415,15 +420,19 @@ template aff3ct::module::Modem<B_16,R_16,Q_16>* aff3ct::factory::Modem::build<B_\ntemplate aff3ct::module::Modem<B_16,R_16,R_16>* aff3ct::factory::Modem::build<B_16,R_16,R_16>(const tools::Distributions<R_16>&) const;\ntemplate aff3ct::module::Modem<B_32,R_32,Q_32>* aff3ct::factory::Modem::build<B_32,R_32,Q_32>(const tools::Distributions<R_32>&) const;\ntemplate aff3ct::module::Modem<B_64,R_64,Q_64>* aff3ct::factory::Modem::build<B_64,R_64,Q_64>(const tools::Distributions<R_64>&) const;\n+\n+template tools::Constellation<R_32>* aff3ct::factory::Modem::build_constellation<R_32>() const;\n+template tools::Constellation<R_64>* aff3ct::factory::Modem::build_constellation<R_64>() const;\n#else\n-template aff3ct::module::Modem<B,R,Q>* aff3ct::factory::Modem::build<B,R,Q>() const;\n+template aff3ct::module::Modem<B,R,Q>* aff3ct::factory::Modem::build<B,R,Q>(const tools::Constellation<R>*) const;\ntemplate aff3ct::module::Modem<B,R,Q>* aff3ct::factory::Modem::build<B,R,Q>(const tools::Distributions<R>&) const;\n#if !defined(AFF3CT_32BIT_PREC) && !defined(AFF3CT_64BIT_PREC)\n-template aff3ct::module::Modem<B,R,R>* aff3ct::factory::Modem::build<B,R,R>() const;\n+template aff3ct::module::Modem<B,R,R>* aff3ct::factory::Modem::build<B,R,R>(const tools::Constellation<R>*) const;\ntemplate aff3ct::module::Modem<B,R,R>* aff3ct::factory::Modem::build<B,R,R>(const tools::Distributions<R>&) const;\n#endif\n+template tools::Constellation<R>* aff3ct::factory::Modem::build_constellation<R>() const;\n#endif\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.cpp", "new_path": "src/Simulation/BFER/BFER.cpp", "diff": "@@ -58,6 +58,14 @@ BFER<B,R,Q>\ntools::Distribution_mode::SUMMATION,\nparams_BFER.mdm->rop_est_bits > 0));\n+ try\n+ {\n+ auto cstl = params_BFER.mdm->build_constellation<R>();\n+ constellation.reset(cstl);\n+ }\n+ catch(tools::cannot_allocate&) {}\n+\n+\nthis->build_monitors ();\nthis->build_reporters();\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.hpp", "new_path": "src/Simulation/BFER/BFER.hpp", "diff": "#include <memory>\n#include \"Factory/Simulation/BFER/BFER.hpp\"\n+#include \"Tools/Constellation/Constellation.hpp\"\n+#include \"Tools/Display/Reporter/Reporter.hpp\"\n#include \"Tools/Display/Reporter/Reporter.hpp\"\n#include \"Tools/Display/Terminal/Terminal.hpp\"\n#include \"Tools/Display/Dumper/Dumper.hpp\"\n@@ -72,6 +74,9 @@ protected:\n// noise distribution\nstd::unique_ptr<tools::Distributions<R>> distributions;\n+ // modem constellation\n+ std::unique_ptr<tools::Constellation<R>> constellation;\n+\nstd::chrono::steady_clock::time_point t_start_noise_point;\npublic:\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/BFER_ite.cpp", "new_path": "src/Simulation/BFER/Iterative/BFER_ite.cpp", "diff": "@@ -213,7 +213,7 @@ std::unique_ptr<module::Modem<B,R,Q>> BFER_ite<B,R,Q>\n}\nelse\n{\n- auto modem = std::unique_ptr<module::Modem<B,R,Q>>(params_BFER_ite.mdm->template build<B,R,Q>());\n+ auto modem = std::unique_ptr<module::Modem<B,R,Q>>(params_BFER_ite.mdm->template build<B,R,Q>(this->constellation.get()));\nmodem->set_noise(*this->noise);\nreturn modem;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/BFER_std.cpp", "new_path": "src/Simulation/BFER/Standard/BFER_std.cpp", "diff": "@@ -190,7 +190,7 @@ std::unique_ptr<module::Modem<B,R,R>> BFER_std<B,R,Q>\n}\nelse\n{\n- auto modem = std::unique_ptr<module::Modem<B,R,R>>(params_BFER_std.mdm->template build<B,R,R>());\n+ auto modem = std::unique_ptr<module::Modem<B,R,R>>(params_BFER_std.mdm->template build<B,R,R>(this->constellation.get()));\nmodem->set_noise(*this->noise);\nreturn modem;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/EXIT/EXIT.cpp", "new_path": "src/Simulation/EXIT/EXIT.cpp", "diff": "@@ -46,6 +46,13 @@ EXIT<B,R>\nif (params_EXIT.n_threads > 1)\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, \"EXIT simu does not support the multi-threading.\");\n+ try\n+ {\n+ auto cstl = params_EXIT.mdm->build_constellation<R>();\n+ constellation.reset(cstl);\n+ }\n+ catch(tools::cannot_allocate&) {}\n+\nthis->add_module(\"source\" , params_EXIT.n_threads);\nthis->add_module(\"codec\" , params_EXIT.n_threads);\nthis->add_module(\"encoder\" , params_EXIT.n_threads);\n@@ -357,7 +364,7 @@ template <typename B, typename R>\nstd::unique_ptr<module::Modem<B,R,R>> EXIT<B,R>\n::build_modem()\n{\n- auto modem = std::unique_ptr<module::Modem<B,R,R>>(params_EXIT.mdm->template build<B,R>());\n+ auto modem = std::unique_ptr<module::Modem<B,R,R>>(params_EXIT.mdm->template build<B,R>(this->constellation.get()));\nmodem->set_noise(this->noise);\nreturn modem;\n}\n@@ -368,7 +375,7 @@ std::unique_ptr<module::Modem<B,R>> EXIT<B,R>\n{\nstd::unique_ptr<factory::Modem> mdm_params(params_EXIT.mdm->clone());\nmdm_params->N = params_EXIT.cdc->K;\n- auto modem = std::unique_ptr<module::Modem<B,R>>(mdm_params->template build<B,R>());\n+ auto modem = std::unique_ptr<module::Modem<B,R>>(mdm_params->template build<B,R>(this->constellation.get()));\nmodem->set_noise(this->noise_a);\nreturn modem;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/EXIT/EXIT.hpp", "new_path": "src/Simulation/EXIT/EXIT.hpp", "diff": "@@ -45,6 +45,9 @@ protected:\nstd::unique_ptr<module::Decoder_SISO< R>> siso;\nstd::unique_ptr<module::Monitor_EXIT<B,R>> monitor;\n+ // modem constellation\n+ std::unique_ptr<tools::Constellation<R>> constellation;\n+\n// terminal and reporters (for the output of the code)\nstd::vector<std::unique_ptr<tools::Reporter>> reporters;\nstd::unique_ptr<tools::Terminal> terminal;\n" } ]
C++
MIT License
aff3ct/aff3ct
Simplify the memory management of codebooks and constellations.
8,490
12.11.2019 10:45:03
-3,600
7ffe71237b6d83e023ac2d7f4c28271e0774ca53
Replace '--mdm-codebook' argument by '--mdm-cb-path'.
[ { "change_type": "MODIFY", "old_path": "doc/source/user/simulation/parameters/modem/modem.rst", "new_path": "doc/source/user/simulation/parameters/modem/modem.rst", "diff": "@@ -386,16 +386,16 @@ Where |n0_equation|\nSee the :ref:`mdm-mdm-no-sig2` parameter to disable the division by\n:math:`\\sigma^2`.\n-.. _mdm-mdm-codebook:\n+.. _mdm-mdm-cb-path:\n-``--mdm-codebook``\n-\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n+``--mdm-cb-path``\n+\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n:Type: file\n:Rights: read/write\n- :Examples: ``--mdm-codebook conf/mod/SCMA/CS1.cb``\n+ :Examples: ``--mdm-cb-path conf/mod/SCMA/CS1.cb``\n-|factory::Modem::p+codebook|\n+|factory::Modem::p+cb-path|\n.. note:: Only 3 |BPS| codebook symbols are supported at this time.\n" }, { "change_type": "MODIFY", "old_path": "doc/strings.rst", "new_path": "doc/strings.rst", "diff": "Give the path to the ordered modulation symbols (constellation), to use with\nthe ``USER`` |modem|.\n-.. |factory::Modem::p+codebook| replace::\n+.. |factory::Modem::p+cb-path| replace::\nGive the path to the codebook, to use with the ``SCMA`` |modem|.\n.. |factory::Modem::p+cpm-std| replace::\n" }, { "change_type": "MODIFY", "old_path": "include/Factory/Module/Modem/Modem.hpp", "new_path": "include/Factory/Module/Modem/Modem.hpp", "diff": "@@ -34,7 +34,7 @@ public:\nstd::string type = \"BPSK\"; // modulation type (PAM, QAM, ...)\nstd::string implem = \"STD\";\nstd::string const_path = \"\"; // PATH to constellation file (CSV file)\n- std::string codebook = \"\"; // PATH to codebook file\n+ std::string codebook_path = \"\"; // PATH to codebook file\nbool complex = true; // true if the modulated signal is complex\nint bps = 1; // bits per symbol\n" }, { "change_type": "MODIFY", "old_path": "refs", "new_path": "refs", "diff": "-Subproject commit 1d8ba69eae32f73923b025de175f6bd4392ac9e9\n+Subproject commit bee5c6e2b86981d5664ef7b8ac8c330fafd31f84\n" }, { "change_type": "MODIFY", "old_path": "scripts/debug_parser/test/test.sh", "new_path": "scripts/debug_parser/test/test.sh", "diff": "@@ -22,13 +22,13 @@ $AFF3CT_PATH -p \"8\" --sim-type \"BFER\" -C \"POLAR\" -K \"32\" -N \"64\" -m \"2.81\" \\\n$AFF3CT_PATH --sim-type \"BFER\" -p \"8\" --sim-cde-type \"UNCODED\" -K \"12\" -m \"5\" \\\n-M \"5\" -s \"0.5\" --chn-type \"RAYLEIGH\" -t \"1\" --mdm-type \"SCMA\" --mdm-ite \"4\" \\\n--mnt-max-fe \"100\" -F \"6\" --sim-dbg --sim-meta \"Dump Test\" \\\n---mdm-codebook \"conf/mod/SCMA/CS1.cb\" \\\n+--mdm-cb-path \"conf/mod/SCMA/CS1.cb\" \\\n> dump_debug_gold2.txt\n$AFF3CT_PATH --sim-type \"BFER\" -p \"8\" --sim-cde-type \"UNCODED\" -K \"12\" -m \"5\" \\\n-M \"5\" -s \"0.5\" --chn-type \"USER\" --chn-path \"./refs/error_tracker_0.23.chn\" \\\n-t \"1\" --mdm-type \"SCMA\" --mdm-ite \"4\" --mnt-max-fe \"100\" -F \"6\" --sim-dbg-hex \\\n---sim-meta \"Dump Test\" --mdm-codebook \"conf/mod/SCMA/CS1.cb\" \\\n+--sim-meta \"Dump Test\" --mdm-cb-path \"conf/mod/SCMA/CS1.cb\" \\\n> dump_debug_gold4.txt\nrc=0\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Modem/Modem.cpp", "new_path": "src/Factory/Module/Modem/Modem.cpp", "diff": "@@ -66,7 +66,7 @@ void Modem\ntools::add_arg(args, p, class_name+\"p+const-path\",\ncli::File(cli::openmode::read_write));\n- tools::add_arg(args, p, class_name+\"p+codebook\",\n+ tools::add_arg(args, p, class_name+\"p+cb-path\",\ncli::File(cli::openmode::read));\ntools::add_arg(args, p, class_name+\"p+cpm-std\",\n@@ -116,7 +116,7 @@ void Modem\nif(vals.exist({p+\"-type\" })) this->type = vals.at ({p+\"-type\" });\nif(vals.exist({p+\"-implem\" })) this->implem = vals.at ({p+\"-implem\" });\nif(vals.exist({p+\"-cpm-std\" })) this->cpm_std = vals.at ({p+\"-cpm-std\" });\n- if(vals.exist({p+\"-codebook\"})) this->codebook = vals.to_file({p+\"-codebook\"});\n+ if(vals.exist({p+\"-cb-path\" })) this->codebook_path = vals.to_file({p+\"-cb-path\"});\nif (this->type == \"CPM\")\n{\n@@ -143,7 +143,7 @@ void Modem\nif (this->type == \"SCMA\")\n{\n- tools::Codebook<float> cb(this->codebook);\n+ tools::Codebook<float> cb(this->codebook_path);\nthis->bps = (int)cb.get_system_bps(); // codebook bps is float so here bps is stocked rounded\nthis->n_frames = cb.get_number_of_users();\n@@ -240,7 +240,7 @@ void Modem\n{\nheaders[p].push_back(std::make_pair(\"Number of iterations\", demod_ite ));\nheaders[p].push_back(std::make_pair(\"Psi function\", demod_psi ));\n- headers[p].push_back(std::make_pair(\"Codebook\", codebook ));\n+ headers[p].push_back(std::make_pair(\"Codebook\", codebook_path));\n}\nif (full) headers[p].push_back(std::make_pair(\"Channel type\", channel_type));\n@@ -284,10 +284,10 @@ template <typename B, typename R, typename Q>\nmodule::Modem<B,R,Q>* Modem\n::_build_scma() const\n{\n- if (this->psi == \"PSI0\") return new module::Modem_SCMA<B,R,Q,tools::psi_0<Q>>(this->N, this->codebook, this->no_sig2, this->n_ite, this->n_frames);\n- if (this->psi == \"PSI1\") return new module::Modem_SCMA<B,R,Q,tools::psi_1<Q>>(this->N, this->codebook, this->no_sig2, this->n_ite, this->n_frames);\n- if (this->psi == \"PSI2\") return new module::Modem_SCMA<B,R,Q,tools::psi_2<Q>>(this->N, this->codebook, this->no_sig2, this->n_ite, this->n_frames);\n- if (this->psi == \"PSI3\") return new module::Modem_SCMA<B,R,Q,tools::psi_3<Q>>(this->N, this->codebook, this->no_sig2, this->n_ite, this->n_frames);\n+ if (this->psi == \"PSI0\") return new module::Modem_SCMA<B,R,Q,tools::psi_0<Q>>(this->N, this->codebook_path, this->no_sig2, this->n_ite, this->n_frames);\n+ if (this->psi == \"PSI1\") return new module::Modem_SCMA<B,R,Q,tools::psi_1<Q>>(this->N, this->codebook_path, this->no_sig2, this->n_ite, this->n_frames);\n+ if (this->psi == \"PSI2\") return new module::Modem_SCMA<B,R,Q,tools::psi_2<Q>>(this->N, this->codebook_path, this->no_sig2, this->n_ite, this->n_frames);\n+ if (this->psi == \"PSI3\") return new module::Modem_SCMA<B,R,Q,tools::psi_3<Q>>(this->N, this->codebook_path, this->no_sig2, this->n_ite, this->n_frames);\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Replace '--mdm-codebook' argument by '--mdm-cb-path'.
8,490
13.11.2019 11:18:12
-3,600
e0ed05573f716dd90a08d941579c4e957f383773
Simplify the 'start_thread_build_comm_chain' prototype.
[ { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.cpp", "new_path": "src/Simulation/BFER/BFER.cpp", "diff": "@@ -79,9 +79,8 @@ void BFER<B,R,Q>\n// build the communication chain in multi-threaded mode\nstd::vector<std::thread> threads(params_BFER.n_threads -1);\nfor (auto tid = 1; tid < params_BFER.n_threads; tid++)\n- threads[tid -1] = std::thread(BFER<B,R,Q>::start_thread_build_comm_chain, this, tid);\n-\n- BFER<B,R,Q>::start_thread_build_comm_chain(this, 0);\n+ threads[tid -1] = std::thread(&BFER<B,R,Q>::start_thread_build_comm_chain, this, tid);\n+ this->start_thread_build_comm_chain(0);\n// join the slave threads with the master thread\nfor (auto tid = 1; tid < params_BFER.n_threads; tid++)\n@@ -381,39 +380,39 @@ void BFER<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nvoid BFER<B,R,Q>\n-::start_thread_build_comm_chain(BFER<B,R,Q> *simu, const int tid)\n+::start_thread_build_comm_chain(const int tid)\n{\ntry\n{\n- simu->__build_communication_chain(tid);\n+ this->__build_communication_chain(tid);\n- if (simu->params_BFER.err_track_enable)\n- simu->monitor_er[tid]->record_callback_fe(std::bind(&tools::Dumper::add,\n- simu->dumper[tid].get(),\n+ if (this->params_BFER.err_track_enable)\n+ this->monitor_er[tid]->record_callback_fe(std::bind(&tools::Dumper::add,\n+ this->dumper[tid].get(),\nstd::placeholders::_1,\nstd::placeholders::_2));\n}\ncatch (std::exception const& e)\n{\ntools::Terminal::stop();\n- simu->simu_error = true;\n+ this->simu_error = true;\n- simu->mutex_exception.lock();\n+ this->mutex_exception.lock();\nauto save = tools::exception::no_backtrace;\ntools::exception::no_backtrace = true;\nstd::string msg = e.what(); // get only the function signature\ntools::exception::no_backtrace = save;\n- if (std::find(simu->prev_err_messages.begin(), simu->prev_err_messages.end(), msg) ==\n- simu->prev_err_messages.end())\n+ if (std::find(this->prev_err_messages.begin(), this->prev_err_messages.end(), msg) ==\n+ this->prev_err_messages.end())\n{\n// with backtrace if debug mode\nrang::format_on_each_line(std::cerr, std::string(e.what()) + \"\\n\", rang::tag::error);\n// save only the function signature\n- simu->prev_err_messages.push_back(msg);\n+ this->prev_err_messages.push_back(msg);\n}\n- simu->mutex_exception.unlock();\n+ this->mutex_exception.unlock();\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.hpp", "new_path": "src/Simulation/BFER/BFER.hpp", "diff": "@@ -99,7 +99,7 @@ protected:\nbool stop_time_reached();\nprivate:\n- static void start_thread_build_comm_chain(BFER<B,R,Q> *simu, const int tid);\n+ void start_thread_build_comm_chain(const int tid);\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Simplify the 'start_thread_build_comm_chain' prototype.
8,490
13.11.2019 11:20:42
-3,600
18f1d5131d51615a9d58678413f2ca8a360dae71
Improve the 'Callback' class by adding thread safety.
[ { "change_type": "MODIFY", "old_path": "include/Tools/Algo/Callback/Callback.hpp", "new_path": "include/Tools/Algo/Callback/Callback.hpp", "diff": "#ifndef CALLBACK_HPP__\n#define CALLBACK_HPP__\n+#include <mutex>\n#include <vector>\n#include <cstdint>\n#include <utility>\n@@ -19,15 +20,17 @@ class Callback\n{\nprotected:\nstd::vector<std::pair<std::function<void(Args...)>, uint32_t>> callbacks;\n+ mutable std::mutex mtx;\npublic:\nCallback() = default;\n+ Callback(const Callback &c);\nvirtual ~Callback() = default;\nuint32_t record(std::function<void(Args...)> callback);\nbool unrecord(const uint32_t id);\nvoid clear();\n- void notify(Args ... args) const;\n+ void notify(Args ... args);\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Algo/Callback/Callback.hxx", "new_path": "include/Tools/Algo/Callback/Callback.hxx", "diff": "@@ -5,14 +5,25 @@ namespace aff3ct\nnamespace tools\n{\n+template <class... Args>\n+Callback<Args...>\n+::Callback(const Callback &c)\n+{\n+ c.mtx.lock();\n+ this->callbacks = c.callbacks;\n+ c.mtx.unlock();\n+}\n+\ntemplate <class... Args>\nuint32_t Callback<Args...>\n::record(std::function<void(Args...)> callback)\n{\n+ this->mtx.lock();\nuint32_t id = 0;\nif (this->callbacks.size())\nid = this->callbacks[this->callbacks.size() -1].second +1;\nthis->callbacks.push_back(std::make_pair(callback, id));\n+ this->mtx.unlock();\nreturn id;\n}\n@@ -20,17 +31,20 @@ template <class... Args>\nbool Callback<Args...>\n::unrecord(const uint32_t id)\n{\n+ this->mtx.lock();\nauto it = this->callbacks.begin();\nwhile (it != this->callbacks.end())\n{\nif ((*it).second == id)\n{\nit = this->callbacks.erase(it);\n+ this->mtx.unlock();\nreturn true;\n}\nelse\n++it;\n}\n+ this->mtx.unlock();\nreturn false;\n}\n@@ -38,15 +52,19 @@ template <class... Args>\nvoid Callback<Args...>\n::clear()\n{\n+ this->mtx.lock();\nthis->callbacks.clear();\n+ this->mtx.unlock();\n}\ntemplate <class... Args>\nvoid Callback<Args...>\n-::notify(Args ... args) const\n+::notify(Args ... args)\n{\n+ this->mtx.lock();\nfor (auto& c : this->callbacks)\nc.first(args...);\n+ this->mtx.unlock();\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve the 'Callback' class by adding thread safety.
8,490
13.11.2019 11:20:55
-3,600
7a30fdc0a7d84edd7e232624f565a0239ed93ed8
Use pointer for dynamic cast.
[ { "change_type": "MODIFY", "old_path": "src/Tools/Display/Reporter/Noise/Reporter_noise.cpp", "new_path": "src/Tools/Display/Reporter/Noise/Reporter_noise.cpp", "diff": "@@ -57,20 +57,20 @@ Reporter::report_t Reporter_noise<R>\n{\ncase Noise_type::SIGMA:\n{\n- auto sig = dynamic_cast<const tools::Sigma<R>&>(noise);\n+ auto sig = dynamic_cast<const tools::Sigma<R>*>(&noise);\nif (show_sigma)\n{\n- stream << std::setprecision(4) << std::fixed << sig.get_value();\n+ stream << std::setprecision(4) << std::fixed << sig->get_value();\nnoise_report.push_back(stream.str());\nstream.str(\"\");\n}\n- stream << std::setprecision(2) << std::fixed << sig.get_esn0();\n+ stream << std::setprecision(2) << std::fixed << sig->get_esn0();\nnoise_report.push_back(stream.str());\nstream.str(\"\");\n- stream << std::setprecision(2) << std::fixed << sig.get_ebn0();\n+ stream << std::setprecision(2) << std::fixed << sig->get_ebn0();\nbreak;\n}\ncase Noise_type::ROP:\n" } ]
C++
MIT License
aff3ct/aff3ct
Use pointer for dynamic cast.
8,490
13.11.2019 23:32:52
-3,600
e8502ef85e4ea089ceb06b47be223df071dd6d52
Fix fixed noise value for the frozen bits generation.
[ { "change_type": "MODIFY", "old_path": "src/Module/Codec/Polar/Codec_polar.cpp", "new_path": "src/Module/Codec/Polar/Codec_polar.cpp", "diff": "@@ -132,15 +132,16 @@ Codec_polar<B,Q>\n{\nif (fb_params.type == \"BEC\")\n{\n- auto ep = tools::Event_probability<float>(fb_params.noise);\n+ tools::Event_probability<> ep(fb_params.noise);\nfb_generator->set_noise(ep);\n+ fb_generator->generate(frozen_bits);\n}\nelse /* type = GA, TV or FILE */\n{\n- auto sigma = tools::Sigma<float>(fb_params.noise);\n+ tools::Sigma<> sigma(fb_params.noise);\nfb_generator->set_noise(sigma);\n- }\nfb_generator->generate(frozen_bits);\n+ }\nif (this->N_cw != this->N && puncturer_shortlast)\npuncturer_shortlast->gen_frozen_bits(frozen_bits);\nthis->notify_frozenbits_update();\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix fixed noise value for the frozen bits generation.
8,490
15.11.2019 11:15:59
-3,600
4082a415e82b490d81c554c7e8692411fd311310
Copy the CRC in the classes that use it.
[ { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Polar/SCF/Decoder_polar_SCF_naive.hpp", "new_path": "include/Module/Decoder/Polar/SCF/Decoder_polar_SCF_naive.hpp", "diff": "@@ -22,7 +22,7 @@ template <typename B = int, typename R = float, tools::proto_f< R> F = tools::f\nclass Decoder_polar_SCF_naive : public Decoder_polar_SC_naive<B,R,F,G,H>\n{\nprotected:\n- CRC<B>& crc;\n+ CRC<B> crc;\nconst int n_flips;\nstd::vector<int> index;\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hpp", "new_path": "include/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hpp", "diff": "@@ -30,7 +30,7 @@ private:\nbool fast_store;\nprotected:\n- CRC<B>& crc;\n+ CRC<B> crc;\nmipp::vector<B> U_test;\npublic:\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hpp", "new_path": "include/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hpp", "diff": "@@ -30,7 +30,7 @@ private:\nbool fast_store;\nprotected:\n- CRC<B>& crc;\n+ CRC<B> crc;\nmipp::vector<B> U_test;\npublic:\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_naive_CA.hpp", "new_path": "include/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_naive_CA.hpp", "diff": "@@ -17,7 +17,7 @@ template <typename B, typename R, tools::proto_f<R> F = tools::f_LLR, tools::pro\nclass Decoder_polar_SCL_naive_CA : public Decoder_polar_SCL_naive<B,R,F,G>\n{\nprotected:\n- CRC<B>& crc;\n+ CRC<B> crc;\npublic:\nDecoder_polar_SCL_naive_CA(const int& K, const int& N, const int& L, const std::vector<bool>& frozen_bits,\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Code/Turbo/Post_processing_SISO/CRC/CRC_checker.hpp", "new_path": "include/Tools/Code/Turbo/Post_processing_SISO/CRC/CRC_checker.hpp", "diff": "@@ -20,7 +20,7 @@ class CRC_checker : public Post_processing_SISO<B,R>\nprotected:\nconst int start_crc_check_ite;\nconst int simd_inter_frame_level;\n- module::CRC<B> &crc;\n+ module::CRC<B> crc;\npublic:\nCRC_checker(module::CRC<B> &crc, const int start_crc_check_ite = 2, const int simd_inter_frame_level = 1);\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Code/Turbo/Post_processing_SISO/Flip_and_check/Flip_and_check.hpp", "new_path": "include/Tools/Code/Turbo/Post_processing_SISO/Flip_and_check/Flip_and_check.hpp", "diff": "@@ -27,7 +27,6 @@ private:\nmipp::vector<B> fnc_ite;\npublic:\n-\nFlip_and_check(const int K,\nconst int n_ite,\nmodule::CRC<B> &crc,\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Code/Turbo/Post_processing_SISO/Flip_and_check/Flip_and_check_DB.hpp", "new_path": "include/Tools/Code/Turbo/Post_processing_SISO/Flip_and_check/Flip_and_check_DB.hpp", "diff": "@@ -20,7 +20,6 @@ class Flip_and_check_DB : public CRC_checker_DB<B,R>\n{\nprivate:\nconst int K;\n-\nconst int q;\nmipp::vector<R> metric;\nmipp::vector<B> s_tmp;\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Code/Turbo/Post_processing_SISO/Self_corrected/Self_corrected.hpp", "new_path": "include/Tools/Code/Turbo/Post_processing_SISO/Self_corrected/Self_corrected.hpp", "diff": "@@ -20,7 +20,6 @@ class Self_corrected : public Post_processing_SISO<B,R>\nprivate:\nconst int K;\nconst int simd_inter_frame_level;\n-\nconst int m;\nconst int M;\n" } ]
C++
MIT License
aff3ct/aff3ct
Copy the CRC in the classes that use it.
8,490
15.11.2019 14:56:54
-3,600
81b6e3d1d2bc08dc18da3879e907495832747cda
Simplify the memory management of the 'Pattern_polar_i'.
[ { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hpp", "new_path": "include/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-#include <memory>\n#include <vector>\n#include \"Tools/Code/Polar/API/API_polar_dynamic_seq.hpp\"\n@@ -39,7 +38,7 @@ public:\nDecoder_polar_ASCL_MEM_fast_CA_sys(const int& K, const int& N, const int& max_L,\nconst std::vector<bool>& frozen_bits,\n- std::vector<std::unique_ptr<tools::Pattern_polar_i>> &&polar_patterns,\n+ const std::vector<tools::Pattern_polar_i*> &polar_patterns,\nconst int idx_r0, const int idx_r1,\nconst CRC<B>& crc, const bool is_full_adaptive = true, const int n_frames = 1);\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hxx", "new_path": "include/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hxx", "diff": "@@ -25,11 +25,11 @@ template <typename B, typename R, class API_polar>\nDecoder_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,\nconst std::vector<bool>& frozen_bits,\n- std::vector<std::unique_ptr<tools::Pattern_polar_i>> &&polar_patterns,\n+ const std::vector<tools::Pattern_polar_i*> &polar_patterns,\nconst int idx_r0, const int idx_r1,\nconst CRC<B>& crc, const bool is_full_adaptive, const int n_frames)\n: Decoder(K, N, n_frames, 1),\n- Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>(K, N, L_max, frozen_bits, std::move(polar_patterns), idx_r0, idx_r1, crc, n_frames),\n+ Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>(K, N, L_max, frozen_bits, polar_patterns, idx_r0, idx_r1, crc, n_frames),\nsc_decoder (K, N , frozen_bits, n_frames),\nL_max(L_max), is_full_adaptive(is_full_adaptive)\n{\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hpp", "new_path": "include/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hpp", "diff": "#ifndef DECODER_POLAR_ASCL_FAST_SYS_CA\n#define DECODER_POLAR_ASCL_FAST_SYS_CA\n-#include <memory>\n#include <vector>\n#include \"Tools/Code/Polar/API/API_polar_dynamic_seq.hpp\"\n@@ -37,7 +36,7 @@ public:\nconst CRC<B>& crc, const bool is_full_adaptive = true, const int n_frames = 1);\nDecoder_polar_ASCL_fast_CA_sys(const int& K, const int& N, const int& max_L, const std::vector<bool>& frozen_bits,\n- std::vector<std::unique_ptr<tools::Pattern_polar_i>> &&polar_patterns,\n+ const std::vector<tools::Pattern_polar_i*> &polar_patterns,\nconst int idx_r0, const int idx_r1,\nconst CRC<B>& crc, const bool is_full_adaptive = true, const int n_frames = 1);\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hxx", "new_path": "include/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hxx", "diff": "@@ -23,7 +23,7 @@ Decoder_polar_ASCL_fast_CA_sys<B,R,API_polar>\ntemplate <typename B, typename R, class API_polar>\nDecoder_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 std::vector<bool>& frozen_bits,\n- std::vector<std::unique_ptr<tools::Pattern_polar_i>> &&polar_patterns,\n+ const std::vector<tools::Pattern_polar_i*> &polar_patterns,\nconst int idx_r0, const int idx_r1,\nconst CRC<B>& crc, const bool is_full_adaptive, const int n_frames)\n: Decoder(K, N, n_frames, 1),\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hpp", "new_path": "include/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hpp", "diff": "#ifndef DECODER_POLAR_SC_FAST_SYS_\n#define DECODER_POLAR_SC_FAST_SYS_\n-#include <memory>\n#include <vector>\n#include <mipp.h>\n@@ -52,7 +51,7 @@ public:\nDecoder_polar_SC_fast_sys(const int& K, const int& N, const std::vector<bool>& frozen_bits, const int n_frames = 1);\nDecoder_polar_SC_fast_sys(const int& K, const int& N, const std::vector<bool>& frozen_bits,\n- std::vector<std::unique_ptr<tools::Pattern_polar_i>>&& polar_patterns,\n+ const std::vector<tools::Pattern_polar_i*> &polar_patterns,\nconst int idx_r0, const int idx_r1, const int n_frames = 1);\nvirtual ~Decoder_polar_SC_fast_sys() = default;\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx", "new_path": "include/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx", "diff": "@@ -173,7 +173,7 @@ Decoder_polar_SC_fast_sys<B,R,API_polar>\ntemplate <typename B, typename R, class API_polar>\nDecoder_polar_SC_fast_sys<B,R,API_polar>\n::Decoder_polar_SC_fast_sys(const int& K, const int& N, const std::vector<bool>& frozen_bits,\n- std::vector<std::unique_ptr<tools::Pattern_polar_i>> &&polar_patterns,\n+ const std::vector<tools::Pattern_polar_i*> &polar_patterns,\nconst int idx_r0, const int idx_r1, const int n_frames)\n: Decoder (K, N, n_frames, API_polar::get_n_frames()),\nDecoder_SIHO<B,R>(K, N, n_frames, API_polar::get_n_frames()),\n@@ -182,7 +182,7 @@ Decoder_polar_SC_fast_sys<B,R,API_polar>\ns (1 * N * this->simd_inter_frame_level + mipp::nElReg<B>(), 0),\ns_bis (1 * N * this->simd_inter_frame_level + mipp::nElReg<B>() ),\nfrozen_bits (frozen_bits),\n- polar_patterns (N, frozen_bits, std::move(polar_patterns), idx_r0, idx_r1)\n+ polar_patterns (N, frozen_bits, polar_patterns, idx_r0, idx_r1)\n{\nconst std::string name = \"Decoder_polar_SC_fast_sys\";\nthis->set_name(name);\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hpp", "new_path": "include/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-#include <memory>\n#include <vector>\n#include <mipp.h>\n@@ -38,7 +37,7 @@ public:\nconst CRC<B>& crc, const int n_frames = 1);\nDecoder_polar_SCL_MEM_fast_CA_sys(const int& K, const int& N, const int& L, const std::vector<bool>& frozen_bits,\n- std::vector<std::unique_ptr<tools::Pattern_polar_i>> &&polar_patterns,\n+ const std::vector<tools::Pattern_polar_i*> &polar_patterns,\nconst int idx_r0, const int idx_r1, const CRC<B>& crc, const int n_frames = 1);\nvirtual ~Decoder_polar_SCL_MEM_fast_CA_sys() = default;\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hxx", "new_path": "include/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hxx", "diff": "@@ -34,11 +34,11 @@ Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>\ntemplate <typename B, typename R, class API_polar>\nDecoder_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 std::vector<bool>& frozen_bits,\n- std::vector<std::unique_ptr<tools::Pattern_polar_i>> &&polar_patterns,\n+ const std::vector<tools::Pattern_polar_i*> &polar_patterns,\nconst int idx_r0, const int idx_r1,\nconst CRC<B>& crc, const int n_frames)\n: Decoder(K, N, n_frames, API_polar::get_n_frames()),\n- Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>(K, N, L, frozen_bits, std::move(polar_patterns), idx_r0, idx_r1, n_frames),\n+ Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>(K, N, L, frozen_bits, polar_patterns, idx_r0, idx_r1, n_frames),\nfast_store(false), crc(crc), U_test(K)\n{\nconst std::string name = \"Decoder_polar_SCL_MEM_fast_CA_sys\";\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hpp", "new_path": "include/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hpp", "diff": "#ifndef DECODER_POLAR_SCL_FAST_SYS_CA\n#define DECODER_POLAR_SCL_FAST_SYS_CA\n-#include <memory>\n#include <vector>\n#include <mipp.h>\n@@ -38,7 +37,7 @@ public:\nconst CRC<B>& crc, const int n_frames = 1);\nDecoder_polar_SCL_fast_CA_sys(const int& K, const int& N, const int& L, const std::vector<bool>& frozen_bits,\n- std::vector<std::unique_ptr<tools::Pattern_polar_i>> &&polar_patterns,\n+ const std::vector<tools::Pattern_polar_i*> &polar_patterns,\nconst int idx_r0, const int idx_r1, const CRC<B>& crc, const int n_frames = 1);\nvirtual ~Decoder_polar_SCL_fast_CA_sys() = default;\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hxx", "new_path": "include/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hxx", "diff": "@@ -33,10 +33,10 @@ Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>\ntemplate <typename B, typename R, class API_polar>\nDecoder_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 std::vector<bool>& frozen_bits,\n- std::vector<std::unique_ptr<tools::Pattern_polar_i>> &&polar_patterns,\n+ const std::vector<tools::Pattern_polar_i*> &polar_patterns,\nconst int idx_r0, const int idx_r1, const CRC<B>& crc, const int n_frames)\n: Decoder(K, N, n_frames, API_polar::get_n_frames()),\n- Decoder_polar_SCL_fast_sys<B,R,API_polar>(K, N, L, frozen_bits, std::move(polar_patterns), idx_r0, idx_r1, n_frames),\n+ Decoder_polar_SCL_fast_sys<B,R,API_polar>(K, N, L, frozen_bits, polar_patterns, idx_r0, idx_r1, n_frames),\nfast_store(false), crc(crc), U_test(K)\n{\nconst std::string name = \"Decoder_polar_SCL_fast_CA_sys\";\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hpp", "new_path": "include/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hpp", "diff": "#ifndef DECODER_POLAR_SCL_MEM_FAST_SYS\n#define DECODER_POLAR_SCL_MEM_FAST_SYS\n-#include <memory>\n#include <vector>\n#include <mipp.h>\n@@ -67,7 +66,7 @@ public:\nconst int n_frames = 1);\nDecoder_polar_SCL_MEM_fast_sys(const int& K, const int& N, const int& L, const std::vector<bool>& frozen_bits,\n- std::vector<std::unique_ptr<tools::Pattern_polar_i>> &&polar_patterns,\n+ const std::vector<tools::Pattern_polar_i*> &polar_patterns,\nconst int idx_r0, const int idx_r1,\nconst int n_frames = 1);\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx", "new_path": "include/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx", "diff": "@@ -122,7 +122,7 @@ Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\ntemplate <typename B, typename R, class API_polar>\nDecoder_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 std::vector<bool>& frozen_bits,\n- std::vector<std::unique_ptr<tools::Pattern_polar_i>> &&polar_patterns,\n+ const std::vector<tools::Pattern_polar_i*> &polar_patterns,\nconst int idx_r0, const int idx_r1,\nconst int n_frames)\n: Decoder (K, N, n_frames, API_polar::get_n_frames()),\n@@ -130,7 +130,7 @@ Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\nm ((int)std::log2(N)),\nL (L),\nfrozen_bits (frozen_bits),\n- polar_patterns (N, frozen_bits, std::move(polar_patterns), idx_r0, idx_r1),\n+ polar_patterns (N, frozen_bits, polar_patterns, idx_r0, idx_r1),\npaths (L),\nmetrics (L),\nl (L, mipp::vector<R>(N + mipp::nElReg<R>())),\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp", "new_path": "include/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 <memory>\n#include <vector>\n#include <mipp.h>\n@@ -62,7 +61,7 @@ public:\nconst int n_frames = 1);\nDecoder_polar_SCL_fast_sys(const int& K, const int& N, const int& L, const std::vector<bool>& frozen_bits,\n- std::vector<std::unique_ptr<tools::Pattern_polar_i>> &&polar_patterns,\n+ const std::vector<tools::Pattern_polar_i*> &polar_patterns,\nconst int idx_r0, const int idx_r1, const int n_frames = 1);\nvirtual ~Decoder_polar_SCL_fast_sys();\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "new_path": "include/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx", "diff": "@@ -148,14 +148,14 @@ Decoder_polar_SCL_fast_sys<B,R,API_polar>\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 std::vector<bool>& frozen_bits,\n- std::vector<std::unique_ptr<tools::Pattern_polar_i>> &&polar_patterns,\n+ const std::vector<tools::Pattern_polar_i*> &polar_patterns,\nconst int idx_r0, const int idx_r1, const int n_frames)\n: Decoder (K, N, n_frames, API_polar::get_n_frames()),\nDecoder_SIHO<B,R>(K, N, n_frames, API_polar::get_n_frames()),\nm ((int)std::log2(N)),\nL (L),\nfrozen_bits (frozen_bits),\n- polar_patterns (N, frozen_bits, std::move(polar_patterns), idx_r0, idx_r1),\n+ polar_patterns (N, frozen_bits, polar_patterns, idx_r0, idx_r1),\npaths (L),\nmetrics (L),\nl (L, mipp::vector<R>(N + mipp::nElReg<R>())),\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Polar/Decoder_polar.cpp", "new_path": "src/Factory/Module/Decoder/Polar/Decoder_polar.cpp", "diff": "@@ -208,8 +208,8 @@ module::Decoder_SIHO<B,Q>* Decoder_polar\nif (crc == nullptr || crc->get_size() == 0)\n{\nint idx_r0, idx_r1;\n- auto polar_patterns = tools::Nodes_parser<>::parse_uptr(this->polar_nodes, idx_r0, idx_r1);\n- if (this->type == \"SC\" ) return new module::Decoder_polar_SC_fast_sys<B, Q, API_polar>(this->K, this->N_cw, frozen_bits, std::move(polar_patterns), idx_r0, idx_r1, this->n_frames);\n+ auto polar_patterns = tools::Nodes_parser<>::parse_ptr(this->polar_nodes, idx_r0, idx_r1);\n+ if (this->type == \"SC\" ) return new module::Decoder_polar_SC_fast_sys<B, Q, API_polar>(this->K, this->N_cw, frozen_bits, polar_patterns, idx_r0, idx_r1, this->n_frames);\n}\n}\n}\n@@ -222,21 +222,21 @@ module::Decoder_SIHO<B,Q>* Decoder_polar\n::_build_scl_fast(const std::vector<bool> &frozen_bits, module::CRC<B> *crc, module::Encoder<B> *encoder) const\n{\nint idx_r0, idx_r1;\n- auto polar_patterns = tools::Nodes_parser<>::parse_uptr(this->polar_nodes, idx_r0, idx_r1);\n+ auto polar_patterns = tools::Nodes_parser<>::parse_ptr(this->polar_nodes, idx_r0, idx_r1);\nif (this->implem == \"FAST\" && this->systematic)\n{\nif (crc != nullptr && crc->get_size() > 0)\n{\n- if (this->type == \"ASCL\" ) return new module::Decoder_polar_ASCL_fast_CA_sys <B, Q, API_polar>(this->K, this->N_cw, this->L, frozen_bits, std::move(polar_patterns), idx_r0, idx_r1, *crc, this->full_adaptive, this->n_frames);\n- if (this->type == \"ASCL_MEM\") return new module::Decoder_polar_ASCL_MEM_fast_CA_sys<B, Q, API_polar>(this->K, this->N_cw, this->L, frozen_bits, std::move(polar_patterns), idx_r0, idx_r1, *crc, this->full_adaptive, this->n_frames);\n- if (this->type == \"SCL\" ) return new module::Decoder_polar_SCL_fast_CA_sys <B, Q, API_polar>(this->K, this->N_cw, this->L, frozen_bits, std::move(polar_patterns), idx_r0, idx_r1, *crc, this->n_frames);\n- if (this->type == \"SCL_MEM\" ) return new module::Decoder_polar_SCL_MEM_fast_CA_sys <B, Q, API_polar>(this->K, this->N_cw, this->L, frozen_bits, std::move(polar_patterns), idx_r0, idx_r1, *crc, this->n_frames);\n+ if (this->type == \"ASCL\" ) return new module::Decoder_polar_ASCL_fast_CA_sys <B, Q, API_polar>(this->K, this->N_cw, this->L, frozen_bits, polar_patterns, idx_r0, idx_r1, *crc, this->full_adaptive, this->n_frames);\n+ if (this->type == \"ASCL_MEM\") return new module::Decoder_polar_ASCL_MEM_fast_CA_sys<B, Q, API_polar>(this->K, this->N_cw, this->L, frozen_bits, polar_patterns, idx_r0, idx_r1, *crc, this->full_adaptive, this->n_frames);\n+ if (this->type == \"SCL\" ) return new module::Decoder_polar_SCL_fast_CA_sys <B, Q, API_polar>(this->K, this->N_cw, this->L, frozen_bits, polar_patterns, idx_r0, idx_r1, *crc, this->n_frames);\n+ if (this->type == \"SCL_MEM\" ) return new module::Decoder_polar_SCL_MEM_fast_CA_sys <B, Q, API_polar>(this->K, this->N_cw, this->L, frozen_bits, polar_patterns, idx_r0, idx_r1, *crc, this->n_frames);\n}\nelse\n{\n- if (this->type == \"SCL\" ) return new module::Decoder_polar_SCL_fast_sys <B, Q, API_polar>(this->K, this->N_cw, this->L, frozen_bits, std::move(polar_patterns), idx_r0, idx_r1, this->n_frames);\n- if (this->type == \"SCL_MEM\" ) return new module::Decoder_polar_SCL_MEM_fast_sys <B, Q, API_polar>(this->K, this->N_cw, this->L, frozen_bits, std::move(polar_patterns), idx_r0, idx_r1, this->n_frames);\n+ if (this->type == \"SCL\" ) return new module::Decoder_polar_SCL_fast_sys <B, Q, API_polar>(this->K, this->N_cw, this->L, frozen_bits, polar_patterns, idx_r0, idx_r1, this->n_frames);\n+ if (this->type == \"SCL_MEM\" ) return new module::Decoder_polar_SCL_MEM_fast_sys <B, Q, API_polar>(this->K, this->N_cw, this->L, frozen_bits, polar_patterns, idx_r0, idx_r1, this->n_frames);\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Simplify the memory management of the 'Pattern_polar_i'.
8,490
15.11.2019 16:17:50
-3,600
7e5c2057a87dbca27d86a1291685df616ada622f
Fix segfault because of H in LDPC decoders.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/LDPC/BP/Decoder_LDPC_BP.cpp", "new_path": "src/Module/Decoder/LDPC/BP/Decoder_LDPC_BP.cpp", "diff": "@@ -12,7 +12,7 @@ Decoder_LDPC_BP\nconst bool enable_syndrome,\nconst int syndrome_depth)\n: n_ite (n_ite ),\n- H (_H.turn(tools::Sparse_matrix::Way::VERTICAL)),\n+ H (_H ),\nenable_syndrome (enable_syndrome),\nsyndrome_depth (syndrome_depth ),\ncur_syndrome_depth(0 )\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix segfault because of H in LDPC decoders.
8,490
15.11.2019 18:13:52
-3,600
3b444250c253960912e67a46ab9351d90b5558dd
Add copy method in the 'Module' class.
[ { "change_type": "MODIFY", "old_path": "include/Module/Module.hpp", "new_path": "include/Module/Module.hpp", "diff": "@@ -53,6 +53,7 @@ public:\nexplicit Module(const int n_frames = 1);\n#ifndef AFF3CT_SYSTEMC_MODULE\n+ virtual void copy(const Module &m);\nvirtual Module* clone() const;\n#endif\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Module.cpp", "new_path": "src/Module/Module.cpp", "diff": "@@ -22,27 +22,34 @@ Module\n}\n#ifndef AFF3CT_SYSTEMC_MODULE\n-Module* Module\n-::clone() const\n+\n+void Module\n+::copy(const Module &m)\n{\n- auto m = new Module(*this);\n- m->tasks_with_nullptr.clear();\n- m->tasks.clear();\n+ this->tasks_with_nullptr.clear();\n+ this->tasks.clear();\n- for (auto &t : this->tasks_with_nullptr)\n+ for (auto &t : m.tasks_with_nullptr)\n{\nif (t == nullptr)\n- m->tasks_with_nullptr.push_back(nullptr);\n+ this->tasks_with_nullptr.push_back(nullptr);\nelse\n{\nauto t_new = std::shared_ptr<Task>(t->clone());\n- m->tasks_with_nullptr.push_back(t_new);\n- m->tasks.push_back(std::move(t_new));\n+ this->tasks_with_nullptr.push_back(t_new);\n+ this->tasks.push_back(std::move(t_new));\n+ }\n}\n}\n+Module* Module\n+::clone() const\n+{\n+ auto m = new Module(*this); // soft copy constructor\n+ m->copy(*this); // hard copy\nreturn m;\n}\n+\n#endif\nint Module\n" } ]
C++
MIT License
aff3ct/aff3ct
Add copy method in the 'Module' class.
8,490
21.11.2019 10:39:15
-3,600
97fbc3016ea2db93e0262480d765d183f12630fd
Rm wrong declaration.
[ { "change_type": "MODIFY", "old_path": "include/Tools/Codec/Uncoded/Codec_uncoded.hpp", "new_path": "include/Tools/Codec/Uncoded/Codec_uncoded.hpp", "diff": "@@ -20,9 +20,6 @@ public:\nCodec_uncoded(const factory::Encoder_NO &enc_params,\nconst factory::Decoder_NO &dec_params);\nvirtual ~Codec_uncoded() = default;\n-\n-protected:\n- void _extract_sys_par(const Q *Y_N, Q *sys, Q *par, const int frame_id);\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Rm wrong declaration.
8,490
21.11.2019 10:40:05
-3,600
82b91aa01e5df6a3704907de537d016180e9566b
CI : temporarily disable MSVC build.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -395,28 +395,28 @@ build-windows-gcc-x64-avx2:\n- call ./ci/tools/threads.bat\n- ./ci/build-windows-gcc.bat\n-build-windows-msvc-avx:\n- stage: build\n- variables:\n- GIT_SUBMODULE_STRATEGY: recursive\n- except:\n- - schedules\n- dependencies: []\n- tags:\n- - windows\n- - msvc\n- - cmake\n- - x86\n- artifacts:\n- name: build-windows-msvc-avx\n- paths:\n- - build_windows_msvc_avx\n- script:\n- - set \"CFLAGS=-D_CRT_SECURE_NO_DEPRECATE /MT /EHsc /arch:AVX\"\n- - set \"CMAKE_OPT=-DAFF3CT_COMPILE_EXE=ON -DAFF3CT_COMPILE_STATIC_LIB=ON -DAFF3CT_COMPILE_SHARED_LIB=ON -DAFF3CT_PREC=MULTI\"\n- - set \"NAME=build_windows_msvc_avx\"\n- - call ./ci/tools/threads.bat\n- - ./ci/build-windows-msvc.bat\n+# build-windows-msvc-avx:\n+# stage: build\n+# variables:\n+# GIT_SUBMODULE_STRATEGY: recursive\n+# except:\n+# - schedules\n+# dependencies: []\n+# tags:\n+# - windows\n+# - msvc\n+# - cmake\n+# - x86\n+# artifacts:\n+# name: build-windows-msvc-avx\n+# paths:\n+# - build_windows_msvc_avx\n+# script:\n+# - set \"CFLAGS=-D_CRT_SECURE_NO_DEPRECATE /MT /EHsc /arch:AVX\"\n+# - set \"CMAKE_OPT=-DAFF3CT_COMPILE_EXE=ON -DAFF3CT_COMPILE_STATIC_LIB=ON -DAFF3CT_COMPILE_SHARED_LIB=ON -DAFF3CT_PREC=MULTI\"\n+# - set \"NAME=build_windows_msvc_avx\"\n+# - call ./ci/tools/threads.bat\n+# - ./ci/build-windows-msvc.bat\nbuild-macos-clang-x64-sse4.2:\nstage: build\n" } ]
C++
MIT License
aff3ct/aff3ct
CI : temporarily disable MSVC build.
8,490
21.11.2019 14:25:10
-3,600
ca4eb727fc5d711ffd6b8fb179164e357a8efec7
Fix PPBF decoder.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/LDPC/BF/PPBF/Decoder_LDPC_probabilistic_parallel_bit_flipping.cpp", "new_path": "src/Module/Decoder/LDPC/BF/PPBF/Decoder_LDPC_probabilistic_parallel_bit_flipping.cpp", "diff": "@@ -42,7 +42,7 @@ Decoder_LDPC_probabilistic_parallel_bit_flipping<B,R>\n}\n// generate Bernouilli distributions\n- for (unsigned i = 0; i < bernouilli_dist.size(); i++)\n+ for (unsigned i = 0; i < bernouilli_probas.size(); i++)\nbernouilli_dist.push_back(std::bernoulli_distribution(bernouilli_probas[i]));\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix PPBF decoder.
8,490
21.11.2019 14:31:50
-3,600
47ba6c831cad5a39ea4ff3ac49d686bc2f45396d
Rm false comments.
[ { "change_type": "MODIFY", "old_path": "include/Module/Decoder/LDPC/BF/Decoder_LDPC_bit_flipping_hard.hpp", "new_path": "include/Module/Decoder/LDPC/BF/Decoder_LDPC_bit_flipping_hard.hpp", "diff": "@@ -23,10 +23,7 @@ protected:\nconst int syndrome_depth;\nint cur_syndrome_depth;\n- const tools::Sparse_matrix &H; // In vertical way\n- // CN are along the columns -> H.get_n_cols() == M (often M=N-K)\n- // VN are along the rows -> H.get_n_rows() == N\n- // automatically transpose in the constructor if needed\n+ const tools::Sparse_matrix &H;\n// data structures for iterative decoding\nstd::vector<B> var_nodes;\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/LDPC/BP/Decoder_LDPC_BP.hpp", "new_path": "include/Module/Decoder/LDPC/BP/Decoder_LDPC_BP.hpp", "diff": "@@ -15,10 +15,7 @@ class Decoder_LDPC_BP\n{\nprotected:\nconst int n_ite;\n- const tools::Sparse_matrix &H; // In vertical way\n- // CN are along the columns -> H.get_n_cols() == M (often M=N-K)\n- // VN are along the rows -> H.get_n_rows() == N\n- // automatically transpose in the constructor if needed\n+ const tools::Sparse_matrix &H;\nconst bool enable_syndrome;\nconst int syndrome_depth;\n" } ]
C++
MIT License
aff3ct/aff3ct
Rm false comments.
8,490
23.11.2019 20:50:45
-3,600
730032affa2a10c27fc3f160c11fa04f1274b053
Fix 'clone()' bugs.
[ { "change_type": "MODIFY", "old_path": "include/Module/Modem/CPM/Modem_CPM.hpp", "new_path": "include/Module/Modem/CPM/Modem_CPM.hpp", "diff": "#include <string>\n#include <vector>\n+#include <memory>\n#include \"Tools/Math/max.h\"\n#include \"Tools/Code/CPM/CPM_parameters.hpp\"\n@@ -34,7 +35,7 @@ protected:\nconst bool no_sig2; // no computation of sigma^2\n// modulation data:\n- tools::CPM_parameters<SIN,SOUT> cpm; // all CPM parameters\n+ std::shared_ptr<tools::CPM_parameters<SIN,SOUT>> cpm; // all CPM parameters\nR cpm_h; // modulation index = k/p\nR T_samp; // sample duration = 1/s_factor\nstd::vector<R> baseband; // translation of base band vectors\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Modem/CPM/Modem_CPM.hxx", "new_path": "include/Module/Modem/CPM/Modem_CPM.hxx", "diff": "@@ -42,21 +42,21 @@ Modem_CPM<B,R,Q,MAX>\nModem_CPM<B,R,Q,MAX>::size_fil(N, bits_per_symbol, cpm_L, cpm_p),\nn_frames),\nno_sig2 (no_sig2 ),\n- cpm (cpm_L,\n+ cpm (new tools::CPM_parameters<SIN,SOUT>(cpm_L,\ncpm_k,\ncpm_p,\nbits_per_symbol,\nsampling_factor,\n\"TOTAL\",\n- wave_shape ),\n- cpm_h ((R)cpm.k/(R)cpm.p ),\n- T_samp ((R)1.0 /(R)cpm.s_factor ),\n- baseband (cpm.max_wa_id * cpm.s_factor *2, 0),\n- projection(cpm.max_wa_id * cpm.s_factor *2, 0),\n- n_sy (N/cpm.n_b_per_s ),\n- n_sy_tl (n_sy+cpm.tl ),\n- cpe (n_sy, cpm ),\n- bcjr (cpm, n_sy_tl )\n+ wave_shape)),\n+ cpm_h ((R)cpm->k/(R)cpm->p ),\n+ T_samp ((R)1.0 /(R)cpm->s_factor ),\n+ baseband (cpm->max_wa_id * cpm->s_factor *2, 0),\n+ projection(cpm->max_wa_id * cpm->s_factor *2, 0),\n+ n_sy (N/cpm->n_b_per_s ),\n+ n_sy_tl (n_sy+cpm->tl ),\n+ cpe (n_sy, *cpm ),\n+ bcjr (*cpm, n_sy_tl )\n{\nconst std::string name = \"Modem_CPM\";\nthis->set_name(name);\n@@ -72,17 +72,17 @@ Modem_CPM<B,R,Q,MAX>\n}\n// initialize CPM\n- cpe.generate_allowed_states (cpm.allowed_states );\n- cpe.generate_allowed_wave_forms(cpm.allowed_wave_forms );\n+ cpe.generate_allowed_states (cpm->allowed_states );\n+ cpe.generate_allowed_wave_forms(cpm->allowed_wave_forms );\n- cpe.generate_mapper (cpm.transition_to_binary,\n- cpm.binary_to_transition,\n+ cpe.generate_mapper (cpm->transition_to_binary,\n+ cpm->binary_to_transition,\nmapping );\n- cpe.generate_trellis (cpm.trellis_next_state,\n- cpm.trellis_related_wave_form );\n- cpe.generate_anti_trellis (cpm.anti_trellis_original_state,\n- cpm.anti_trellis_input_transition);\n+ cpe.generate_trellis (cpm->trellis_next_state,\n+ cpm->trellis_related_wave_form );\n+ cpe.generate_anti_trellis (cpm->anti_trellis_original_state,\n+ cpm->anti_trellis_input_transition);\ncpe.generate_tail_symb_transition();\n@@ -159,7 +159,7 @@ void Modem_CPM<B,R,Q,MAX>\nstd::vector<SIN> mapped_frame(n_sy);\nfor (int i=0; i < n_sy; i++)\n- mapped_frame[i] = cpm.binary_to_transition[cpe.merge_bits(X_N1+i*cpm.n_b_per_s, cpm.n_b_per_s, true)];\n+ mapped_frame[i] = cpm->binary_to_transition[cpe.merge_bits(X_N1+i*cpm->n_b_per_s, cpm->n_b_per_s, true)];\n// continuous phase encoder\nstd::vector<SIN> encoded_frame(n_sy_tl);\n@@ -172,10 +172,10 @@ void Modem_CPM<B,R,Q,MAX>\nconst auto off_BB_i = (int)baseband.size() / 2;\nfor (auto i = 0; i < n_sy_tl; i++)\n- for (auto s = 0; s < cpm.s_factor; s++)\n+ for (auto s = 0; s < cpm->s_factor; s++)\n{\n- X_N2[off_X_r + i * cpm.s_factor + s] = baseband[off_BB_r + encoded_frame[i] * cpm.s_factor + s];\n- X_N2[off_X_i + i * cpm.s_factor + s] = baseband[off_BB_i + encoded_frame[i] * cpm.s_factor + s];\n+ X_N2[off_X_r + i * cpm->s_factor + s] = baseband[off_BB_r + encoded_frame[i] * cpm->s_factor + s];\n+ X_N2[off_X_i + i * cpm->s_factor + s] = baseband[off_BB_i + encoded_frame[i] * cpm->s_factor + s];\n}\n}\n@@ -194,14 +194,14 @@ void Modem_CPM<B,R,Q,MAX>\nconst auto p_imag = projection.data() + (projection.size() >> 1);\nfor (auto i = 0; i < n_sy_tl; i++)\n- for (auto wa = 0; wa < cpm.n_wa; wa++)\n+ for (auto wa = 0; wa < cpm->n_wa; wa++)\n{\nR sum_r = (R)0;\n- for (auto s = 0; s < cpm.s_factor; s++)\n- sum_r += Y_real[i * cpm.s_factor + s] * p_real[s * cpm.max_wa_id + cpm.allowed_wave_forms[wa]]\n- - Y_imag[i * cpm.s_factor + s] * p_imag[s * cpm.max_wa_id + cpm.allowed_wave_forms[wa]];\n+ for (auto s = 0; s < cpm->s_factor; s++)\n+ sum_r += Y_real[i * cpm->s_factor + s] * p_real[s * cpm->max_wa_id + cpm->allowed_wave_forms[wa]]\n+ - Y_imag[i * cpm->s_factor + s] * p_imag[s * cpm->max_wa_id + cpm->allowed_wave_forms[wa]];\n- Y_N2[i * cpm.max_wa_id + cpm.allowed_wave_forms[wa]] = sum_r;\n+ Y_N2[i * cpm->max_wa_id + cpm->allowed_wave_forms[wa]] = sum_r;\n}\n}\n@@ -223,50 +223,50 @@ template <typename B, typename R, typename Q, tools::proto_max<Q> MAX>\nvoid Modem_CPM<B,R,Q,MAX>\n::generate_baseband()\n{\n- if ((int)baseband.size() != (cpm.max_wa_id * cpm.s_factor * 2))\n+ if ((int)baseband.size() != (cpm->max_wa_id * cpm->s_factor * 2))\n{\nstd::stringstream message;\n- message << \"'baseband.size()' has to be equal to 'cpm.max_wa_id' * 'cpm.s_factor' * 2 ('baseband.size()' = \"\n- << baseband.size() << \", 'cpm.max_wa_id' = \" << cpm.max_wa_id\n- << \", 'cpm.s_factor' = \" << cpm.s_factor << \").\";\n+ message << \"'baseband.size()' has to be equal to 'cpm->max_wa_id' * 'cpm->s_factor' * 2 ('baseband.size()' = \"\n+ << baseband.size() << \", 'cpm->max_wa_id' = \" << cpm->max_wa_id\n+ << \", 'cpm->s_factor' = \" << cpm->s_factor << \").\";\nthrow tools::length_error(__FILE__, __LINE__, __func__, message.str());\n}\n- std::vector<R> phase_response(cpm.L*cpm.s_factor);\n+ std::vector<R> phase_response(cpm->L*cpm->s_factor);\n// calculate the different phase responses\n- for (auto s = 0; s < cpm.L * cpm.s_factor; s++)\n+ for (auto s = 0; s < cpm->L * cpm->s_factor; s++)\nphase_response[s] = calculate_phase_response(s * T_samp);\n- auto p_mask = (1 << cpm.n_bits_p ) -1;\n- auto L_mask = (1 << cpm.n_b_per_s) -1;\n+ auto p_mask = (1 << cpm->n_bits_p ) -1;\n+ auto L_mask = (1 << cpm->n_b_per_s) -1;\n- for (auto wa = 0; wa < cpm.n_wa; wa++)\n+ for (auto wa = 0; wa < cpm->n_wa; wa++)\n{\n- auto allowed_wa = cpm.allowed_wave_forms[wa];\n+ auto allowed_wa = cpm->allowed_wave_forms[wa];\nauto tilted_phase_part1 = (R)(2 * (R)M_PI * cpm_h * (allowed_wa & p_mask));\n- std::vector<R> tilted_phase_part2(cpm.s_factor, (R)0);\n- std::vector<R> tilted_phase_part3(cpm.s_factor, (R)0);\n+ std::vector<R> tilted_phase_part2(cpm->s_factor, (R)0);\n+ std::vector<R> tilted_phase_part3(cpm->s_factor, (R)0);\n- for (auto l = 0; l < cpm.L; l++)\n+ for (auto l = 0; l < cpm->L; l++)\n{\n- auto U_n = (allowed_wa >> ((cpm.L -l -1) * cpm.n_b_per_s + cpm.n_bits_p)) & L_mask;\n+ auto U_n = (allowed_wa >> ((cpm->L -l -1) * cpm->n_b_per_s + cpm->n_bits_p)) & L_mask;\n- for (auto s = 0; s < cpm.s_factor; s++)\n+ for (auto s = 0; s < cpm->s_factor; s++)\n{\n- tilted_phase_part2[s] += phase_response[l * cpm.s_factor +s] * U_n;\n- tilted_phase_part3[s] += phase_response[l * cpm.s_factor +s];\n+ tilted_phase_part2[s] += phase_response[l * cpm->s_factor +s] * U_n;\n+ tilted_phase_part3[s] += phase_response[l * cpm->s_factor +s];\n}\n}\n- for (auto s = 0; s < cpm.s_factor; s++)\n+ for (auto s = 0; s < cpm->s_factor; s++)\n{\nR 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]));\n+ (cpm->m_order -1) * (s * T_samp + (cpm->L -1) - 2 * tilted_phase_part3[s]));\n- baseband[allowed_wa * cpm.s_factor + s ] = std::cos(tilted_phase);\n- baseband[allowed_wa * cpm.s_factor + s + baseband.size() / 2] = std::sin(tilted_phase);\n+ baseband[allowed_wa * cpm->s_factor + s ] = std::cos(tilted_phase);\n+ baseband[allowed_wa * cpm->s_factor + s + baseband.size() / 2] = std::sin(tilted_phase);\n}\n}\n}\n@@ -303,21 +303,21 @@ template <typename B, typename R, typename Q, tools::proto_max<Q> MAX>\nR Modem_CPM<B,R,Q,MAX>\n::calculate_phase_response(const R t_stamp)\n{\n- if (cpm.wave_shape == \"GMSK\")\n+ if (cpm->wave_shape == \"GMSK\")\n{\nif (t_stamp == (R)0.0)\nreturn (R)0.0;\n- GMSK<R> g((R)0.3, -(R)cpm.L / (R)2.0);\n+ GMSK<R> g((R)0.3, -(R)cpm->L / (R)2.0);\nreturn tools::mid_rect_integral_seq(g, (R)0.0, t_stamp, (int)(t_stamp / (R)1e-4));\n}\n- else if (cpm.wave_shape == \"RCOS\")\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;\n- else if (cpm.wave_shape == \"REC\")\n- return t_stamp / ((R)2.0 * cpm.L);\n+ else if (cpm->wave_shape == \"RCOS\")\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;\n+ else if (cpm->wave_shape == \"REC\")\n+ return t_stamp / ((R)2.0 * cpm->L);\nelse\n{\n- std::string message = \"Unknown CPM wave shape ('cpm.wave_shape' = \" + cpm.wave_shape + \").\";\n+ std::string message = \"Unknown CPM wave shape ('cpm->wave_shape' = \" + cpm->wave_shape + \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message);\n}\n}\n@@ -343,9 +343,9 @@ void Modem_CPM<B,R,Q,MAX>\nfactor = (R)1 / (this->noise->get_value() * this->noise->get_value()); // 2 / sigma_complex^2\n}\n- if (cpm.filters_type == \"TOTAL\")\n+ if (cpm->filters_type == \"TOTAL\")\n{\n- tools::complex_transpose(cpm.max_wa_id, cpm.s_factor, baseband, projection);\n+ tools::complex_transpose(cpm->max_wa_id, cpm->s_factor, baseband, projection);\nfor (auto i = 0; i < (int)projection.size() ; i++)\nprojection[i] *= factor;\n@@ -355,7 +355,7 @@ void Modem_CPM<B,R,Q,MAX>\n//}\nelse\n{\n- std::string message = \"Unknown CPM filter bank type ('cpm.filters_type' = \" + cpm.filters_type + \").\";\n+ std::string message = \"Unknown CPM filter bank type ('cpm->filters_type' = \" + cpm->filters_type + \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Codec/Codec.hxx", "new_path": "include/Tools/Codec/Codec.hxx", "diff": "@@ -62,8 +62,6 @@ template <typename B, typename Q>\nvoid Codec<B,Q>\n::deep_copy(const Codec<B,Q> &t)\n{\n- if (t.interleaver_bit != nullptr) this->interleaver_bit.reset(t.interleaver_bit ->clone());\n- if (t.interleaver_llr != nullptr) this->interleaver_llr.reset(t.interleaver_llr ->clone());\nif (t.encoder != nullptr) this->encoder .reset(t.encoder ->clone());\nif (t.puncturer != nullptr) this->puncturer.reset(t.puncturer->clone());\nif (t.extractor != nullptr) this->extractor.reset(t.extractor->clone());\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/RS/Decoder_RS.cpp", "new_path": "src/Factory/Module/Decoder/RS/Decoder_RS.cpp", "diff": "@@ -107,6 +107,8 @@ module::Decoder_SIHO<B,Q>* Decoder_RS\n}\n}\n}\n+\n+ throw tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/BFER_ite.cpp", "new_path": "src/Simulation/BFER/Iterative/BFER_ite.cpp", "diff": "@@ -62,8 +62,6 @@ void BFER_ite<B,R,Q>\ncoset_real [tid] = build_coset_real (tid);\ncoset_bit [tid] = build_coset_bit (tid);\ninterleaver_core[tid] = build_interleaver(tid);\n- interleaver_bit [tid].reset(factory::Interleaver::build<B>(*interleaver_core[tid]));\n- interleaver_llr [tid].reset(factory::Interleaver::build<Q>(*interleaver_core[tid]));\n}\nif (params_BFER_ite.alloc_clone)\n@@ -77,10 +75,11 @@ void BFER_ite<B,R,Q>\ncoset_real [tid].reset(coset_real [0]->clone());\ncoset_bit [tid].reset(coset_bit [0]->clone());\ninterleaver_core[tid].reset(interleaver_core[0]->clone());\n- interleaver_bit [tid].reset(interleaver_bit [0]->clone());\n- interleaver_llr [tid].reset(interleaver_llr [0]->clone());\n}\n+ interleaver_bit[tid].reset(factory::Interleaver::build<B>(*interleaver_core[tid]));\n+ interleaver_llr[tid].reset(factory::Interleaver::build<Q>(*interleaver_core[tid]));\n+\n// set the noise\ncodec [tid]->set_noise(*this->noise);\nmodem [tid]->set_noise(*this->noise);\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Pattern_polar_parser.cpp", "new_path": "src/Tools/Code/Polar/Pattern_polar_parser.cpp", "diff": "@@ -93,8 +93,9 @@ void Pattern_polar_parser\ntools::Binary_node<Pattern_polar_i> *nclone)\n{\nauto cref = nref->get_contents();\n- auto cclone = cref->alloc(cref->get_size(), nclone);\n- nclone->set_contents(cclone);\n+ nclone->set_contents((cref != nullptr) ?\n+ cref->alloc(cref->get_size(), cref->get_size() ? nclone : nullptr) :\n+ nullptr);\nif (!nref->is_leaf() && !nclone->is_leaf())\n{\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix 'clone()' bugs.
8,490
23.11.2019 20:55:11
-3,600
61f22624068b18599d8cb2ffb549f362fa6f561d
CI: use the clone allocation method in the regression tests.
[ { "change_type": "MODIFY", "old_path": "ci/test-build-coverage-regression.sh", "new_path": "ci/test-build-coverage-regression.sh", "diff": "@@ -33,7 +33,7 @@ function gen_coverage_info\nci=$(awk -F \"=\" '/ci/ {print $2}' $path)\nif [ \"$ci\" != \"off\" ]; then\ncd $build\n- eval \"${cmd} --sim-threads 1 --sim-max-fra 1 --sim-crit-nostop --ter-freq 0\"\n+ eval \"${cmd} --sim-threads 1 --sim-max-fra 1 --sim-crit-nostop --ter-freq 0 --sim-clone\"\nrc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\ncd ..\nelse\n" }, { "change_type": "MODIFY", "old_path": "ci/test-regression.py", "new_path": "ci/test-regression.py", "diff": "@@ -370,7 +370,7 @@ for fn in fileNames:\nargsAFFECT = argsAFFECTcommand[:] # hard copy\nargsAFFECT += simuRef.getSplitCommand()\nargsAFFECT[len(argsAFFECTcommand)] = args.binaryPath;\n- argsAFFECT += [\"--ter-freq\", \"0\", \"-t\", str(args.nThreads), \"--sim-meta\", simuRef.getMetadata(\"title\")]\n+ argsAFFECT += [\"--ter-freq\", \"0\", \"-t\", str(args.nThreads), \"--sim-meta\", simuRef.getMetadata(\"title\"), \"--sim-clone\"]\nif args.maxFE:\nargsAFFECT += [\"-e\", str(args.maxFE)]\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: use the clone allocation method in the regression tests.
8,490
23.11.2019 23:04:22
-3,600
e0ea22e24faa1b7a3efef0dff300d54c93cfe033
Fix BCH fast bug.
[ { "change_type": "MODIFY", "old_path": "include/Module/Decoder/BCH/Decoder_BCH.hpp", "new_path": "include/Module/Decoder/BCH/Decoder_BCH.hpp", "diff": "@@ -29,6 +29,10 @@ public:\nvirtual Decoder_BCH<B,R>* clone() const;\nbool get_last_is_codeword(const int frame_id = -1) const;\n+\n+protected:\n+ Decoder_BCH(const int K, const int N, const int t, const int n_frames, const int simd_inter_frame_level);\n+\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/BCH/Decoder_BCH.cpp", "new_path": "src/Module/Decoder/BCH/Decoder_BCH.cpp", "diff": "@@ -10,8 +10,8 @@ using namespace aff3ct::module;\ntemplate <typename B, typename R>\nDecoder_BCH<B, R>\n-::Decoder_BCH(const int K, const int N, const int t, const int n_frames)\n-: Decoder_SIHO<B,R>(K, N, n_frames, 1),\n+::Decoder_BCH(const int K, const int N, const int t, const int n_frames, const int simd_inter_frame_level)\n+: Decoder_SIHO<B,R>(K, N, n_frames, simd_inter_frame_level),\nt(t), N_p2_1(tools::next_power_of_2(N) -1), last_is_codeword(n_frames)\n{\nconst std::string name = \"Decoder_BCH\";\n@@ -25,6 +25,13 @@ Decoder_BCH<B, R>\n}\n}\n+template <typename B, typename R>\n+Decoder_BCH<B, R>\n+::Decoder_BCH(const int K, const int N, const int t, const int n_frames)\n+: Decoder_BCH(K, N, t, n_frames, 1)\n+{\n+}\n+\ntemplate <typename B, typename R>\nDecoder_BCH<B,R>* Decoder_BCH<B,R>\n::clone() const\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/BCH/Fast/Decoder_BCH_fast.cpp", "new_path": "src/Module/Decoder/BCH/Fast/Decoder_BCH_fast.cpp", "diff": "@@ -17,7 +17,7 @@ using namespace aff3ct::module;\ntemplate <typename B, typename R>\nDecoder_BCH_fast<B,R>\n::Decoder_BCH_fast(const int& K, const int& N, const tools::BCH_polynomial_generator<B> &GF_poly, const int n_frames)\n-: Decoder_BCH<B,R>(K, N, GF_poly.get_t(), n_frames ),\n+: Decoder_BCH<B,R>(K, N, GF_poly.get_t(), n_frames, mipp::N<R>() ),\nt2 (2 * this->t ),\nYH_N (this->N * mipp::N<B>() ),\nY_N_reorderered (this->N, mipp::Reg<B>((B)0)),\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix BCH fast bug.
8,490
24.11.2019 00:49:17
-3,600
2c419682e448e2e56d19eb2a7b0fb0a617640227
Fix LDPC DVB-S2 encoder bug.
[ { "change_type": "MODIFY", "old_path": "include/Tools/Codec/LDPC/Codec_LDPC.hpp", "new_path": "include/Tools/Codec/LDPC/Codec_LDPC.hpp", "diff": "@@ -41,9 +41,6 @@ public:\nconst Sparse_matrix& get_G() const;\nconst LDPC_matrix_handler::Positions_vector& get_info_bits_pos() const;\nconst dvbs2_values& get_DVBS2() const;\n-\n-protected:\n- virtual void deep_copy(const Codec_LDPC<B,Q> &t);\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Codec/LDPC/Codec_LDPC.cpp", "new_path": "src/Tools/Codec/LDPC/Codec_LDPC.cpp", "diff": "@@ -167,14 +167,6 @@ Codec_LDPC<B,Q>* Codec_LDPC<B,Q>\nreturn t;\n}\n-template <typename B, typename Q>\n-void Codec_LDPC<B,Q>\n-::deep_copy(const Codec_LDPC<B,Q> &t)\n-{\n- Codec_SISO<B,Q>::deep_copy(t);\n- if (t.dvbs2 != nullptr) this->dvbs2.reset(new dvbs2_values(*t.dvbs2));\n-}\n-\ntemplate <typename B, typename Q>\nconst Sparse_matrix& Codec_LDPC<B,Q>\n::get_H() const\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix LDPC DVB-S2 encoder bug.
8,490
24.11.2019 15:22:18
-3,600
51b81b1c7b691277bef2c323b5b10d981822af5a
Fix 'clone()' for modules in SystemC.
[ { "change_type": "MODIFY", "old_path": "include/Module/SC_Module.hpp", "new_path": "include/Module/SC_Module.hpp", "diff": "@@ -106,8 +106,11 @@ protected:\nclass SC_Module_container\n{\n+#ifndef DOXYGEN_SHOULD_SKIP_THIS\n+ friend Module;\n+#endif\nprotected:\n- Module &module;\n+ Module *module;\nstd::vector<std::shared_ptr<SC_Module>> sc_modules;\npublic:\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Module.cpp", "new_path": "src/Module/Module.cpp", "diff": "@@ -39,6 +39,14 @@ void Module\nthis->tasks.push_back(std::move(t_new));\n}\n}\n+\n+#ifdef AFF3CT_SYSTEMC_MODULE\n+ this->sc.module = this;\n+ this->sc.sc_modules.clear();\n+ for (size_t i = 0; i < m.sc.sc_modules.size(); i++)\n+ if (m.sc.sc_modules[i] != nullptr)\n+ this->sc.create_module(i);\n+#endif\n}\nModule* Module\n" }, { "change_type": "MODIFY", "old_path": "src/Module/SC_Module.cpp", "new_path": "src/Module/SC_Module.cpp", "diff": "@@ -246,16 +246,16 @@ void SC_Module\nSC_Module_container\n::SC_Module_container(Module &module)\n-: module(module), sc_modules()\n+: module(&module), sc_modules()\n{\n}\nvoid SC_Module_container\n::create_module(const int id)\n{\n- if (module.tasks_with_nullptr.size() != sc_modules.size())\n+ if (module->tasks_with_nullptr.size() != sc_modules.size())\n{\n- sc_modules.resize(module.tasks_with_nullptr.size());\n+ sc_modules.resize(module->tasks_with_nullptr.size());\nfill(sc_modules.begin(), sc_modules.end(), nullptr);\n}\n@@ -264,13 +264,13 @@ void SC_Module_container\nif (sc_modules[id] != nullptr)\nerase_module(id);\n- const std::string module_name = module.get_custom_name().empty() ? module.get_name() : module.get_custom_name();\n- sc_modules[id] = std::shared_ptr<SC_Module>(new SC_Module(module[id], (module_name + \"::\" + module[id].get_name()).c_str()));\n+ const std::string module_name = module->get_custom_name().empty() ? module->get_name() : module->get_custom_name();\n+ sc_modules[id] = std::shared_ptr<SC_Module>(new SC_Module((*module)[id], (module_name + \"::\" + (*module)[id].get_name()).c_str()));\n}\nelse\n{\nstd::stringstream message;\n- message << \"'id' does not exist ('id' = \" << id << \", 'module.name' = \" << module.get_name() << \").\";\n+ message << \"'id' does not exist ('id' = \" << id << \", 'module.name' = \" << module->get_name() << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n}\n@@ -285,7 +285,7 @@ void SC_Module_container\nelse\n{\nstd::stringstream message;\n- message << \"'id' does not exist ('id' = \" << id << \", 'module.name' = \" << module.get_name() << \").\";\n+ message << \"'id' does not exist ('id' = \" << id << \", 'module.name' = \" << module->get_name() << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix 'clone()' for modules in SystemC.
8,490
25.11.2019 12:33:18
-3,600
f77c843234095f50316d460663ddb95b58c16fb7
Fix missing 'operator[]' methods.
[ { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Decoder_SIHO.hpp", "new_path": "include/Module/Decoder/Decoder_SIHO.hpp", "diff": "@@ -31,6 +31,8 @@ class Decoder_SIHO : public Decoder_HIHO<B>\n{\npublic:\ninline Task& operator[](const dec::tsk t);\n+ inline Socket& operator[](const dec::sck::decode_hiho s);\n+ inline Socket& operator[](const dec::sck::decode_hiho_cw s);\ninline Socket& operator[](const dec::sck::decode_siho s);\ninline Socket& operator[](const dec::sck::decode_siho_cw s);\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Decoder_SIHO.hxx", "new_path": "include/Module/Decoder/Decoder_SIHO.hxx", "diff": "@@ -18,6 +18,20 @@ Task& Decoder_SIHO<B,R>\nreturn Module::operator[]((size_t)t);\n}\n+template <typename B, typename R>\n+Socket& Decoder_SIHO<B,R>\n+::operator[](const dec::sck::decode_hiho s)\n+{\n+ return Module::operator[]((size_t)dec::tsk::decode_hiho)[(size_t)s];\n+}\n+\n+template <typename B, typename R>\n+Socket& Decoder_SIHO<B,R>\n+::operator[](const dec::sck::decode_hiho_cw s)\n+{\n+ return Module::operator[]((size_t)dec::tsk::decode_hiho_cw)[(size_t)s];\n+}\n+\ntemplate <typename B, typename R>\nSocket& Decoder_SIHO<B,R>\n::operator[](const dec::sck::decode_siho s)\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Decoder_SISO.hpp", "new_path": "include/Module/Decoder/Decoder_SISO.hpp", "diff": "@@ -28,6 +28,10 @@ class Decoder_SISO : public Decoder_SIHO<B,R>\n{\npublic:\ninline Task& operator[](const dec::tsk t);\n+ inline Socket& operator[](const dec::sck::decode_hiho s);\n+ inline Socket& operator[](const dec::sck::decode_hiho_cw s);\n+ inline Socket& operator[](const dec::sck::decode_siho s);\n+ inline Socket& operator[](const dec::sck::decode_siho_cw s);\ninline Socket& operator[](const dec::sck::decode_siso s);\nprivate:\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Decoder_SISO.hxx", "new_path": "include/Module/Decoder/Decoder_SISO.hxx", "diff": "@@ -18,6 +18,34 @@ Task& Decoder_SISO<B,R>\nreturn Module::operator[]((size_t)t);\n}\n+template <typename B, typename R>\n+Socket& Decoder_SISO<B,R>\n+::operator[](const dec::sck::decode_hiho s)\n+{\n+ return Module::operator[]((size_t)dec::tsk::decode_hiho)[(size_t)s];\n+}\n+\n+template <typename B, typename R>\n+Socket& Decoder_SISO<B,R>\n+::operator[](const dec::sck::decode_hiho_cw s)\n+{\n+ return Module::operator[]((size_t)dec::tsk::decode_hiho_cw)[(size_t)s];\n+}\n+\n+template <typename B, typename R>\n+Socket& Decoder_SISO<B,R>\n+::operator[](const dec::sck::decode_siho s)\n+{\n+ return Module::operator[]((size_t)dec::tsk::decode_siho)[(size_t)s];\n+}\n+\n+template <typename B, typename R>\n+Socket& Decoder_SISO<B,R>\n+::operator[](const dec::sck::decode_siho_cw s)\n+{\n+ return Module::operator[]((size_t)dec::tsk::decode_siho_cw)[(size_t)s];\n+}\n+\ntemplate <typename B, typename R>\nSocket& Decoder_SISO<B,R>\n::operator[](const dec::sck::decode_siso s)\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix missing 'operator[]' methods.
8,490
28.11.2019 10:04:56
-3,600
170f09a388a6c7dbed65be8e3a365397df1e2ca8
Working on implementing the multi-threaded chain.
[ { "change_type": "MODIFY", "old_path": "include/Module/Chain.hpp", "new_path": "include/Module/Chain.hpp", "diff": "#define CHAIN_HPP_\n#include <functional>\n+#include <memory>\n#include <vector>\nnamespace aff3ct\n@@ -13,24 +14,31 @@ namespace aff3ct\nnamespace module\n{\nclass Task;\n+class Module;\nclass Chain\n{\nprotected:\nsize_t n_threads;\n- std::vector<Task*> tasks_sequence;\n- std::vector<std::vector<Task*>> tasks_sequences;\n+ std::vector<const Task*> tasks_sequence;\n+ std::vector<std::vector<std::shared_ptr<Task>>> tasks_sequences;\n+ std::vector<std::vector<std::shared_ptr<Module>>> modules;\npublic:\n- Chain(Task &bootstrap, const size_t n_threads = 1);\n- virtual ~Chain();\n+ Chain(const Task &first, const size_t n_threads = 1);\n+ Chain(const Task &first, const Task &last, const size_t n_threads = 1);\n+ virtual ~Chain() = default;\nvoid exec(std::function<bool(const std::vector<int>&)> &stop_condition);\ninline size_t get_n_threads() const;\n+ template <class C = Module>\n+ std::vector<C*> get_modules() const;\n+\nprotected:\n- void init_recursive(Task& current_task);\n- void _exec(std::function<bool(const std::vector<int>&)> &stop_condition, std::vector<Task*> &tasks_sequence);\n+ void init_recursive(const Task& current_task, const Task *last = nullptr);\n+ void _exec(std::function<bool(const std::vector<int>&)> &stop_condition,\n+ std::vector<std::shared_ptr<Task>> &tasks_sequence);\nvoid duplicate();\n};\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Chain.hxx", "new_path": "include/Module/Chain.hxx", "diff": "@@ -9,5 +9,24 @@ size_t Chain\n{\nreturn this->n_threads;\n}\n+\n+template <class C>\n+std::vector<C*> Chain\n+::get_modules() const\n+{\n+ std::vector<Module*> ret;\n+ for (auto &mm : this->modules)\n+ for (auto &m : mm)\n+ try\n+ {\n+ auto c = dynamic_cast<C*>(m.get());\n+ ret.push_back(c);\n+ }\n+ catch (...) {}\n+\n+ return ret;\n+}\n+\n+\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Chain.cpp", "new_path": "src/Module/Chain.cpp", "diff": "@@ -10,8 +10,8 @@ using namespace aff3ct;\nusing namespace aff3ct::module;\nChain\n-::Chain(Task &bootstrap, const size_t n_threads)\n-: n_threads(n_threads)\n+::Chain(const Task &first, const Task &last, const size_t n_threads)\n+: n_threads(n_threads), tasks_sequences(n_threads), modules(n_threads)\n{\nif (n_threads == 0)\n{\n@@ -20,25 +20,27 @@ Chain\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- this->init_recursive(bootstrap);\n-\n- if (n_threads > 1)\n- {\n- this->tasks_sequences.resize(n_threads);\n+ this->init_recursive(first, &last);\nthis->duplicate();\n}\n-}\nChain\n-::~Chain()\n+::Chain(const Task &first, const size_t n_threads)\n+: n_threads(n_threads), tasks_sequences(n_threads), modules(n_threads)\n+{\n+ if (n_threads == 0)\n{\n- for (auto &s : this->tasks_sequences)\n- for (auto &ta : s)\n- delete ta;\n+ std::stringstream message;\n+ message << \"'n_threads' has to be strictly greater than 0.\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ this->init_recursive(first);\n+ this->duplicate();\n}\nvoid Chain\n-::init_recursive(Task& current_task)\n+::init_recursive(const Task& current_task, const Task *last)\n{\nif (current_task.can_exec())\n{\n@@ -51,6 +53,8 @@ void Chain\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n+ if (&current_task != last)\n+ {\nfor (auto &s : current_task.sockets)\n{\nif (current_task.get_socket_type(*s) == socket_t::SIN_SOUT ||\n@@ -63,7 +67,7 @@ void Chain\n{\nauto &t = bs->get_task();\nif (t.is_last_input_socket(*bs))\n- this->init_recursive(t);\n+ this->init_recursive(t, last);\n}\n}\n}\n@@ -84,9 +88,10 @@ void Chain\n}\n}\n}\n+}\nvoid Chain\n-::_exec(std::function<bool(const std::vector<int>&)> &stop_condition, std::vector<Task*> &tasks_sequence)\n+::_exec(std::function<bool(const std::vector<int>&)> &stop_condition, std::vector<std::shared_ptr<Task>> &tasks_sequence)\n{\nstd::vector<int> statuses(tasks_sequence.size(), 0);\nwhile (!stop_condition(statuses))\n@@ -96,23 +101,43 @@ void Chain\nvoid Chain\n::exec(std::function<bool(const std::vector<int>&)> &stop_condition)\n-{\n- if (this->get_n_threads() == 1)\n- this->_exec(stop_condition, this->tasks_sequence);\n- else\n{\nstd::vector<std::thread> threads(n_threads);\n- for (size_t tid = 0; tid < n_threads; tid++)\n+ for (size_t tid = 1; tid < n_threads; tid++)\nthreads[tid] = std::thread(&Chain::_exec, this, std::ref(stop_condition), std::ref(this->tasks_sequences[tid]));\n- for (size_t tid = 0; tid < n_threads; tid++)\n+ this->_exec(stop_condition, this->tasks_sequences[0]);\n+\n+ for (size_t tid = 1; tid < n_threads; tid++)\nthreads[tid].join();\n}\n-}\nvoid Chain\n::duplicate()\n{\n+ // clone the modules\n+ std::map<const Module*, std::vector<const Task*>> modules_to_tasks;\n+\n+ for (auto &ta : this->tasks_sequence)\n+ {\n+ auto key = &ta->get_module();\n+ if (modules_to_tasks.count(key))\n+ modules_to_tasks[key].push_back(ta);\n+ else\n+ modules_to_tasks[key] = {ta};\n+ }\n+\n+ for (size_t tid = 0; tid < this->n_threads; tid++)\n+ {\n+ this->modules[tid].resize(modules_to_tasks.size());\n+ size_t m = 0;\n+ for (auto &mtt : modules_to_tasks)\n+ this->modules[tid][m++] = std::shared_ptr<Module>(mtt.first->clone());\n+ }\n+\n+\n+\n+\n// clone the tasks\nfor (size_t tid = 0; tid < this->n_threads; tid++)\n{\n@@ -121,7 +146,7 @@ void Chain\n{\nauto ta_clone = ta->clone();\nta_clone->set_autoalloc(true);\n- tasks_chain_cpy.push_back(ta_clone);\n+ tasks_chain_cpy.push_back(std::unique_ptr<Task>(ta_clone));\n}\n}\n@@ -155,8 +180,9 @@ void Chain\n{\nauto &tin = sin->get_task();\nauto tin_id = get_task_id(tin);\n- assert(tin_id != -1);\n+ if (tin_id != -1)\n+ {\nauto sin_id = get_socket_id(tin, *sin);\nassert(sin_id != -1);\n@@ -171,3 +197,4 @@ void Chain\n}\n}\n}\n+}\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Working on implementing the multi-threaded chain.
8,490
29.11.2019 14:30:39
-3,600
287bf4e31f3d615e8232f7c0a51370b6af87e084
Fix compilation on MSVC.
[ { "change_type": "MODIFY", "old_path": "include/Tools/Algo/Draw_generator/Draw_generator.hpp", "new_path": "include/Tools/Algo/Draw_generator/Draw_generator.hpp", "diff": "#ifndef DRAW_GENERATOR_HPP_\n#define DRAW_GENERATOR_HPP_\n+#ifndef _MSC_VER\n#include \"Tools/Interface/Interface_clone.hpp\"\n+#endif\n#include \"Tools/Interface/Interface_set_seed.hpp\"\nnamespace aff3ct\n@@ -13,7 +15,11 @@ namespace aff3ct\nnamespace tools\n{\ntemplate <typename R = float>\n+#ifdef _MSC_VER\n+class Draw_generator : public Interface_set_seed\n+#else\nclass Draw_generator : public Interface_set_seed, public Interface_clone\n+#endif\n{\npublic:\nDraw_generator() = default;\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Codec/Codec.hpp", "new_path": "include/Tools/Codec/Codec.hpp", "diff": "#include \"Tools/Interface/Interface_get_set_noise.hpp\"\n#include \"Tools/Interface/Interface_notify_noise_update.hpp\"\n+#ifndef _MSC_VER\n#include \"Tools/Interface/Interface_clone.hpp\"\n+#endif\n#include \"Tools/Interleaver/Interleaver_core.hpp\"\n#include \"Tools/Noise/Noise.hpp\"\n#include \"Module/Interleaver/Interleaver.hpp\"\n@@ -26,9 +28,11 @@ namespace tools\n{\ntemplate <typename B = int, typename Q = float>\n-class Codec : public Interface_get_set_noise,\n- public Interface_notify_noise_update,\n- public Interface_clone\n+#ifdef _MSC_VER\n+class Codec : public Interface_get_set_noise, public Interface_notify_noise_update\n+#else\n+class Codec : public Interface_get_set_noise, public Interface_notify_noise_update, public Interface_clone\n+#endif\n{\nprivate:\nstd::shared_ptr<Interleaver_core < >> interleaver_core;\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Interleaver/Interleaver_core.hpp", "new_path": "include/Tools/Interleaver/Interleaver_core.hpp", "diff": "#include <vector>\n#include \"Tools/Interface/Interface_set_seed.hpp\"\n+#ifndef _MSC_VER\n#include \"Tools/Interface/Interface_clone.hpp\"\n+#endif\nnamespace aff3ct\n{\nnamespace tools\n{\ntemplate <typename T = uint32_t>\n+#ifdef _MSC_VER\n+class Interleaver_core : public Interface_set_seed\n+#else\nclass Interleaver_core : public Interface_set_seed, public Interface_clone\n+#endif\n{\nprotected:\nconst int size;\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix compilation on MSVC.
8,490
30.11.2019 00:44:31
-3,600
413b5421eb2c596674f1ea0698e5049061e734ad
Simplify the code of the Monitors.
[ { "change_type": "MODIFY", "old_path": "include/Module/Monitor/Monitor.hpp", "new_path": "include/Module/Monitor/Monitor.hpp", "diff": "@@ -54,24 +54,10 @@ public:\nvirtual void reset();\n- virtual void clear_callbacks();\n-\n- /*!\n- * \\brief collect data from 'm' monitor into this monitor.\n- * 'fully' flag indicates if only \"Value_t\" struct vals must be merged\n- * or also any other attributes of the class.\n- */\n- virtual void collect(const Monitor& m, bool fully = false) = 0;\n-\n/*\n* \\brief return true if enough data have been processed and respect check conditions\n*/\nvirtual bool is_done() const = 0;\n-\n- /*!\n- * \\brief completely copy values of the monitor 'm' into this monitor\n- */\n- Monitor& operator=(const Monitor& m);\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Monitor/Monitor_reduction.hpp", "new_path": "include/Tools/Monitor/Monitor_reduction.hpp", "diff": "@@ -18,11 +18,11 @@ namespace aff3ct\nnamespace tools\n{\n-class Monitor_reduction\n+class Monitor_reduction_static\n{\n-private:\n+protected:\nstatic bool stop_loop;\n- static std::vector<Monitor_reduction*> monitors;\n+ static std::vector<Monitor_reduction_static*> monitors;\nstatic std::thread::id master_thread_id;\nstatic std::chrono::nanoseconds d_reduce_frequency;\n@@ -39,14 +39,14 @@ public:\nstatic bool is_done_all(bool fully = false, bool final = false);\n/*\n- * \\brief call __reduce__ with 'fully' and 'force' arguments\n+ * \\brief call _reduce with 'fully' and 'force' arguments\n*/\nstatic void reduce_all(bool fully = false, bool force = false);\n/*\n- * \\brief loop on a forced reduction until '__reduce__' call return 'true' after having call 'set_stop_loop()'\n+ * \\brief throw if all process do not have the same number of monitors to reduce\n*/\n- static void last_reduce_all(bool fully = false);\n+ static void check_reducible();\n/*\n* reset 't_last_mpi_comm', clear 'stop_loop' and call 'reset_mr' on each monitor\n@@ -58,47 +58,47 @@ public:\nstatic void set_reduce_frequency(std::chrono::nanoseconds d);\n/*\n- * \\brief get if the current simulation loop must be stopped or not\n- * \\return true if loop must be stopped\n+ * \\brief reset this monitor\n*/\n- static bool get_stop_loop();\n+ virtual void reset() = 0;\n/*\n- * \\brief set that the current simulation loop must be stopped\n+ * \\brief check if this monitor has done\n+ * \\return true if has done\n*/\n- static void set_stop_loop();\n+ virtual bool is_done() = 0;\n/*\n- * \\brief throw if all process do not have the same number of monitors to reduce\n+ * \\brief do the reduction of this monitor\n*/\n- static void check_reducible();\n+ virtual void reduce(bool fully = true) = 0;\nprotected:\n- Monitor_reduction();\n+ Monitor_reduction_static();\n- virtual ~Monitor_reduction() = default;\n+ virtual ~Monitor_reduction_static() = default;\n+private:\n/*\n- * \\brief do the reduction of this monitor\n+ * \\brief loop on a forced reduction until '_reduce' call return 'true' after having call 'set_stop_loop()'\n*/\n- virtual void _reduce(bool fully = false) = 0;\n+ static void last_reduce_all(bool fully = false);\n/*\n- * \\brief reset this monitor\n+ * \\brief get if the current simulation loop must be stopped or not\n+ * \\return true if loop must be stopped\n*/\n- virtual void reset_mr() = 0;\n+ static bool get_stop_loop();\n/*\n- * \\brief check if this monitor has done\n- * \\return true if has done\n+ * \\brief set that the current simulation loop must be stopped\n*/\n- virtual bool is_done_mr() = 0;\n+ static void set_stop_loop();\n-private:\n/*\n* \\brief add the monitor in the 'monitors' list\n*/\n- static void add_monitor(Monitor_reduction*);\n+ static void add_monitor(Monitor_reduction_static*);\n/*\n* \\brief do a reduction of the number of process that are at the final reduce step\n@@ -113,12 +113,12 @@ private:\n* \\param fully if set, do a full reduction of all attributes\n* \\return the result of the 'reduce_stop_loop()' call after the reductions. If there were not, then return false.\n*/\n- static bool __reduce__(bool fully, bool force);\n+ static bool _reduce(bool fully, bool force);\n};\ntemplate <class M> // M is the monitor on which must be applied the reduction\n-class Monitor_reduction_M : public Monitor_reduction, public M\n+class Monitor_reduction : public Monitor_reduction_static, public M\n{\nstatic_assert(std::is_base_of<module::Monitor, M>::value, \"M have to be based on a module::Monitor class.\");\n@@ -131,26 +131,16 @@ public:\n* \\brief do reductions upon a monitor list to merge data in this monitor\n* \\param monitors is the list of monitors on which the reductions are done\n*/\n- explicit Monitor_reduction_M(const std::vector<M*> &monitors);\n- explicit Monitor_reduction_M(const std::vector<std::unique_ptr<M>> &monitors);\n- explicit Monitor_reduction_M(const std::vector<std::shared_ptr<M>> &monitors);\n- virtual ~Monitor_reduction_M() = default;\n+ explicit Monitor_reduction(const std::vector<M*> &monitors);\n+ explicit Monitor_reduction(const std::vector<std::unique_ptr<M>> &monitors);\n+ explicit Monitor_reduction(const std::vector<std::shared_ptr<M>> &monitors);\n+ virtual ~Monitor_reduction() = default;\nvirtual void reset();\n- virtual void clear_callbacks();\n-protected:\n- virtual void _reduce(bool fully = false);\n+ virtual bool is_done();\n- /*\n- * \\brief call reset()\n- */\n- virtual void reset_mr();\n-\n- /*\n- * \\brief call is_done()\n- */\n- virtual bool is_done_mr();\n+ virtual void reduce(bool fully = true);\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Monitor/Monitor_reduction.hxx", "new_path": "include/Tools/Monitor/Monitor_reduction.hxx", "diff": "@@ -11,9 +11,9 @@ namespace tools\n{\ntemplate <class M>\n-Monitor_reduction_M<M>\n-::Monitor_reduction_M(const std::vector<M*>& _monitors)\n-: Monitor_reduction(),\n+Monitor_reduction<M>\n+::Monitor_reduction(const std::vector<M*>& _monitors)\n+: Monitor_reduction_static(),\nM((_monitors.size() && _monitors.front()) ? *_monitors.front() : M(),\nstd::accumulate(_monitors.begin(), _monitors.end(), 0,\n[](int tot, const M *m) { return tot + m->get_n_frames(); })),\n@@ -27,7 +27,7 @@ Monitor_reduction_M<M>\nthrow tools::length_error(__FILE__, __LINE__, __func__, message.str());\n}\n- const std::string name = \"Monitor_reduction_M<\" + monitors[0]->get_name() + \">\";\n+ const std::string name = \"Monitor_reduction<\" + monitors[0]->get_name() + \">\";\nthis->set_name(name);\nfor (size_t m = 0; m < this->monitors.size(); m++)\n@@ -60,71 +60,51 @@ Monitor_reduction_M<M>\n}\ntemplate <class M>\n-Monitor_reduction_M<M>\n-::Monitor_reduction_M(const std::vector<std::unique_ptr<M>>& _monitors)\n-: Monitor_reduction_M(convert_to_ptr<M>(_monitors))\n+Monitor_reduction<M>\n+::Monitor_reduction(const std::vector<std::unique_ptr<M>>& _monitors)\n+: Monitor_reduction(convert_to_ptr<M>(_monitors))\n{\n}\ntemplate <class M>\n-Monitor_reduction_M<M>\n-::Monitor_reduction_M(const std::vector<std::shared_ptr<M>>& _monitors)\n-: Monitor_reduction_M(convert_to_ptr<M>(_monitors))\n+Monitor_reduction<M>\n+::Monitor_reduction(const std::vector<std::shared_ptr<M>>& _monitors)\n+: Monitor_reduction(convert_to_ptr<M>(_monitors))\n{\n}\ntemplate <class M>\n-void Monitor_reduction_M<M>\n+void Monitor_reduction<M>\n::reset()\n{\nM::reset();\n-\nfor (auto& m : this->monitors)\nm->reset();\n}\ntemplate <class M>\n-void Monitor_reduction_M<M>\n-::reset_mr()\n+bool Monitor_reduction<M>\n+::is_done()\n{\n- this->reset();\n-}\n-\n-template <class M>\n-bool Monitor_reduction_M<M>\n-::is_done_mr()\n+ // only the master thread can do this\n+ if ((std::this_thread::get_id() == Monitor_reduction_static::master_thread_id &&\n+ (std::chrono::steady_clock::now() - Monitor_reduction_static::t_last_reduction) >=\n+ Monitor_reduction_static::d_reduce_frequency))\n{\n- return M::is_done();\n+ this->reduce(false);\n+ Monitor_reduction_static::t_last_reduction = std::chrono::steady_clock::now();\n}\n-template <class M>\n-void Monitor_reduction_M<M>\n-::clear_callbacks()\n-{\n- M::clear_callbacks();\n-\n- for (auto& m : monitors)\n- m->clear_callbacks();\n+ return M::is_done();\n}\ntemplate <class M>\n-void Monitor_reduction_M<M>\n-::_reduce(bool fully)\n+void Monitor_reduction<M>\n+::reduce(bool fully)\n{\n- // Old slow way to collect data (with object allocation)\n- // M collecter(*this);\n-\n- // for (auto& m : this->monitors)\n- // collecter.collect(*m, fully);\n-\n- // M::copy(collecter, fully);\n-\n- // New way to collect data (without object allocation)\ncollecter.reset();\n-\nfor (auto& m : this->monitors)\ncollecter.collect(*m, fully);\n-\nM::copy(collecter, fully);\n}\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Monitor/Monitor_reduction_MPI.hpp", "new_path": "include/Tools/Monitor/Monitor_reduction_MPI.hpp", "diff": "@@ -18,7 +18,7 @@ namespace aff3ct\nnamespace tools\n{\ntemplate <class M> // M is the monitor on which must be applied the reduction\n-class Monitor_reduction_MPI : public Monitor_reduction_M<M>\n+class Monitor_reduction_MPI : public Monitor_reduction<M>\n{\nprotected:\nusing Attributes = typename M::Attributes;\n@@ -31,10 +31,7 @@ public:\nexplicit Monitor_reduction_MPI(const std::vector<std::unique_ptr<M>> &monitors);\nvirtual ~Monitor_reduction_MPI() = default;\n- virtual void reset();\n-\n-protected:\n- virtual void _reduce(bool fully = false);\n+ virtual void reduce(bool fully = false);\nprivate:\nstatic void MPI_reduce_monitors(void *in, void *inout, int *len, MPI_Datatype *datatype);\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Monitor/Monitor_reduction_MPI.hxx", "new_path": "include/Tools/Monitor/Monitor_reduction_MPI.hxx", "diff": "@@ -16,7 +16,7 @@ namespace tools\ntemplate <class M>\nMonitor_reduction_MPI<M>\n::Monitor_reduction_MPI(const std::vector<std::unique_ptr<M>> &monitors)\n-: Monitor_reduction_M<M>(monitors)\n+: Monitor_reduction<M>(monitors)\n{\nconst std::string name = \"Monitor_reduction_MPI<\" + monitors[0]->get_name() + \">\";\nthis->set_name(name);\n@@ -49,11 +49,11 @@ Monitor_reduction_MPI<M>\ntemplate <class M>\nvoid Monitor_reduction_MPI<M>\n-::_reduce(bool fully)\n+::reduce(bool fully)\n{\nfully = false;\n- Monitor_reduction_M<M>::_reduce(fully);\n+ Monitor_reduction<M>::reduce(fully);\nAttributes mvals_send = M::get_attributes(), mvals_recv;\nMPI_Allreduce(&mvals_send, &mvals_recv, 1, MPI_monitor_vals, MPI_Op_reduce_monitors, MPI_COMM_WORLD);\n@@ -61,13 +61,6 @@ void Monitor_reduction_MPI<M>\nM::copy(mvals_recv);\n}\n-template <class M>\n-void Monitor_reduction_MPI<M>\n-::reset()\n-{\n- Monitor_reduction_M<M>::reset();\n-}\n-\ntemplate <class M>\nvoid Monitor_reduction_MPI<M>\n::MPI_reduce_monitors(void *in, void *inout, int *len, MPI_Datatype *datatype)\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/BFER/Monitor_BFER.cpp", "new_path": "src/Module/Monitor/BFER/Monitor_BFER.cpp", "diff": "@@ -355,8 +355,6 @@ template <typename B>\nvoid Monitor_BFER<B>\n::clear_callbacks()\n{\n- Monitor::clear_callbacks();\n-\nthis->callback_fe.clear();\nthis->callback_check.clear();\nthis->callback_fe_limit_achieved.clear();\n@@ -366,17 +364,14 @@ template <typename B>\nvoid Monitor_BFER<B>\n::collect(const Monitor& m, bool fully)\n{\n- collect(dynamic_cast<const Monitor_BFER<B>&>(m), fully);\n+ collect(static_cast<const Monitor_BFER<B>&>(m), fully);\n}\ntemplate <typename B>\nvoid Monitor_BFER<B>\n::collect(const Monitor_BFER<B>& m, bool fully)\n{\n- equivalent(m, true);\n-\ncollect(m.get_attributes());\n-\nif (fully)\nthis->err_hist.add_values(m.err_hist);\n}\n@@ -396,23 +391,18 @@ Monitor_BFER<B>& Monitor_BFER<B>\nreturn *this;\n}\n-\n-\ntemplate <typename B>\nvoid Monitor_BFER<B>\n::copy(const Monitor& m, bool fully)\n{\n- copy(dynamic_cast<const Monitor_BFER<B>&>(m), fully);\n+ copy(static_cast<const Monitor_BFER<B>&>(m), fully);\n}\ntemplate <typename B>\nvoid Monitor_BFER<B>\n::copy(const Monitor_BFER<B>& m, bool fully)\n{\n- equivalent(m, true);\n-\ncopy(m.get_attributes());\n-\nif (fully)\nthis->err_hist = m.err_hist;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/EXIT/Monitor_EXIT.cpp", "new_path": "src/Module/Monitor/EXIT/Monitor_EXIT.cpp", "diff": "@@ -354,15 +354,13 @@ template <typename B, typename R>\nvoid Monitor_EXIT<B,R>\n::collect(const Monitor& m, bool fully)\n{\n- collect(dynamic_cast<const Monitor_EXIT<B,R>&>(m), fully);\n+ collect(static_cast<const Monitor_EXIT<B,R>&>(m), fully);\n}\ntemplate <typename B, typename R>\nvoid Monitor_EXIT<B,R>\n::collect(const Monitor_EXIT<B,R>& m, bool fully)\n{\n- equivalent(m, true);\n-\ncollect(m.get_attributes());\n}\n@@ -385,15 +383,13 @@ template <typename B, typename R>\nvoid Monitor_EXIT<B,R>\n::copy(const Monitor& m, bool fully)\n{\n- copy(dynamic_cast<const Monitor_EXIT<B,R>&>(m), fully);\n+ copy(static_cast<const Monitor_EXIT<B,R>&>(m), fully);\n}\ntemplate <typename B, typename R>\nvoid Monitor_EXIT<B,R>\n::copy(const Monitor_EXIT<B,R>& m, bool fully)\n{\n- equivalent(m, true);\n-\ncopy(m.get_attributes());\n}\n@@ -437,7 +433,6 @@ Monitor_EXIT<B,R>::Attributes\nreset();\n}\n-\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef AFF3CT_MULTI_PREC\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/MI/Monitor_MI.cpp", "new_path": "src/Module/Monitor/MI/Monitor_MI.cpp", "diff": "@@ -301,8 +301,6 @@ template <typename B, typename R>\nvoid Monitor_MI<B,R>\n::clear_callbacks()\n{\n- Monitor::clear_callbacks();\n-\nthis->callback_check.clear();\nthis->callback_n_trials_limit_achieved.clear();\n}\n@@ -311,17 +309,14 @@ template <typename B, typename R>\nvoid Monitor_MI<B,R>\n::collect(const Monitor& m, bool fully)\n{\n- collect(dynamic_cast<const Monitor_MI<B,R>&>(m), fully);\n+ collect(static_cast<const Monitor_MI<B,R>&>(m), fully);\n}\ntemplate <typename B, typename R>\nvoid Monitor_MI<B,R>\n::collect(const Monitor_MI<B,R>& m, bool fully)\n{\n- equivalent(m, true);\n-\ncollect(m.get_attributes());\n-\nif (fully)\nthis->mutinfo_hist.add_values(m.mutinfo_hist);\n}\n@@ -341,23 +336,18 @@ Monitor_MI<B,R>& Monitor_MI<B,R>\nreturn *this;\n}\n-\n-\ntemplate <typename B, typename R>\nvoid Monitor_MI<B,R>\n::copy(const Monitor& m, bool fully)\n{\n- copy(dynamic_cast<const Monitor_MI<B,R>&>(m), fully);\n+ copy(static_cast<const Monitor_MI<B,R>&>(m), fully);\n}\ntemplate <typename B, typename R>\nvoid Monitor_MI<B,R>\n::copy(const Monitor_MI<B,R>& m, bool fully)\n{\n- equivalent(m, true);\n-\ncopy(m.get_attributes());\n-\nif (fully)\nthis->mutinfo_hist = m.mutinfo_hist;\n}\n@@ -369,7 +359,6 @@ void Monitor_MI<B,R>\nvals = v;\n}\n-\ntemplate <typename B, typename R>\nMonitor_MI<B,R>& Monitor_MI<B,R>\n::operator=(const Monitor_MI<B,R>& m)\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Monitor.cpp", "new_path": "src/Module/Monitor/Monitor.cpp", "diff": "@@ -22,18 +22,7 @@ Monitor* Monitor\nthrow tools::unimplemented_error(__FILE__, __LINE__, __func__);\n}\n-void Monitor\n-::clear_callbacks()\n-{\n-}\n-\nvoid Monitor\n::reset()\n{\n}\n-\n-Monitor& Monitor\n-::operator=(const Monitor& m)\n-{\n- return *this;\n-}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.cpp", "new_path": "src/Simulation/BFER/BFER.cpp", "diff": "@@ -183,11 +183,11 @@ void BFER<B,R,Q>\ntry\n{\nthis->_launch();\n- tools::Monitor_reduction::is_done_all(true, true); // final reduction\n+ tools::Monitor_reduction_static::is_done_all(true, true); // final reduction\n}\ncatch (std::exception const& e)\n{\n- tools::Monitor_reduction::is_done_all(true, true); // final reduction\n+ tools::Monitor_reduction_static::is_done_all(true, true); // final reduction\nterminal->final_report(std::cout); // display final report to not lost last line overwritten by the error\n// messages\n@@ -283,7 +283,7 @@ void BFER<B,R,Q>\nfor (auto &t : mm->tasks)\nt->reset();\n- tools::Monitor_reduction::reset_all();\n+ tools::Monitor_reduction_static::reset_all();\ntools::Terminal::reset();\n}\n}\n@@ -363,9 +363,9 @@ void BFER<B,R,Q>\nthis->monitor_mi_red.reset(new Monitor_MI_reduction_type(this->monitor_mi));\n}\n- tools::Monitor_reduction::set_master_thread_id(std::this_thread::get_id());\n+ tools::Monitor_reduction_static::set_master_thread_id(std::this_thread::get_id());\n#ifdef AFF3CT_MPI\n- tools::Monitor_reduction::set_reduce_frequency(params_BFER.mnt_mpi_comm_freq);\n+ tools::Monitor_reduction_static::set_reduce_frequency(params_BFER.mnt_mpi_comm_freq);\n#else\nauto freq = std::chrono::milliseconds(0);\nif (params_BFER.mnt_red_lazy)\n@@ -375,11 +375,11 @@ void BFER<B,R,Q>\nelse\nfreq = std::chrono::milliseconds(1000); // default value when lazy reduction and no terminal refresh\n}\n- tools::Monitor_reduction::set_reduce_frequency(freq);\n+ tools::Monitor_reduction_static::set_reduce_frequency(freq);\n#endif\n- tools::Monitor_reduction::reset_all();\n- tools::Monitor_reduction::check_reducible();\n+ tools::Monitor_reduction_static::reset_all();\n+ tools::Monitor_reduction_static::check_reducible();\n}\ntemplate <typename B, typename R, typename Q>\n@@ -426,7 +426,7 @@ bool BFER<B,R,Q>\n{\n// communication chain execution\nreturn !(tools::Terminal::is_interrupt() // if user stopped the simulation\n- || tools::Monitor_reduction::is_done_all() // while any monitor criteria is not reached -> do reduction\n+ || tools::Monitor_reduction_static::is_done_all() // while any monitor criteria is not reached -> do reduction\n|| this->stop_time_reached());\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.hpp", "new_path": "src/Simulation/BFER/BFER.hpp", "diff": "@@ -55,8 +55,8 @@ protected:\nusing Monitor_BFER_reduction_type = tools::Monitor_reduction_MPI<Monitor_BFER_type>;\nusing Monitor_MI_reduction_type = tools::Monitor_reduction_MPI<Monitor_MI_type >;\n#else\n- using Monitor_BFER_reduction_type = tools::Monitor_reduction_M<Monitor_BFER_type>;\n- using Monitor_MI_reduction_type = tools::Monitor_reduction_M<Monitor_MI_type >;\n+ using Monitor_BFER_reduction_type = tools::Monitor_reduction<Monitor_BFER_type>;\n+ using Monitor_MI_reduction_type = tools::Monitor_reduction<Monitor_MI_type >;\n#endif\nstd::vector<std::unique_ptr<Monitor_MI_type >> monitor_mi;\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Monitor/Monitor_reduction.cpp", "new_path": "src/Tools/Monitor/Monitor_reduction.cpp", "diff": "using namespace aff3ct;\nusing namespace aff3ct::tools;\n-bool aff3ct::tools::Monitor_reduction::stop_loop = false;\n-std::vector<aff3ct::tools::Monitor_reduction*> aff3ct::tools::Monitor_reduction::monitors;\n-std::thread::id aff3ct::tools::Monitor_reduction::master_thread_id = std::this_thread::get_id();\n-std::chrono::nanoseconds aff3ct::tools::Monitor_reduction::d_reduce_frequency = std::chrono::milliseconds(1000);\n-std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> aff3ct::tools::Monitor_reduction::t_last_reduction;\n-\n-Monitor_reduction\n-::Monitor_reduction()\n+bool aff3ct::tools::Monitor_reduction_static::stop_loop = false;\n+std::vector<aff3ct::tools::Monitor_reduction_static*> aff3ct::tools::Monitor_reduction_static::monitors;\n+std::thread::id aff3ct::tools::Monitor_reduction_static::master_thread_id = std::this_thread::get_id();\n+std::chrono::nanoseconds aff3ct::tools::Monitor_reduction_static::d_reduce_frequency = std::chrono::milliseconds(1000);\n+std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> aff3ct::tools::Monitor_reduction_static::t_last_reduction;\n+\n+Monitor_reduction_static\n+::Monitor_reduction_static()\n{\n- Monitor_reduction::add_monitor(this);\n+ Monitor_reduction_static::add_monitor(this);\n}\n-void Monitor_reduction\n-::add_monitor(Monitor_reduction* m)\n+void Monitor_reduction_static\n+::add_monitor(Monitor_reduction_static* m)\n{\n- Monitor_reduction::monitors.push_back(m);\n+ Monitor_reduction_static::monitors.push_back(m);\n}\n-void Monitor_reduction\n+void Monitor_reduction_static\n::reset_all()\n{\n- Monitor_reduction::t_last_reduction = std::chrono::steady_clock::now();\n- Monitor_reduction::stop_loop = false;\n+ Monitor_reduction_static::t_last_reduction = std::chrono::steady_clock::now();\n+ Monitor_reduction_static::stop_loop = false;\n- for(auto& m : Monitor_reduction::monitors)\n- m->reset_mr();\n+ for(auto& m : Monitor_reduction_static::monitors)\n+ m->reset();\n}\n-bool Monitor_reduction\n+bool Monitor_reduction_static\n::is_done_all(bool fully, bool final)\n{\nif (final)\n@@ -48,8 +48,8 @@ bool Monitor_reduction\nbool is_done = false;\n- for(auto& m : Monitor_reduction::monitors)\n- is_done |= m->is_done_mr();\n+ for(auto& m : Monitor_reduction_static::monitors)\n+ is_done |= m->is_done();\nif (is_done)\nset_stop_loop();\n@@ -57,25 +57,25 @@ bool Monitor_reduction\nreturn get_stop_loop();\n}\n-void Monitor_reduction\n+void Monitor_reduction_static\n::reduce_all(bool fully, bool force)\n{\n- __reduce__(fully, force);\n+ _reduce(fully, force);\n}\n-void Monitor_reduction\n+void Monitor_reduction_static\n::last_reduce_all(bool fully)\n{\n- Monitor_reduction::set_stop_loop();\n+ Monitor_reduction_static::set_stop_loop();\n- while(!__reduce__(fully, true));\n+ while(!_reduce(fully, true));\n}\n-void Monitor_reduction\n+void Monitor_reduction_static\n::check_reducible()\n{\n#ifdef AFF3CT_MPI\n- int n_monitor_send = Monitor_reduction::monitors.size(), n_monitor_recv;\n+ int n_monitor_send = Monitor_reduction_static::monitors.size(), n_monitor_recv;\nMPI_Allreduce(&n_monitor_send, &n_monitor_recv, 1, MPI_INT, MPI_PROD, MPI_COMM_WORLD);\nint np;\n@@ -96,15 +96,15 @@ void Monitor_reduction\n#endif\n}\n-bool Monitor_reduction\n+bool Monitor_reduction_static\n::reduce_stop_loop()\n{\n#ifdef AFF3CT_MPI\n- int n_stop_recv, stop_send = Monitor_reduction::get_stop_loop() ? 1 : 0;\n+ int n_stop_recv, stop_send = Monitor_reduction_static::get_stop_loop() ? 1 : 0;\nMPI_Allreduce(&stop_send, &n_stop_recv, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);\nif (n_stop_recv > 0)\n- Monitor_reduction::set_stop_loop();\n+ Monitor_reduction_static::set_stop_loop();\nint np;\nMPI_Comm_size(MPI_COMM_WORLD, &np);\n@@ -115,47 +115,47 @@ bool Monitor_reduction\n#endif\n}\n-bool Monitor_reduction\n-::__reduce__(bool fully, bool force)\n+bool Monitor_reduction_static\n+::_reduce(bool fully, bool force)\n{\nbool all_process_on_last = false;\n// only the master thread can do this\n- if (force || (std::this_thread::get_id() == Monitor_reduction::master_thread_id &&\n- (std::chrono::steady_clock::now() - Monitor_reduction::t_last_reduction) >=\n- Monitor_reduction::d_reduce_frequency))\n+ if (force || (std::this_thread::get_id() == Monitor_reduction_static::master_thread_id &&\n+ (std::chrono::steady_clock::now() - Monitor_reduction_static::t_last_reduction) >=\n+ Monitor_reduction_static::d_reduce_frequency))\n{\n- for (auto& m : Monitor_reduction::monitors)\n- m->_reduce(fully);\n+ for (auto& m : Monitor_reduction_static::monitors)\n+ m->reduce(fully);\nall_process_on_last = reduce_stop_loop();\n- Monitor_reduction::t_last_reduction = std::chrono::steady_clock::now();\n+ Monitor_reduction_static::t_last_reduction = std::chrono::steady_clock::now();\n}\nreturn all_process_on_last;\n}\n-void Monitor_reduction\n+void Monitor_reduction_static\n::set_master_thread_id(std::thread::id t)\n{\n- Monitor_reduction::master_thread_id = t;\n+ Monitor_reduction_static::master_thread_id = t;\n}\n-void Monitor_reduction\n+void Monitor_reduction_static\n::set_reduce_frequency(std::chrono::nanoseconds d)\n{\n- Monitor_reduction::d_reduce_frequency = d;\n+ Monitor_reduction_static::d_reduce_frequency = d;\n}\n-bool Monitor_reduction\n+bool Monitor_reduction_static\n::get_stop_loop()\n{\n- return Monitor_reduction::stop_loop;\n+ return Monitor_reduction_static::stop_loop;\n}\n-void Monitor_reduction\n+void Monitor_reduction_static\n::set_stop_loop()\n{\n- Monitor_reduction::stop_loop = true;\n+ Monitor_reduction_static::stop_loop = true;\n}\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Simplify the code of the Monitors.