1. petsc
  2. PETSc
  3. petsc

Commits

Jed Brown  committed 99c3dd1 Merge

Merge branch 'barry/ams' into master

* commit 'eb4227cfdd169cc03749ba3ef12d3932f2f322bf': (24 commits)
forgotten files
basic snooping on PetscStack is now working
split AMSJavascript.py into AMS.py for AMS javascript and AMSSnoopObjects.py for example showing published objects
fix bug in previous commit
added error returns for JSON-RPC AMS calls
don't let web accessor change length of array setting to publisher
Pass arrays of values back from webserver to AMS publisher
fix for last commit, missing errorcode and wrong variable name
KSPLogResidualHistory and SNESLogConvergenceHistory need to lock for AMS and have error checking when called
shutdown webserver if you started it on PetscFinalize(), what about when crash, should still shut it down
Added support for starting server automatically by application code messed around finding a bug in AMS
got value back from webclient to application
goddman script Jed sent me doesn;t work, it loses changes
split webserver into standalone problem that is not part of running PETSc application had to do this since impossible for AMS publisher and accessor to be in same application better to just totally redo AMS! But that is to large a project
moved webserver code to its own directory and file
added callback for changable fields in pyjs representation of AMS memories
add AMS viewer for PC, server can only run without any memory debugging
changed AMS publishing to use the Viewer model added simple AMS viewer for mat,ksp,snes,ts added --ksp/snes/ts_view_pre for starting the viewer before the solve (ugly but useful for AMS) added PetscStackCalls around AMS function calls when appropriate (note do not want these in webserver because do not webserver stopping just because AMS server is down
more work on moving AMS model to viewer
Fix for SNESSetConvergenceHistory() when input a is null
...

  • Participants
  • Parent commits 7eb4f4c, eb4227c
  • Branches master

Comments (0)

Files changed (105)

File config/PETSc/packages/server.py

View file
   def setupDependencies(self, framework):
     PETSc.package.NewPackage.setupDependencies(self, framework)
     self.pthread = framework.require('PETSc.packages.pthread',self)
+    self.yaml    = framework.require('PETSc.packages.yaml',self)
+    self.ams     = framework.require('PETSc.packages.ams',self)
     self.deps    = []
     return
 

File include/petsc-private/kspimpl.h

View file
 #define __FUNCT__ "KSPLogResidualHistory"
 PETSC_STATIC_INLINE PetscErrorCode KSPLogResidualHistory(KSP ksp,PetscReal norm)
 {
+  PetscErrorCode ierr;
+
   PetscFunctionBegin;
+  ierr = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
   if (ksp->res_hist && ksp->res_hist_max > ksp->res_hist_len) {
     ksp->res_hist[ksp->res_hist_len++] = norm;
   }
+  ierr = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }
 

File include/petsc-private/petscimpl.h

View file
                           with the first object using a name.
       composefunction() - Attaches an a function to a PETSc object with a name.
       queryfunction()   - Requests a registered function that has been attached to a PETSc object.
-      publish()         - Not currently used
 */
 
 typedef struct {
    PetscErrorCode (*query)(PetscObject,const char[],PetscObject *);
    PetscErrorCode (*composefunction)(PetscObject,const char[],const char[],void (*)(void));
    PetscErrorCode (*queryfunction)(PetscObject,const char[],void (**)(void));
-   PetscErrorCode (*publish)(PetscObject);
 } PetscOps;
 
 typedef enum {PETSC_FORTRAN_CALLBACK_CLASS,PETSC_FORTRAN_CALLBACK_SUBTYPE,PETSC_FORTRAN_CALLBACK_MAXTYPE} PetscFortranCallbackType;
 #if defined(PETSC_HAVE_AMS)
   PetscInt             amsmem;
   PetscBool            amspublishblock; /* if PETSC_TRUE and publishing objects then will block at PetscObjectAMSBlock() */
+  PetscBool            amsblock;
 #endif
 } _p_PetscObject;
 

File include/petsc-private/snesimpl.h

View file
 #define __FUNCT__ "SNESLogConvergenceHistory"
 PETSC_STATIC_INLINE PetscErrorCode SNESLogConvergenceHistory(SNES snes,PetscReal res,PetscInt its)
 {
+  PetscErrorCode ierr;
+
   PetscFunctionBegin;
+  ierr = PetscObjectAMSTakeAccess((PetscObject)snes);CHKERRQ(ierr);
   if (snes->conv_hist && snes->conv_hist_max > snes->conv_hist_len) {
     if (snes->conv_hist)     snes->conv_hist[snes->conv_hist_len]     = res;
     if (snes->conv_hist_its) snes->conv_hist_its[snes->conv_hist_len] = its;
     snes->conv_hist_len++;
   }
+  ierr = PetscObjectAMSGrantAccess((PetscObject)snes);CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }
 

File include/petscerror.h

View file
 #define PetscFunctionBegin \
   do {                                                                        \
     PetscStack* petscstackp;                                                  \
+    PetscStackAMSTakeAccess();                                                \
     petscstackp = (PetscStack*)PetscThreadLocalGetValue(petscstack);          \
     if (petscstackp && (petscstackp->currentsize < PETSCSTACKSIZE)) {         \
       petscstackp->function[petscstackp->currentsize]  = PETSC_FUNCTION_NAME; \
     }                                                                         \
     PetscCheck__FUNCT__();                                                    \
     PetscRegister__FUNCT__();                                                 \
+    PetscStackAMSGrantAccess();                                               \
   } while (0)
 
 /*MC
 #define PetscFunctionBeginUser \
   do {                                                                        \
     PetscStack* petscstackp;                                                  \
+    PetscStackAMSTakeAccess();                                                \
     petscstackp = (PetscStack*)PetscThreadLocalGetValue(petscstack);          \
     if (petscstackp && (petscstackp->currentsize < PETSCSTACKSIZE)) {         \
       petscstackp->function[petscstackp->currentsize]  = PETSC_FUNCTION_NAME; \
     }                                                                         \
     PetscCheck__FUNCT__();                                                    \
     PetscRegister__FUNCT__();                                                 \
+    PetscStackAMSGrantAccess();                                               \
   } while (0)
 
 
 #define PetscStackPush(n) \
   do {                                                                  \
     PetscStack * petscstackp;                                           \
+    PetscStackAMSTakeAccess();                                          \
     petscstackp = (PetscStack*)PetscThreadLocalGetValue(petscstack);    \
     if (petscstackp && (petscstackp->currentsize < PETSCSTACKSIZE)) {   \
       petscstackp->function[petscstackp->currentsize]  = n;             \
       petscstackp->directory[petscstackp->currentsize] = "unknown";     \
       petscstackp->line[petscstackp->currentsize]      = 0;             \
       petscstackp->currentsize++;                                       \
-    } CHKMEMQ;} while (0)
+    }                                                                   \
+    PetscStackAMSGrantAccess();                                         \
+    CHKMEMQ;                                                            \
+  } while (0)
 
 #define PetscStackPop \
   do {PetscStack* petscstackp;CHKMEMQ;                                  \
+    PetscStackAMSTakeAccess();                                          \
     petscstackp = (PetscStack*)PetscThreadLocalGetValue(petscstack);    \
     if (petscstackp && petscstackp->currentsize > 0) {                  \
       petscstackp->currentsize--;                                       \
       petscstackp->file[petscstackp->currentsize]      = 0;             \
       petscstackp->directory[petscstackp->currentsize] = 0;             \
       petscstackp->line[petscstackp->currentsize]      = 0;             \
-    }} while (0)
+    }                                                                   \
+    PetscStackAMSGrantAccess();                                         \
+  } while (0)
 
 /*MC
    PetscFunctionReturn - Last executable line of each PETSc function
 #define PetscFunctionReturn(a) \
   do {                                                                \
     PetscStack* petscstackp;                                          \
+    PetscStackAMSTakeAccess();                                        \
     petscstackp = (PetscStack*)PetscThreadLocalGetValue(petscstack);  \
     if (petscstackp && petscstackp->currentsize > 0) {                \
       petscstackp->currentsize--;                                     \
       petscstackp->directory[petscstackp->currentsize] = 0;           \
       petscstackp->line[petscstackp->currentsize]      = 0;           \
     }                                                                 \
+    PetscStackAMSGrantAccess();                                       \
     return(a);} while (0)
 
 #define PetscFunctionReturnVoid() \
   do {                                                                \
     PetscStack* petscstackp;                                          \
+    PetscStackAMSTakeAccess();                                        \
     petscstackp = (PetscStack*)PetscThreadLocalGetValue(petscstack);  \
     if (petscstackp && petscstackp->currentsize > 0) {                \
       petscstackp->currentsize--;                                     \
       petscstackp->directory[petscstackp->currentsize] = 0;           \
       petscstackp->line[petscstackp->currentsize]      = 0;           \
     }                                                                 \
+    PetscStackAMSGrantAccess();                                       \
     return;} while (0)
 #else
 
 #define PetscFunctionBegin
 #define PetscFunctionBeginUser
-#define PetscFunctionReturn(a)  return(a)
+#define PetscFunctionReturn(a)    return(a)
 #define PetscFunctionReturnVoid() return
-#define PetscStackPop     CHKMEMQ
-#define PetscStackPush(f) CHKMEMQ
-#define PetscStackActive        PETSC_FALSE
+#define PetscStackPop             CHKMEMQ
+#define PetscStackPush(f)         CHKMEMQ
+#define PetscStackActive          PETSC_FALSE
 
 #endif
 
 PETSC_EXTERN PetscErrorCode PetscStackCreate(void);
 PETSC_EXTERN PetscErrorCode PetscStackView(FILE*);
 PETSC_EXTERN PetscErrorCode PetscStackDestroy(void);
-PETSC_EXTERN PetscErrorCode PetscStackPublish(void);
-PETSC_EXTERN PetscErrorCode PetscStackDepublish(void);
 
 #endif

File include/petscsys.h

View file
 PETSC_EXTERN PetscErrorCode PetscMallocGetCurrentUsage(PetscLogDouble *);
 PETSC_EXTERN PetscErrorCode PetscMallocGetMaximumUsage(PetscLogDouble *);
 PETSC_EXTERN PetscErrorCode PetscMallocDebug(PetscBool);
+PETSC_EXTERN PetscErrorCode PetscMallocGetDebug(PetscBool*);
 PETSC_EXTERN PetscErrorCode PetscMallocValidate(int,const char[],const char[],const char[]);
 PETSC_EXTERN PetscErrorCode PetscMallocSetDumpLog(void);
 PETSC_EXTERN PetscErrorCode PetscMallocSetDumpLogThreshold(PetscLogDouble);
 PETSC_EXTERN PetscErrorCode PetscRegisterFinalize(PetscErrorCode (*)(void));
 PETSC_EXTERN PetscErrorCode PetscRegisterFinalizeAll(void);
 
-PETSC_EXTERN PetscErrorCode PetscObjectAMSPublish(PetscObject);
-PETSC_EXTERN PetscErrorCode PetscObjectAMSUnPublish(PetscObject);
+#if defined(PETSC_HAVE_AMS)
+PETSC_EXTERN PetscErrorCode PetscObjectAMSViewOff(PetscObject);
 PETSC_EXTERN PetscErrorCode PetscObjectAMSSetBlock(PetscObject,PetscBool);
 PETSC_EXTERN PetscErrorCode PetscObjectAMSBlock(PetscObject);
+PETSC_EXTERN PetscErrorCode PetscObjectAMSGrantAccess(PetscObject);
+PETSC_EXTERN PetscErrorCode PetscObjectAMSTakeAccess(PetscObject);
+PETSC_EXTERN void           PetscStackAMSGrantAccess(void);
+PETSC_EXTERN void           PetscStackAMSTakeAccess(void);
+PETSC_EXTERN PetscErrorCode PetscStackViewAMS(void);
+PETSC_EXTERN PetscErrorCode PetscStackAMSViewOff(void);
+
+#else
+#define PetscObjectAMSViewOff(obj)             0
+#define PetscObjectAMSSetBlock(obj,flg)        0
+#define PetscObjectAMSBlock(obj)               0
+#define PetscObjectAMSGrantAccess(obj)         0
+#define PetscObjectAMSTakeAccess(obj)          0
+#define PetscStackViewAMS()                    0
+#define PetscStackAMSViewOff()                 0
+#define PetscStackAMSTakeAccess()
+#define PetscStackAMSGrantAccess()
+
+#endif
 
 typedef void* PetscDLHandle;
 typedef enum {PETSC_DL_DECIDE=0,PETSC_DL_NOW=1,PETSC_DL_LOCAL=2} PetscDLMode;
 */
 #include <petsclog.h>
 
