示例#1
0
文件: mpi.go 项目: rwl/mpi
func Allreduce_float64(sendbuf, recvbuf []float64, op C.MPI_Op, comm C.MPI_Comm) {

	// mpi communication call
	err := C.MPI_Allreduce(
		unsafe.Pointer(&sendbuf[0]), unsafe.Pointer(&recvbuf[0]),
		C.int(len(sendbuf)), FLOAT64, op, comm)

	if err != 0 {
		log.Fatal(err)
	}
}
示例#2
0
文件: comm.go 项目: jmptrader/go-mpi
//Allreduce
//Combines values from all processes and distributes the result back to all processes.
func Allreduce(sendBuffer interface{},
	recvBuffer interface{},
	count int,
	dataType Datatype,
	op Op,
	comm Comm) int {

	sendBufferVoidPointer := Get_void_ptr(sendBuffer)
	recvBufferVoidPointer := Get_void_ptr(recvBuffer)

	err := C.MPI_Allreduce(sendBufferVoidPointer,
		recvBufferVoidPointer,
		C.int(count),
		C.MPI_Datatype(dataType),
		C.MPI_Op(op),
		C.MPI_Comm(comm))

	return int(err)
}
示例#3
0
文件: mpi.go 项目: npadmana/mpi
// AllReduceInt64 : MPI_Allreduce for int64
func AllReduceInt64(comm Comm, in, out *int64, n int, op Op) {
	C.MPI_Allreduce(unsafe.Pointer(in), unsafe.Pointer(out), C.int(n), MPI_i64, SUM, comm)
}
示例#4
0
文件: mpi.go 项目: npadmana/npgo
// AllReduceInt64 : MPI_Allreduce for int64
func AllReduceInt64(comm Comm, in, out *int64, n int, op Op) {
	C.MPI_Allreduce(unsafe.Pointer(in), unsafe.Pointer(out), C.int(n), C.MPI_Datatype(MPI_i64), C.MPI_Op(SUM), C.MPI_Comm(comm))
}