Mentions légales du service

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

Update C++ tests since use_csr has been replace to factor_format.

parent e555f004
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@
#include "faust_ConstraintInt.h"
#include "faust_MatDense.h"
#include "faust_hierarchical.h"
#include "faust_MHTP.h"
#ifdef USE_GPU_MOD
#include"faust_gpu_mod_utils.h"
#endif
......@@ -98,20 +99,20 @@ int main(int argc, const char** argv)
Faust::SpBlasHandle<Cpu> cusparseHandle;
double lambda2020;
char* str_use_csr = getenv("USE_CSR");
char* str_factors_format = getenv("FACTOR_FORMAT");
char* str_packing_RL = getenv("PACKING_RL");
char* str_isUpdateWayR2L = getenv("UR2L");
char* str_isFactSideLeft = getenv("FSL");
params.isUpdateWayR2L = true;
params.isFactSideLeft = true;
params.packing_RL = true;
params.use_csr = true;
params.factors_format = AllDynamic;
params.isVerbose = true;
if(str_packing_RL)
params.packing_RL = std::atoi(str_packing_RL) != 0;
if(str_use_csr)
params.use_csr = std::atoi(str_use_csr) != 0;
if(str_factors_format)
params.factors_format = static_cast<FactorsFormat>(std::atoi(str_factors_format));
if(str_isUpdateWayR2L)
params.isUpdateWayR2L = std::atoi(str_isUpdateWayR2L) != 0;
if(str_isFactSideLeft)
......@@ -139,10 +140,10 @@ int main(int argc, const char** argv)
#ifdef ON_CPU
cout << "on_gpu: " << on_gpu << endl;
auto th = Faust::hierarchical<double,Cpu>(MEG, params, lambda2020, false, on_gpu);
auto th = Faust::hierarchical<double,Cpu>(MEG, params, lambda2020, false, MHTPParams<double>(), on_gpu);
#else
cout << "hierarchical on GPU2 MEG" << endl;
auto th = Faust::hierarchical<double,GPU2>(gpu_MEG, params, lambda2020, false, on_gpu);
auto th = Faust::hierarchical<double,GPU2>(gpu_MEG, params, lambda2020, false, MHTPParams<double>(), on_gpu);
#endif
th->display();
......
#include "faust_MatDense.h"
#include "faust_MatSparse.h"
#include "faust_prox.h"
#include "faust_prox_gen.h"
#include <iostream>
/** \brief unitary test for MatDense conjugate
......
......@@ -94,7 +94,8 @@ int main(int argc, char* argv[])
//algorithm
Real<FPP> lambda;
bool isUpdateWayR2L = true, isFactSideLeft = false, use_csr = true, packing_RL = false;
bool isUpdateWayR2L = true, isFactSideLeft = false, packing_RL = false;
FactorsFormat factors_format = Faust::AllDynamic;
char* str_norm2_threshold = getenv("NORM2_THRESHOLD");
char* str_norm2_max_iter = getenv("NORM2_MAX_ITER");
char* str_packing_RL = getenv("PACKING_RL");
......@@ -125,7 +126,7 @@ int main(int argc, char* argv[])
// sc.push_back(30);
auto th = Faust::hierarchical(whtmat, sc, fac_cons, res_cons, lambda, isUpdateWayR2L,
isFactSideLeft, use_csr, packing_RL,
isFactSideLeft, factors_format, packing_RL,
MHTPParams<FPP>(),
/* compute_2norm_on_array*/ false,
norm2_threshold,
......
......@@ -57,6 +57,7 @@
#include <iostream>
#include <iomanip>
#include <vector>
#include "faust_MHTP.h"
/** \brief An example of using the hierarchical factorization of a dense matrix. from .mat file.
* A dense matrix is loaded from "@FAUST_DATA_MAT_DIR@
* \param MatrixFilename : a .mat (MATLAB file) where the matrix to be factorized is stored (or its transposed (cf. parameter transposeMatrix))
......@@ -100,8 +101,9 @@ int main(int argc, char* argv[])
//algorithm
Real<FPP> lambda;
bool isUpdateWayR2L = true, isFactSideLeft = false, use_csr = true, packing_RL = false;
char* str_use_csr = getenv("USE_CSR");
bool isUpdateWayR2L = true, isFactSideLeft = false, packing_RL = false;
Faust::FactorsFormat factors_format = Faust::AllDynamic;
char* str_factors_format = getenv("FACTOR_FORMAT");
char* str_norm2_threshold = getenv("NORM2_THRESHOLD");
char* str_norm2_max_iter = getenv("NORM2_MAX_ITER");
char* str_packing_RL = getenv("PACKING_RL");
......@@ -116,8 +118,8 @@ int main(int argc, char* argv[])
norm2_max_iter = std::atoi(str_norm2_max_iter);
if(str_packing_RL)
packing_RL = std::atoi(str_packing_RL) != 0;
if(str_use_csr)
use_csr = std::atoi(str_use_csr) != 0;
if(str_factors_format)
factors_format = static_cast<Faust::FactorsFormat>(std::atoi(str_factors_format));
if(str_nfacts)
nfacts = std::atoi(str_nfacts);
if(str_constraint_name)
......@@ -144,11 +146,13 @@ int main(int argc, char* argv[])
cout << "norm2_threshold: "<< norm2_threshold << endl;
cout << "norm2_max_iter: " << norm2_max_iter << endl;
cout << "prox: " << str_constraint_name << endl;
cout << "use_csr: " << use_csr << endl;
cout << "factors format: " << factors_format << endl;
cout << "packing_RL: " << packing_RL << endl;
vector<StoppingCriterion<Real<FPP>>> sc = {2,2};
auto th = Faust::hierarchical(whtmat_gpu, sc, fac_cons, res_cons, lambda, isUpdateWayR2L,
isFactSideLeft, use_csr, packing_RL,
isFactSideLeft, factors_format, packing_RL,
Faust::MHTPParams<FPP>(),
/* compute_2norm_on_array*/ false,
norm2_threshold,
norm2_max_iter);
......
......@@ -49,6 +49,7 @@
#include "faust_SpBlasHandle.h"
#include "faust_HierarchicalFact.h"
#include "faust_hierarchical.h"
#include "faust_MHTP.h"
#include <iostream>
#include <iomanip>
......@@ -186,14 +187,10 @@ int main(int argc, char* argv[])
auto res_cons = cons[1];
vector<Faust::StoppingCriterion<Real<FPP>>> sc = {200,200};
Real<FPP> lambda;
// auto th = Faust::hierarchical(matrix, sc, fac_cons, res_cons, lambda, params.isUpdateWayR2L,
// params.isFactSideLeft, /*use_csr */ true, /*packing_RL default to true*/true,
// /* compute_norms_on_arrays */false, FAUST_PRECISION, FAUST_NORM2_MAX_ITER, /* is_verbose default to false */ true, false, FAUST_PRECISION, /*on_gpu*/ true);
//
params.isVerbose = true;
params.use_csr = true;
auto th = Faust::hierarchical<FPP,Cpu>(matrix, params, lambda, false, /* on_gpu */ on_gpu);
params.factors_format = Faust::AllDynamic;
auto th = Faust::hierarchical<FPP,Cpu>(matrix, params, lambda, false, Faust::MHTPParams<FPP>(), on_gpu);
cout << "lambda=" << lambda << endl;
th->multiply(lambda);
th->display();
......
......@@ -99,7 +99,8 @@ int main(int argc, char* argv[])
// MatDense<FPP, Cpu>* H = Faust::MatDense<FPP,Cpu>::randMat(500,32);
// H->Display();
data.Display();
bool use_csr = true, is_update_way_R2L = false;
bool is_update_way_R2L = false;
FactorsFormat factors_format = AllDynamic;
bool packing_RL = true;
packing_RL = false;
int nites = 200;
......@@ -117,12 +118,12 @@ int main(int argc, char* argv[])
if(meth == 1)
{
cout << "use impl1" << endl;
Faust::palm4msa<FPP,Cpu>(data, constraints, facts, lambda, sc, is_update_way_R2L, use_csr, compute_2norm_on_array, norm2_threshold, norm2_max_iter, false, FAUST_PRECISION, on_gpu, true);
Faust::palm4msa<FPP,Cpu>(data, constraints, facts, lambda, sc, is_update_way_R2L, factors_format, compute_2norm_on_array, norm2_threshold, norm2_max_iter, false, FAUST_PRECISION, on_gpu, true);
}
else if(meth == 2)
{
cout << "use impl2" << endl;
Faust::palm4msa2<FPP,Cpu>(data, constraints, facts, lambda, sc, is_update_way_R2L, use_csr, packing_RL, MHTPParams<FPP>(), compute_2norm_on_array, norm2_threshold, norm2_max_iter, false, FAUST_PRECISION, on_gpu);
Faust::palm4msa2<FPP,Cpu>(data, constraints, facts, lambda, sc, is_update_way_R2L, factors_format, packing_RL, MHTPParams<FPP>(), compute_2norm_on_array, norm2_threshold, norm2_max_iter, false, FAUST_PRECISION, on_gpu);
}
#ifdef USE_GPU_MOD
else if(meth == 3)
......@@ -130,7 +131,7 @@ int main(int argc, char* argv[])
cout << "use impl3" << endl;
Faust::MatDense<FPP,GPU2> gpu_data(data);
TransformHelper<FPP,GPU2> gpu_facts;
Faust::palm4msa2<FPP,GPU2>(gpu_data, gpu_constraints, gpu_facts, lambda, sc, is_update_way_R2L, use_csr, packing_RL, MHTPParams<FPP>(), compute_2norm_on_array, norm2_threshold, norm2_max_iter, false, FAUST_PRECISION, on_gpu);
Faust::palm4msa2<FPP,GPU2>(gpu_data, gpu_constraints, gpu_facts, lambda, sc, is_update_way_R2L, factors_format, packing_RL, MHTPParams<FPP>(), compute_2norm_on_array, norm2_threshold, norm2_max_iter, false, FAUST_PRECISION, on_gpu);
gpu_facts.display();
gpu_facts.tocpu(facts);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment