Esempio n. 1
0
File: mpi.go Progetto: 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
}
Esempio n. 2
0
File: mpi.go Progetto: 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)
	}
}
Esempio n. 3
0
File: mpi.go Progetto: 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)
	}
}
Esempio 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)
}
Esempio 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)
}
Esempio 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)
}