scheduling using real slots number

This commit is contained in:
Rongsong Shen 2025-12-30 18:13:15 +08:00
parent 8db4458375
commit 780e9fb313
22 changed files with 980 additions and 105 deletions

View file

@ -35,7 +35,7 @@ typedef int (*plugin_begin_session_fn_t)(void*);
typedef int (*plugin_end_session_fn_t)(void*);
/* allocation function of job */
typedef xce_job_alloc_t* (*plugin_job_allocate_fn_t)(void*, int64_t,
typedef xce_job_alloc_t* (*plugin_job_allocate_fn_t)(void*, int64_t, resreq_t*,
xce_pendreason_t**);
typedef struct {

View file

@ -10,14 +10,36 @@
#include "xce/types.h"
#include "zarray.h"
/* FIXME: improve later */
typedef void* host_selection_t;
typedef enum {
RESREQ_OP_SIMPLE
= 0, /* simple just a list of resources and require values */
RESREQ_OP_AFFINITY, /* with affinity allocation */
RESREQ_OP_GPU, /* with GPU allocation */
RESREQ_OP_PARALL, /* parall job nhosts, ptile and other constraints */
RESREQ_OP_AND, /* success for all */
RESREQ_OP_OR /* success for any */
} resreq_op_t;
/* simple resource allocation just have numeric resource values */
typedef struct {
host_selection_t* select;
int nres;
uint32_t* resources;
float* amount;
} rank_req_t;
host_selection_t* selection;
int nres_shared;
int* idxs_shared;
float* vals_shared;
int nres_host;
int* idxs_host;
float* vals_host;
} resreq_simple_t;
typedef struct {
resreq_op_t op;
union {
resreq_simple_t simple;
} u;
} resreq_t;
typedef struct {
char* name;
@ -48,10 +70,11 @@ typedef struct {
xce_sched_queue_t* queue;
xce_sched_user_t* user;
xce_sched_project_t* project;
void* allocator;
resreq_t* resreq;
uint32_t mintasks;
uint32_t maxtasks;
xce_job_alloc_t* allocs;
xce_job_account_t* accounts;
} xce_sched_job_t;
typedef struct {

View file

@ -52,11 +52,17 @@ typedef struct {
mylock_t lock;
int stop;
xcecli_ctx_t apictx;
uint64_t nextid;
xce_conf4sched_t* config;
kvmgr_t plugins;
void* simple_allocator;
void* affinity_allocator;
void* gpu_allocator;
void* parallel_allocator;
dataq_t* pend_updates[2];
resmgr_t resmgr;
zarray_t sharedInst;
zarray_t sharedInUse;
kvmgr_t jobs;
kvmgr_t queues;
kvmgr_t workers;
@ -92,5 +98,17 @@ extern int sched_queue_is_ready(xce_sched_queue_t*);
extern int sched_commit_decision(xce_scheduler_t*, xce_decision_t*);
extern int sched_publish_pend_reason(xce_scheduler_t*, xce_preason_set_t*);
extern int sched_publish_dispatch(xce_scheduler_t*, xce_job_dispatch_t*);
extern int sched_meet_host_selection(xce_scheduler_t*, xce_sched_worker_t*,
host_selection_t*);
extern int sched_check_shared_satisfy(xce_scheduler_t*, int, int*, float*, int*,
int*, float*);
extern int sched_check_host_satisfy(xce_scheduler_t*, xce_sched_worker_t*, int,
int*, float*, int*, int*, float*);
extern int sched_collect_workers(xce_scheduler_t*, xlist_t*,
zarray_iter_skip_fn_t);
extern int sched_commit_job_alloc(xce_scheduler_t*, xce_sched_job_t*);
extern uint64_t sched_get_id(xce_scheduler_t*);
extern xce_alloc_t** sched_make_allocs(xce_scheduler_t*, char*, int, int*,
float*, int*);
#endif