Class Job

Class Documentation

class switchml::Job

A Job is used to represent work to be done by SwitchML.

It is created by the Context when an operation is requested, submitted to the Scheduler, then the scheduler creates instances of JobSlice from it to give it to the worker threads.

Public Functions

Job(Tensor tensor, JobType job_type, ExtraJobInfo extra_job_info)

Construct a new Job object.

Parameters
  • tensor[in] The tensor to work on for this job.

  • job_type[in] The type of the job.

  • extra_job_info[in] Extra information that might be needed for the job.

~Job() = default
Job(Job const&) = delete
void operator=(Job const&) = delete
Job(Job&&) = default
Job &operator=(Job&&) = default
void WaitToComplete()

Block the calling thread until the job completes or fails.

JobStatus GetJobStatus()

Get the job’s status.

Returns

JobStatus

void SetJobStatus(JobStatus job_status)

Update the job’s status and notify waiting threads if needed.

This function must only be called by the scheduler or the context. JobStatus must progress in an increasing order.

Parameters

job_status[in] the new job_status

Public Members

const JobId id_

Unique identifier for the job.

const Tensor tensor_

Tensor to perform the collective communication job on.

const JobType job_type_

The type of collective communication that the job will do.

const ExtraJobInfo extra_job_info_

Extra information specific to the collective communication job.