xref: /petsc/src/sys/classes/viewer/impls/ams/amsopen.c (revision ce8c27fb3b504bcf221ee8531f3108ecb56e2a86)
1 
2 #include <petsc-private/viewerimpl.h>   /*I  "petscsys.h"  */
3 #include <petscviewerams.h>
4 
5 #undef __FUNCT__
6 #define __FUNCT__ "PetscViewerAMSOpen"
7 /*@C
8     PetscViewerAMSOpen - Opens an AMS memory snooper PetscViewer.
9 
10     Collective on MPI_Comm
11 
12     Input Parameters:
13 +   comm - the MPI communicator
14 -   name - name of AMS communicator being created
15 
16     Output Parameter:
17 .   lab - the PetscViewer
18 
19     Options Database Keys:
20 +   -ams_port <port number> - port number where you are running AMS client
21 .   -ams_publish_objects - publish all PETSc objects to be visible to the AMS memory snooper,
22                            use PetscObjectAMSPublish() to publish individual objects
23 -   -ams_java - open JAVA AMS client
24 
25     Level: advanced
26 
27     Fortran Note:
28     This routine is not supported in Fortran.
29 
30     See the matlab/petsc directory in the AMS installation for one example of external
31     tools that can monitor PETSc objects that have been published.
32 
33     Notes:
34     This PetscViewer can be destroyed with PetscViewerDestroy().
35 
36     This viewer is currently different than other viewers in that you cannot pass this viewer to XXXView() to view the XXX object.
37     PETSC_VIEWER_AMS_() is used by PetscObjectAMSPublish() to connect to that particular AMS communicator.
38 
39     Information about the AMS is available via http://www.mcs.anl.gov/ams.
40 
41    Concepts: AMS
42    Concepts: ALICE Memory Snooper
43    Concepts: Asynchronous Memory Snooper
44 
45 .seealso: PetscObjectAMSPublish(), PetscViewerDestroy(), PetscViewerStringSPrintf(), PETSC_VIEWER_AMS_(),
46           PetscObjectAMSPublish(), PetscObjectAMSUnPublish(), PetscObjectAMSTakeAccess(), PetscObjectAMSGrantAccess()
47 
48 @*/
49 PetscErrorCode PetscViewerAMSOpen(MPI_Comm comm,const char name[],PetscViewer *lab)
50 {
51   PetscErrorCode ierr;
52 
53   PetscFunctionBegin;
54   ierr = PetscViewerCreate(comm,lab);CHKERRQ(ierr);
55   ierr = PetscViewerSetType(*lab,PETSCVIEWERAMS);CHKERRQ(ierr);
56   ierr = PetscViewerAMSSetCommName(*lab,name);CHKERRQ(ierr);
57   PetscFunctionReturn(0);
58 }
59