Mentions légales du service

Skip to content
Snippets Groups Projects
Commit cf7ed28c authored by hhakim's avatar hhakim
Browse files

Update PALM4MSA 2020 C++ impl. to allow changing the product method (GREEDY,...

Update PALM4MSA 2020 C++ impl. to allow changing the product method (GREEDY, DYNPROG etc.) through an environment variable and change the default method from GREEDY to DYNPROG (because it is a bit faster for MEG matrix factorization).
parent 4f9dd278
No related branches found
No related tags found
No related merge requests found
...@@ -18,7 +18,10 @@ void Faust::palm4msa2(const Faust::MatDense<FPP,DEVICE>& A, ...@@ -18,7 +18,10 @@ void Faust::palm4msa2(const Faust::MatDense<FPP,DEVICE>& A,
{ {
std::chrono::duration<double> norm2_duration = std::chrono::duration<double>::zero(); std::chrono::duration<double> norm2_duration = std::chrono::duration<double>::zero();
std::chrono::duration<double> fgrad_duration = std::chrono::duration<double>::zero(); std::chrono::duration<double> fgrad_duration = std::chrono::duration<double>::zero();
int prod_mod = GREEDY_ALL_BEST_GENMAT; char* str_env_prod_mod = getenv("PROD_MOD");
int prod_mod = DYNPROG; // GREEDY_ALL_BEST_GENMAT; DYNPROG is a bit better to factorize the MEG matrix and not slower to factorize a Hadamard matrix
if(str_env_prod_mod)
prod_mod = std::atoi(str_env_prod_mod);
double norm1, norm2; double norm1, norm2;
// std::cout << "palm4msa2 "<< std::endl; // std::cout << "palm4msa2 "<< std::endl;
if(constraints.size() == 0) if(constraints.size() == 0)
...@@ -272,7 +275,7 @@ void Faust::compute_n_apply_grad2(const int f_id, const Faust::MatDense<FPP,DEVI ...@@ -272,7 +275,7 @@ void Faust::compute_n_apply_grad2(const int f_id, const Faust::MatDense<FPP,DEVI
_R = pR[f_id]->get_gen_fact_nonconst(0); _R = pR[f_id]->get_gen_fact_nonconst(0);
else else
{ {
// __R = pR[f_id]->get_product(prod_mod); // disabled because GREEDY_ALL_BEST_GENMAT is slower than DEFAULT_L2R for Hadamard factorization // __R = pR[f_id]->get_product(prod_mod); // disabled because GREEDY_ALL_BEST_GENMAT is slower than DEFAULT_L2R for Hadamard factorization
__R = pR[f_id]->get_product(); __R = pR[f_id]->get_product();
_R = &__R; _R = &__R;
} }
...@@ -284,7 +287,7 @@ void Faust::compute_n_apply_grad2(const int f_id, const Faust::MatDense<FPP,DEVI ...@@ -284,7 +287,7 @@ void Faust::compute_n_apply_grad2(const int f_id, const Faust::MatDense<FPP,DEVI
_L = pL[f_id]->get_gen_fact_nonconst(0); _L = pL[f_id]->get_gen_fact_nonconst(0);
else else
{ {
// __L = pL[f_id]->get_product(prod_mod); // disabled because GREEDY_ALL_BEST_GENMAT is slower than DEFAULT_L2R for Hadamard factorization // __L = pL[f_id]->get_product(prod_mod); // disabled because GREEDY_ALL_BEST_GENMAT is slower than DEFAULT_L2R for Hadamard factorization
__L = pL[f_id]->get_product(); __L = pL[f_id]->get_product();
_L = &__L; _L = &__L;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment