[cig-commits] r18951 - in short/3D/PyLith/trunk: modulesrc/utils pylith/problems

brad at geodynamics.org brad at geodynamics.org
Tue Sep 20 12:49:33 PDT 2011


Author: brad
Date: 2011-09-20 12:49:33 -0700 (Tue, 20 Sep 2011)
New Revision: 18951

Modified:
   short/3D/PyLith/trunk/modulesrc/utils/petsc_general.i
   short/3D/PyLith/trunk/pylith/problems/Solver.py
Log:
Set PETSc vec_type for CUDA solve only if it has not already been set.

Modified: short/3D/PyLith/trunk/modulesrc/utils/petsc_general.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/utils/petsc_general.i	2011-09-20 19:45:56 UTC (rev 18950)
+++ short/3D/PyLith/trunk/modulesrc/utils/petsc_general.i	2011-09-20 19:49:33 UTC (rev 18951)
@@ -52,6 +52,20 @@
   } // optionsSetValue
 %} // inline
 
+// ----------------------------------------------------------------------
+// PetscOptionsHasName
+%inline %{
+  bool
+  optionsHasName(const char* name)
+  { // optionsHasName
+    PetscBool hasName = PetscBool(0);
+    PetscErrorCode err =
+      PetscOptionsHasName(PETSC_NULL, name, &hasName);
 
+    return (hasName) ? true : false;
+  } // optionsHasName
+%} // inline
+
+
 // End of file
 

Modified: short/3D/PyLith/trunk/pylith/problems/Solver.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Solver.py	2011-09-20 19:45:56 UTC (rev 18950)
+++ short/3D/PyLith/trunk/pylith/problems/Solver.py	2011-09-20 19:49:33 UTC (rev 18951)
@@ -77,9 +77,10 @@
 
   def preinitialize(self):
     if self.useCUDA:
-      from pylith.utils.petsc import optionsSetValue
-      optionsSetValue("-vec_type", "mpicusp")
-      optionsSetValue("-mat_type", "mpiaijcusp")
+      # Set vec_type for CUDA, if it has not already been set.
+      from pylith.utils.petsc import optionsSetValue, optionsHasName
+      if not optionsHasName("-vec_type"):
+        optionsSetValue("-vec_type", "mpicusp")
     return
 
 



More information about the CIG-COMMITS mailing list