1 2 #include <petsc-private/viewerimpl.h> /*I "petscsys.h" */ 3 #include <petscviewersaws.h> 4 5 #undef __FUNCT__ 6 #define __FUNCT__ "PetscViewerSAWsOpen" 7 /*@C 8 PetscViewerSAWsOpen - Opens an SAWs memory snooper PetscViewer. 9 10 Collective on MPI_Comm 11 12 Input Parameters: 13 . comm - the MPI communicator 14 15 Output Parameter: 16 . lab - the PetscViewer 17 18 Options Database Keys: 19 + -ams_port <port number> - port number where you are running SAWs client 20 . -xxx_view ams - publish the object xxx 21 - -xxx_saws_block - blocks the program at the end of a critical point (for KSP and SNES it is the end of a solve) until 22 the user unblocks the the problem with an external tool that access the object with the AMS 23 24 Level: advanced 25 26 Fortran Note: 27 This routine is not supported in Fortran. 28 29 30 Notes: 31 Unlike other viewers that only access the object being viewed on the call to XXXView(object,viewer) the SAWs viewer allows 32 one to view the object asynchronously as the program continues to run. One can remove SAWs access to the object with a call to 33 PetscObjectSAWsViewOff(). 34 35 Information about the SAWs is available via http://www.mcs.anl.gov/SAWs. 36 37 Concepts: AMS 38 Concepts: Argonne Memory Snooper 39 Concepts: Asynchronous Memory Snooper 40 41 .seealso: PetscViewerDestroy(), PetscViewerStringSPrintf(), PETSC_VIEWER_SAWS_(), PetscObjectSAWsBlock(), 42 PetscObjectSAWsViewOff(), PetscObjectSAWsTakeAccess(), PetscObjectSAWsGrantAccess() 43 44 @*/ 45 PetscErrorCode PetscViewerSAWsOpen(MPI_Comm comm,PetscViewer *lab) 46 { 47 PetscErrorCode ierr; 48 49 PetscFunctionBegin; 50 ierr = PetscViewerCreate(comm,lab);CHKERRQ(ierr); 51 ierr = PetscViewerSetType(*lab,PETSCVIEWERSAWS);CHKERRQ(ierr); 52 PetscFunctionReturn(0); 53 } 54 55 #undef __FUNCT__ 56 #define __FUNCT__ "PetscObjectViewSAWs" 57 /*@C 58 PetscObjectViewSAWs - View the base portion of any object with an SAWs viewer 59 60 Collective on PetscObject 61 62 Input Parameters: 63 + obj - the Petsc variable 64 Thus must be cast with a (PetscObject), for example, 65 PetscObjectSetName((PetscObject)mat,name); 66 - viewer - the SAWs viewer 67 68 Level: advanced 69 70 Concepts: publishing object 71 72 .seealso: PetscObjectSetName(), PetscObjectSAWsViewOff() 73 74 @*/ 75 PetscErrorCode PetscObjectViewSAWs(PetscObject obj,PetscViewer viewer) 76 { 77 PetscErrorCode ierr; 78 79 PetscFunctionBegin; 80 PetscValidHeader(obj,1); 81 if (obj->amsmem) PetscFunctionReturn(0); 82 ierr = PetscObjectName(obj);CHKERRQ(ierr); 83 84 PetscStackCallSAWs(SAWS_Directory_Create,(obj->name,&obj->amsmem)); 85 PetscStackCallSAWs(SAWS_New_Variable,(obj->amsmem,"Class",&obj->class_name,1,SAWS_READ,SAWS_STRING)); 86 PetscStackCallSAWs(SAWS_New_Variable,(obj->amsmem,"Type",&obj->type_name,1,SAWS_READ,SAWS_STRING)); 87 PetscStackCallSAWs(SAWS_New_Variable,(obj->amsmem,"Id",&obj->id,1,SAWS_READ,SAWS_INT)); 88 PetscStackCallSAWs(SAWS_New_Variable,(obj->amsmem,"ParentId",&obj->parentid,1,SAWS_READ,SAWS_INT)); 89 PetscStackCallSAWs(SAWS_New_Variable,(obj->amsmem,"Name",&obj->name,1,SAWS_READ,SAWS_STRING)); 90 PetscStackCallSAWs(SAWS_New_Variable,(obj->amsmem,"Publish Block",&obj->amspublishblock,1,SAWS_READ,SAWS_BOOLEAN)); 91 PetscStackCallSAWs(SAWS_New_Variable,(obj->amsmem,"Block",&obj->amsblock,1,SAWS_WRITE,SAWS_BOOLEAN)); 92 PetscFunctionReturn(0); 93 } 94