#include "petscthreadcomm.h" PetscErrorCode PetscThreadCommRegisterDestroy(void)Not collective
*/ PetscErrorCode PetscThreadCommGetAffinities(MPI_Comm comm,PetscInt affinities[]) { PetscErrorCode ierr; PetscThreadComm tcomm=0;
PetscFunctionBegin; ierr = PetscCommGetThreadComm(comm,&tcomm);CHKERRQ(ierr); PetscValidIntPointer(affinities,2); ierr = PetscMemcpy(affinities,tcomm->affinities,tcomm->nworkThreads*sizeof(PetscInt));CHKERRQ(ierr); PetscFunctionReturn(0); }
#undef __FUNCT__ #define __FUNCT__ "PetscThreadCommSetType" /* PetscThreadCommSetType - Sets the threading model for the thread communicator
Logically collective
tcomm | - the thread communicator | |
type | - the type of thread model needed |
Available types See "petsc/include/petscthreadcomm.h" for available types
*/ PetscErrorCode PetscThreadCommSetType(PetscThreadComm tcomm,const PetscThreadCommType type) { PetscErrorCode ierr,(*r)(PetscThreadComm); char ttype[256]; PetscBool flg;
PetscFunctionBegin; PetscValidCharPointer(type,2); if(!PetscThreadCommRegisterAllCalled) { ierr = PetscThreadCommRegisterAll(PETSC_NULL);CHKERRQ(ierr);}
ierr = PetscOptionsBegin(PETSC_COMM_WORLD,PETSC_NULL,"Thread comm - setting threading model",PETSC_NULL);CHKERRQ(ierr); ierr = PetscOptionsList("-threadcomm_type","Thread communicator model","PetscThreadCommSetType",PetscThreadCommList,type,ttype,256,&flg);CHKERRQ(ierr); ierr = PetscOptionsEnd();CHKERRQ(ierr); if(!flg) { ierr = PetscStrcpy(ttype,type);CHKERRQ(ierr); } ierr = PetscFListFind(PetscThreadCommList,PETSC_COMM_WORLD,ttype,PETSC_TRUE,(void (**)(void)) &r);CHKERRQ(ierr); if (!r) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_UNKNOWN_TYPE,"Unable to find requested PetscThreadComm type %s",ttype); ierr = (*r)(tcomm);CHKERRQ(ierr);
PetscFunctionReturn(0); }
#undef __FUNCT__ #define __FUNCT__ "PetscThreadCommBarrier" /* PetscThreadCommBarrier - Apply a barrier on the thread communicator associated with the MPI communicator
Called by the main thread only.
May not be applicable to all types. */ PetscErrorCode PetscThreadCommBarrier(MPI_Comm comm) { PetscErrorCode ierr; PetscThreadComm tcomm=0;
PetscFunctionBegin; ierr = PetscCommGetThreadComm(comm,&tcomm);CHKERRQ(ierr); if(tcomm->ops->barrier) { (*tcomm->ops->barrier)(tcomm); } PetscFunctionReturn(0); }
#undef __FUNCT__ #define __FUNCT__ "PetscThreadCommRegisterDestroy" /*@C PetscThreadCommRegisterDestroy - Frees the list of thread communicator models that were registered by PetscThreadCommRegisterDynamic().
Not Collective
Level:developer
Location:src/sys/threadcomm/threadcomm.c
Index of all PetscThreadComm routines
Table of Contents for all manual pages
Index of all manual pages