-/*
-          For locking, unlocking and destroying AMS memories associated with  PETSc objects. ams.h is included in petscviewer.h
 
-          Developers note: These should all be made functions and ams.h removed from public petscviewer.h
-*/
-#if defined(PETSC_HAVE_AMS)
-PETSC_EXTERN PetscBool PetscAMSPublishAll;
-#define PetscObjectTakeAccess(obj)  ((((PetscObject)(obj))->amsmem == -1) ? 0 : AMS_Memory_take_access(((PetscObject)(obj))->amsmem))
-#define PetscObjectGrantAccess(obj) ((((PetscObject)(obj))->amsmem == -1) ? 0 : AMS_Memory_grant_access(((PetscObject)(obj))->amsmem))
-#define PetscObjectDepublish(obj)   ((((PetscObject)(obj))->amsmem == -1) ? 0 : AMS_Memory_destroy(((PetscObject)(obj))->amsmem));((PetscObject)(obj))->amsmem = -1;
-#else
-#define PetscObjectTakeAccess(obj)   0
-#define PetscObjectGrantAccess(obj)  0
-#define PetscObjectDepublish(obj)    0
-#endif
 
 /*
       Simple PETSc parallel IO for ASCII printing

File include/petscviewer.h

View file
 PETSC_EXTERN PetscErrorCode PetscViewerMatlabGetArray(PetscViewer,int,int,PetscScalar*,const char*);
 PETSC_EXTERN PetscErrorCode PetscViewerMatlabPutVariable(PetscViewer,const char*,void*);
 
+#if defined(PETSC_HAVE_AMS)
+PETSC_EXTERN PetscErrorCode PetscObjectViewAMS(PetscObject,PetscViewer);
+#endif
+
 /*S
      PetscViewers - Abstract collection of PetscViewers. It is just an expandable array of viewers.
 
 PETSC_EXTERN PetscErrorCode PetscViewersDestroy(PetscViewers*);
 PETSC_EXTERN PetscErrorCode PetscViewersGetViewer(PetscViewers,PetscInt,PetscViewer*);
 
-#if defined(PETSC_HAVE_AMS)
-#include <ams.h>
-PETSC_EXTERN PetscErrorCode PetscViewerAMSSetCommName(PetscViewer,const char[]);
-PETSC_EXTERN PetscErrorCode PetscViewerAMSGetAMSComm(PetscViewer,AMS_Comm *);
-PETSC_EXTERN PetscErrorCode PetscViewerAMSOpen(MPI_Comm,const char[],PetscViewer*);
-PETSC_EXTERN PetscErrorCode PetscViewerAMSLock(PetscViewer);
-PETSC_EXTERN PetscViewer    PETSC_VIEWER_AMS_(MPI_Comm);
-PETSC_EXTERN PetscErrorCode PETSC_VIEWER_AMS_Destroy(MPI_Comm);
-#define PETSC_VIEWER_AMS_WORLD PETSC_VIEWER_AMS_(PETSC_COMM_WORLD)
-#endif
-
-/* Reset __FUNCT__ in case the user does not define it themselves */
-#undef __FUNCT__
-#define __FUNCT__ "User provided function"
-
 #endif

File include/petscviewerams.h

View file
+
+#if !defined(__PETSCVIEWERAMS_H)
+#define __PETSCVIEWERAMS_H
+
+#include <petscviewer.h>
+#include <ams.h>
+PETSC_EXTERN PetscErrorCode PetscViewerAMSSetCommName(PetscViewer,const char[]);
+PETSC_EXTERN PetscErrorCode PetscViewerAMSGetAMSComm(PetscViewer,AMS_Comm *);
+PETSC_EXTERN PetscErrorCode PetscViewerAMSOpen(MPI_Comm,const char[],PetscViewer*);
+PETSC_EXTERN PetscViewer    PETSC_VIEWER_AMS_(MPI_Comm);
+PETSC_EXTERN PetscErrorCode PETSC_VIEWER_AMS_Destroy(MPI_Comm);
+#define PETSC_VIEWER_AMS_WORLD PETSC_VIEWER_AMS_(PETSC_COMM_WORLD)
+#define PETSC_VIEWER_AMS_SELF  PETSC_VIEWER_AMS_(PETSC_COMM_SELF)
+
+#define PetscStackCallAMS(func,args) do {PetscErrorCode _ierr; char* err; \
+    PetscStackPush(#func);_ierr = func args;PetscStackPop; if (_ierr) {AMS_Explain_error(_ierr,&err); SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in %s() %s",#func,err);} \
+} while (0)
+
+#endif

File include/web/AMS.py

