Exemplo n.º 1
0
Arquivo: mpi.go Projeto: adk9/go-mpi
func Send(buf interface{}, count int, datatype MPI_Datatype, dest int,
	tag int, comm MPI_Comm) int {
	switch ptr := buf.(type) {
	case *int:
		ret := C.MPI_Send(unsafe.Pointer(ptr), C.int(count), datatype,
			C.int(dest), C.int(tag), comm)
		return int(ret)
	}
	return 0
}
Exemplo n.º 2
0
Arquivo: mpi.go Projeto: rwl/mpi
func Send_float64(sendbuf []float64, dest, tag int, comm C.MPI_Comm) {

	err := C.MPI_Send(
		unsafe.Pointer(&sendbuf[0]), C.int(len(sendbuf)), FLOAT64,
		C.int(dest), C.int(tag), comm)

	if err != 0 {
		log.Fatal(err)
	}
}
Exemplo n.º 3
0
Arquivo: mpi.go Projeto: rwl/mpi
func Send_int32(sendbuf []int32, dest, tag int, comm C.MPI_Comm) {

	err := C.MPI_Send(
		unsafe.Pointer(&sendbuf[0]), C.int(len(sendbuf)), INT32,
		C.int(dest), C.int(tag), comm)

	if err != 0 {
		log.Fatal(err)
	}
}
Exemplo n.º 4
0
//Send
//Performs a standard-mode blocking send.
func Send(buffer interface{},
	count int,
	dataType Datatype,
	dest int,
	tag int,
	comm Comm) int {

	bufferVoidPointer := Get_void_ptr(buffer)

	err := C.MPI_Send(bufferVoidPointer,
		C.int(count),
		C.MPI_Datatype(dataType),
		C.int(dest),
		C.int(tag),
		C.MPI_Comm(comm))

	return int(err)
}
Exemplo n.º 5
0
func SendFloat32(data []float32, dest, tag int) int {
	// sizeof(MPI_FLOAT) == 4
	ret := C.MPI_Send(unsafe.Pointer(&data[0]), C.int(len(data)), MPI_FLOAT, C.int(dest), C.int(tag),
		COMM_WORLD)
	return int(ret)
}
Exemplo n.º 6
0
func SendInt32(data []int32, dest, tag int) int {
	// sizeof(MPI_INTEGER) == 4
	ret := C.MPI_Send(unsafe.Pointer(&data[0]), C.int(len(data)), MPI_INTEGER, C.int(dest), C.int(tag),
		COMM_WORLD)
	return int(ret)
}