mpi

package
v0.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2023 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SelfRank                   uint64
	DispatcherToWorkerTCPConn  []*net.Conn
	WorkerToDispatcherTCPConn  *net.Conn
	DispatcherToWorkerListener []*net.Listener
	WorkerOutputs              []bytes.Buffer
	WorkerOutputsErr           []bytes.Buffer
	BytesSent                  uint64
	BytesReceived              uint64
	WorldSize                  uint64
)

Functions

func Close

func Close()

func GetHash

func GetHash(str string)

func GetLocalIP

func GetLocalIP() ([]string, error)

func ReceiveBytes

func ReceiveBytes(size uint64, rank uint64) ([]byte, error)

If Dispatcher calls this function, rank is required, it will receive from rank-th worker If Worker calls this function, rank is not required, it will receive from Dispatcher

func SendBytes

func SendBytes(buf []byte, rank uint64) error

If Dispatcher calls this function, rank is required If Worker calls this function, rank is not required, it will send to Dispatcher

func SerializeWorld

func SerializeWorld(world *MPIWorld) []byte

func SetIPPoolFromFile added in v0.3.6

func SetIPPoolFromFile(filePath string, world *MPIWorld) error

func SetIPPoolFromKubernetes added in v0.3.6

func SetIPPoolFromKubernetes(world *MPIWorld) error

SetIPPoolFromKubernetes dynamically constructs the pool of IP addresses for the MPI world by querying the Kubernetes cluster for pods that match specific criteria. It utilizes the in-cluster configuration to create a clientset, which is then used to access the Kubernetes API and list pods based on a specified label selector. This function iterates over the list of worker pods, extracting their IP addresses and adding them to the world's IPPool. It is designed to run from within a pod inside a Kubernetes cluster. The function assumes that the pod has the necessary permissions to list pods in the Kubernetes API.

Parameters:

world - A pointer to the MPIWorld structure where the pool of IP addresses
        will be stored.

Returns:

error - Any error encountered while setting up the IPPool from Kubernetes.
        Returns nil if the operation is successful.

Example Usage:

var myWorld MPIWorld
err := SetIPPoolFromKubernetes(&myWorld)
if err != nil {
    // handle error
}

Types

type MPIWorld

type MPIWorld struct {
	IPPool []string
	Port   []uint64
	// contains filtered or unexported fields
}

func DeserializeWorld

func DeserializeWorld(buf []byte) *MPIWorld

func WorldInit

func WorldInit(IPfilePath, SSHKeyFilePath, SSHUserName string) *MPIWorld

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL