Actual source code: dlregissf.c
petsc-3.13.6 2020-09-29
1: #include <petsc/private/sfimpl.h>
3: static PetscBool PetscSFPackageInitialized = PETSC_FALSE;
5: PetscClassId PETSCSF_CLASSID;
7: PetscLogEvent PETSCSF_SetGraph;
8: PetscLogEvent PETSCSF_SetUp;
9: PetscLogEvent PETSCSF_BcastBegin;
10: PetscLogEvent PETSCSF_BcastEnd;
11: PetscLogEvent PETSCSF_BcastAndOpBegin;
12: PetscLogEvent PETSCSF_BcastAndOpEnd;
13: PetscLogEvent PETSCSF_ReduceBegin;
14: PetscLogEvent PETSCSF_ReduceEnd;
15: PetscLogEvent PETSCSF_FetchAndOpBegin;
16: PetscLogEvent PETSCSF_FetchAndOpEnd;
17: PetscLogEvent PETSCSF_EmbedSF;
18: PetscLogEvent PETSCSF_DistSect;
19: PetscLogEvent PETSCSF_SectSF;
20: PetscLogEvent PETSCSF_RemoteOff;
21: PetscLogEvent PETSCSF_Pack;
22: PetscLogEvent PETSCSF_Unpack;
24: /*@C
25: PetscSFInitializePackage - Initialize SF package
27: Logically Collective
29: Level: developer
31: .seealso: PetscSFFinalizePackage()
32: @*/
33: PetscErrorCode PetscSFInitializePackage(void)
34: {
35: char logList[256];
36: PetscBool opt,pkg;
40: if (PetscSFPackageInitialized) return(0);
41: PetscSFPackageInitialized = PETSC_TRUE;
42: /* Register Class */
43: PetscClassIdRegister("Star Forest Graph", &PETSCSF_CLASSID);
44: /* Register Constructors */
45: PetscSFRegisterAll();
46: /* Register Events */
47: PetscLogEventRegister("SFSetGraph" , PETSCSF_CLASSID, &PETSCSF_SetGraph);
48: PetscLogEventRegister("SFSetUp" , PETSCSF_CLASSID, &PETSCSF_SetUp);
49: PetscLogEventRegister("SFBcastBegin" , PETSCSF_CLASSID, &PETSCSF_BcastBegin);
50: PetscLogEventRegister("SFBcastEnd" , PETSCSF_CLASSID, &PETSCSF_BcastEnd);
51: PetscLogEventRegister("SFBcastOpBegin" , PETSCSF_CLASSID, &PETSCSF_BcastAndOpBegin);
52: PetscLogEventRegister("SFBcastOpEnd" , PETSCSF_CLASSID, &PETSCSF_BcastAndOpEnd);
53: PetscLogEventRegister("SFReduceBegin" , PETSCSF_CLASSID, &PETSCSF_ReduceBegin);
54: PetscLogEventRegister("SFReduceEnd" , PETSCSF_CLASSID, &PETSCSF_ReduceEnd);
55: PetscLogEventRegister("SFFetchOpBegin" , PETSCSF_CLASSID, &PETSCSF_FetchAndOpBegin);
56: PetscLogEventRegister("SFFetchOpEnd" , PETSCSF_CLASSID, &PETSCSF_FetchAndOpEnd);
57: PetscLogEventRegister("SFCreateEmbed" , PETSCSF_CLASSID, &PETSCSF_EmbedSF);
58: PetscLogEventRegister("SFDistSection" , PETSCSF_CLASSID, &PETSCSF_DistSect);
59: PetscLogEventRegister("SFSectionSF" , PETSCSF_CLASSID, &PETSCSF_SectSF);
60: PetscLogEventRegister("SFRemoteOff" , PETSCSF_CLASSID, &PETSCSF_RemoteOff);
61: PetscLogEventRegister("SFPack" , PETSCSF_CLASSID, &PETSCSF_Pack);
62: PetscLogEventRegister("SFUnpack" , PETSCSF_CLASSID, &PETSCSF_Unpack);
63: /* Process Info */
64: {
65: PetscClassId classids[1];
67: classids[0] = PETSCSF_CLASSID;
68: PetscInfoProcessClass("sf", 1, classids);
69: }
70: /* Process summary exclusions */
71: PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
72: if (opt) {
73: PetscStrInList("sf",logList,',',&pkg);
74: if (pkg) {PetscLogEventExcludeClass(PETSCSF_CLASSID);}
75: }
76: /* Register package finalizer */
77: PetscRegisterFinalize(PetscSFFinalizePackage);
78: return(0);
79: }
81: /*@C
82: PetscSFFinalizePackage - Finalize PetscSF package, it is called from PetscFinalize()
84: Logically Collective
86: Level: developer
88: .seealso: PetscSFInitializePackage()
89: @*/
90: PetscErrorCode PetscSFFinalizePackage(void)
91: {
95: PetscFunctionListDestroy(&PetscSFList);
96: PetscSFPackageInitialized = PETSC_FALSE;
97: PetscSFRegisterAllCalled = PETSC_FALSE;
98: return(0);
99: }