View file
+#
+#   Defines an interface from Pyjs to the AMS memory snooper.  This version downloads ALL the memories and fields when the AMS_Comm is attached
+#  thus all memory and field value inquiries are local and immediate and do not involve accessing the publisher. To get fresh values one simply
+#  creates another AMS_Comm() which makes a freash connection to the publisher
+#
+
+import pyjd
+from pyjamas.JSONService import JSONProxy
+
+args   = {}  # Arguments to each remote call
+sent   = 0   # Number of calls sent to server
+recv   = 0   # Number of calls received from server
+
+class ServicePython(JSONProxy):
+    def __init__(self):
+        JSONProxy.__init__(self, "No service name", ["YAML_echo", "YAML_AMS_Connect", "YAML_AMS_Comm_attach", "YAML_AMS_Comm_get_memory_list","YAML_AMS_Memory_attach","YAML_AMS_Memory_get_field_list","YAML_AMS_Memory_get_field_info","YAML_AMS_Memory_set_field_info","YAML_AMS_Memory_update_send_begin"])
+
+# ---------------------------------------------------------
+class AMS_Memory(JSONProxy):
+    def __init__(self,comm,memory):
+        global args,sent,recv
+        self.comm             = comm
+        self.name             = memory   # string name of memory
+        self.fieldlist        = []
+        self.fields           = {}
+        self.remote           = ServicePython()
+        id = self.remote.YAML_AMS_Memory_attach(comm,memory,self)
+        args[id] = ['YAML_AMS_Memory_attach',comm,memory]
+        sent += 1
+
+    def get_field_list(self,func = null):
+        '''If called with func (net yet supported) then calls func asynchronously with latest memory list;
+           otherwise returns current (possibly out-dated) memory list'''
+        return self.fieldlist
+
+    def get_field_info(self,field, func = null):
+        '''Pass in string name of AMS field
+           If called with func (not yet done) then first updates comm with latest field list and then calls func with field'''
+        if not self.fields.has_key(field):
+            return 'Memory does not have field named '+field
+        return self.fields[field]
+
+    def set_field_info(self,field,value,funct = null):
+        '''Pass in string name of AMS field and value to be set back on publisher
+           If called with func (not yet done) then first updates remove and then calls func with any error information'''
+        if not self.fields.has_key(field):
+            return 'Memory does not have field named '+field+' thus value not set'
+        id = self.remote.YAML_AMS_Memory_set_field_info(self.memory,field,value,self)
+        args[id] = ['YAML_AMS_Memory_set_field_info',comm,memory,field]
+
+    def update_send_begin(self,funct = null):
+        '''Tells the accessor to update the values in the memory on the publisher
+           If called with func (not yet done) then first updates remove and then calls func with any error information'''
+        id = self.remote.YAML_AMS_Memory_update_send_begin(self.memory,self)
+
+    def onRemoteResponse(self, response, request_info):
+        global args,sent,recv,statusbar
+        recv += 1
+        method = str(request_info.method)
+        rid    = request_info.id
+        if method == "YAML_AMS_Memory_attach":
+            self.memory = response[0]
+            id = self.remote.YAML_AMS_Memory_get_field_list(self.memory,self)
+            args[id] = ['YAML_AMS_Memory_get_field_list',self.memory]
+            sent += 1
+        elif method == "YAML_AMS_Memory_get_field_list":
+            self.fieldlist = response
+            if not isinstance(self.fieldlist,list): self.fieldlist = [self.fieldlist]
+            for i in self.fieldlist:
+                id = self.remote.YAML_AMS_Memory_get_field_info(self.memory,i,self)
+                args[id] = ['YAML_AMS_Memory_get_field_info',self.memory,i]
+                sent += 1
+        elif method == "YAML_AMS_Memory_get_field_info":
+            self.fields[args[rid][2]] = response
+        elif method == "YAML_AMS_Memory_set_field_info":
+          self.update_send_begin()
+#          statusbar.setText("Value updated on server")
+
+
+    def onRemoteError(self, code, errobj, request_info):
+        global statusbar,recv
+        recv += 1
+        method = str(request_info.method)
+        if method == "YAML_AMS_Memory_update_send_begin":
+          self.comm.comm = -1;
+#          statusbar.setText("Publisher is no longer accessable")
+        else:
+#          statusbar.setText("Error "+str(errobj))
+          pass
+
+# ---------------------------------------------------------
+class AMS_Comm(JSONProxy):
+    def __init__(self):
+        global args,sent,recv
+        self.comm             = -1
+        self.commname         = ''
+        self.memlist          = []
+        self.memories         = {}
+        self.memory_list_func = null
+        self.remote           = ServicePython()
+        id = self.remote.YAML_AMS_Connect('No argument', self)
+        args[id] = ['YAML_AMS_Connect']
+        sent += 1
+
+    def get_memory_list(self,func = null):
+        '''If called with func then calls func asynchronously with latest memory list;
+           otherwise returns current (possibly out-dated) memory list'''
+        if func:
+            self.memory_list_func = func
+            id = self.remote.YAML_AMS_Comm_get_memory_list(self.comm,self)
+            args[id] = ['YAML_AMS_Comm_get_memory_list',self.comm]
+            sent += 1
+        else:
+            return self.memlist
+
+    def memory_attach(self,memory,func = null):
+        '''Pass in string name of AMS memory object
+           If called with func (not yet done) then first updates comm with latest memory list and then calls func with memory'''
+        return self.memories[memory]
+
+    def onRemoteResponse(self, response, request_info):
+        global args,sent,recv
+        recv += 1
+        method = str(request_info.method)
+        rid    = request_info.id
+        if method == "YAML_AMS_Connect":
+            if isinstance(response,list):
+#             Currently always connects to the zeroth communicator published, no way to connect to others.
+              self.commname = str(response[0])
+            else:
+              self.commname = str(response)
+            if self.commname == 'No AMS publisher running':
+                 pass
+            else:
+                 id = self.remote.YAML_AMS_Comm_attach(self.commname,self)
+                 args[id] = ['YAML_AMS_Comm_attach',self.commname]
+                 sent += 1
+        elif method == "YAML_AMS_Comm_attach":
+            self.comm = str(response)
+            id = self.remote.YAML_AMS_Comm_get_memory_list(self.comm,self)
+            args[id] = ['YAML_AMS_Comm_get_memory_list',self.comm]
+            sent += 1
+        elif method == "YAML_AMS_Comm_get_memory_list":
+            if not isinstance(response,list):response = [response]
+            self.memlist = response
+            for i in self.memlist:
+                self.memories[i] = AMS_Memory(self.comm,i)
+            if self.memory_list_func:
+                self.memory_list_func(response)
+                self.memory_list_func = null
+
+    def onRemoteError(self, code, errobj, request_info):
+        global statusbar,recv
+        recv += 1
+#        statusbar.setText("Error "+str(errobj))
+
+

File include/web/AMSJavascript.html

View file
 <body bgcolor="white">
 <script language="javascript" src="bootstrap.js"></script>
 <iframe id='__pygwt_historyFrame' style='width:0;height:0;border:0'></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
+<script type="text/javascript" src="bootstrap.js"></script>
+<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
 </body>
 </html>

File include/web/AMSJavascript.py

