Mentions légales du service

Skip to content
Snippets Groups Projects
Commit e3a423a5 authored by FELŠÖCI Marek's avatar FELŠÖCI Marek
Browse files

Simplify HMAT settings

parent 10bcd28f
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,10 @@
extern hmat_interface_t * interface;
extern double epsilon;
extern hmat_progress_t progress;
/*! \brief Number of right hand sides for the test */
extern int nbRHS;
......@@ -68,6 +72,7 @@ int printHelp() ;
void prepare_hmat(int, int, int, int, int*, int*, int*, int*, void*, hmat_block_info_t *);
void advanced_compute_hmat(struct hmat_block_compute_context_t*);
int init_hmat_interface() ;
void update_progress(hmat_progress_t * ctx);
struct HMAT_desc_s;
typedef struct HMAT_desc_s HMAT_desc_t;
......
......@@ -32,21 +32,6 @@
typedef enum { MPF_FALSE, MPF_TRUE } Logical;
enum mpf_hmat_engine { mpf_hmat_seq, mpf_hmat_starpu, mpf_hmat_toyrt };
struct mpf_hmat_settings_t {
/** hmat interfaces for all scalar types */
hmat_interface_t *interfaces[4];
bool interface_initialized;
enum mpf_hmat_engine engine;
hmat_factorization_t factorization_type;
hmat_progress_t progress;
int l0size;
hmat_compress_t compressionMethod;
double epsilon;
double acaEpsilon;
int max_leaf_size;
};
_EXTERN_TEST_FEMBEM_ struct mpf_hmat_settings_t mpf_hmat_settings;
struct mpf_hmat_create_compression_args_t {
int method;
double threshold;
......
......@@ -170,57 +170,6 @@ advanced_compute_hmat(struct hmat_block_compute_context_t *b) {
} /* for (j = 0; ... */
}
/*! \brief Computes a block for the matrix of interactions.
This routines works for double complex and double precision matrices only. It is compliant with
the description given \ref pageCalculerBloc "here"
\param LigInf first row of the block
\param LigSup last row of the block
\param ColInf first column of the block
\param ColSup last column of the block
\param ___Inf first matrix to compute
\param ___Sup last matrix to compute
\param iloc initial row for writing in \a bloc
\param jloc initial column for writing in \a bloc
\param tailleS dimension of each page of \a bloc
\param tailleL leading dimension of \a bloc
\param bloc output buffer
\param context Pointer on the user's context, set with MpfSetUserContext()
*/
void computeDenseBlockFEMBEM(int *LigInf, int *LigSup, int *ColInf, int *ColSup,
int *___Inf, int *___Sup, int *iloc, int *jloc,
int *tailleS, int *tailleL, void *bloc, void *context) {
ASSERTA(*iloc==1);
ASSERTA(*jloc==1);
ASSERTA(*___Inf==0);
ASSERTA(*___Sup==1);
ASSERTA(context);
// Call prepare_block() to initialize the data for computing this matrix block
hmat_block_info_t block_info;
memset(&block_info, 0, sizeof(hmat_block_info_t));
prepare_hmat(*LigInf-1, *LigSup-*LigInf+1, *ColInf-1, *ColSup-*ColInf+1,
NULL, NULL, NULL, NULL, // All the mappings are NULL
context, &block_info);
// Set the actual leading dimension of 'bloc'
((block_data_t*)block_info.user_data)->leadingDim = *tailleL;
struct hmat_block_compute_context_t b;
b.user_data = block_info.user_data;
b.row_start = 0;
b.row_count = *LigSup-*LigInf+1;
b.col_start = 0;
b.col_count = *ColSup-*ColInf+1;
b.block = bloc;
b.stratum = -1;
advanced_compute_hmat(&b);
// We free the data allocated by prepare_block()
free_block_data(block_info.user_data);
}
HMAT_desc_t *HMAT_generate_matrix( hmat_interface_t *hi ) {
HMAT_desc_t *hdesc = MpfCalloc( 1, sizeof(HMAT_desc_t) );
......@@ -230,10 +179,6 @@ HMAT_desc_t *HMAT_generate_matrix( hmat_interface_t *hi ) {
hmat_cluster_tree_builder_t *ct_builder;
clustering = hmat_create_clustering_median();
if(mpf_hmat_settings.max_leaf_size > 0) {
printf("HMat maximum leaf size: %d\n", mpf_hmat_settings.max_leaf_size);
clustering = hmat_create_clustering_max_dof(clustering, mpf_hmat_settings.max_leaf_size);
}
hmat_set_clustering_divider(clustering, 2);
ct_builder = hmat_create_cluster_tree_builder( clustering );
......@@ -256,17 +201,17 @@ HMAT_desc_t *HMAT_generate_matrix( hmat_interface_t *hi ) {
// hmat_admissibility_t *admissibilityCondition = hmat_create_admissibility_standard(3.0);
hmat_matrix_t* hmatrix = hi->create_empty_hmatrix_admissibility(cluster_tree, cluster_tree, 1, admissibilityCondition);
hi->set_low_rank_epsilon(hmatrix, mpf_hmat_settings.epsilon);
hi->set_low_rank_epsilon(hmatrix, epsilon);
/* Assembly the Matrix */
struct mpf_hmat_create_compression_args_t compression_ctx;
compression_ctx.method = mpf_hmat_settings.compressionMethod;
compression_ctx.threshold = mpf_hmat_settings.acaEpsilon;
compression_ctx.method = hmat_compress_aca_plus;
compression_ctx.threshold = epsilon;
compression_ctx.output = hmat_create_compression_aca_plus(compression_ctx.threshold);
hmat_assemble_context_t ctx;
hmat_assemble_context_init(&ctx);
ctx.progress = &mpf_hmat_settings.progress;
ctx.progress = &progress;
ctx.progress->user_data = NULL;
ctx.factorization = hmat_factorization_none;
ctx.lower_symmetric = 1;
......
......@@ -3,6 +3,8 @@
#include "main.h"
hmat_interface_t * interface = NULL;
double epsilon = 1e-3;
hmat_progress_t progress;
// instantiation of globales defined in main.h
int nbRHS = 1;
......@@ -19,6 +21,10 @@ char *sTYPE_ELEMENT_ARRAY_test_fembem[] = {NULL};
int coupled = 0;
double lambda;
void update_progress(hmat_progress_t * ctx) {
Mpf_progressBar(ctx->current, ctx->max);
}
/*! \brief Main routine
\return 0 for success
*/
......@@ -32,6 +38,7 @@ int main(int argc, char **argv) {
ierr=SCAB_Init(&argc, &argv) ; CHKERRQ(ierr) ;
ierr = init_hmat_interface(); CHKERRQ(ierr);
progress.update = update_progress;
/* ------------------------------------------------------------------------- */
/* --------------------- DECODAGE DE LA LIGNE D'OPTIONS -------------------*/
......
......@@ -8,8 +8,7 @@ int testHMAT(double * relative_error) {
int ierr;
double temps_initial, temps_final, temps_cpu;
printf("<PERFTESTS> HAcaAccuracy = %.4e \n", mpf_hmat_settings.acaEpsilon);
printf("<PERFTESTS> HRecompressionAccuracy = %.4e \n", mpf_hmat_settings.epsilon);
printf("<PERFTESTS> Epsilon = %.4e \n", epsilon);
// String to append to the timer printed when doing asynchronous computation
char *postfix_async = hmat_get_sync_exec() ? "" : "_submission";
......@@ -25,13 +24,6 @@ int testHMAT(double * relative_error) {
temps_initial = getTime ();
printf("\n**** Creating HMAT...\n") ;
// hmat_factorization_none mean the user did not chose a factorization so we
// must choose one for him
if(mpf_hmat_settings.factorization_type == hmat_factorization_none) {
// use LDLT for real matrices
mpf_hmat_settings.factorization_type = hmat_factorization_ldlt;
}
HMAT_desc_t *hdesc;
hdesc = HMAT_generate_matrix( interface );
hmat_matrix_t *hmatrix = hdesc->hmatrix;
......@@ -59,9 +51,9 @@ int testHMAT(double * relative_error) {
hmat_factorization_context_t ctx;
hmat_factorization_context_init(&ctx);
ctx.progress = &mpf_hmat_settings.progress;
ctx.progress = &progress;
ctx.progress->user_data = NULL;
ctx.factorization = mpf_hmat_settings.factorization_type;
ctx.factorization = hmat_factorization_ldlt;
ierr = interface->factorize_generic(hmatrix, &ctx); CHKERRQ(ierr);
temps_final = getTime ();
......
......@@ -467,22 +467,11 @@ int hmat_get_sync_exec(void) {
return 1;
}
/* ================================================================================== */
static void update_progress(hmat_progress_t * ctx) {
Mpf_progressBar(ctx->current, ctx->max);
}
/* ================================================================================== */
int SCAB_Init(int* argc, char*** argv) {
int ierr;
printf( "HMATRIX solver\n");
memset(&mpf_hmat_settings, 0, sizeof(mpf_hmat_settings));
mpf_hmat_settings.factorization_type = hmat_factorization_none;
mpf_hmat_settings.acaEpsilon = 1e-3;
mpf_hmat_settings.compressionMethod = hmat_compress_aca_plus;
mpf_hmat_settings.epsilon = 1e-3;
mpf_hmat_settings.max_leaf_size = -1;
mpf_hmat_settings.engine = mpf_hmat_seq;
if(strcmp(hmat_get_version(), HMAT_VERSION))
printf( "***\n*** hmat version %s (compiled with version %s)\n", hmat_get_version(), HMAT_VERSION);
else
......@@ -491,13 +480,10 @@ int SCAB_Init(int* argc, char*** argv) {
hmat_get_build_date(&d, &t);
printf("*** Built on %s at %s\n***\n", d, t);
if (MpfArgGetDouble( argc, *argv, 1, "-epsilon" , &mpf_hmat_settings.epsilon )) {
mpf_hmat_settings.acaEpsilon = mpf_hmat_settings.epsilon;
printf("[HMat] Compression/Recompression epsilon: %e\n", mpf_hmat_settings.epsilon );
if (MpfArgGetDouble( argc, *argv, 1, "-epsilon" , &epsilon )) {
printf("[HMat] Compression/Recompression epsilon: %e\n", epsilon );
}
mpf_hmat_settings.progress.update = update_progress;
/*! \brief Abort timer (in seconds)
Abort timer: it is the initial value of the countdown timer started by setitimer().
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment