Documentation
¶
Index ¶
- Constants
- Variables
- func AddExternalMountsForDump(next types.Dump) types.Dump
- func AddMountsForRestore(next types.Restore) types.Restore
- func Attach(gpus Manager) types.Adapter[types.Run]
- func Dump(gpus Manager) types.Adapter[types.Dump]
- func EnsureLogDir(id string, uid, gid uint32) (string, error)
- func Freeze(gpus Manager) types.Adapter[types.Freeze]
- func InheritFilesForRestore(next types.Restore) types.Restore
- func Interception(next types.Run) types.Run
- func InterceptionRestore(next types.Restore) types.Restore
- func ProcessInterception(next types.Run) types.Run
- func ProcessTracing(next types.Run) types.Run
- func Restore(gpus Manager) types.Adapter[types.Restore]
- func Tracing(next types.Run) types.Run
- func TracingRestore(next types.Restore) types.Restore
- func Unfreeze(gpus Manager) types.Adapter[types.Freeze]
- type Manager
- type ManagerMissing
- func (ManagerMissing) Attach(ctx context.Context, pid <-chan uint32) (string, error)
- func (ManagerMissing) CRIUCallback(id string) *criu.NotifyCallback
- func (ManagerMissing) Checks() types.Checks
- func (ManagerMissing) Detach(ctx context.Context, pid uint32) error
- func (ManagerMissing) Freeze(ctx context.Context, pid uint32) error
- func (ManagerMissing) GetID(pid uint32) string
- func (ManagerMissing) IsAttached(pid uint32) bool
- func (ManagerMissing) Sync(ctx context.Context) error
- func (ManagerMissing) Unfreeze(ctx context.Context, pid uint32) error
- type ManagerPool
- type ManagerSimple
- func (m *ManagerSimple) Attach(ctx context.Context, pid <-chan uint32) (id string, err error)
- func (m *ManagerSimple) CRIUCallback(id string) *criu.NotifyCallback
- func (m *ManagerSimple) Checks() types.Checks
- func (m *ManagerSimple) Detach(ctx context.Context, pid uint32) error
- func (m *ManagerSimple) Freeze(ctx context.Context, pid uint32) error
- func (m *ManagerSimple) GetID(pid uint32) string
- func (m *ManagerSimple) IsAttached(pid uint32) bool
- func (m *ManagerSimple) Sync(ctx context.Context) error
- func (m *ManagerSimple) Unfreeze(ctx context.Context, pid uint32) error
Constants ¶
const ( CONTROLLER_PROCESS_NAME = "cedana-gpu-controller" CONTROLLER_ADDRESS_FORMATTER = "unix://%s/cedana-gpu-controller-%s.sock" CONTROLLER_SOCKET_FORMATTER = "%s/cedana-gpu-controller-%s.sock" CONTROLLER_SOCKET_PATTERN = "cedana-gpu-controller-(.*).sock" CONTROLLER_SHM_FILE_FORMATTER = "/dev/shm/cedana-gpu.%s" CONTROLLER_SHM_FILE_PATTERN = "/dev/shm/cedana-gpu.(.*)" CONTROLLER_HOSTMEM_FILE_FORMATTER = "/dev/shm/cedana-gpu.%s.misc/hostmem-%d" CONTROLLER_HOSTMEM_FILE_PATTERN = "/dev/shm/cedana-gpu.(.*).misc/hostmem-(\\d+)" CONTROLLER_MISC_DIR_FORMATTER = "/dev/shm/cedana-gpu.%s.misc" CONTROLLER_BOOKING_LOCK_FILE_FORMATTER = "/dev/shm/cedana-gpu.%s.booking" CONTROLLER_TERMINATE_SIGNAL = syscall.SIGTERM CONTROLLER_RESTORE_NEW_PID_SIGNAL = syscall.SIGUSR1 // Signal to the restored process to notify it has a new PID CONTROLLER_CHECK_SHM_SIZE = 32 * utils.MEBIBYTE // Small size to run controller health check LOG_DIR_FORMATTER = "%s/cedana-gpu.%s" LOG_DIR_PATTERN = "(.*)/cedana-gpu.(.*)" INTERCEPTOR_LOG_FILE_PATTERN = LOG_DIR_PATTERN + "/cedana-so-(\\d+).log" INTERCEPTOR_LOG_FILE_FORMATTER = LOG_DIR_FORMATTER + "/cedana-so-%d.log" TRACER_LOG_FILE_PATTERN = LOG_DIR_PATTERN + "/cedana-tracer-(\\d+).log" TRACER_LOG_FILE_FORMATTER = LOG_DIR_FORMATTER + "/cedana-tracer-%d.log" FREEZE_TIMEOUT = 1 * time.Minute UNFREEZE_TIMEOUT = 1 * time.Minute DUMP_TIMEOUT = 10 * time.Minute RESTORE_TIMEOUT = 10 * time.Minute HEALTH_TIMEOUT = 30 * time.Second INFO_TIMEOUT = 30 * time.Second TERMINATE_TIMEOUT = 10 * time.Second MAX_SYNC_FAILURES = 2 )
const ( CONTROLLER_STALE controllerStatus = iota CONTROLLER_FREE CONTROLLER_BUSY )
const ( SYNC_INTERVAL = 10 * time.Second SYNC_SHUTDOWN_TIMEOUT = 45 * time.Second )
Variables ¶
var NVIDIA_MOUNTS_PATTERN = regexp.MustCompile(
`^(` +
`/nvidia|` +
`/dev/nvidia\d+|` +
`/driver/nvidia/gpus|` +
`/run/nvidia|` +
`/usr/bin/nv|` +
`/usr/lib/firmware/nv|` +
`/usr/lib(64)?/(x86_64-linux-gnu/|aarch64-linux-gnu/)?(libcuda|libnv)|` +
`.*nvidia.*|` +
`/etc/vulkan` +
`)`,
)
NOTE: Add any other known NVIDIA GPU mount paths here.
Functions ¶
func AddExternalMountsForDump ¶ added in v0.9.292
Adapter that tells CRIU about the external GPU mounts.
func AddMountsForRestore ¶ added in v0.9.285
Adapter that tells CRIU about the external GPU mounts.
func Interception ¶
Adapter that adds GPU interception to the request based on the job type. Each plugin must implement its own support for GPU interception.
func InterceptionRestore ¶ added in v0.9.268
Adapter that restore GPU interception to the request based on the job type. Each plugin must implement its own support for restoring GPU interception.
func ProcessInterception ¶
Adapter that adds GPU interception to a process
func ProcessTracing ¶ added in v0.9.268
Adapter that adds GPU tracing to a process
func Tracing ¶ added in v0.9.268
Adapter that adds GPU tracing to the request based on the job type. Each plugin must implement its own support for GPU tracing.
func TracingRestore ¶ added in v0.9.268
Adapter that restores GPU tracing to the request based on the job type. Each plugin must implement its own support for restoring GPU tracing.
Types ¶
type Manager ¶
type Manager interface {
// Attach attaches a GPU controller to a process with the given PID.
// Takes in a channel for the PID, allowing this to be called before the process is started,
// so that the PID can be passed in later. Returns a unique ID for the GPU controller.
Attach(ctx context.Context, pid <-chan uint32) (string, error)
// IsAttached returns true if GPU is attached to a process with the given PID.
IsAttached(pid uint32) bool
// Detach detaches the GPU controller from a process with the given and PID.
Detach(ctx context.Context, pid uint32) error
// Returns server-compatible health checks.
Checks() types.Checks
// GetID returns the ID of the GPU controller for a given PID.
GetID(pid uint32) string
// Freeze the GPU for a given PID
Freeze(ctx context.Context, pid uint32) error
// Unfreeze the GPU for a given PID
Unfreeze(ctx context.Context, pid uint32) error
// CRIUCallback returns the CRIU notify callback for GPU checkpoint/restore.
CRIUCallback(id string) *criu.NotifyCallback
// Sync is used to force the GPU manager to sync its state with the current system state.
Sync(ctx context.Context) error
}
type ManagerMissing ¶
type ManagerMissing struct{}
Embed this into unimplmented implmentations
func (ManagerMissing) CRIUCallback ¶
func (ManagerMissing) CRIUCallback(id string) *criu.NotifyCallback
func (ManagerMissing) Checks ¶
func (ManagerMissing) Checks() types.Checks
func (ManagerMissing) Freeze ¶ added in v0.9.263
func (ManagerMissing) Freeze(ctx context.Context, pid uint32) error
func (ManagerMissing) GetID ¶
func (ManagerMissing) GetID(pid uint32) string
func (ManagerMissing) IsAttached ¶
func (ManagerMissing) IsAttached(pid uint32) bool
type ManagerPool ¶
type ManagerPool struct {
*ManagerSimple // Embed simple manager implements most of what we need
// contains filtered or unexported fields
}
Implements a GPU manager pool that is capable of maintaining a pool of GPU controllers
func NewPoolManager ¶
type ManagerSimple ¶
type ManagerSimple struct {
// contains filtered or unexported fields
}
Implements a simple GPU manager that spawns GPU controllers on-demand
func NewSimpleManager ¶
func (*ManagerSimple) CRIUCallback ¶
func (m *ManagerSimple) CRIUCallback(id string) *criu.NotifyCallback
func (*ManagerSimple) Checks ¶
func (m *ManagerSimple) Checks() types.Checks
func (*ManagerSimple) Detach ¶
func (m *ManagerSimple) Detach(ctx context.Context, pid uint32) error
func (*ManagerSimple) Freeze ¶ added in v0.9.263
func (m *ManagerSimple) Freeze(ctx context.Context, pid uint32) error
func (*ManagerSimple) GetID ¶
func (m *ManagerSimple) GetID(pid uint32) string
func (*ManagerSimple) IsAttached ¶
func (m *ManagerSimple) IsAttached(pid uint32) bool