Changeset 26432
- Timestamp:
- 09/04/21 18:06:05 (4 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/c/classes/FemModel.cpp ¶
r26165 r26432 2307 2307 2308 2308 #if defined(_HAVE_CODIPACK_) 2309 auto& tape_codi = IssmDouble::get GlobalTape();2309 auto& tape_codi = IssmDouble::getTape(); 2310 2310 #endif 2311 2311 … … 2319 2319 tape_codi.registerOutput(output_value); 2320 2320 dependents[i] = output_value.getValue(); 2321 codi_global.output_indices.push_back(output_value.get GradientData());2321 codi_global.output_indices.push_back(output_value.getIdentifier()); 2322 2322 #else 2323 2323 output_value>>=dependents[i]; -
TabularUnified issm/trunk-jpl/src/c/classes/IoModel.cpp ¶
r26253 r26432 2065 2065 scalar=pscalar; 2066 2066 } 2067 auto& tape_codi = IssmDouble::get GlobalTape();2067 auto& tape_codi = IssmDouble::getTape(); 2068 2068 tape_codi.registerInput(scalar); 2069 codi_global.input_indices.push_back(scalar.get GradientData());2069 codi_global.input_indices.push_back(scalar.getIdentifier()); 2070 2070 #else 2071 2071 if(X){ … … 2138 2138 #if defined(_HAVE_CODIPACK_) 2139 2139 // FIXME codi here we just assign instead of using "operator <<=" 2140 auto& tape_codi = IssmDouble::get GlobalTape();2140 auto& tape_codi = IssmDouble::getTape(); 2141 2141 if(X){ 2142 2142 for (int i=0;i<M*N;i++) { 2143 2143 matrix[i]=X[Xcount+i]; 2144 2144 tape_codi.registerInput(matrix[i]); 2145 codi_global.input_indices.push_back(matrix[i].get GradientData());2145 codi_global.input_indices.push_back(matrix[i].getIdentifier()); 2146 2146 } 2147 2147 } … … 2150 2150 matrix[i]=buffer[i]; 2151 2151 tape_codi.registerInput(matrix[i]); 2152 codi_global.input_indices.push_back(matrix[i].get GradientData());2152 codi_global.input_indices.push_back(matrix[i].getIdentifier()); 2153 2153 } 2154 2154 } … … 2963 2963 * -> These parameters are not read for the CoDiPack ISSM version! 2964 2964 */ 2965 auto& tape_codi = IssmDouble::get GlobalTape();2965 auto& tape_codi = IssmDouble::getTape(); 2966 2966 tape_codi.setActive(); 2967 2967 #if _AD_TAPE_ALLOC_ … … 2976 2976 /* 2977 2977 std::stringstream out_s; 2978 IssmDouble::get GlobalTape().printStatistics(out_s);2978 IssmDouble::getTape().printStatistics(out_s); 2979 2979 _printf0_("StartTrace::Tape Statistics : TapeAlloc count=[" << codi_allocn << "]\n" << out_s.str()); 2980 2980 */ -
TabularUnified issm/trunk-jpl/src/c/cores/ad_core.cpp ¶
r23250 r26432 326 326 327 327 /*First, stop tracing: */ 328 auto& tape_codi = IssmDouble::get GlobalTape();328 auto& tape_codi = IssmDouble::getTape(); 329 329 tape_codi.setPassive(); 330 330 -
TabularUnified issm/trunk-jpl/src/c/cores/controladm1qn3_core.cpp ¶
r25793 r26432 75 75 * -> These parameters are not read for the CoDiPack ISSM version! 76 76 */ 77 auto& tape_codi = IssmDouble::get GlobalTape();77 auto& tape_codi = IssmDouble::getTape(); 78 78 tape_codi.setActive(); 79 79 #if _AD_TAPE_ALLOC_ … … 88 88 /* 89 89 std::stringstream out_s; 90 IssmDouble::get GlobalTape().printStatistics(out_s);90 IssmDouble::getTape().printStatistics(out_s); 91 91 _printf0_("StartTrace::Tape Statistics : TapeAlloc count=[" << codi_allocn << "]\n" << out_s.str()); 92 92 */ … … 153 153 #endif 154 154 std::stringstream out_s; 155 IssmDouble::get GlobalTape().printStatistics(out_s);155 IssmDouble::getTape().printStatistics(out_s); 156 156 _printf0_("CoDiPack Profiling::Tape Statistics :\n" << out_s.str()); 157 157 #endif … … 159 159 160 160 #elif defined(_HAVE_CODIPACK_) 161 auto& tape_codi = IssmDouble::get GlobalTape();161 auto& tape_codi = IssmDouble::getTape(); 162 162 tape_codi.setPassive(); 163 163 if(VerboseAutodiff()){ … … 239 239 } 240 240 #elif defined(_HAVE_CODIPACK_) 241 auto& tape_codi = IssmDouble::get GlobalTape();241 auto& tape_codi = IssmDouble::getTape(); 242 242 codi_global.input_indices.clear(); 243 243 if(my_rank==0){ … … 245 245 aX[i]=X[i]; 246 246 tape_codi.registerInput(aX[i]); 247 codi_global.input_indices.push_back(aX[i].get GradientData());247 codi_global.input_indices.push_back(aX[i].getIdentifier()); 248 248 } 249 249 } … … 285 285 tape_codi.registerOutput(output_value); 286 286 dependents[i] = output_value.getValue(); 287 codi_global.output_indices.push_back(output_value.get GradientData());287 codi_global.output_indices.push_back(output_value.getIdentifier()); 288 288 289 289 #elif defined(_HAVE_ADOLC_) -
TabularUnified issm/trunk-jpl/src/c/cores/controlvalidation_core.cpp ¶
r25578 r26432 50 50 * -> These parameters are not read for the CoDiPack ISSM version! 51 51 */ 52 auto& tape_codi = IssmDouble::get GlobalTape();52 auto& tape_codi = IssmDouble::getTape(); 53 53 tape_codi.setActive(); 54 54 #if _AD_TAPE_ALLOC_ … … 63 63 /* 64 64 std::stringstream out_s; 65 IssmDouble::get GlobalTape().printStatistics(out_s);65 IssmDouble::getTape().printStatistics(out_s); 66 66 _printf0_("StartTrace::Tape Statistics : TapeAlloc count=[" << codi_allocn << "]\n" << out_s.str()); 67 67 */ … … 127 127 #endif 128 128 std::stringstream out_s; 129 IssmDouble::get GlobalTape().printStatistics(out_s);129 IssmDouble::getTape().printStatistics(out_s); 130 130 _printf0_("CoDiPack Profiling::Tape Statistics :\n" << out_s.str()); 131 131 #endif … … 133 133 134 134 #elif defined(_HAVE_CODIPACK_) 135 auto& tape_codi = IssmDouble::get GlobalTape();135 auto& tape_codi = IssmDouble::getTape(); 136 136 tape_codi.setPassive(); 137 137 if(VerboseAutodiff()){ … … 190 190 simul_starttrace2(femmodel); 191 191 IssmDouble* aX=xNew<IssmDouble>(n); 192 auto& tape_codi = IssmDouble::get GlobalTape();192 auto& tape_codi = IssmDouble::getTape(); 193 193 codi_global.input_indices.clear(); 194 194 if(my_rank==0){ … … 196 196 aX[i]=X0[i]; 197 197 tape_codi.registerInput(aX[i]); 198 codi_global.input_indices.push_back(aX[i].get GradientData());198 codi_global.input_indices.push_back(aX[i].getIdentifier()); 199 199 } 200 200 } … … 230 230 tape_codi.registerOutput(output_value); 231 231 dependents[i] = output_value.getValue(); 232 codi_global.output_indices.push_back(output_value.get GradientData());232 codi_global.output_indices.push_back(output_value.getIdentifier()); 233 233 J+=output_value; 234 234 } -
TabularUnified issm/trunk-jpl/src/c/cores/transient_core.cpp ¶
r26224 r26432 374 374 375 375 /*Start tracing*/ 376 auto& tape_codi = IssmDouble::get GlobalTape();376 auto& tape_codi = IssmDouble::getTape(); 377 377 tape_codi.setActive(); 378 378 -
TabularUnified issm/trunk-jpl/src/c/shared/io/Marshalling/Marshalling.cpp ¶
r25543 r26432 75 75 this->identifiers = identifiers_in; 76 76 this->size_max = size_max_in; 77 this->tape_codi = &(IssmDouble::get GlobalTape());77 this->tape_codi = &(IssmDouble::getTape()); 78 78 }/*}}}*/ 79 79 void RegisterInputFunctor::Echo(void){/*{{{*/ … … 84 84 _assert_(this->double_count<size_max); 85 85 this->tape_codi->registerInput(value); 86 this->identifiers[this->double_count] = value.get GradientData();86 this->identifiers[this->double_count] = value.getIdentifier(); 87 87 this->double_count++; 88 88 }/*}}}*/ … … 92 92 _assert_(this->double_count<size_max); 93 93 this->tape_codi->registerInput(value[i]); 94 this->identifiers[this->double_count] = value[i].get GradientData();94 this->identifiers[this->double_count] = value[i].getIdentifier(); 95 95 this->double_count++; 96 96 } … … 100 100 RegisterOutputFunctor::RegisterOutputFunctor(void) : MarshallHandle(AD_REGISTEROUTPUT){/*{{{*/ 101 101 this->double_count = 0; 102 this->tape_codi = &(IssmDouble::get GlobalTape());102 this->tape_codi = &(IssmDouble::getTape()); 103 103 }/*}}}*/ 104 104 void RegisterOutputFunctor::Echo(void){/*{{{*/ … … 121 121 SetAdjointFunctor::SetAdjointFunctor(double* adjoint_in,int size_max_in) : MarshallHandle(AD_SETADJOINT){/*{{{*/ 122 122 this->double_count = 0; 123 this->tape_codi = &(IssmDouble::get GlobalTape());123 this->tape_codi = &(IssmDouble::getTape()); 124 124 this->adjoint = adjoint_in; 125 125 this->size_max = size_max_in; -
TabularUnified issm/trunk-jpl/src/c/shared/io/Marshalling/Marshalling.h ¶
r25543 r26432 128 128 int *identifiers; 129 129 int size_max; 130 IssmDouble::Tape Type*tape_codi;130 IssmDouble::Tape *tape_codi; 131 131 132 132 public: … … 142 142 private: 143 143 int double_count; 144 IssmDouble::Tape Type* tape_codi;144 IssmDouble::Tape* tape_codi; 145 145 146 146 public: … … 157 157 int double_count; 158 158 int size_max; 159 IssmDouble::Tape Type* tape_codi;159 IssmDouble::Tape* tape_codi; 160 160 double* adjoint; 161 161 -
TabularUnified issm/trunk-jpl/src/c/toolkits/codipack/CoDiPackCommon.hpp ¶
r23241 r26432 35 35 inline void getVectorGradData(const Real* vec, Data* dataVec, int n) { 36 36 for(int i = 0; i < n; ++i) { 37 dataVec[i]=vec[i].get GradientData();37 dataVec[i]=vec[i].getIdentifier(); 38 38 } 39 39 } … … 43 43 for(int i = 0; i < n; ++i) { 44 44 pasVec[i]=vec[i].getValue(); 45 dataVec[i]=vec[i].get GradientData();45 dataVec[i]=vec[i].getIdentifier(); 46 46 } 47 47 } … … 50 50 inline void getPrimalAndGradData(const Real& value, Passive& pas, Data& data) { 51 51 pas=value.getValue(); 52 data=value.get GradientData();52 data=value.getIdentifier(); 53 53 } 54 54 55 55 template<typename Real, typename Data> 56 56 inline void registerVector(Real* vec, Data* dataVec, int n) { 57 typename Real::TapeType& tape = Real::get GlobalTape();57 typename Real::TapeType& tape = Real::getTape(); 58 58 59 59 for(int i = 0; i < n; ++i) { 60 60 tape.registerInput(vec[i]); 61 dataVec[i]=vec[i].get GradientData();61 dataVec[i]=vec[i].getIdentifier(); 62 62 } 63 63 } -
TabularUnified issm/trunk-jpl/src/c/toolkits/gsl/DenseGslSolve.cpp ¶
r25336 r26432 258 258 /*recast data_in and tape*/ 259 259 codi::DataStore* data = (codi::DataStore*)data_in; 260 //IssmDouble::Tape Type& tape = (IssmDouble::TapeType&)tape_in;261 IssmDouble::Tape Type& tape = IssmDouble::getGlobalTape();260 //IssmDouble::Tape& tape = (IssmDouble::Tape&)tape_in; 261 IssmDouble::Tape& tape = IssmDouble::getTape(); 262 262 263 263 IssmDouble::Real* valueATrans; … … 277 277 278 278 // create the adjoint vector for x and reset the adjoint values on the tape 279 IssmDouble::Gradient Value* adjX = xNew<IssmDouble::GradientValue>(n);279 IssmDouble::Gradient* adjX = xNew<IssmDouble::Gradient>(n); 280 280 getVectorAdjoint(tape, indexX, adjX, n); 281 281 282 IssmDouble::Gradient Value* sol = xNew<IssmDouble::GradientValue>(n);282 IssmDouble::Gradient* sol = xNew<IssmDouble::Gradient>(n); 283 283 SolverxSeq(sol, valueATrans, adjX, n); 284 284 … … 324 324 /*}}}*/ 325 325 void SolverxSeq(IssmDouble *X,IssmDouble *A,IssmDouble *B,int n, Parameters* parameters){/*{{{*/ 326 IssmDouble::Tape Type& tape = IssmDouble::getGlobalTape();326 IssmDouble::Tape& tape = IssmDouble::getTape(); 327 327 codi::DataStore* dataHandler = NULL; 328 328 -
TabularUnified issm/trunk-jpl/src/c/toolkits/mpi/issmmpi.h ¶
r24768 r26432 31 31 //#define AMPI_ADOUBLE TOOL::MPI_TYPE 32 32 // 33 //#include <codi/externals/codiMpiTypes.hpp> 34 //using MpiTypes = CoDiMpiTypes<IssmDouble>; 33 35 /*New implementation*/ 34 #include <codi/ externals/codiMpiTypes.hpp>35 using MpiTypes =CoDiMpiTypes<IssmDouble>;36 #include <codi/tools/mpi/codiMpiTypes.hpp> 37 using MpiTypes = codi::CoDiMpiTypes<IssmDouble>; 36 38 extern MpiTypes* mpiTypes; 37 39 #define AMPI_ADOUBLE mpiTypes->MPI_TYPE -
TabularUnified issm/trunk-jpl/src/c/toolkits/mumps/MumpsSolve.cpp ¶
r25336 r26432 489 489 /*recast data_in and tape*/ 490 490 codi::DataStore* data = (codi::DataStore*)data_in; 491 //IssmDouble::Tape Type& tape = (IssmDouble::TapeType&)tape_in;492 IssmDouble::Tape Type& tape = IssmDouble::getGlobalTape();491 //IssmDouble::Tape& tape = (IssmDouble::Tape&)tape_in; 492 IssmDouble::Tape& tape = IssmDouble::getTape(); 493 493 494 494 … … 518 518 519 519 // create the adjoint vector for x and reset the adjoint values on the tape 520 IssmDouble::Gradient Value* adjX = xNew<IssmDouble::GradientValue>(n);520 IssmDouble::Gradient* adjX = xNew<IssmDouble::Gradient>(n); 521 521 getVectorAdjoint(tape, indexX, adjX, n); 522 522 … … 581 581 /*}}}*/ 582 582 void MumpsSolve(int n,int nnz,int local_nnz,int* irn_loc,int* jcn_loc,IssmDouble *a_loc,IssmDouble *rhs,Parameters* parameters){/*{{{*/ 583 IssmDouble::Tape Type& tape = IssmDouble::getGlobalTape();583 IssmDouble::Tape& tape = IssmDouble::getTape(); 584 584 codi::DataStore* dataHandler = NULL; 585 585
Note:
See TracChangeset
for help on using the changeset viewer.