Lines Matching refs:sf
6 PetscErrorCode PetscSFSetUp_Allgather(PetscSF sf) in PetscSFSetUp_Allgather() argument
9 PetscSF_Allgather *dat = (PetscSF_Allgather *)sf->data; in PetscSFSetUp_Allgather()
13 sf->leafbuflen[i] = 0; in PetscSFSetUp_Allgather()
14 sf->leafstart[i] = 0; in PetscSFSetUp_Allgather()
15 sf->leafcontig[i] = PETSC_TRUE; in PetscSFSetUp_Allgather()
16 sf->leafdups[i] = PETSC_FALSE; in PetscSFSetUp_Allgather()
23 sf->leafbuflen[PETSCSF_REMOTE] = sf->nleaves; in PetscSFSetUp_Allgather()
24 dat->rootbuflen[PETSCSF_REMOTE] = sf->nroots; in PetscSFSetUp_Allgather()
25 sf->persistent = PETSC_FALSE; in PetscSFSetUp_Allgather()
26 …sf->nleafreqs = 0; /* MPI collectives only need one request. We treat it as a ro… in PetscSFSetUp_Allgather()
31 static PetscErrorCode PetscSFBcastBegin_Allgather(PetscSF sf, MPI_Datatype unit, PetscMemType rootm… in PetscSFBcastBegin_Allgather() argument
40 …PetscCall(PetscSFLinkCreate(sf, unit, rootmtype, rootdata, leafmtype, leafdata, op, PETSCSF_BCAST,… in PetscSFBcastBegin_Allgather()
41 PetscCall(PetscSFLinkPackRootData(sf, link, PETSCSF_REMOTE, rootdata)); in PetscSFBcastBegin_Allgather()
42 …PetscCall(PetscSFLinkCopyRootBufferInCaseNotUseGpuAwareMPI(sf, link, PETSC_TRUE /* device2host bef… in PetscSFBcastBegin_Allgather()
43 PetscCall(PetscObjectGetComm((PetscObject)sf, &comm)); in PetscSFBcastBegin_Allgather()
44 PetscCall(PetscMPIIntCast(sf->nroots, &sendcount)); in PetscSFBcastBegin_Allgather()
45 …PetscCall(PetscSFLinkGetMPIBuffersAndRequests(sf, link, PETSCSF_ROOT2LEAF, &rootbuf, &leafbuf, &re… in PetscSFBcastBegin_Allgather()
46 PetscCall(PetscSFLinkSyncStreamBeforeCallMPI(sf, link)); in PetscSFBcastBegin_Allgather()
51 static PetscErrorCode PetscSFReduceBegin_Allgather(PetscSF sf, MPI_Datatype unit, PetscMemType leaf… in PetscSFReduceBegin_Allgather() argument
58 PetscSF_Allgather *dat = (PetscSF_Allgather *)sf->data; in PetscSFReduceBegin_Allgather()
62 …PetscCall(PetscSFLinkCreate(sf, unit, rootmtype, rootdata, leafmtype, leafdata, op, PETSCSF_REDUCE… in PetscSFReduceBegin_Allgather()
65 PetscCall(PetscLayoutGetRange(sf->map, &rstart, NULL)); in PetscSFReduceBegin_Allgather()
66 …fmtype, (const char *)leafdata + (size_t)rstart * link->unitbytes, (size_t)sf->nroots * link->unit… in PetscSFReduceBegin_Allgather()
69 PetscCall(PetscObjectGetComm((PetscObject)sf, &comm)); in PetscSFReduceBegin_Allgather()
71 PetscCall(PetscSFLinkPackLeafData(sf, link, PETSCSF_REMOTE, leafdata)); in PetscSFReduceBegin_Allgather()
72 …PetscCall(PetscSFLinkCopyLeafBufferInCaseNotUseGpuAwareMPI(sf, link, PETSC_TRUE /* device2host bef… in PetscSFReduceBegin_Allgather()
73 …PetscCall(PetscSFLinkGetMPIBuffersAndRequests(sf, link, PETSCSF_LEAF2ROOT, &rootbuf, &leafbuf, &re… in PetscSFReduceBegin_Allgather()
75 …[PETSCSF_REMOTE][link->leafmtype_mpi]) PetscCall(PetscSFMalloc(sf, link->leafmtype_mpi, sf->leafbu… in PetscSFReduceBegin_Allgather()
77 PetscCall(PetscMPIIntCast(sf->nleaves * link->bs, &count)); in PetscSFReduceBegin_Allgather()
78 PetscCall(PetscSFLinkSyncStreamBeforeCallMPI(sf, link)); in PetscSFReduceBegin_Allgather()
85 static PetscErrorCode PetscSFBcastToZero_Allgather(PetscSF sf, MPI_Datatype unit, PetscMemType root… in PetscSFBcastToZero_Allgather() argument
95 …PetscCall(PetscSFLinkCreate(sf, unit, rootmtype, rootdata, leafmtype, leafdata, MPI_REPLACE, PETSC… in PetscSFBcastToZero_Allgather()
96 PetscCall(PetscSFLinkPackRootData(sf, link, PETSCSF_REMOTE, rootdata)); in PetscSFBcastToZero_Allgather()
97 …PetscCall(PetscSFLinkCopyRootBufferInCaseNotUseGpuAwareMPI(sf, link, PETSC_TRUE /* device2host bef… in PetscSFBcastToZero_Allgather()
98 PetscCall(PetscObjectGetComm((PetscObject)sf, &comm)); in PetscSFBcastToZero_Allgather()
99 PetscCall(PetscMPIIntCast(sf->nroots, &sendcount)); in PetscSFBcastToZero_Allgather()
100 …PetscCall(PetscSFLinkGetMPIBuffersAndRequests(sf, link, PETSCSF_ROOT2LEAF, &rootbuf, &leafbuf, &re… in PetscSFBcastToZero_Allgather()
101 PetscCall(PetscSFLinkSyncStreamBeforeCallMPI(sf, link)); in PetscSFBcastToZero_Allgather()
103 PetscCall(PetscSFLinkGetInUse(sf, unit, rootdata, leafdata, PETSC_OWN_POINTER, &link)); in PetscSFBcastToZero_Allgather()
104 PetscCall(PetscSFLinkFinishCommunication(sf, link, PETSCSF_ROOT2LEAF)); in PetscSFBcastToZero_Allgather()
105 PetscCallMPI(MPI_Comm_rank(PetscObjectComm((PetscObject)sf), &rank)); in PetscSFBcastToZero_Allgather()
106 if (rank == 0 && PetscMemTypeDevice(leafmtype) && !sf->use_gpu_aware_mpi) { in PetscSFBcastToZero_Allgather()
107 …ta, PETSC_MEMTYPE_HOST, link->leafbuf[PETSCSF_REMOTE][PETSC_MEMTYPE_HOST], sf->leafbuflen[PETSCSF_… in PetscSFBcastToZero_Allgather()
109 PetscCall(PetscSFLinkReclaim(sf, &link)); in PetscSFBcastToZero_Allgather()
113 PETSC_INTERN PetscErrorCode PetscSFCreate_Allgather(PetscSF sf) in PetscSFCreate_Allgather() argument
115 PetscSF_Allgather *dat = (PetscSF_Allgather *)sf->data; in PetscSFCreate_Allgather()
118 sf->ops->BcastEnd = PetscSFBcastEnd_Basic; in PetscSFCreate_Allgather()
119 sf->ops->ReduceEnd = PetscSFReduceEnd_Allgatherv; in PetscSFCreate_Allgather()
122 sf->ops->Reset = PetscSFReset_Allgatherv; in PetscSFCreate_Allgather()
123 sf->ops->Destroy = PetscSFDestroy_Allgatherv; in PetscSFCreate_Allgather()
124 sf->ops->FetchAndOpBegin = PetscSFFetchAndOpBegin_Allgatherv; in PetscSFCreate_Allgather()
125 sf->ops->FetchAndOpEnd = PetscSFFetchAndOpEnd_Allgatherv; in PetscSFCreate_Allgather()
126 sf->ops->GetRootRanks = PetscSFGetRootRanks_Allgatherv; in PetscSFCreate_Allgather()
127 sf->ops->CreateLocalSF = PetscSFCreateLocalSF_Allgatherv; in PetscSFCreate_Allgather()
128 sf->ops->GetGraph = PetscSFGetGraph_Allgatherv; in PetscSFCreate_Allgather()
129 sf->ops->GetLeafRanks = PetscSFGetLeafRanks_Allgatherv; in PetscSFCreate_Allgather()
132 sf->ops->SetUp = PetscSFSetUp_Allgather; in PetscSFCreate_Allgather()
133 sf->ops->BcastBegin = PetscSFBcastBegin_Allgather; in PetscSFCreate_Allgather()
134 sf->ops->ReduceBegin = PetscSFReduceBegin_Allgather; in PetscSFCreate_Allgather()
135 sf->ops->BcastToZero = PetscSFBcastToZero_Allgather; in PetscSFCreate_Allgather()
137 sf->collective = PETSC_TRUE; in PetscSFCreate_Allgather()
140 sf->data = (void *)dat; in PetscSFCreate_Allgather()