Changeset 12988
- Timestamp:
- 08/10/12 17:09:30 (13 years ago)
- Location:
- issm/trunk-jpl
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/configs/config-macosx64-larour-ad.sh
r12689 r12988 17 17 --without-groundingline \ 18 18 --without-kriging \ 19 --with-gsl-dir=$ISSM_DIR/externalpackages/gsl/install 20 #--with-adolc-dir=$ISSM_DIR/externalpackages/adolc/install\19 --with-gsl-dir=$ISSM_DIR/externalpackages/gsl/install \ 20 --with-adolc-dir=$ISSM_DIR/externalpackages/adolc/install -
issm/trunk-jpl/src/c/classes/objects/Params/TransientParam.cpp
r12832 r12988 99 99 void TransientParam::GetParameterValue(IssmDouble* pdouble,IssmDouble time){ 100 100 101 double output;101 IssmDouble output; 102 102 bool found; 103 103 -
issm/trunk-jpl/src/c/modules/Solverx/Solverx.h
r12850 r12988 25 25 void SolverxSeq(SeqVec** puf,SeqMat* Kff, SeqVec* pf); 26 26 void SolverxSeq(IssmDouble** pX,IssmDouble* A,IssmDouble* B,int n); 27 void SolverxSeq(double** pX,double* A,double* B,int n); 27 28 28 29 #endif /* _SOLVERX_H */ -
issm/trunk-jpl/src/c/modules/Solverx/SolverxSeq.cpp
r12850 r12988 44 44 45 45 }/*}}}*/ 46 void SolverxSeq(IssmDouble** pX,IssmDouble* A,IssmDouble* B,int n){/*{{{*/ 46 #ifdef _HAVE_ADOLC_ 47 void SolverxSeq(IssmDouble** pX,IssmDouble* A,IssmDouble* B,int n){//{{{ 48 /* if we use Adol-C then the IssmDouble will be an adouble 49 and the calls to gsl_... will not work. 50 We therefore call a wrapped solver instead. 51 */ 47 52 53 /*Output: */ 54 IssmDouble* X=NULL; 55 56 /*Intermediary: */ 57 int i; 58 double* doubleA=NULL; 59 double* doubleB=NULL; 60 double* doubleX=NULL; 61 62 /*First, transfer from IssmDouble to double all our matrices and vectors: */ 63 doubleA=xNew<double>(n*n); 64 doubleB=xNew<double>(n); 65 for(i=0;i<n*n;i++)A[i]>>=doubleA[i]; 66 for(i=0;i<n;i++)B[i]>>=doubleB[i]; 67 68 /*Call wrapped solver: */ 69 SolverxSeq(&doubleX,doubleA, doubleB, n); 70 71 /*Transfer solution vector from double to IssmDouble: */ 72 X = xNew<IssmDouble>(n); 73 for(i=0;i<n;i++)X[i]<<=doubleX[i]; 74 75 /*Free ressources:*/ 76 xDelete<double>(doubleA); 77 xDelete<double>(doubleB); 78 79 /*Assign output pointers: */ 80 *pX=X; 81 } 82 /*}}}*/ 83 #endif 84 //void SolverxSeq(double** pX,double* A,double* B,int n){ //{{{ 85 #ifdef _HAVE_ADOLC_ 86 void SolverxSeq(double** pX,double* A,double* B,int n){ 87 #else 88 void SolverxSeq(IssmDouble** pX,IssmDouble* A,IssmDouble* B,int n){ 89 #endif 48 90 #ifdef _HAVE_GSL_ 49 /*GSL Matrices and vectors: */ 50 int s; 51 gsl_matrix_view a; 52 gsl_vector_view b; 53 gsl_vector *x = NULL; 54 gsl_permutation *p = NULL; 55 #ifdef _HAVE_ADOLC_ 56 // if we use Adol-C then the IssmDouble will be an adouble 57 // and the calls to gsl_... will not work 58 // and we should call a suitable wrapped solve instead 59 _error2_("SolverxSeq: should not be here with Adol-C"); 60 #else 61 /*A will be modified by LU decomposition. Use copy*/ 62 IssmDouble* Acopy = xNew<IssmDouble>(n*n); 63 xMemCpy<IssmDouble>(Acopy,A,n*n); 91 /*GSL Matrices and vectors: */ 92 int s; 93 gsl_matrix_view a; 94 gsl_vector_view b; 95 gsl_vector *x = NULL; 96 gsl_permutation *p = NULL; 97 /*A will be modified by LU decomposition. Use copy*/ 98 double* Acopy = xNew<double>(n*n); 99 xMemCpy<double>(Acopy,A,n*n); 64 100 65 66 67 68 101 /*Initialize gsl matrices and vectors: */ 102 a = gsl_matrix_view_array (Acopy,n,n); 103 b = gsl_vector_view_array (B,n); 104 x = gsl_vector_alloc (n); 69 105 70 71 72 73 106 /*Run LU and solve: */ 107 p = gsl_permutation_alloc (n); 108 gsl_linalg_LU_decomp (&a.matrix, p, &s); 109 gsl_linalg_LU_solve (&a.matrix, p, &b.vector, x); 74 110 75 76 111 //printf ("x = \n"); 112 //gsl_vector_fprintf (stdout, x, "%g"); 77 113 78 79 IssmDouble* X = xNew<IssmDouble>(n);80 memcpy(X,gsl_vector_ptr(x,0),n*sizeof(IssmDouble));114 /*Copy result*/ 115 double* X = xNew<double>(n); 116 memcpy(X,gsl_vector_ptr(x,0),n*sizeof(double)); 81 117 82 /*Clean up and assign output pointer*/ 83 xDelete<IssmDouble>(Acopy); 84 gsl_permutation_free(p); 85 gsl_vector_free(x); 86 *pX=X; 87 #endif 118 /*Clean up and assign output pointer*/ 119 xDelete<double>(Acopy); 120 gsl_permutation_free(p); 121 gsl_vector_free(x); 122 *pX=X; 88 123 #endif 89 }/*}}}*/ 124 } 125 /*}}}*/ -
issm/trunk-jpl/src/c/shared/Elements/PddSurfaceMassBalance.cpp
r12867 r12988 80 80 if (tstar < PDup){ 81 81 pd = 1.; 82 if (tstar >= -siglimc){ pd = pds[ int(tstar/DT + siglim0c)];}}82 if (tstar >= -siglimc){ pd = pds[reCast<int,IssmDouble>(tstar/DT + siglim0c)];}} 83 83 else { 84 84 pd = 0.;} … … 100 100 if (tstar >= siglim) {pdd = pdd + tstar*deltm;} 101 101 else if (tstar> -siglim){ 102 pddsig=pdds[ int(tstar/DT + siglim0)];102 pddsig=pdds[reCast<int,IssmDouble>(tstar/DT + siglim0)]; 103 103 pdd = pdd + pddsig*deltm; 104 104 frzndd = frzndd - (tstar-pddsig)*deltm;} -
issm/trunk-jpl/src/c/solutions/issm.cpp
r12696 r12988 14 14 bool dakota_analysis,control_analysis,tao_analysis; 15 15 16 /*AD: */ 17 int tape_stats[11]; 18 16 19 /*FemModel: */ 17 20 FemModel *femmodel = NULL; … … 41 44 42 45 ISSMBOOT(); 46 47 /*If running AD, then initialize the tape: */ 48 #ifdef _HAVE_ADOLC_ 49 trace_on(1); 50 #endif 43 51 44 52 /*Initialize environments: Petsc, MPI, etc...: */ … … 200 208 #endif 201 209 #endif 210 211 /*If running AD, close our tape, print statistics: */ 212 #ifdef _HAVE_ADOLC_ 213 trace_off(); 214 tapestats(1,tape_stats); //reading of tape statistics 215 _pprintLine_(" ADOLC statistics: "); 216 _pprintLine_(" "<<setw(45)<<left<<"Number of independents: " <<tape_stats[0]); 217 _pprintLine_(" "<<setw(45)<<left<<"Number of dependents: " <<tape_stats[1]); 218 _pprintLine_(" "<<setw(45)<<left<<"Maximal number of live active variables: " <<tape_stats[2]); 219 _pprintLine_(" "<<setw(45)<<left<<"Size of value stack (number of overwrites): " <<tape_stats[3]); 220 _pprintLine_(" "<<setw(45)<<left<<"Buffer size (a multiple of eight): " <<tape_stats[4]); 221 _pprintLine_(" "<<setw(45)<<left<<"Total number of operations recorded: " <<tape_stats[5]); 222 #endif 202 223 203 224 /*end module: */ -
issm/trunk-jpl/src/m/model/solve.m
r12845 r12988 68 68 end 69 69 70 %we need to make sure we have PETSC support, otherwise, we run with only one cpu: 71 if ~ispetsc, 72 disp('PETSC support not included, running on 1 cpu only!'); 73 cluster.np=1; 74 end 75 76 70 77 %Wite all input files 71 78 marshall(md); % bin file … … 73 80 BuildQueueScript(cluster,md.private.runtimename,md.miscellaneous.name,md.private.solution,md.settings.io_gather,md.debug.valgrind,md.debug.gprof); % queue file 74 81 75 %we need to make sure we have PETSC support, otherwise, we run with only one cpu:76 if ~ispetsc,77 disp('PETSC support not included, running on 1 cpu only!');78 cluster.np=1;79 end80 82 81 83 %Stop here if batch mode
Note:
See TracChangeset
for help on using the changeset viewer.