Skip to content

Commit

Permalink
Small change in EXT+I MEX prolongation algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-franceschini committed Mar 24, 2024
1 parent 980fc6f commit f76f036
Show file tree
Hide file tree
Showing 6 changed files with 321 additions and 202 deletions.
51 changes: 35 additions & 16 deletions sources/prolong/MEX_EXTI_Prol/EXTI_prolongation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#include "omp.h"

#include "MIS.h"
#include "TWOLP_ProlStripe_EXTI.h"
#include "ProlStripe_EXTI.h"
#include "ONELP_ProlStripe_EXTI.h"

int EXTI_prolongation(const int level, const int nthreads,
const int *vecstart, const int nn_A, const int nt_A,
Expand All @@ -16,22 +17,17 @@ int EXTI_prolongation(const int level, const int nthreads,
const int nr_I, const int nc_I, int &nt_I, int *&iat_I,
int *&ja_I, double *&coef_I){


int *ridv_i;
int *ridvn_i;


int ierr = 0;


ridv_i = new int [nthreads+1](); if (ridv_i == NULL) exit(ierr += 1);
ridvn_i = new int [nthreads+1](); if (ridvn_i == NULL) exit(ierr += 1);

int nn_I;


#pragma omp parallel num_threads(nthreads)

{
std::chrono::time_point<std::chrono::high_resolution_clock> START_OLD,END_OLD;
std::chrono::time_point<std::chrono::high_resolution_clock> START_ONE,END_ONE;
Expand Down Expand Up @@ -64,13 +60,39 @@ int EXTI_prolongation(const int level, const int nthreads,
coef_scr = new double [nt_Imax]();
if (coef_scr == NULL) {ierr_L = 1; goto exit_pragma;}

START_TWO = std::chrono::high_resolution_clock::now();
ierr_L = TWOLP_ProlStripe_EXTI(firstrow,lastrow,nn_loc,nn_A,nt_A,nt_Imax,
iat_A,ja_A,coef_A,coef_S,iat_C,ja_C,coef_C,
fcnodes,nn_I_loc,nt_I_loc,iat_scr,ja_scr,
coef_scr);
END_TWO = std::chrono::high_resolution_clock::now();
time_TWO = std::chrono::duration<double>(END_TWO-START_TWO);

#if 1
START_ONE = std::chrono::high_resolution_clock::now();
ierr_L = ONELP_ProlStripe_EXTI(firstrow,lastrow,nn_loc,nn_A,nt_A,nt_Imax,
iat_A,ja_A,coef_A,coef_S,iat_C,ja_C,coef_C,
fcnodes,nn_I_loc,nt_I_loc,iat_scr,ja_scr,
coef_scr);
END_ONE = std::chrono::high_resolution_clock::now();
time_ONE = std::chrono::duration<double>(END_ONE-START_ONE);
//printf("TIME ONE [s] = %15.6e\n",time_ONE.count());
//printf("\n\n\n\n------------\n\n\n\n");
#endif
#if 0
START_TWO = std::chrono::high_resolution_clock::now();
ierr_L = TWOLP_ProlStripe_EXTI(firstrow,lastrow,nn_loc,nn_A,nt_A,nt_Imax,
iat_A,ja_A,coef_A,coef_S,iat_C,ja_C,coef_C,
fcnodes,nn_I_loc,nt_I_loc,iat_scr,ja_scr,
coef_scr);
END_TWO = std::chrono::high_resolution_clock::now();
time_TWO = std::chrono::duration<double>(END_TWO-START_TWO);
printf("TIME TWO [s] = %15.6e\n",time_TWO.count());
printf("\n\n\n\n------------\n\n\n\n");
#endif
#if 0
START_OLD = std::chrono::high_resolution_clock::now();
ierr_L = ProlStripe_EXTI(firstrow,lastrow,nn_loc,nn_A,nt_A,nt_Imax,
iat_A,ja_A,coef_A,coef_S,fcnodes,nn_I_loc,nt_I_loc,
iat_scr,ja_scr,coef_scr);
END_OLD = std::chrono::high_resolution_clock::now();
time_OLD = std::chrono::duration<double>(END_OLD-START_OLD);
printf("TIME OLD [s] = %15.6e\n",time_OLD.count());
printf("\n\n\n\n------------\n\n\n\n");
#endif
#pragma omp atomic update
ierr += ierr_L;

Expand Down Expand Up @@ -127,13 +149,10 @@ int EXTI_prolongation(const int level, const int nthreads,
delete [] ja_scr;
delete [] coef_scr;


exit_pragma: ;


#pragma omp atomic update
ierr += ierr_L;

}

delete [] ridv_i;
Expand Down
Loading

0 comments on commit f76f036

Please sign in to comment.