-#
-#   Run
-#
-#     python pyjsbuild --frame=AMSJavascript.html --enable-debug --enable-wrap-calls --output . AMSJavascript.py
-#     hg revert AMSJavascript.html
-#
-#   to generate the needed HTML and Javascript
-#
-
-import pyjd
-
-from pyjamas.ui.RootPanel import RootPanel
-from pyjamas.ui.TextArea import TextArea
-from pyjamas.ui.Label import Label
-from pyjamas.ui.Button import Button
-from pyjamas.ui.HTML import HTML
-from pyjamas.ui.VerticalPanel import VerticalPanel
-from pyjamas.ui.HorizontalPanel import HorizontalPanel
-from pyjamas.ui.ListBox import ListBox
-from pyjamas.JSONService import JSONProxy
-from pyjamas.ui.Tree import Tree
-from pyjamas.ui.TreeItem import TreeItem
-
-
-comm   = -1  # Currently attached AMS communicator; only one is supported at a time
-args   = {}  # Arguments to each remote call
-sent   = 0   # Number of calls sent to server
-recv   = 0   # Number of calls received from server
-
-class AMSJavascriptExample:
-    def onModuleLoad(self):
-        self.status=Label()
-        self.button = Button("Display list of all published memories and fields", self)
-        self.buttonupdate = Button("Update data from AMS publisher", self)
-
-        buttons = HorizontalPanel()
-        buttons.add(self.button)
-        buttons.add(self.buttonupdate)
-        buttons.setSpacing(8)
-
-        info = """<p>This example demonstrates the calling of the Memory Snooper in PETSc with Pyjamas and <a href="http://json-rpc.org/">JSON-RPC</a>.</p>"""
-
-        self.panel = VerticalPanel()
-        self.panel.add(HTML(info))
-        self.panel.add(buttons)
-        self.panel.add(self.status)
-        RootPanel().add(self.panel)
-        self.commobj = AMS_Comm()
-        self.tree = None
-
-    def onClick(self, sender):
-        global sent,recv
-        self.status.setText('Button pressed')
-        if sender == self.buttonupdate:
-            self.commobj = AMS_Comm()
-            self.status.setText('Updating data: Press Display list button to refesh')
-        if sender == self.button:
-            if sent > recv:
-               self.status.setText('Press button again: sent '+str(sent)+' recv '+str(recv))
-            if self.commobj.commname == 'No AMS publisher running':
-               self.status.setText(self.commobj.commname)
-            else:
-               self.status.setText('Memories for AMS Comm: '+self.commobj.commname)
-               result = self.commobj.get_memory_list()
-               if self.tree: self.panel.remove(self.tree)
-               self.tree = Tree()
-               for i in result:
-                  subtree = TreeItem(i)
-                  memory = self.commobj.memory_attach(i)
-                  fields = memory.get_field_list()
-                  for j in fields:
-                     field = memory.get_field_info(j)
-                     subtree.addItem(j+' = '+str(field[4]))
-                  self.tree.addItem(subtree)
-                  self.panel.add(self.tree)
-
-class ServicePython(JSONProxy):
-    def __init__(self):
-        JSONProxy.__init__(self, "No service name", ["YAML_echo", "YAML_AMS_Connect", "YAML_AMS_Comm_attach", "YAML_AMS_Comm_get_memory_list","YAML_AMS_Memory_attach","YAML_AMS_Memory_get_field_list","YAML_AMS_Memory_get_field_info"])
-
-# ---------------------------------------------------------
-class AMS_Memory(JSONProxy):
-    def __init__(self,comm,memory):
-        global args,sent,recv
-        self.comm             = comm
-        self.name             = memory   # string name of memory
-        self.fieldlist        = []
-        self.fields           = {}
-        self.remote           = ServicePython()
-        id = self.remote.YAML_AMS_Memory_attach(comm,memory,self)
-        args[id] = ['YAML_AMS_Memory_attach',comm,memory]
-        sent += 1
-
-    def get_field_list(self,func = null):
-        '''If called with func (net yet supported) then calls func asynchronously with latest memory list;
-           otherwise returns current (possibly out-dated) memory list'''
-        return self.fieldlist
-
-    def get_field_info(self,field, func = null):
-        '''Pass in string name of AMS field
-           If called with func (not yet done) then first updates comm with latest field list and then calls func with field'''
-        if not self.fields.has_key(field):
-            return 'Memory does not have field named '+field
-        return self.fields[field]
-
-    def onRemoteResponse(self, response, request_info):
-        global args,sent,recv
-        recv += 1
-        method = str(request_info.method)
-        rid    = request_info.id
-        if method == "YAML_AMS_Memory_attach":
-            self.memory = response[0]
-            id = self.remote.YAML_AMS_Memory_get_field_list(self.memory,self)
-            args[id] = ['YAML_AMS_Memory_get_field_list',self.memory]
-            sent += 1
-        elif method == "YAML_AMS_Memory_get_field_list":
-            self.fieldlist = response
-            for i in self.fieldlist:
-                id = self.remote.YAML_AMS_Memory_get_field_info(self.memory,i,self)
-                args[id] = ['YAML_AMS_Memory_get_field_info',self.memory,i]
-                sent += 1
-        elif method == "YAML_AMS_Memory_get_field_info":
-            self.fields[args[rid][2]] = response
-
-
-    def onRemoteError(self, code, errobj, request_info):
-        pass
-
-# ---------------------------------------------------------
-class AMS_Comm(JSONProxy):
-    def __init__(self):
-        global args,sent,recv
-        self.comm             = -1
-        self.commname         = ''
-        self.memlist          = []
-        self.memories         = {}
-        self.memory_list_func = null
-        self.remote           = ServicePython()
-        id = self.remote.YAML_AMS_Connect('No argument', self)
-        args[id] = ['YAML_AMS_Connect']
-        sent += 1
-
-    def get_memory_list(self,func = null):
-        '''If called with func then calls func asynchronously with latest memory list;
-           otherwise returns current (possibly out-dated) memory list'''
-        if func:
-            self.memory_list_func = func
-            id = self.remote.YAML_AMS_Comm_get_memory_list(self.comm,self)
-            args[id] = ['YAML_AMS_Comm_get_memory_list',self.comm]
-            sent += 1
-        else:
-            return self.memlist
-
-    def memory_attach(self,memory,func = null):
-        '''Pass in string name of AMS memory object
-           If called with func (not yet done) then first updates comm with latest memory list and then calls func with memory'''
-        return self.memories[memory]
-
-    def onRemoteResponse(self, response, request_info):
-        global args,sent,recv
-        global comm
-        recv += 1
-        method = str(request_info.method)
-        rid    = request_info.id
-        if method == "YAML_AMS_Connect":
-            self.commname = str(response)
-            if self.commname == 'No AMS publisher running':
-                 pass
-            else:
-                 id = self.remote.YAML_AMS_Comm_attach(self.commname,self)
-                 args[id] = ['YAML_AMS_Comm_attach',self.commname]
-                 sent += 1
-        elif method == "YAML_AMS_Comm_attach":
-            self.comm = str(response)
-            id = self.remote.YAML_AMS_Comm_get_memory_list(self.comm,self)
-            args[id] = ['YAML_AMS_Comm_get_memory_list',self.comm]
-            sent += 1
-        elif method == "YAML_AMS_Comm_get_memory_list":
-            if not isinstance(response,list):response = [response]
-            self.memlist = response
-            for i in self.memlist:
-                self.memories[i] = AMS_Memory(comm,i)
-            if self.memory_list_func:
-                self.memory_list_func(response)
-                self.memory_list_func = null
-
-    def onRemoteError(self, code, errobj, request_info):
-        pass
-
-if __name__ == '__main__':
-    pyjd.setup()
-    app = AMSJavascriptExample()
-    app.onModuleLoad()
-    pyjd.run()
-

File include/web/AMSSnoopObjects.py

View file
+#
+#   Run
+#
+#     python pyjsbuild --frame=AMSSnoopObjects.html --enable-debug --enable-wrap-calls --output . AMSSnoopObjects.py
+#
+#   to generate the needed HTML and Javascript
+#
+
+import pyjd
+
+from pyjamas.ui.RootPanel import RootPanel
+from pyjamas.ui.TextArea import TextArea
+from pyjamas.ui.Label import Label
+from pyjamas.ui.Button import Button
+from pyjamas.ui.HTML import HTML
+from pyjamas.ui.VerticalPanel import VerticalPanel
+from pyjamas.ui.HorizontalPanel import HorizontalPanel
+from pyjamas.ui.ListBox import ListBox
+from pyjamas.ui.Tree import Tree
+from pyjamas.ui.TreeItem import TreeItem
+from pyjamas.ui.TextBox import TextBox
+
+import AMS
+
+
+statusbar = 0
+
+boxes  = {}  # The memory and field name for each writable text box created
+
+class AMSSnoopObjects:
+    def onModuleLoad(self):
+        global statusbar
+        statusbar = Label()
+        self.button = Button("Display list of all published memories and fields", self)
+        self.buttonupdate = Button("Update data from AMS publisher", self)
+
+        buttons = HorizontalPanel()
+        buttons.add(self.button)
+        buttons.add(self.buttonupdate)
+        buttons.setSpacing(8)
+
+        info = """<p>This example demonstrates the calling of the Memory Snooper in PETSc with Pyjamas and <a href="http://json-rpc.org/">JSON-RPC</a>.</p>"""
+
+        self.panel = VerticalPanel()
+        self.panel.add(HTML(info))
+        self.panel.add(buttons)
+        self.panel.add(statusbar)
+        RootPanel().add(self.panel)
+        self.commobj = AMS.AMS_Comm()
+        self.tree = None
+
+    def textboxlistener(self,arg):
+      global boxes,statusbar
+      statusbar.setText('User changed value in text box to ' + str(arg.getText()) + " " + str(boxes[arg]))
+      # the user has changed this value we should send it back to the AMS program
+      boxes[arg][2].set_field_info(boxes[arg][1],arg.getText())
+
+    def onClick(self, sender):
+        global statusbar,boxes
+        statusbar.setText('Button pressed')
+        pass
+        if sender == self.buttonupdate:
+            self.commobj = AMS.AMS_Comm()
+            statusbar.setText('Updating data: Press Display list button to refesh')
+        if sender == self.button:
+            if AMS.sent > AMS.recv:
+               statusbar.setText('Press button again: sent '+str(AMS.sent)+' recv '+str(AMS.recv))
+            if self.commobj.commname == 'No AMS publisher running' or not self.commobj.commname or  self.commobj.comm == -1:
+               if self.tree: self.panel.remove(self.tree)
+            else:
+               statusbar.setText('Memories for AMS Comm: '+self.commobj.commname)
+               result = self.commobj.get_memory_list()
+               if self.tree: self.panel.remove(self.tree)
+               self.tree = Tree()
+               for i in result:
+                  if i == "Stack": continue
+                  subtree = TreeItem(i)
+                  memory = self.commobj.memory_attach(i)
+                  fields = memory.get_field_list()
+                  if not isinstance(fields,list): fields = [fields]
+                  block  = false
+                  for j in fields:
+                     field = memory.get_field_info(j)
+                     if str(field[1]) == 'AMS_READ':
+                       if j == "Publish Block":
+                         if field[4] == "true": block = true
+                       else:
+                         subtree.addItem(j+' = '+str(field[4]))
+                     else:
+                       if j == "Block" and not block: continue
+                       PN = HorizontalPanel()
+                       PN.add(Label(Text=j+' ='))
+                       tb = TextBox(Text=str(field[4]))
+                       boxes[tb] = [i,j,memory]
+                       tb.addChangeListener(self.textboxlistener)
+                       PN.add(tb)
+                       subtree.addItem(PN)
+                  self.tree.addItem(subtree)
+                  self.panel.add(self.tree)
+
+if __name__ == '__main__':
+    pyjd.setup()
+    app = AMSSnoopObjects()
+    app.onModuleLoad()
+    pyjd.run()
+

File include/web/AMSSnoopStack.py

