本文整理汇总了Golang中C.MPI_Comm函数的典型用法代码示例。如果您正苦于以下问题:Golang MPI_Comm函数的具体用法?Golang MPI_Comm怎么用?Golang MPI_Comm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MPI_Comm函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Comm_compare
//Comm_compare
//Compares two communicators.
func Comm_compare(comm1 Comm, comm2 Comm) (int, int) {
var result C.int
err := C.MPI_Comm_compare(C.MPI_Comm(comm1), C.MPI_Comm(comm2), &result)
return int(result), int(err)
}
示例2: Intercomm_create
//Intercomm_create
//Creates an intercommunicator from two intracommunicators.
func Intercomm_create(localComm Comm, localLeader int, peerComm Comm,
remoteLeader int, tag int) (Comm, int) {
var cNewInterComm C.MPI_Comm
err := C.MPI_Intercomm_create(C.MPI_Comm(localComm),
C.int(localLeader),
C.MPI_Comm(peerComm),
C.int(remoteLeader),
C.int(tag),
&cNewInterComm)
return Comm(cNewInterComm), int(err)
}
示例3: Comm_split
//Comm_split
//Creates new communicators based on colors and keys.
func Comm_split(comm Comm, color, key int) (Comm, int) {
var newComm C.MPI_Comm
err := C.MPI_Comm_split(C.MPI_Comm(comm), C.int(color), C.int(key), &newComm)
return Comm(newComm), int(err)
}
示例4: Comm_rank
//Comm_rank
//Determines the rank of the calling process in the communicator.
func Comm_rank(comm Comm) (int, int) {
var rank C.int
err := C.MPI_Comm_rank(C.MPI_Comm(comm), &rank)
return int(rank), int(err)
}
示例5: Comm_create
//Comm_create
//Creates a new communicator.
func Comm_create(comm Comm, group Group) (Comm, int) {
var newComm C.MPI_Comm
err := C.MPI_Comm_create(C.MPI_Comm(comm), C.MPI_Group(group), &newComm)
return Comm(newComm), int(err)
}
示例6: Barrier
// Barrier calls MPI_Barrier
func Barrier(comm Comm) error {
perr := C.MPI_Barrier(C.MPI_Comm(comm))
if perr != 0 {
return errors.New("Error calling Barrier")
}
return nil
}
示例7: Gatherv
//Gatherv
//Gathers into specified locations from all processes in a group
func Gatherv(sendBuffer interface{},
sendCount int,
sendType Datatype,
recvBuffer interface{},
recvCount []int,
displacements []int,
recvType Datatype,
rootRank int,
comm Comm) int {
sendBufferVoidPointer := Get_void_ptr(sendBuffer)
recvBufferVoidPointer := Get_void_ptr(recvBuffer)
err := C.MPI_Gatherv(sendBufferVoidPointer,
C.int(sendCount),
C.MPI_Datatype(sendType),
recvBufferVoidPointer,
(*C.int)(unsafe.Pointer(&recvCount[0])),
(*C.int)(unsafe.Pointer(&displacements[0])),
C.MPI_Datatype(recvType),
C.int(rootRank),
C.MPI_Comm(comm))
return int(err)
}
示例8: Cart_get
func Cart_get(comm Comm, maxDims int) ([]int, []bool, []int, int) {
cDims := make([]C.int, maxDims)
cPeriods := make([]C.int, maxDims)
cCoords := make([]C.int, maxDims)
arrayOfDims := make([]int, maxDims)
arrayOfPeriods := make([]bool, maxDims)
arrayOfCoords := make([]int, maxDims)
err := C.MPI_Cart_get(C.MPI_Comm(comm),
C.int(maxDims),
&cDims[0],
&cPeriods[0],
&cCoords[0])
for i := 0; i < maxDims; i++ {
arrayOfDims[i] = int(cDims[i])
if int(cPeriods[i]) == 0 {
arrayOfPeriods[i] = false
} else {
arrayOfPeriods[i] = true
}
arrayOfCoords[i] = int(cCoords[i])
}
return arrayOfDims, arrayOfPeriods, arrayOfCoords, int(err)
}
示例9: Comm_get_errhandler
//Comm_get_errhandler
//Get the error handler attached to a communicator
func Comm_get_errhandler(comm Comm) (Errhandler, int) {
var errhandler C.MPI_Errhandler
err := C.MPI_Comm_get_errhandler(C.MPI_Comm(comm), &errhandler)
return Errhandler(errhandler), int(err)
}
示例10: Cart_create
//Cart_create
//Makes a new communicator to which Cartesian topology information has been attached.
func Cart_create(oldComm Comm, dims []int, periods []bool, reorder int) (Comm, int) {
ndims := len(dims)
cDims := make([]C.int, ndims)
cPeriods := make([]C.int, ndims)
for i := 0; i < ndims; i++ {
cDims[i] = C.int(dims[i])
if periods[i] {
cPeriods[i] = C.int(1)
} else {
cPeriods[i] = C.int(0)
}
}
var cCommCart C.MPI_Comm
err := C.MPI_Cart_create(C.MPI_Comm(oldComm),
C.int(ndims),
&cDims[0],
&cPeriods[0],
C.int(reorder),
&cCommCart)
return Comm(cCommCart), int(err)
}
示例11: Abort
// Abort calls MPI_Abort
func Abort(comm Comm, err int) error {
perr := C.MPI_Abort(C.MPI_Comm(comm), C.int(err))
if perr != 0 {
return errors.New("Error aborting!?!!")
}
return nil
}
示例12: Graph_create
//Graph_create
//Makes a new communicator to which topology information has been attached.
func Graph_create(oldComm Comm, nnodes int, index []int, edges []int, reorder int) (Comm, int) {
cSizeOfIndex := len(index)
cSizeOfEdges := len(edges)
cIndex := make([]C.int, cSizeOfIndex)
cEdges := make([]C.int, cSizeOfEdges)
for i := 0; i < cSizeOfIndex; i++ {
cIndex[i] = C.int(index[i])
}
for i := 0; i < cSizeOfEdges; i++ {
cEdges[i] = C.int(edges[i])
}
var cCommGraph C.MPI_Comm
err := C.MPI_Graph_create(C.MPI_Comm(oldComm),
C.int(nnodes),
&cIndex[0],
&cEdges[0],
C.int(reorder),
&cCommGraph)
return Comm(cCommGraph), int(err)
}
示例13: Alltoallv
//Alltoallv
//All processes send different amount of data to,
//and receive different amount of data from, all processes
func Alltoallv(sendBuffer interface{},
sendCounts []int,
sendDisplacements []int,
sendType Datatype,
recvBuffer interface{},
recvCounts []int,
recvDisplacements []int,
recvType Datatype,
comm Comm) int {
sendBufferVoidPointer := Get_void_ptr(sendBuffer)
recvBufferVoidPointer := Get_void_ptr(recvBuffer)
err := C.MPI_Alltoallv(sendBufferVoidPointer,
(*C.int)(unsafe.Pointer(&sendCounts[0])),
(*C.int)(unsafe.Pointer(&sendDisplacements[0])),
C.MPI_Datatype(sendType),
recvBufferVoidPointer,
(*C.int)(unsafe.Pointer(&recvCounts[0])),
(*C.int)(unsafe.Pointer(&recvDisplacements[0])),
C.MPI_Datatype(recvType),
C.MPI_Comm(comm))
return int(err)
}
示例14: Comm_remote_size
//Comm_remote_size
//Determines the size of the remote group associated with an inter-communictor
func Comm_remote_size(comm Comm) (int, int) {
var size C.int
err := C.MPI_Comm_remote_size(C.MPI_Comm(comm), &size)
return int(size), int(err)
}
示例15: Graph_map
//Graph_map
//Maps process to graph topology information.
func Graph_map(comm Comm, nnodes int, index []int, edges []int) (int, int) {
cSizeOfIndex := len(index)
cSizeOfEdges := len(edges)
cIndex := make([]C.int, cSizeOfIndex)
cEdges := make([]C.int, cSizeOfEdges)
for i := 0; i < cSizeOfIndex; i++ {
cIndex[i] = C.int(index[i])
}
for i := 0; i < cSizeOfEdges; i++ {
cEdges[i] = C.int(edges[i])
}
var cNewRank C.int
err := C.MPI_Graph_map(C.MPI_Comm(comm),
C.int(nnodes),
&cIndex[0],
&cEdges[0],
&cNewRank)
return int(cNewRank), int(err)
}