Lines Matching refs:w
72 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFWindowGetDataTypes() local
79 for (link = w->link; link; link = link->next) { in PetscSFWindowGetDataTypes()
119 link->next = w->link; in PetscSFWindowGetDataTypes()
120 w->link = link; in PetscSFWindowGetDataTypes()
181 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFWindowSetFlavorType_Window() local
184 w->flavor = flavor; in PetscSFWindowSetFlavorType_Window()
214 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFWindowGetFlavorType_Window() local
217 *flavor = w->flavor; in PetscSFWindowGetFlavorType_Window()
248 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFWindowSetSyncType_Window() local
251 w->sync = sync; in PetscSFWindowSetSyncType_Window()
281 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFWindowGetSyncType_Window() local
284 *sync = w->sync; in PetscSFWindowGetSyncType_Window()
314 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFWindowSetInfo_Window() local
317 if (w->info != MPI_INFO_NULL) PetscCallMPI(MPI_Info_free(&w->info)); in PetscSFWindowSetInfo_Window()
318 if (info != MPI_INFO_NULL) PetscCallMPI(MPI_Info_dup(info, &w->info)); in PetscSFWindowSetInfo_Window()
351 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFWindowGetInfo_Window() local
354 *info = w->info; in PetscSFWindowGetInfo_Window()
379 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFWindowAttach() local
385 wcomm = w->window_comm; in PetscSFWindowAttach()
388 PetscCheck(w->dynsf, wcomm, PETSC_ERR_ORDER, "Must call PetscSFSetUp()"); in PetscSFWindowAttach()
389 PetscCall(PetscSFGetRootRanks(w->dynsf, &nranks, NULL, NULL, NULL, NULL)); in PetscSFWindowAttach()
392 PetscCall(PetscSFBcastBegin(w->dynsf, MPI_AINT, &winaddr, link->dyn_target_addr, MPI_REPLACE)); in PetscSFWindowAttach()
393 PetscCall(PetscSFBcastEnd(w->dynsf, MPI_AINT, &winaddr, link->dyn_target_addr, MPI_REPLACE)); in PetscSFWindowAttach()
429 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFGetWindow() local
440 wcomm = w->window_comm; in PetscSFGetWindow()
441 is_empty = w->is_empty; in PetscSFGetWindow()
448 if (w->flavor != PETSCSF_WINDOW_FLAVOR_CREATE) reuse = PETSC_TRUE; in PetscSFGetWindow()
449 if (PetscDefined(HAVE_MPI_FEATURE_DYNAMIC_WINDOW) && w->flavor == PETSCSF_WINDOW_FLAVOR_DYNAMIC) { in PetscSFGetWindow()
451 for (link = w->wins; reuse && link; link = link->next) { in PetscSFGetWindow()
455 …match = (link->flavor == w->flavor && link->rootdata == rootdata && link->leafdata == leafdata) ? … in PetscSFGetWindow()
478 for (link = w->wins; reuse && link; link = link->next) { in PetscSFGetWindow()
479 if (w->flavor != link->flavor) continue; in PetscSFGetWindow()
484 if (w->flavor == PETSCSF_WINDOW_FLAVOR_DYNAMIC) { in PetscSFGetWindow()
499 link->next = w->wins; in PetscSFGetWindow()
500 link->flavor = w->flavor; in PetscSFGetWindow()
503 w->wins = link; in PetscSFGetWindow()
510 switch (w->flavor) { in PetscSFGetWindow()
512 PetscCallMPI(MPI_Win_create(rootdata, wsize, (PetscMPIInt)bytes, w->info, wcomm, &link->win)); in PetscSFGetWindow()
517 PetscCallMPI(MPI_Win_create_dynamic(w->info, wcomm, &link->win)); in PetscSFGetWindow()
521 …PetscCallMPI(MPI_Win_allocate(wsize, (PetscMPIInt)bytes, w->info, wcomm, &link->addr, &link->win)); in PetscSFGetWindow()
527 …PetscCallMPI(MPI_Win_allocate_shared(wsize, (PetscMPIInt)bytes, w->info, wcomm, &link->addr, &link… in PetscSFGetWindow()
532 SETERRQ(wcomm, PETSC_ERR_SUP, "No support for flavor %s", PetscSFWindowFlavorTypes[w->flavor]); in PetscSFGetWindow()
607 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFFindWindow() local
615 is_empty = w->is_empty; in PetscSFFindWindow()
621 for (link = w->wins; link; link = link->next) { in PetscSFFindWindow()
623 …PETSC_INTPTR_T_FMT "\n", (PETSC_INTPTR_T)link->win, link->flavor, (PETSC_INTPTR_T)w->window_comm)); in PetscSFFindWindow()
652 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFRestoreWindow() local
662 wcomm = w->window_comm; in PetscSFRestoreWindow()
663 for (p = &w->wins; *p; p = &(*p)->next) { in PetscSFRestoreWindow()
742 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFSetUp_Window() local
749 if (w->window_comm == MPI_COMM_NULL) { in PetscSFSetUp_Window()
755 …if (w->flavor == PETSCSF_WINDOW_FLAVOR_DYNAMIC) PetscCall(PetscSFWindowCreateDynamicSF(sf, &dynsf_… in PetscSFSetUp_Window()
760 PetscCall(PetscMalloc1(nranks, &w->wcommranks)); in PetscSFSetUp_Window()
761 w->is_empty = has_empty; in PetscSFSetUp_Window()
769 PetscCallMPI(MPI_Comm_split(comm, w->is_empty ? 1 : 0, rank, &raw_comm)); in PetscSFSetUp_Window()
770 PetscCall(PetscCommDuplicate(raw_comm, &w->window_comm, NULL)); in PetscSFSetUp_Window()
773 PetscCallMPI(MPI_Comm_rank(w->window_comm, &wcommrank)); in PetscSFSetUp_Window()
775 PetscCall(PetscSFBcastBegin(dynsf_full, MPI_INT, &wcommrank, w->wcommranks, MPI_REPLACE)); in PetscSFSetUp_Window()
776 PetscCall(PetscSFBcastEnd(dynsf_full, MPI_INT, &wcommrank, w->wcommranks, MPI_REPLACE)); in PetscSFSetUp_Window()
778 if (w->flavor == PETSCSF_WINDOW_FLAVOR_DYNAMIC) { in PetscSFSetUp_Window()
779 PetscCall(PetscSFCreate(w->window_comm, &w->dynsf)); in PetscSFSetUp_Window()
780 PetscCall(PetscSFSetType(w->dynsf, PETSCSFBASIC)); /* break recursion */ in PetscSFSetUp_Window()
783 remotes[i].rank = w->wcommranks[i]; in PetscSFSetUp_Window()
786 …PetscCall(PetscSFSetGraph(w->dynsf, 1, sf->nranks, NULL, PETSC_OWN_POINTER, remotes, PETSC_OWN_POI… in PetscSFSetUp_Window()
789 PetscCall(PetscCommDuplicate(PetscObjectComm((PetscObject)sf), &w->window_comm, NULL)); in PetscSFSetUp_Window()
790 PetscCall(PetscArraycpy(w->wcommranks, sf->ranks, nranks)); in PetscSFSetUp_Window()
792 w->dynsf = dynsf_full; in PetscSFSetUp_Window()
794 if (w->dynsf) PetscCall(PetscSFSetUp(w->dynsf)); in PetscSFSetUp_Window()
797 switch (w->sync) { in PetscSFSetUp_Window()
808 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFSetFromOptions_Window() local
809 PetscSFWindowFlavorType flavor = w->flavor; in PetscSFSetFromOptions_Window()
813 … "PetscSFWindowSetSyncType", PetscSFWindowSyncTypes, (PetscEnum)w->sync, (PetscEnum *)&w->sync, NU… in PetscSFSetFromOptions_Window()
822 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFReset_Window() local
830 for (link = w->link; link; link = next) { in PetscSFReset_Window()
840 w->link = NULL; in PetscSFReset_Window()
841 wcomm = w->window_comm; in PetscSFReset_Window()
842 is_empty = w->is_empty; in PetscSFReset_Window()
844 for (wlink = w->wins; wlink; wlink = wnext) { in PetscSFReset_Window()
853 w->wins = NULL; in PetscSFReset_Window()
854 PetscCall(PetscSFDestroy(&w->dynsf)); in PetscSFReset_Window()
855 if (w->info != MPI_INFO_NULL) PetscCallMPI(MPI_Info_free(&w->info)); in PetscSFReset_Window()
856 PetscCall(PetscCommDestroy(&w->window_comm)); in PetscSFReset_Window()
857 PetscCall(PetscFree(w->wcommranks)); in PetscSFReset_Window()
863 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFRegisterPersistent_Window() local
870 if (w->flavor != PETSCSF_WINDOW_FLAVOR_DYNAMIC) PetscFunctionReturn(PETSC_SUCCESS); in PetscSFRegisterPersistent_Window()
873 is_empty = w->is_empty; in PetscSFRegisterPersistent_Window()
876 link->flavor = w->flavor; in PetscSFRegisterPersistent_Window()
877 link->next = w->wins; in PetscSFRegisterPersistent_Window()
880 MPI_Comm wcomm = w->window_comm; in PetscSFRegisterPersistent_Window()
881 PetscCallMPI(MPI_Win_create_dynamic(w->info, wcomm, &link->win)); in PetscSFRegisterPersistent_Window()
891 w->wins = link; in PetscSFRegisterPersistent_Window()
892 if (w->sync == PETSCSF_WINDOW_SYNC_LOCK) { in PetscSFRegisterPersistent_Window()
903 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFDeregisterPersistent_Window() local
911 if (w->flavor != PETSCSF_WINDOW_FLAVOR_DYNAMIC) PetscFunctionReturn(PETSC_SUCCESS); in PetscSFDeregisterPersistent_Window()
913 wcomm = w->window_comm; in PetscSFDeregisterPersistent_Window()
914 is_empty = w->is_empty; in PetscSFDeregisterPersistent_Window()
916 for (p = &w->wins; *p; p = &(*p)->next) { in PetscSFDeregisterPersistent_Window()
918 …if (link->flavor == w->flavor && link->persistent && link->rootdata == rootdata && link->leafdata … in PetscSFDeregisterPersistent_Window()
954 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFView_Window() local
962 …onization=%s MultiSF sort=%s\n", PetscSFWindowFlavorTypes[w->flavor], PetscSFWindowSyncTypes[w->sy… in PetscSFView_Window()
964 if (w->info != MPI_INFO_NULL) { in PetscSFView_Window()
968 PetscCallMPI(MPI_Info_get_nkeys(w->info, &nkeys)); in PetscSFView_Window()
973 PetscCallMPI(MPI_Info_get_nthkey(w->info, k, key)); in PetscSFView_Window()
974 PetscCallMPI(MPI_Info_get(w->info, key, MPI_MAX_INFO_VAL, value, &flag)); in PetscSFView_Window()
988 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFDuplicate_Window() local
992 synctype = w->sync; in PetscSFDuplicate_Window()
996 PetscCall(PetscSFWindowSetFlavorType(newsf, w->flavor)); in PetscSFDuplicate_Window()
997 PetscCall(PetscSFWindowSetInfo(newsf, w->info)); in PetscSFDuplicate_Window()
1003 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFBcastBegin_Window() local
1015 …PetscCall(PetscSFGetWindow(sf, unit, (void *)rootdata, leafdata, w->sync, PETSC_TRUE, MPI_MODE_NOP… in PetscSFBcastBegin_Window()
1016 ranks = w->wcommranks; in PetscSFBcastBegin_Window()
1019 if (w->sync == PETSCSF_WINDOW_SYNC_LOCK) { in PetscSFBcastBegin_Window()
1037 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFBcastEnd_Window() local
1044 if (w->sync == PETSCSF_WINDOW_SYNC_LOCK) { in PetscSFBcastEnd_Window()
1049 ranks = w->wcommranks; in PetscSFBcastEnd_Window()
1052 …PetscCall(PetscSFRestoreWindow(sf, unit, (void *)rootdata, w->sync, PETSC_TRUE, MPI_MODE_NOSTORE |… in PetscSFBcastEnd_Window()
1058 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFReduceBegin_Window() local
1069 …PetscCall(PetscSFGetWindow(sf, unit, rootdata, (void *)leafdata, w->sync, PETSC_TRUE, MPI_MODE_NOP… in PetscSFReduceBegin_Window()
1070 ranks = w->wcommranks; in PetscSFReduceBegin_Window()
1074 …if (w->sync == PETSCSF_WINDOW_SYNC_LOCK) PetscCallMPI(MPI_Win_lock(MPI_LOCK_SHARED, ranks[i], MPI_… in PetscSFReduceBegin_Window()
1076 if (w->sync == PETSCSF_WINDOW_SYNC_LOCK) PetscCallMPI(MPI_Win_unlock(ranks[i], win)); in PetscSFReduceBegin_Window()
1083 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFReduceEnd_Window() local
1090 …PetscCall(PetscSFRestoreWindow(sf, unit, rootdata, w->sync, PETSC_TRUE, MPI_MODE_NOSUCCEED, PETSC_… in PetscSFReduceEnd_Window()
1101 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFFetchAndOpBegin_Window() local
1113 oldf = w->flavor; in PetscSFFetchAndOpBegin_Window()
1114 w->flavor = PETSCSF_WINDOW_FLAVOR_CREATE; in PetscSFFetchAndOpBegin_Window()
1117 …PetscCall(PetscSFGetWindow(sf, unit, rootdata, (void *)leafdata, w->sync, PETSC_TRUE, MPI_MODE_NOP… in PetscSFFetchAndOpBegin_Window()
1119 ranks = w->wcommranks; in PetscSFFetchAndOpBegin_Window()
1129 …if (w->sync == PETSCSF_WINDOW_SYNC_LOCK) PetscCallMPI(MPI_Win_lock(MPI_LOCK_SHARED, ranks[i], 0, w… in PetscSFFetchAndOpBegin_Window()
1131 if (w->sync == PETSCSF_WINDOW_SYNC_LOCK) PetscCallMPI(MPI_Win_unlock(ranks[i], win)); in PetscSFFetchAndOpBegin_Window()
1135 w->flavor = oldf; in PetscSFFetchAndOpBegin_Window()
1144 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFFetchAndOpEnd_Window() local
1152 …PetscCall(PetscSFRestoreWindow(sf, unit, rootdata, w->sync, PETSC_TRUE, MPI_MODE_NOSUCCEED, PETSC_… in PetscSFFetchAndOpEnd_Window()
1161 PetscSF_Window *w = (PetscSF_Window *)sf->data; in PetscSFCreate_Window() local
1177 PetscCall(PetscNew(&w)); in PetscSFCreate_Window()
1178 sf->data = (void *)w; in PetscSFCreate_Window()
1179 w->sync = PETSCSF_WINDOW_SYNC_FENCE; in PetscSFCreate_Window()
1180 w->flavor = PETSCSF_WINDOW_FLAVOR_CREATE; in PetscSFCreate_Window()
1181 w->info = MPI_INFO_NULL; in PetscSFCreate_Window()
1182 w->window_comm = MPI_COMM_NULL; in PetscSFCreate_Window()