View file
+#
+#   Run
+#
+#     python pyjsbuild --frame=AMSSnoopStack.html --enable-debug --enable-wrap-calls --output . AMSSnoopStack.py
+#
+#   to generate the needed HTML and Javascript
+#
+
+import pyjd
+
+from pyjamas.ui.RootPanel import RootPanel
+from pyjamas.ui.TextArea import TextArea
+from pyjamas.ui.Label import Label
+from pyjamas.ui.Button import Button
+from pyjamas.ui.HTML import HTML
+from pyjamas.ui.VerticalPanel import VerticalPanel
+from pyjamas.ui.HorizontalPanel import HorizontalPanel
+from pyjamas.ui.ListBox import ListBox
+from pyjamas.ui.Tree import Tree
+from pyjamas.ui.TreeItem import TreeItem
+from pyjamas.ui.TextBox import TextBox
+from pyjamas.ui.TextArea import TextArea
+import json
+import AMS
+
+
+statusbar = 0
+
+class AMSSnoopStack:
+    def onModuleLoad(self):
+        global statusbar
+        statusbar = Label()
+        self.button = Button("Display Current Stack Frames", self)
+        self.buttonupdate = Button("Update data from AMS publisher", self)
+
+        buttons = HorizontalPanel()
+        buttons.add(self.button)
+        buttons.add(self.buttonupdate)
+        buttons.setSpacing(8)
+
+        info = """<p>This example demonstrates the calling of the Memory Snooper in PETSc with Pyjamas and <a href="http://json-rpc.org/">JSON-RPC</a>.</p>"""
+
+        self.panel = VerticalPanel()
+        self.panel.add(HTML(info))
+        self.panel.add(buttons)
+        self.panel.add(statusbar)
+        RootPanel().add(self.panel)
+        self.commobj = AMS.AMS_Comm()
+        self.textarea = None
+
+    def onClick(self, sender):
+        global statusbar,boxes
+        statusbar.setText('Button pressed')
+        pass
+        if sender == self.buttonupdate:
+            self.commobj = AMS.AMS_Comm()
+            statusbar.setText('Updating data: Press Display list button to refesh')
+        if sender == self.button:
+            if AMS.sent > AMS.recv:
+               statusbar.setText('Press button again: sent '+str(AMS.sent)+' recv '+str(AMS.recv))
+            if self.commobj.commname == 'No AMS publisher running' or not self.commobj.commname or  self.commobj.comm == -1:
+               if self.textarea: self.panel.remove(self.textarea)
+               pass
+            else:
+               statusbar.setText('Memories for AMS Comm: '+self.commobj.commname)
+               result = self.commobj.get_memory_list()
+               if self.textarea: self.panel.remove(self.textarea)
+               self.textarea = TextArea()
+               memory = self.commobj.memory_attach("Stack")
+               size = memory.get_field_info("current size")
+               functions = memory.get_field_info("functions")
+               funcs = '\n'.join(functions[4])
+               self.textarea.setText(str(funcs))
+               self.textarea.setVisibleLines(size[4])
+               self.panel.add(self.textarea)
+
+if __name__ == '__main__':
+    pyjd.setup()
+    app = AMSSnoopStack()
+    app.onModuleLoad()
+    pyjd.run()
+

File src/dm/impls/da/dadestroy.c

View file
     ierr = PetscFree(dd->startin[i]);CHKERRQ(ierr);
   }
 
-  /* if memory was published with AMS then destroy it */
-  ierr = PetscObjectDepublish(da);CHKERRQ(ierr);
-
   ierr = VecScatterDestroy(&dd->ltog);CHKERRQ(ierr);
   ierr = VecScatterDestroy(&dd->gtol);CHKERRQ(ierr);
   ierr = VecScatterDestroy(&dd->ltol);CHKERRQ(ierr);

File src/dm/interface/dm.c

View file
   }
   ierr = PetscFree((*dm)->fields);CHKERRQ(ierr);
   /* if memory was published with AMS then destroy it */
-  ierr = PetscObjectDepublish(*dm);CHKERRQ(ierr);
+  ierr = PetscObjectAMSViewOff((PetscObject)*dm);CHKERRQ(ierr);
 
   ierr = (*(*dm)->ops->destroy)(*dm);CHKERRQ(ierr);
   /* We do not destroy (*dm)->data here so that we can reference count backend objects */

File src/docs/website/documentation/ams.html

View file
     </div>
 
     <div id="header">
-      <h1><!--begin-->Documentation: AMS - ALICE Memory Snooper<!--end--></h1>
+      <h1><!--begin-->Documentation: AMS - Argonne Memory Snooper<!--end--></h1>
     </div>
 
     <hr>

File src/ksp/ksp/impls/bcgs/bcgs.c

View file
   if (ksp->normtype != KSP_NORM_NONE) {
     ierr = VecNorm(R,NORM_2,&dp);CHKERRQ(ierr);
   }
-  ierr       = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+  ierr       = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
   ksp->its   = 0;
   ksp->rnorm = dp;
-  ierr       = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
-  KSPLogResidualHistory(ksp,dp);
+  ierr       = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
+  ierr = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
   ierr = KSPMonitor(ksp,0,dp);CHKERRQ(ierr);
   ierr = (*ksp->converged)(ksp,0,dp,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
   if (ksp->reason) PetscFunctionReturn(0);
         break;
       }
       ierr = VecAXPY(X,alpha,P);CHKERRQ(ierr);   /*   x <- x + a p       */
-      ierr = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+      ierr = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
       ksp->its++;
       ksp->rnorm  = 0.0;
       ksp->reason = KSP_CONVERGED_RTOL;
-      ierr        = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
-      KSPLogResidualHistory(ksp,dp);
+      ierr = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
+      ierr = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
       ierr = KSPMonitor(ksp,i+1,0.0);CHKERRQ(ierr);
       break;
     }
     rhoold   = rho;
     omegaold = omega;
 
-    ierr = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+    ierr = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
     ksp->its++;
     ksp->rnorm = dp;
-    ierr       = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
-    KSPLogResidualHistory(ksp,dp);
+    ierr = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
+    ierr = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
     ierr = KSPMonitor(ksp,i+1,dp);CHKERRQ(ierr);
     ierr = (*ksp->converged)(ksp,i+1,dp,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
     if (ksp->reason) break;

File src/ksp/ksp/impls/bcgs/fbcgs/fbcgs.c

View file
   if (ksp->normtype != KSP_NORM_NONE) {
     ierr = VecNorm(R,NORM_2,&dp);CHKERRQ(ierr);
   }
-  ierr       = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+  ierr       = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
   ksp->its   = 0;
   ksp->rnorm = dp;
-  ierr       = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
-  KSPLogResidualHistory(ksp,dp);
+  ierr = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
+  ierr = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
   ierr = KSPMonitor(ksp,0,dp);CHKERRQ(ierr);
   ierr = (*ksp->converged)(ksp,0,dp,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
   if (ksp->reason) PetscFunctionReturn(0);
         break;
       }
       ierr = VecAXPY(X,alpha,P2);CHKERRQ(ierr);   /* x <- x + alpha p2 */
-      ierr = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+      ierr = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
       ksp->its++;
       ksp->rnorm  = 0.0;
       ksp->reason = KSP_CONVERGED_RTOL;
-      ierr        = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
-      KSPLogResidualHistory(ksp,dp);
+      ierr = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
+      ierr = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
       ierr = KSPMonitor(ksp,i+1,0.0);CHKERRQ(ierr);
       break;
     }
     rhoold   = rho;
     omegaold = omega;
 
-    ierr = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+    ierr = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
     ksp->its++;
     ksp->rnorm = dp;
