Skip to content

Commit

Permalink
Scheduler Release 0.9.9 (#38)
Browse files Browse the repository at this point in the history
* Test Cases added

* Check for mode 1 & 2 fir errors

* HTML Result Fix

* Bug in Dispatch Kernel

* AEAP Advanced Fix

* Error checks added for all modes and mode 99 to run all scheduler mode added

* Debug msg reorg

* Develop local (#36)

* Mode 1 Clean Up

* Mode 2 Clean Up

* Mode 2 Cleanup and removal of redundant code

* Mode 1-3 cleanup

* Mode 3 cleanup and redundant code removal

* Mode 3 cleanup

* Dispatch Jobs Fix

* Mode 3 Fix and cleanup

* Mode 4 Cleanup and partial fix

* Mode 3 Fix for AEAP condition 1 & 2 schedule

* Mode 4 AEAP refactor

* Mode 4 AEAP Fixed

* Mode 4 - ALAP Advance fixed

* Mode 4 AEAP Advanced changes

* Removed Debug statement

* TestScript Update

* Editorial Changes

* Mode 3 - Processor Retrival Print Fix

* Mode 4 Changes and bug find

* Mode 5 File name change

* Mode 4 - ALAP Advanced bug fix

* Mode 4 - intermediate working code

* Editorail Changes and use of preScheduleList for AEAP ADV

* Mode 4 - AEAP Advanced

* Mode 4 - AEAP Advanced

* Condition 6 A,B,c, & D implemented

* Expanded the test cases

* Test Cases Expanded

* Mode 4 - AEAP Condition 7 Added

* Removed unused functions

* Mode 4 cleanup - AEAP Advanced - removed condition 6b, remaned ALAP schedule function and added process requested to preScheduled Jobs

* Ascending Insert for Pre Scheduled Jobs Implemented

* Dispatch Jobs - Error Check added

* Mode 4 - working AEAP Adv and ALAP Adv

* Mode 4 Working code

* Mode 5 - ALAP Function fix

* Mode 5 - processors unavailable fix

* Mode 3 book keeper fix

* Mode 5 synced to mode 4

* Fail Case check added

* Removed unused variables

* AEAP_ADV cleanup

* Editorial Changes

* ALAP Improve added to mode 5

* Jobs sent back to CPU - wordings change

* removed unused functions

* Added Test Cases: Check errors

* Removed TBD

* Version 0.9.9 (#37)

* Mode 1 Clean Up

* Mode 2 Clean Up

* Mode 2 Cleanup and removal of redundant code

* Mode 1-3 cleanup

* Mode 3 cleanup and redundant code removal

* Mode 3 cleanup

* Dispatch Jobs Fix

* Mode 3 Fix and cleanup

* Mode 4 Cleanup and partial fix

* Mode 3 Fix for AEAP condition 1 & 2 schedule

* Mode 4 AEAP refactor

* Mode 4 AEAP Fixed

* Mode 4 - ALAP Advance fixed

* Mode 4 AEAP Advanced changes

* Removed Debug statement

* TestScript Update

* Editorial Changes

* Mode 3 - Processor Retrival Print Fix

* Mode 4 Changes and bug find

* Mode 5 File name change

* Mode 4 - ALAP Advanced bug fix

* Mode 4 - intermediate working code

* Editorail Changes and use of preScheduleList for AEAP ADV

* Mode 4 - AEAP Advanced

* Mode 4 - AEAP Advanced

* Condition 6 A,B,c, & D implemented

* Expanded the test cases

* Test Cases Expanded

* Mode 4 - AEAP Condition 7 Added

* Removed unused functions

* Mode 4 cleanup - AEAP Advanced - removed condition 6b, remaned ALAP schedule function and added process requested to preScheduled Jobs

* Ascending Insert for Pre Scheduled Jobs Implemented

* Dispatch Jobs - Error Check added

* Mode 4 - working AEAP Adv and ALAP Adv

* Mode 4 Working code

* Mode 5 - ALAP Function fix

* Mode 5 - processors unavailable fix

* Mode 3 book keeper fix

* Mode 5 synced to mode 4

* Fail Case check added

* Removed unused variables

* AEAP_ADV cleanup

* Editorial Changes

* ALAP Improve added to mode 5

* Jobs sent back to CPU - wordings change

* removed unused functions

* Added Test Cases: Check errors

* Removed TBD

* Scheduler Version 0.9.9
  • Loading branch information
kiritigowda authored May 15, 2018
1 parent c00c34f commit 22aef6b
Show file tree
Hide file tree
Showing 22 changed files with 3,662 additions and 3,592 deletions.
2 changes: 1 addition & 1 deletion RTG-scheduler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ source/RTGS-mode_3.c
source/RTGS-mode_4.c
source/RTGS-mode_5.c
source/RTGS-queue_handler.c
source/RTGS_ALAP.c
source/RTGS-ALAP.c
source/RTGS-AEAP.c
source/RTGS-AEAP_ALAP_improve.c
source/RTGS-AEAP_ALT.c
Expand Down
194 changes: 99 additions & 95 deletions RTG-scheduler/include/RTGS.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
#include <stdbool.h>
#include <string.h>

#define MAX_GPU_PROCESSOR 14 // total streaming multi-processors available on the GPU
#define MAX_KERNELS 200 // max Kernels needed to be scheduled
#define MAX_GPU_PROCESSOR 14 // Total streaming multi-processors available on the GPU
#define MAX_JOBS 200 // Max jobs to be scheduled
#define PROCESSOR_LIMIT 10 // ALAP Processor Limit
#define MAX_RUN_TIME 1000 // MAX RUN TIME TO VERIFY
#define MAX_RUN_TIME 1000 // Max run time

#define MULTIPLE_KERNELS_SCHEDULED -99 // multiple kerenls scheduled at a given time
#define MULTIPLE_JOBS_SCHEDULED -99 // multiple jobs scheduled at a given time

// PROFILER_MODE:
// 0 - no profiling
Expand Down Expand Up @@ -70,7 +70,7 @@ typedef int RTGS_Status;
* \see rtgs_status.
*/
enum RTGS_status_e {
RTGS_ERROR_INVALID_PARAMETERS = -9, /*!< \brief Indicates that the supplied parameter information does not match the kernel_info_list. */
RTGS_ERROR_INVALID_PARAMETERS = -9, /*!< \brief Indicates that the supplied parameter information does not match the jobAttibutesList. */
RTGS_ERROR_NO_MEMORY = -8, /*!< \brief Indicates that an internal or implicit allocation failed. Typically catastrophic. */
RTGS_ERROR_NO_RESOURCES = -7, /*!< \brief Indicates that an internal or implicit resource can not be acquired (not memory). */
RTGS_ERROR_NOT_COMPATIBLE = -6, /*!< \brief Indicates that the attempt to link two parameters together failed due to type incompatibilty. */
Expand All @@ -88,136 +88,138 @@ enum RTGS_schedule_method_e {
RTGS_SCHEDULE_METHOD_IMMEDIATE = 0,
RTGS_SCHEDULE_METHOD_AEAP = 1,
RTGS_SCHEDULE_METHOD_ALAP = 2,
RTGS_SCHEDULE_METHOD_AEAP_ADVANCED = 3,
RTGS_SCHEDULE_METHOD_ALAP_ADVANCED = 4,
RTGS_SCHEDULE_METHOD_NOT_DEFINED = 99,
};

/* Kernel Info Structure */
struct kernel_information {
int processor_req; // processors needed
int execution_time; // execution time
int deadline; // deadline
/* Job Information Structure */
struct jobInformation {
int processor_req; // processors needed
int execution_time; // execution time
int deadline; // deadline
int latest_schedulable_time; // latest schedule time
int release_time; // latest schedule time
int release_time; // latest schedule time
float schedule_overhead; // scheduler Overhead
int data_send_time; // data for the job sent
int data_send_time; // data for the job sent
int scheduled_execution; // scheduled for GPU exec
int completion_time; // job completion time
int rescheduled_execution; // job rescheduled for gpu exe
int schedule_hardware; // job scheduled on 0: ERROR, 1: GPU, 2: CPU
};
//! \brief kernel_info_list info structure
typedef struct kernel_information kernelInfo;
//! \brief jobInformation structure
typedef struct jobInformation jobAttributes;


/* Kernel Info Structure */
struct kernel_release_time {
int release_time; // job release time
int num_kernel_released; // num jobs released
/* Job Release Info Structure */
struct jobReleaseTime {
int release_time; // job release time
int num_job_released; // num jobs released
};
//! \brief kernel_info_list info structure
typedef struct kernel_release_time kernelReleaseInfo;
//! \brief jobReleaseInfo structure
typedef struct jobReleaseTime jobReleaseInfo;

/* scheduled kernel linked list*/
struct linked_list {
int kernel_number;
int kernel_release_time;
/* scheduled Job Info jobBackupList*/
struct jobScheduleList {
int jobNumber;
int job_release_time;
int processor_release_time;
int processors_allocated;
int schedule_method;
int data;
struct linked_list* next;
struct linked_list* kernel_next;
struct jobScheduleList *next;
struct jobScheduleList *job_next;
};
//! \brief kernel scheduled info
typedef struct linked_list scheduledNode;
//! \brief Job scheduled info
typedef struct jobScheduleList scheduledResourceNode;

// Backup list to revert the processor actions
struct list {
int kernel_number;
// Backup jobBackupList to revert the processor actions
struct jobBackupList {
int jobNumber;
int data;
int processor_release_time;
int processors_allocated;
struct list* next;
int processors_requested;
struct jobBackupList *next;
};
//! \brief backup kernel scheduled info
typedef struct list backup_list;
//! \brief backup job scheduled info
typedef struct jobBackupList genericBackupNode;

// global variables
int GLOBAL_GPU_KERNELS;
int GLOBAL_CPU_KERNELS;
int GLOBAL_GPU_JOBS;
int GLOBAL_CPU_JOBS;
int GLOBAL_RELEASE_TIME[MAX_RUN_TIME];
backup_list* GLOBAL_ALAP_LIST;
genericBackupNode *GLOBAL_preScheduleList;

// debug message setup variable
int GLOBAL_RTGS_DEBUG_MSG; // debug mode information: 0 - TurnOff, 1 - Basic Debug Info, 2 - Detailed Debug Info, 3 - extended Debug Information

//! \brief RTG-scheduler main function
int scheduler_main(char *kernelFilename, char *releaseTimeFilename, int schedulerMode);
int scheduler_main(char *jobsListFileName, char *releaseTimeFilename, int schedulerMode);

//! \brief RTG-scheduler Mode-1 function
int RTGS_mode_1(char *kernelFilename, char *releaseTimeFilename);
int RTGS_mode_1(char *jobsListFileName, char *releaseTimeFilename);
//! \brief RTG-scheduler Mode-2 function
int RTGS_mode_2(char *kernelFilename, char *releaseTimeFilename);
int RTGS_mode_2(char *jobsListFileName, char *releaseTimeFilename);
//! \brief RTG-scheduler Mode-3 function
int RTGS_mode_3(char *kernelFilename, char *releaseTimeFilename);
int RTGS_mode_3(char *jobsListFileName, char *releaseTimeFilename);
//! \brief RTG-scheduler Mode-4 function
int RTGS_mode_4(char *kernelFilename, char *releaseTimeFilename);
int RTGS_mode_4(char *jobsListFileName, char *releaseTimeFilename);
//! \brief RTG-scheduler Mode-4 function
int RTGS_mode_5(char *kernelFilename, char *releaseTimeFilename);
int RTGS_mode_5(char *jobsListFileName, char *releaseTimeFilename);

//! \brief function to get kernel info from the input file
int get_kernel_information(kernelInfo *kernelInfoList, const char *kernelFilename);
//! \brief function to get job info from the input file
int get_job_information(jobAttributes *jobAttributesList, const char *jobsListFileName);

//! \brief function to get kernel release time info from the input file
int get_kernel_release_times(kernelReleaseInfo *releaseTimeInfo, const char *releaseTimeFilename);
//! \brief function to get job release time info from the input file
int get_job_release_times(jobReleaseInfo *releaseTimeInfo, const char *releaseTimeFilename);

//! \brief function to retrieve processors from kernels which complete thier execution
int Retrieve_processors(int present_time, int processors_available,
scheduledNode** processor_alloc_list);
int Retrieve_processors(int present_time, int processors_available, scheduledResourceNode **processorsAllocatedList);

//! \brief function to release kernels for exection at the scheduled time
int Dispatch_queued_kernels(int present_time, int processors_available,
scheduledNode** kernel_queue_list, scheduledNode **processor_alloc_list);
scheduledResourceNode **jobScheduledQueueList, scheduledResourceNode **processorsAllocatedList);

//! \brief Function to add future kernel_info_list releases and arrange kernel_info_list execution times in ascending order
void Queue_kernel_execution(int processorReleased, int processorReleaseTime, int presentTime,
int scheduleMethod, int kernelNumber, scheduledNode **processorAllocList);
//! \brief Function to add future jobAttibutesList releases and arrange jobAttibutesList execution times in ascending order
void queue_job_execution(int processorReleased, int processorReleaseTime, int presentTime,
int scheduleMethod, int kernelNumber, scheduledResourceNode **processorAllocList);

//! \brief Function to
int Kernel_book_keeper(kernelInfo* kernel_info_list, int kernel_number, int processors_available, int present_time,
scheduledNode **processor_alloc_list, scheduledNode **kernel_queue_list);
int Kernel_book_keeper(jobAttributes* jobAttibutesList, int jobNumber, int processors_available, int present_time,
scheduledResourceNode **processorsAllocatedList, scheduledResourceNode **jobScheduledQueueList);

//! \brief Function to
int Processors_unavailable(kernelInfo *kernel_info_list, int kernel_number, int present_time, int processors_available,
scheduledNode ** processor_alloc_list, scheduledNode **kernel_queue_list);
int Processors_unavailable(jobAttributes *jobAttibutesList, int jobNumber, int present_time, int processors_available,
scheduledResourceNode **processorsAllocatedList, scheduledResourceNode **jobScheduledQueueList);

//! \brief Function to
void Kernel_queue_handler(int processorReleased, int kernel_release_time, int processor_release_time,
int schedule_method, int kernel_number, scheduledNode **kernel_queue_list);
void job_queue_handler(int processorReleased, int job_release_time, int processor_release_time,
int schedule_method, int jobNumber, scheduledResourceNode **jobScheduledQueueList);

//! \brief Function to
int AEAP(kernelInfo *kernel_info_list, int kernel_number, int present_time, int processors_available,
scheduledNode ** processor_alloc_list, scheduledNode **kernel_queue_list);
int AEAP(jobAttributes *jobAttibutesList, int jobNumber, int present_time, int processors_available,
scheduledResourceNode **processorsAllocatedList, scheduledResourceNode **jobScheduledQueueList);

//! \brief Function to
int AEAP_ALAP_improve(kernelInfo *kernel_info_list, int kernel_release_time, int present_time, int processors_available,
scheduledNode ** processor_alloc_list, scheduledNode **kernel_queue_list);
int AEAP_ALAP_improve(jobAttributes *jobAttibutesList, int job_release_time, int present_time, int processors_available,
scheduledResourceNode **processorsAllocatedList, scheduledResourceNode **jobScheduledQueueList);

//! \brief Function to
int AEAP_advanced(kernelInfo *kernel_info_list, int kernel_number, int present_time, int processors_available,
scheduledNode ** processor_alloc_list, scheduledNode **kernel_queue_list);
int AEAP_advanced(jobAttributes *jobAttibutesList, int jobNumber, int present_time, int processors_available,
scheduledResourceNode **processorsAllocatedList, scheduledResourceNode **jobScheduledQueueList);

//! \brief Function to
int ALAP(kernelInfo *kernel_info_list, int kernel_number, int present_time, int processors_available,
scheduledNode ** processor_alloc_list, scheduledNode **kernel_queue_list);
int ALAP(jobAttributes *jobAttibutesList, int jobNumber, int present_time, int processors_available,
scheduledResourceNode **processorsAllocatedList, scheduledResourceNode **jobScheduledQueueList);

//! \brief Function to
int ALAP_advanced(kernelInfo *kernel_info_list, int kernel_number, int present_time, int processors_available,
scheduledNode ** processor_alloc_list, scheduledNode **kernel_queue_list);
int ALAP_advanced(jobAttributes *jobAttibutesList, int jobNumber, int present_time, int processors_available,
scheduledResourceNode **processorsAllocatedList, scheduledResourceNode **jobScheduledQueueList);

//! \brief Function to
int ALAP_improve(kernelInfo *kernel_info_list, int kernel_number, int present_time, int processors_available,
scheduledNode ** processor_alloc_list, scheduledNode **kernel_queue_list);
int ALAP_improve(jobAttributes *jobAttibutesList, int jobNumber, int present_time, int processors_available,
scheduledResourceNode **processorsAllocatedList, scheduledResourceNode **jobScheduledQueueList);

/***************************************************************
helper functions
Expand All @@ -229,27 +231,29 @@ int64_t RTGS_GetClockCounter();
int64_t RTGS_GetClockFrequency();

//! \brief Get ENV Variable
bool RTGS_GetEnvironmentVariable(const char * name, char * value, size_t valueSize);

//! \brief print summary
int RTGS_PrintScheduleSummary(int mode, int maxKernels, kernelInfo *kernelInfoList);

// list functions
scheduledNode* insert(scheduledNode* head, scheduledNode* data);
scheduledNode* ascending_insert(scheduledNode* head, int data, int processor_release_time,
int processorReleased, int kernel_number, int schedule_method);
scheduledNode* position_insert(scheduledNode* head, scheduledNode* data, int position);
scheduledNode* position_delete(scheduledNode* head, int position);
scheduledNode* reverse(scheduledNode* head);
scheduledNode* remove_recurring_node(scheduledNode* head);
scheduledNode* clean_node(scheduledNode* head);
backup_list* insert_list(backup_list* head, int data);
backup_list* clean_list(backup_list* head);
backup_list* position_delete_list(backup_list* head);
backup_list* insert_ALAP_list(backup_list* head, int kernel_release_time,
int processor_release_time, int processors_allocated, int kernel_number);
void print(scheduledNode* head);
void Kernel_queue_print(scheduledNode* head);
void R_print(scheduledNode* head);

#endif /* RTGS_H */
bool RTGS_GetEnvironmentVariable(const char *name, char *value, size_t valueSize);

//! \brief print_processorsAllocated_list summary
int RTGS_PrintScheduleSummary(int mode, int maxKernels, jobAttributes *jobAttributesList);

// jobBackupList functions
scheduledResourceNode *insert(scheduledResourceNode *head, scheduledResourceNode *data);
scheduledResourceNode *ascending_insert(scheduledResourceNode *head, int data, int processor_release_time,
int processorReleased, int jobNumber, int schedule_method);
scheduledResourceNode *position_insert(scheduledResourceNode *head, scheduledResourceNode *data, int position);
scheduledResourceNode *position_delete(scheduledResourceNode *head, int position);
scheduledResourceNode *remove_recurring_node(scheduledResourceNode *head);
genericBackupNode *insert_node(genericBackupNode *head, int data);
genericBackupNode *clean_list(genericBackupNode *head);
genericBackupNode *insert_preScheduledJob_list(genericBackupNode *head, int job_release_time,
int processor_release_time, int processors_allocated, int jobNumber);
genericBackupNode *position_insert_preScheduledJobs(genericBackupNode *head, genericBackupNode *positionInsertVariable, int position);
genericBackupNode *insert_preScheduledJobs(genericBackupNode *head, genericBackupNode *insertVariable);
genericBackupNode *ascending_insert_preScheduledJobs(genericBackupNode *head, int job_release_time, int processor_release_time,
int processors_allocated, int jobNumber);
genericBackupNode *position_delete_preScheduledJob(genericBackupNode *head, int position);
void print_processorsAllocated_list(scheduledResourceNode *head);
void print_preScheduledJob_list(scheduledResourceNode *head);
void print_preQueuedJob_list(genericBackupNode *head);

#endif /* RTGS_H */
27 changes: 20 additions & 7 deletions RTG-scheduler/source/RTG-scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,44 @@
/**********************************************************************************************************
Scheduler Main - Mode Selector
***********************************************************************************************************/
int scheduler_main(char *kernelFilename, char *releaseTimeFilename, int schedulerMode)
int scheduler_main(char *jobsListFileName, char *releaseTimeFilename, int schedulerMode)
{
PROFILER_START(SRTG, scheduler_main)
RTGS_Status status = RTGS_SUCCESS;
switch (schedulerMode) {
case 1:
status = RTGS_mode_1(kernelFilename, releaseTimeFilename);
status = RTGS_mode_1(jobsListFileName, releaseTimeFilename);
break;
case 2:
status = RTGS_mode_2(kernelFilename, releaseTimeFilename);
status = RTGS_mode_2(jobsListFileName, releaseTimeFilename);
break;
case 3:
status = RTGS_mode_3(kernelFilename, releaseTimeFilename);
status = RTGS_mode_3(jobsListFileName, releaseTimeFilename);
break;
case 4:
status = RTGS_mode_4(kernelFilename, releaseTimeFilename);
status = RTGS_mode_4(jobsListFileName, releaseTimeFilename);
break;
case 5:
status = RTGS_mode_5(kernelFilename, releaseTimeFilename);
status = RTGS_mode_5(jobsListFileName, releaseTimeFilename);
break;
case 99:
status = RTGS_mode_1(jobsListFileName, releaseTimeFilename);
printf("The Scheduler Mode 1 returned Status ->%d\n", status);
status = RTGS_mode_2(jobsListFileName, releaseTimeFilename);
printf("The Scheduler Mode 2 returned Status ->%d\n", status);
status = RTGS_mode_3(jobsListFileName, releaseTimeFilename);
printf("The Scheduler Mode 3 returned Status ->%d\n", status);
status = RTGS_mode_4(jobsListFileName, releaseTimeFilename);
printf("The Scheduler Mode 4 returned Status ->%d\n", status);
status = RTGS_mode_5(jobsListFileName, releaseTimeFilename);
printf("The Scheduler Mode 5 returned Status ->%d\n", status);
status = 0;
break;

default:
printf("\nMode Not Specified/Not implemented, switched to default mode\n");
printf("Mode 5:: AEAP/ALAP BP with APLAP improver mode->AEAP/ALAP BP Improve\n");
status = RTGS_mode_5(kernelFilename, releaseTimeFilename);
status = RTGS_mode_5(jobsListFileName, releaseTimeFilename);
break;
}
PROFILER_STOP(SRTG, scheduler_main)
Expand Down
Loading

0 comments on commit 22aef6b

Please sign in to comment.