Index: issm/trunk-jpl/src/c/classes/IoModel.cpp
===================================================================
--- issm/trunk-jpl/src/c/classes/IoModel.cpp	(revision 21611)
+++ issm/trunk-jpl/src/c/classes/IoModel.cpp	(revision 21615)
@@ -1719,5 +1719,11 @@
 	if(M*N){
 		buffer=xNew<IssmPDouble>(M*N);
+// AD performance is sensitive to calls to ensurecontiguous.
+// Providing "t" will cause ensurecontiguous to be called.
+#ifdef _HAVE_AD_
+		matrix=xNew<IssmDouble>(M*N,"t");
+#else
 		matrix=xNew<IssmDouble>(M*N);
+#endif
 
 		/*Read matrix on node 0, then broadcast: */
Index: issm/trunk-jpl/src/c/shared/MemOps/MemOps.cpp
===================================================================
--- issm/trunk-jpl/src/c/shared/MemOps/MemOps.cpp	(revision 21611)
+++ issm/trunk-jpl/src/c/shared/MemOps/MemOps.cpp	(revision 21615)
@@ -15,6 +15,8 @@
 
 #if defined(_HAVE_ADOLC_) && !defined(_WRAPPERS_)
-template <> adouble*  xNew(unsigned int size) {
-	ensureContiguousLocations(size);
+template <> adouble*  xNew(unsigned int size, const char* const contig) {
+	if (*contig == 't')
+		ensureContiguousLocations(size);
+
 	adouble* aT_p=new adouble[size];
 	assert(aT_p);
Index: issm/trunk-jpl/src/c/shared/MemOps/MemOps.h
===================================================================
--- issm/trunk-jpl/src/c/shared/MemOps/MemOps.h	(revision 21611)
+++ issm/trunk-jpl/src/c/shared/MemOps/MemOps.h	(revision 21615)
@@ -16,5 +16,12 @@
 #endif 
 
+static char const DEFCONTIG = 'f';
+
+// AD (mostly ADOLC) is sensitive to calls to ensurecontiguous. These changes limit its use.
+#ifdef _HAVE_AD_
+template <class T> T* xNew(unsigned int size, const char* const contig = &DEFCONTIG) { /*{{{*/
+#else
 template <class T> T* xNew(unsigned int size) { /*{{{*/
+#endif
 #ifdef USE_CXX_MEMORY_MANAGMENT_FOR_NON_POD_TYPES
   T* aT_p=new T[size];
@@ -49,7 +56,16 @@
 #endif
 }/*}}}*/
+// AD (mostly ADOLC) is sensitive to calls to ensurecontiguous. These changes limit its use.
+#ifdef _HAVE_AD_
+template <class T> T* xNewZeroInit(unsigned int size,const char* const contig = &DEFCONTIG) {/*{{{*/
+#else
 template <class T> T* xNewZeroInit(unsigned int size) {/*{{{*/
+#endif
 #ifdef USE_CXX_MEMORY_MANAGMENT_FOR_NON_POD_TYPES
+#ifdef _HAVE_AD_
+  T* aT_p=xNew<T>(size,contig);
+#else
   T* aT_p=xNew<T>(size);
+#endif
   for (unsigned int i=0; i<size;++i) 
     aT_p[i]=(T)0;
@@ -144,5 +160,5 @@
 #if defined(_HAVE_ADOLC_) && !defined(_WRAPPERS_)
 #include "../Numerics/types.h"
-template <> adouble*  xNew(unsigned int size);
+template <> adouble*  xNew(unsigned int size, const char* const contig);
 #endif
 
Index: issm/trunk-jpl/src/c/toolkits/gsl/DenseGslSolve.cpp
===================================================================
--- issm/trunk-jpl/src/c/toolkits/gsl/DenseGslSolve.cpp	(revision 21611)
+++ issm/trunk-jpl/src/c/toolkits/gsl/DenseGslSolve.cpp	(revision 21615)
@@ -216,6 +216,11 @@
 	if(Kff_M!=Kff_N)_error_("Stiffness matrix should be square!");
 
-	ensureContiguousLocations(Kff_N);
+// AD performance is sensitive to calls to ensurecontiguous.
+// Providing "t" will cause ensurecontiguous to be called.
+#ifdef _HAVE_AD_
+	IssmDouble *x  = xNew<IssmDouble>(Kff_N,"t");
+#else
 	IssmDouble *x  = xNew<IssmDouble>(Kff_N);
+#endif
 
 	SolverxSeq(x,Kff,pf,Kff_N,parameters);
@@ -227,7 +232,12 @@
 void SolverxSeq(IssmDouble *X,IssmDouble *A,IssmDouble *B,int n, Parameters* parameters){/*{{{*/
 	// pack inputs to conform to the EDF-prescribed interface
-        // ensure a contiguous block of locations:
-        ensureContiguousLocations(n*(n+1));
-        IssmDouble*  adoubleEDFin=xNew<IssmDouble>(n*(n+1));  // packed inputs, i.e. matrix and right hand side
+// AD performance is sensitive to calls to ensurecontiguous.
+// Providing "t" will cause ensurecontiguous to be called.
+#ifdef _HAVE_AD_
+        IssmDouble*  adoubleEDFin=xNew<IssmDouble>(n*(n+1),"t");
+#else
+        IssmDouble*  adoubleEDFin=xNew<IssmDouble>(n*(n+1));
+#endif  
+	// packed inputs, i.e. matrix and right hand side
         for(int i=0; i<n*n;i++)adoubleEDFin[i]    =A[i];      // pack matrix
         for(int i=0; i<n;  i++)adoubleEDFin[i+n*n]=B[i];      // pack the right hand side
Index: issm/trunk-jpl/src/c/toolkits/issm/IssmMpiSparseMat.h
===================================================================
--- issm/trunk-jpl/src/c/toolkits/issm/IssmMpiSparseMat.h	(revision 21611)
+++ issm/trunk-jpl/src/c/toolkits/issm/IssmMpiSparseMat.h	(revision 21615)
@@ -232,5 +232,12 @@
 					row_indices_fromcpu[i]=xNew<int>(size);
 					col_indices_fromcpu[i]=xNew<int>(size);
+// AD performance is sensitive to calls to ensurecontiguous.
+// Providing "t" will cause ensurecontiguous to be called.
+#ifdef _HAVE_AD_
+					values_fromcpu[i]=xNew<doubletype>(size,"t");
+#else
 					values_fromcpu[i]=xNew<doubletype>(size);
+#endif
+
 					modes_fromcpu[i]=xNew<int>(size);
 				}
@@ -492,5 +499,12 @@
 			row_indices_forcpu = xNew<int>(total_size);
 			col_indices_forcpu = xNew<int>(total_size);
+// AD performance is sensitive to calls to ensurecontiguous.
+// Providing "t" will cause ensurecontiguous to be called.
+#ifdef _HAVE_AD_
+			values_forcpu = xNew<doubletype>(total_size,"t");
+#else
 			values_forcpu = xNew<doubletype>(total_size);
+#endif
+
 			modes_forcpu = xNew<int>(total_size);
 
Index: issm/trunk-jpl/src/c/toolkits/issm/IssmMpiVec.h
===================================================================
--- issm/trunk-jpl/src/c/toolkits/issm/IssmMpiVec.h	(revision 21611)
+++ issm/trunk-jpl/src/c/toolkits/issm/IssmMpiVec.h	(revision 21615)
@@ -67,5 +67,12 @@
 
 			if(this->M){
+// AD performance is sensitive to calls to ensurecontiguous.
+// Providing "t" will cause ensurecontiguous to be called.
+#ifdef _HAVE_AD_
+				this->vector=xNew<doubletype>(this->m,"t");
+#else
 				this->vector=xNew<doubletype>(this->m);
+#endif
+
 				xMemCpy<doubletype>(this->vector,buffer,this->m);
 			}
@@ -80,5 +87,12 @@
 
 			if(this->m){
+// AD performance is sensitive to calls to ensurecontiguous.
+// Providing "t" will cause ensurecontiguous to be called.
+#ifdef _HAVE_AD_
+				this->vector=xNew<doubletype>(this->m,"t");
+#else
 				this->vector=xNew<doubletype>(this->m);
+#endif
+
 				xMemCpy<doubletype>(this->vector,buffer,this->m);
 			}
@@ -102,5 +116,12 @@
 
 			/*Allocate: */
+// AD performance is sensitive to calls to ensurecontiguous.
+// Providing "t" will cause ensurecontiguous to be called.
+#ifdef _HAVE_AD_
+			if (m)this->vector=xNewZeroInit<doubletype>(this->m,"t");
+#else
 			if (m)this->vector=xNewZeroInit<doubletype>(this->m);
+#endif
+
 		}
 		/*}}}*/
@@ -196,5 +217,12 @@
 				if(size){
 					row_indices_fromcpu[i]=xNew<int>(size);
+// AD performance is sensitive to calls to ensurecontiguous.
+// Providing "t" will cause ensurecontiguous to be called.
+#ifdef _HAVE_AD_
+					values_fromcpu[i]=xNew<doubletype>(size,"t");
+#else
 					values_fromcpu[i]=xNew<doubletype>(size);
+#endif
+
 					modes_fromcpu[i]=xNew<int>(size);
 				}
@@ -375,5 +403,12 @@
 
 			/*Allocate: */
+// AD performance is sensitive to calls to ensurecontiguous.
+// Providing "t" will cause ensurecontiguous to be called.
+#ifdef _HAVE_AD_
+			buffer=xNew<doubletype>(M,"t");
+#else
 			buffer=xNew<doubletype>(M);
+#endif
+
 			recvcounts=xNew<int>(num_procs);
 			displs=xNew<int>(num_procs);
@@ -527,5 +562,12 @@
 			/*Allocate buffers: */
 			row_indices_forcpu = xNew<int>(total_size);
+// AD performance is sensitive to calls to ensurecontiguous.
+// Providing "t" will cause ensurecontiguous to be called.
+#ifdef _HAVE_AD_
+			values_forcpu = xNew<doubletype>(total_size,"t");
+#else
 			values_forcpu = xNew<doubletype>(total_size);
+#endif
+
 			modes_forcpu = xNew<int>(total_size);
 
Index: issm/trunk-jpl/src/c/toolkits/mumps/MumpsSolve.cpp
===================================================================
--- issm/trunk-jpl/src/c/toolkits/mumps/MumpsSolve.cpp	(revision 21611)
+++ issm/trunk-jpl/src/c/toolkits/mumps/MumpsSolve.cpp	(revision 21615)
@@ -167,5 +167,12 @@
 	}
 	/*Deal with right hand side. We need to ISSM_MPI_Gather it onto cpu 0: */
+// AD performance is sensitive to calls to ensurecontiguous.
+// Providing "t" will cause ensurecontiguous to be called.
+#ifdef _HAVE_AD_
+	rhs=xNew<IssmDouble>(pf_M,"t");
+#else
 	rhs=xNew<IssmDouble>(pf_M);
+#endif
+
 
 	recvcounts=xNew<int>(num_procs);
@@ -246,5 +253,12 @@
 	}
 	/*Deal with right hand side. We need to ISSM_MPI_Gather it onto cpu 0: */
+// AD performance is sensitive to calls to ensurecontiguous.
+// Providing "t" will cause ensurecontiguous to be called.
+#ifdef _HAVE_AD_
+	rhs=xNew<IssmDouble>(pf_M,"t");
+#else
 	rhs=xNew<IssmDouble>(pf_M);
+#endif
+
 
 	recvcounts=xNew<int>(num_procs);
@@ -314,5 +328,12 @@
     packedDimsSparseArr[3+local_nnz+i]=jcn_loc[i];
   }
+// AD performance is sensitive to calls to ensurecontiguous.
+// Providing "t" will cause ensurecontiguous to be called.
+#ifdef _HAVE_AD_
+  IssmDouble *pack_A_rhs=xNew<IssmDouble>(local_nnz+n,"t");
+#else
   IssmDouble *pack_A_rhs=xNew<IssmDouble>(local_nnz+n);
+#endif
+
   for (int i=0;i<local_nnz;++i) { 
     pack_A_rhs[i]=a_loc[i];
@@ -321,5 +342,12 @@
     pack_A_rhs[local_nnz+i]=rhs[i];
   }
+// AD performance is sensitive to calls to ensurecontiguous.
+// Providing "t" will cause ensurecontiguous to be called.
+#ifdef _HAVE_AD_
+  IssmDouble *sol=xNew<IssmDouble>(n,"t");
+#else
   IssmDouble *sol=xNew<IssmDouble>(n);
+#endif
+
   call_ext_fct(xDynamicCast<GenericParam<Adolc_edf> * >(parameters->FindParamObject(AdolcParamEnum))->GetParameterValue().myEDF_for_solverx_p,
 	       packedDimsSparseArrLength, packedDimsSparseArr,