-    ierr       = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
-    KSPLogResidualHistory(ksp,dp);
+    ierr = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
+    ierr = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
     ierr = KSPMonitor(ksp,i+1,dp);CHKERRQ(ierr);
     ierr = (*ksp->converged)(ksp,i+1,dp,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
     if (ksp->reason) break;

File src/ksp/ksp/impls/bcgs/fbcgsr/fbcgsr.c

View file
   if (ksp->normtype != KSP_NORM_NONE) {
     ierr = VecNorm(R,NORM_2,&rho);CHKERRQ(ierr);
   }
-  ierr       = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+  ierr       = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
   ksp->its   = 0;
   ksp->rnorm = rho;
-  ierr       = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
-  KSPLogResidualHistory(ksp,rho);
+  ierr = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
+  ierr = KSPLogResidualHistory(ksp,rho);CHKERRQ(ierr);
   ierr = KSPMonitor(ksp,0,rho);CHKERRQ(ierr);
   ierr = (*ksp->converged)(ksp,0,rho,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
   if (ksp->reason) PetscFunctionReturn(0);
     ierr = VecAXPBYPCZ(X,alpha,omega,1.0,P2,S2);CHKERRQ(ierr); /* x <- alpha * p2 + omega * s2 + x */
 
     /* convergence test */
-    ierr = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+    ierr = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
     ksp->its++;
     ksp->rnorm = rho;
-    ierr       = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
-    KSPLogResidualHistory(ksp,rho);
+    ierr = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
+    ierr = KSPLogResidualHistory(ksp,rho);CHKERRQ(ierr);
     ierr = KSPMonitor(ksp,i+1,rho);CHKERRQ(ierr);
     ierr = (*ksp->converged)(ksp,i+1,rho,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
     if (ksp->reason) break;

File src/ksp/ksp/impls/bcgsl/bcgsl.c

View file
 
   ierr = (*ksp->converged)(ksp, 0, zeta0, &ksp->reason, ksp->cnvP);CHKERRQ(ierr);
   if (ksp->reason) {
-    ierr       = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+    ierr       = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
     ksp->its   = 0;
     ksp->rnorm = zeta0;
-    ierr       = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
+    ierr       = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
     PetscFunctionReturn(0);
   }
 
     ksp->its   = k;
     ksp->rnorm = zeta;
 
-    KSPLogResidualHistory(ksp, zeta);
+    ierr = KSPLogResidualHistory(ksp, zeta);CHKERRQ(ierr);
     ierr = KSPMonitor(ksp, ksp->its, zeta);CHKERRQ(ierr);
 
     ierr = (*ksp->converged)(ksp, k, zeta, &ksp->reason, ksp->cnvP);CHKERRQ(ierr);
       /* NEW: check for early exit */
       ierr = (*ksp->converged)(ksp, k+j, nrm0, &ksp->reason, ksp->cnvP);CHKERRQ(ierr);
       if (ksp->reason) {
-        ierr = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+        ierr = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
 
         ksp->its   = k+j;
         ksp->rnorm = nrm0;
 
-        ierr = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
+        ierr = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
         if (ksp->reason < 0) PetscFunctionReturn(0);
       }
     }

File src/ksp/ksp/impls/bicg/bicg.c

View file
     ierr = VecNorm(Rr,NORM_2,&dp);CHKERRQ(ierr);  /*    dp <- r'*r       */
   }
   ierr       = KSPMonitor(ksp,0,dp);CHKERRQ(ierr);
-  ierr       = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+  ierr       = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
   ksp->its   = 0;
   ksp->rnorm = dp;
-  ierr       = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
-  KSPLogResidualHistory(ksp,dp);
+  ierr       = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
+  ierr = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
   ierr = (*ksp->converged)(ksp,0,dp,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
   if (ksp->reason) PetscFunctionReturn(0);
 
     } else {
       ierr = VecNorm(Rr,NORM_2,&dp);CHKERRQ(ierr);  /*    dp <- r'*r       */
     }
-    ierr       = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+    ierr       = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
     ksp->its   = i+1;
     ksp->rnorm = dp;
-    ierr       = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
-    KSPLogResidualHistory(ksp,dp);
+    ierr       = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
+    ierr = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
     ierr = KSPMonitor(ksp,i+1,dp);CHKERRQ(ierr);
     ierr = (*ksp->converged)(ksp,i+1,dp,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
     if (ksp->reason) break;

File src/ksp/ksp/impls/cg/cg.c

View file
     break;
   default: SETERRQ1(PetscObjectComm((PetscObject)ksp),PETSC_ERR_SUP,"%s",KSPNormTypes[ksp->normtype]);
   }
-  KSPLogResidualHistory(ksp,dp);
+  ierr       = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
   ierr       = KSPMonitor(ksp,0,dp);CHKERRQ(ierr);
   ksp->rnorm = dp;
 
       dp = 0.0;
     }
     ksp->rnorm = dp;
-    KSPLogResidualHistory(ksp,dp);
+    CHKERRQ(ierr);KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
     ierr = KSPMonitor(ksp,i+1,dp);CHKERRQ(ierr);
     ierr = (*ksp->converged)(ksp,i+1,dp,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
     if (ksp->reason) break;

File src/ksp/ksp/impls/cg/cgne/cgne.c

View file
     ierr = VecXDot(Z,R,&beta);CHKERRQ(ierr);
     dp   = PetscSqrtReal(PetscAbsScalar(beta));
   } else dp = 0.0;
-  KSPLogResidualHistory(ksp,dp);
+  ierr       = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
   ierr       = KSPMonitor(ksp,0,dp);CHKERRQ(ierr);
   ksp->rnorm = dp;
   ierr       = (*ksp->converged)(ksp,0,dp,&ksp->reason,ksp->cnvP);CHKERRQ(ierr); /* test for convergence */
       dp = 0.0;
     }
     ksp->rnorm = dp;
-    KSPLogResidualHistory(ksp,dp);
+    ierr = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
     ierr = KSPMonitor(ksp,i+1,dp);CHKERRQ(ierr);
     ierr = (*ksp->converged)(ksp,i+1,dp,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
     if (ksp->reason) break;

File src/ksp/ksp/impls/cg/gltr/gltr.c

View file
     break;
   }
 
-  KSPLogResidualHistory(ksp, norm_r);
+  ierr       = KSPLogResidualHistory(ksp, norm_r);CHKERRQ(ierr);
   ierr       = KSPMonitor(ksp, ksp->its, norm_r);CHKERRQ(ierr);
   ksp->rnorm = norm_r;
 
       break;
     }
 
-    KSPLogResidualHistory(ksp, norm_r);
+    ierr       = KSPLogResidualHistory(ksp, norm_r);CHKERRQ(ierr);
     ierr       = KSPMonitor(ksp, ksp->its, norm_r);CHKERRQ(ierr);
     ksp->rnorm = norm_r;
 
       break;
     }
 
-    KSPLogResidualHistory(ksp, norm_r);
+    ierr       = KSPLogResidualHistory(ksp, norm_r);CHKERRQ(ierr);
     ierr       = KSPMonitor(ksp, ksp->its, norm_r);CHKERRQ(ierr);
     ksp->rnorm = norm_r;
 

File src/ksp/ksp/impls/cg/groppcg/groppcg.c

View file
     break;
   default: SETERRQ1(PetscObjectComm((PetscObject)ksp),PETSC_ERR_SUP,"%s",KSPNormTypes[ksp->normtype]);
   }
-  KSPLogResidualHistory(ksp,dp);
+  ierr       = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
   ierr       = KSPMonitor(ksp,0,dp);CHKERRQ(ierr);
   ksp->rnorm = dp;
   ierr       = (*ksp->converged)(ksp,0,dp,&ksp->reason,ksp->cnvP);CHKERRQ(ierr); /* test for convergence */
       dp = 0.0;
     }
     ksp->rnorm = dp;
-    KSPLogResidualHistory(ksp,dp);
+    ierr = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
     ierr = KSPMonitor(ksp,i,dp);CHKERRQ(ierr);
     ierr = (*ksp->converged)(ksp,i,dp,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
     if (ksp->reason) break;

File src/ksp/ksp/impls/cg/nash/nash.c

View file
     break;
   }
 
-  KSPLogResidualHistory(ksp, norm_r);
+  ierr       = KSPLogResidualHistory(ksp, norm_r);CHKERRQ(ierr);
   ierr       = KSPMonitor(ksp, ksp->its, norm_r);CHKERRQ(ierr);
   ksp->rnorm = norm_r;
 
       break;
     }
 
-    KSPLogResidualHistory(ksp, norm_r);
+    ierr       = KSPLogResidualHistory(ksp, norm_r);CHKERRQ(ierr);
     ierr       = KSPMonitor(ksp, ksp->its, norm_r);CHKERRQ(ierr);
     ksp->rnorm = norm_r;
 

File src/ksp/ksp/impls/cg/pipecg/pipecg.c

View file
     break;
   default: SETERRQ1(PetscObjectComm((PetscObject)ksp),PETSC_ERR_SUP,"%s",KSPNormTypes[ksp->normtype]);
   }
-  KSPLogResidualHistory(ksp,dp);
+  ierr       = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
   ierr       = KSPMonitor(ksp,0,dp);CHKERRQ(ierr);
   ksp->rnorm = dp;
   ierr       = (*ksp->converged)(ksp,0,dp,&ksp->reason,ksp->cnvP);CHKERRQ(ierr); /* test for convergence */
       else if (ksp->normtype == KSP_NORM_NONE) dp = 0.0;
 
       ksp->rnorm = dp;
-      KSPLogResidualHistory(ksp,dp);
+      ierr = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
       ierr = KSPMonitor(ksp,i,dp);CHKERRQ(ierr);
       ierr = (*ksp->converged)(ksp,i,dp,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
       if (ksp->reason) break;

File src/ksp/ksp/impls/cg/stcg/stcg.c

View file
     break;
   }
 
-  KSPLogResidualHistory(ksp, norm_r);
+  ierr       = KSPLogResidualHistory(ksp, norm_r);CHKERRQ(ierr);
   ierr       = KSPMonitor(ksp, ksp->its, norm_r);CHKERRQ(ierr);
   ksp->rnorm = norm_r;
 
       break;
     }
 
-    KSPLogResidualHistory(ksp, norm_r);
+    ierr       = KSPLogResidualHistory(ksp, norm_r);CHKERRQ(ierr);
     ierr       = KSPMonitor(ksp, ksp->its, norm_r);CHKERRQ(ierr);
     ksp->rnorm = norm_r;
 

File src/ksp/ksp/impls/cgs/cgs.c

View file
   /* Test for nothing to do */
   ierr = VecNorm(R,NORM_2,&dp);CHKERRQ(ierr);
   if (ksp->normtype == KSP_NORM_NATURAL) dp *= dp;
-  ierr       = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+  ierr       = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
   ksp->its   = 0;
   ksp->rnorm = dp;
-  ierr       = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
-  KSPLogResidualHistory(ksp,dp);
+  ierr       = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
+  ierr = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
   ierr = KSPMonitor(ksp,0,dp);CHKERRQ(ierr);
   ierr = (*ksp->converged)(ksp,0,dp,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
   if (ksp->reason) PetscFunctionReturn(0);
       ierr = VecNorm(R,NORM_2,&dp);CHKERRQ(ierr);
     }
 
-    ierr = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+    ierr = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
     ksp->its++;
     ksp->rnorm = dp;
-    ierr       = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
-    KSPLogResidualHistory(ksp,dp);
+    ierr       = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
+    ierr = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
     ierr = KSPMonitor(ksp,i+1,dp);CHKERRQ(ierr);
     ierr = (*ksp->converged)(ksp,i+1,dp,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
     if (ksp->reason) break;

File src/ksp/ksp/impls/cheby/cheby.c

View file
   ierr = VecAYPX(p[k],scale,p[km1]);CHKERRQ(ierr);
 
   for (i=0; i<maxit; i++) {
-    ierr = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+    ierr = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
     if (hybrid && cheb->its && (cheb->its%cheb->chebysteps==0)) {
       /* Adaptive step: update eigenvalue estimate - does not seem to improve convergence */
       PetscReal max,min;
 
     ksp->its++;
     cheb->its++;
-    ierr   = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
+    ierr   = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
     c[kp1] = 2.0*mu*c[k] - c[km1];
     omega  = omegaprod*c[k]/c[kp1];
 
     ierr = KSP_MatMult(ksp,Amat,p[k],r);CHKERRQ(ierr);          /*  r = b - Ap[k]    */
     ierr = VecAYPX(r,-1.0,b);CHKERRQ(ierr);
     ierr = KSP_PCApply(ksp,r,p[kp1]);CHKERRQ(ierr);             /*  p[kp1] = B^{-1}r  */
-    ierr         = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
     ksp->vec_sol = p[k];
 
     /* calculate residual norm if requested */
       } else {
         ierr = VecNorm(p[kp1],NORM_2,&rnorm);CHKERRQ(ierr);
       }
-      ierr         = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+      ierr         = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
       ksp->rnorm   = rnorm;
-      KSPLogResidualHistory(ksp,rnorm);
+      ierr = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
+      ierr = KSPLogResidualHistory(ksp,rnorm);CHKERRQ(ierr);
       ierr = KSPMonitor(ksp,i,rnorm);CHKERRQ(ierr);
       ierr = (*ksp->converged)(ksp,i,rnorm,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
       if (ksp->reason) break;
         ierr = KSP_PCApply(ksp,r,p[kp1]);CHKERRQ(ierr); /* p[kp1] = B^{-1}r */
         ierr = VecNorm(p[kp1],NORM_2,&rnorm);CHKERRQ(ierr);
       }
-      ierr         = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+      ierr         = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
       ksp->rnorm   = rnorm;
-      ierr         = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
+      ierr         = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
       ksp->vec_sol = p[k];
-      KSPLogResidualHistory(ksp,rnorm);
+      ierr = KSPLogResidualHistory(ksp,rnorm);CHKERRQ(ierr);
       ierr = KSPMonitor(ksp,i,rnorm);CHKERRQ(ierr);
     }
     if (ksp->its >= ksp->max_it) {

File src/ksp/ksp/impls/cr/cr.c

View file
 
   ksp->its   = 0;
   ierr       = KSPMonitor(ksp,0,dp);CHKERRQ(ierr);
-  ierr       = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+  ierr       = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
   ksp->rnorm = dp;
-  ierr       = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
-  KSPLogResidualHistory(ksp,dp);
+  ierr = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
+  ierr = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
   ierr = (*ksp->converged)(ksp,0,dp,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
   if (ksp->reason) PetscFunctionReturn(0);
 
       break;
     }
 
-    ierr = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+    ierr = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
     ksp->its++;
     ksp->rnorm = dp;
-    ierr       = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
+    ierr       = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
 
-    KSPLogResidualHistory(ksp,dp);
+    ierr = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
     ierr = KSPMonitor(ksp,i+1,dp);CHKERRQ(ierr);
     ierr = (*ksp->converged)(ksp,i+1,dp,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
     if (ksp->reason) break;

File src/ksp/ksp/impls/cr/pipecr/pipecr.c

View file
     break;
   default: SETERRQ1(PetscObjectComm((PetscObject)ksp),PETSC_ERR_SUP,"%s",KSPNormTypes[ksp->normtype]);
   }
-  KSPLogResidualHistory(ksp,dp);
+  ierr       = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
   ierr       = KSPMonitor(ksp,0,dp);CHKERRQ(ierr);
   ksp->rnorm = dp;
   ierr       = (*ksp->converged)(ksp,0,dp,&ksp->reason,ksp->cnvP);CHKERRQ(ierr); /* test for convergence */
     if (i > 0) {
       if (ksp->normtype == KSP_NORM_NONE) dp = 0.0;
       ksp->rnorm = dp;
-      KSPLogResidualHistory(ksp,dp);
+      ierr = KSPLogResidualHistory(ksp,dp);CHKERRQ(ierr);
       ierr = KSPMonitor(ksp,i,dp);CHKERRQ(ierr);
       ierr = (*ksp->converged)(ksp,i,dp,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
       if (ksp->reason) break;

File src/ksp/ksp/impls/gcr/gcr.c

View file
     res        = norm_r;
     ksp->rnorm = res;
 
-    KSPLogResidualHistory(ksp,res);
+    ierr = KSPLogResidualHistory(ksp,res);CHKERRQ(ierr);
     ierr = KSPMonitor(ksp,ksp->its,res);CHKERRQ(ierr);
 
     if (ksp->its > ksp->chknorm) {
   ksp->its    = 0;
   ksp->rnorm0 = norm_r;
 
-  KSPLogResidualHistory(ksp,ksp->rnorm0);
+  ierr = KSPLogResidualHistory(ksp,ksp->rnorm0);CHKERRQ(ierr);
   ierr = KSPMonitor(ksp,ksp->its,ksp->rnorm0);CHKERRQ(ierr);
   ierr = (*ksp->converged)(ksp,ksp->its,ksp->rnorm0,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
   if (ksp->reason) PetscFunctionReturn(0);

File src/ksp/ksp/impls/gmres/agmres/agmres.c

View file
   agmres->it = KspSize-1;
   /*  Test for the convergence */
   ierr = (*ksp->converged)(ksp,ksp->its,res,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
-  KSPLogResidualHistory(ksp,res);
-  KSPMonitor(ksp,ksp->its,res);
+  ierr = KSPLogResidualHistory(ksp,res);CHKERRQ(ierr);
+  ierr = KSPMonitor(ksp,ksp->its,res);CHKERRQ(ierr);
 
 
   *itcount = KspSize;
   PetscInt       test;
 
   PetscFunctionBegin;
-  ierr     = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+  ierr     = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
   ksp->its = 0;
-  ierr     = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
+  ierr     = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
 
   ksp->reason = KSP_CONVERGED_ITERATING;
   if (!agmres->HasShifts) { /* Compute Shifts for the Newton basis */

File src/ksp/ksp/impls/gmres/dgmres/dgmres.c

View file
   *GRS(0) = res_norm;
 
   /* check for the convergence */
-  ierr       = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+  ierr       = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
   ksp->rnorm = res;
-  ierr       = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
+  ierr       = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
   dgmres->it = (it - 1);
   ierr       = KSPLogResidualHistory(ksp,res);CHKERRQ(ierr);
   ierr       = KSPMonitor(ksp,ksp->its,res);CHKERRQ(ierr);
   PetscFunctionBegin;
   if (ksp->calc_sings && !dgmres->Rsvd) SETERRQ(PetscObjectComm((PetscObject)ksp), PETSC_ERR_ORDER,"Must call KSPSetComputeSingularValues() before KSPSetUp() is called");
 
-  ierr            = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+  ierr            = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
   ksp->its        = 0;
   dgmres->matvecs = 0;
-  ierr            = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
+  ierr            = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
 
   itcount     = 0;
   ksp->reason = KSP_CONVERGED_ITERATING;

File src/ksp/ksp/impls/gmres/fgmres/fgmres.c

View file
   *RS(0) = res_norm;
 
   ksp->rnorm = res_norm;
-  KSPLogResidualHistory(ksp,res_norm);
+  ierr       = KSPLogResidualHistory(ksp,res_norm);CHKERRQ(ierr);
 
   /* check for the convergence - maybe the current guess is good enough */
   ierr = (*ksp->converged)(ksp,ksp->its,res_norm,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
   /* keep iterating until we have converged OR generated the max number
      of directions OR reached the max number of iterations for the method */
   while (!ksp->reason && loc_it < max_k && ksp->its < ksp->max_it) {
-    if (loc_it) KSPLogResidualHistory(ksp,res_norm);
+    if (loc_it) {ierr = KSPLogResidualHistory(ksp,res_norm);CHKERRQ(ierr);}
     fgmres->it = (loc_it - 1);
     ierr       = KSPMonitor(ksp,ksp->its,res_norm);CHKERRQ(ierr);
 
     loc_it++;
     fgmres->it = (loc_it-1);   /* Add this here in case it has converged */
 
-    ierr = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+    ierr = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
     ksp->its++;
     ksp->rnorm = res_norm;
-    ierr       = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
+    ierr       = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
 
     ierr = (*ksp->converged)(ksp,ksp->its,res_norm,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
 
   ierr = PCGetDiagonalScale(ksp->pc,&diagonalscale);CHKERRQ(ierr);
   if (diagonalscale) SETERRQ1(PetscObjectComm((PetscObject)ksp),PETSC_ERR_SUP,"Krylov method %s does not support diagonal scaling",((PetscObject)ksp)->type_name);
 
-  ierr     = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+  ierr     = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
   ksp->its = 0;
-  ierr     = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
+  ierr     = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
 
   /* Compute the initial (NOT preconditioned) residual */
   if (!ksp->guess_zero) {

File src/ksp/ksp/impls/gmres/gmres.c

View file
   *GRS(0) = res_norm;
 
   /* check for the convergence */
-  ierr       = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+  ierr       = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
   ksp->rnorm = res;
-  ierr       = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
+  ierr       = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
   gmres->it  = (it - 1);
-  KSPLogResidualHistory(ksp,res);
+  ierr = KSPLogResidualHistory(ksp,res);CHKERRQ(ierr);
   ierr = KSPMonitor(ksp,ksp->its,res);CHKERRQ(ierr);
   if (!res) {
     if (itcount) *itcount = 0;
   ierr = (*ksp->converged)(ksp,ksp->its,res,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
   while (!ksp->reason && it < max_k && ksp->its < ksp->max_it) {
     if (it) {
-      KSPLogResidualHistory(ksp,res);
+      ierr = KSPLogResidualHistory(ksp,res);CHKERRQ(ierr);
       ierr = KSPMonitor(ksp,ksp->its,res);CHKERRQ(ierr);
     }
     gmres->it = (it - 1);
 
   /* Monitor if we know that we will not return for a restart */
   if (it && (ksp->reason || ksp->its >= ksp->max_it)) {
-    KSPLogResidualHistory(ksp,res);
+    ierr = KSPLogResidualHistory(ksp,res);CHKERRQ(ierr);
     ierr = KSPMonitor(ksp,ksp->its,res);CHKERRQ(ierr);
   }
 
   PetscFunctionBegin;
   if (ksp->calc_sings && !gmres->Rsvd) SETERRQ(PetscObjectComm((PetscObject)ksp),PETSC_ERR_ORDER,"Must call KSPSetComputeSingularValues() before KSPSetUp() is called");
 
-  ierr     = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+  ierr     = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
   ksp->its = 0;
-  ierr     = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
+  ierr     = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
 
   itcount     = 0;
   ksp->reason = KSP_CONVERGED_ITERATING;

File src/ksp/ksp/impls/gmres/lgmres/lgmres.c

View file
   ierr = (*ksp->converged)(ksp,ksp->its,res,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
 
   while (!ksp->reason && loc_it < it_total && ksp->its < max_it) { /* LGMRES_MOD: changed to it_total */
-    KSPLogResidualHistory(ksp,res);
+    ierr       = KSPLogResidualHistory(ksp,res);CHKERRQ(ierr);
     lgmres->it = (loc_it - 1);
     ierr       = KSPMonitor(ksp,ksp->its,res);CHKERRQ(ierr);
 
     loc_it++;
     lgmres->it = (loc_it-1);   /* Add this here in case it has converged */
 
-    ierr = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+    ierr = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
     ksp->its++;
     ksp->rnorm = res;
-    ierr       = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
+    ierr       = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
 
     ierr = (*ksp->converged)(ksp,ksp->its,res,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
 
   PetscFunctionBegin;
   if (ksp->calc_sings && !lgmres->Rsvd) SETERRQ(PetscObjectComm((PetscObject)ksp),PETSC_ERR_ORDER,"Must call KSPSetComputeSingularValues() before KSPSetUp() is called");
 
-  ierr = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+  ierr = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
 
   ksp->its        = 0;
   lgmres->aug_ct  = 0;
   lgmres->matvecs = 0;
 
-  ierr = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
+  ierr = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
 
   /* initialize */
   itcount     = 0;

File src/ksp/ksp/impls/gmres/pgmres/pgmres.c

View file
   *RS(0) = res_norm;
 
   /* check for the convergence */
-  ierr       = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+  ierr       = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
   ksp->rnorm = res;
-  ierr       = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
+  ierr       = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
   pgmres->it = it-2;
-  KSPLogResidualHistory(ksp,res);
+  ierr = KSPLogResidualHistory(ksp,res);CHKERRQ(ierr);
   ierr = KSPMonitor(ksp,ksp->its,res);CHKERRQ(ierr);
   if (!res) {
     ksp->reason = KSP_CONVERGED_ATOL;
 
       ierr = (*ksp->converged)(ksp,ksp->its,res,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
       if (it < pgmres->max_k+1 || ksp->reason || ksp->its == ksp->max_it) {  /* Monitor if we are done or still iterating, but not before a restart. */
-        KSPLogResidualHistory(ksp,res);
+        ierr = KSPLogResidualHistory(ksp,res);CHKERRQ(ierr);
         ierr = KSPMonitor(ksp,ksp->its,res);CHKERRQ(ierr);
       }
       if (ksp->reason) break;
 
   PetscFunctionBegin;
   if (ksp->calc_sings && !pgmres->Rsvd) SETERRQ(PetscObjectComm((PetscObject)ksp),PETSC_ERR_ORDER,"Must call KSPSetComputeSingularValues() before KSPSetUp() is called");
-  ierr     = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+  ierr     = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
   ksp->its = 0;
-  ierr     = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
+  ierr     = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
 
   itcount     = 0;
   ksp->reason = KSP_CONVERGED_ITERATING;

File src/ksp/ksp/impls/lcd/lcd.c

View file
 
   ierr = KSP_PCApply(ksp,Z,R);CHKERRQ(ierr);                   /*     r <- M^-1z         */
   ierr = VecNorm(R,NORM_2,&rnorm);CHKERRQ(ierr);
-  KSPLogResidualHistory(ksp,rnorm);
+  ierr = KSPLogResidualHistory(ksp,rnorm);CHKERRQ(ierr);
   ierr       = KSPMonitor(ksp,0,rnorm);CHKERRQ(ierr);
   ksp->rnorm = rnorm;
 
       ierr = VecNorm(R,NORM_2,&rnorm);CHKERRQ(ierr);
 
       ksp->rnorm = rnorm;
-      KSPLogResidualHistory(ksp,rnorm);
+      ierr = KSPLogResidualHistory(ksp,rnorm);CHKERRQ(ierr);
       ierr = KSPMonitor(ksp,ksp->its,rnorm);CHKERRQ(ierr);
       ierr = (*ksp->converged)(ksp,ksp->its,rnorm,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
 

File src/ksp/ksp/impls/lsqr/lsqr.c

View file
 
   /* Test for nothing to do */
   ierr       = VecNorm(U,NORM_2,&rnorm);CHKERRQ(ierr);
-  ierr       = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+  ierr       = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
   ksp->its   = 0;
   ksp->rnorm = rnorm;
-  ierr       = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
-  KSPLogResidualHistory(ksp,rnorm);
+  ierr       = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
+  ierr = KSPLogResidualHistory(ksp,rnorm);CHKERRQ(ierr);
   ierr = KSPMonitor(ksp,0,rnorm);CHKERRQ(ierr);
   ierr = (*ksp->converged)(ksp,0,rnorm,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
   if (ksp->reason) PetscFunctionReturn(0);
     lsqr->arnorm = alpha*PetscAbsScalar(tau);
     rnorm        = PetscRealPart(phibar);
 
-    ierr = PetscObjectTakeAccess(ksp);CHKERRQ(ierr);
+    ierr = PetscObjectAMSTakeAccess((PetscObject)ksp);CHKERRQ(ierr);
     ksp->its++;
     ksp->rnorm = rnorm;
-    ierr       = PetscObjectGrantAccess(ksp);CHKERRQ(ierr);
-    KSPLogResidualHistory(ksp,rnorm);
+    ierr       = PetscObjectAMSGrantAccess((PetscObject)ksp);CHKERRQ(ierr);
+    ierr = KSPLogResidualHistory(ksp,rnorm);CHKERRQ(ierr);
     ierr = KSPMonitor(ksp,i+1,rnorm);CHKERRQ(ierr);
     ierr = (*ksp->converged)(ksp,i+1,rnorm,&ksp->reason,ksp->cnvP);CHKERRQ(ierr);
     if (ksp->reason) break;

File src/ksp/ksp/impls/minres/minres.c

View file
 
   ierr = VecNorm(Z,NORM_2,&np);CHKERRQ(ierr);      /*   np <- ||z||        */
 
-  KSPLogResidualHistory(ksp,np);