# HG changeset patch # User Sean Halle # Date 1343808482 25200 # Node ID 7a85919442f2b301586870da6130682d069ec34f Initial add -- test application for use while developing VSs features diff -r 000000000000 -r 7a85919442f2 .hgeol --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgeol Wed Aug 01 01:08:02 2012 -0700 @@ -0,0 +1,14 @@ + +[patterns] +**.py = native +**.txt = native +**.c = native +**.h = native +**.cpp = native +**.java = native +**.class = bin +**.jar = bin +**.sh = native +**.pl = native +**.jpg = bin +**.gif = bin diff -r 000000000000 -r 7a85919442f2 .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Wed Aug 01 01:08:02 2012 -0700 @@ -0,0 +1,12 @@ +nbproject +Makefile +build +dist +src/Default +src/.settings +src/.cproject +src/.project +.dep.inc +glob:.cproject +glob:.project +glob:Debug diff -r 000000000000 -r 7a85919442f2 Design_Notes.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Design_Notes.txt Wed Aug 01 01:08:02 2012 -0700 @@ -0,0 +1,51 @@ + +This test app has to exercise all the aspects of the request handling +and the assigner code. + +The assigner has two different Qs, plus a set of currentTaskSlvs check for tasks and also check for explicit VPs. + +So, in the app, make tasks, and also explicit VPs.. create such that they +interleave, cause assigner to switch between. + +So, when start, make some tasks, then make some explicit VPs, then some +tasks, back and forth.. second batch of tasks have inter-dependencies, so +some of the VPs should jump into the middle of them.. + +Then, make it so that the last two tasks talk to each other, suspending +each other in turn, (which should cause the extra VPs to dissipate) and +after that they create a bunch more tasks. + +Okay.. what needs to be exercised? +-] create new slave when task suspends +-] dissipate extra slave when have a task one, and no free tasks +-] suspend a task -> no tasks in taskQ -> empty task slave in slaveQ -> + dissipate that task slave -> explicit slave next in slaveQ, animate that. + Means: To get an empty task slave in slaveQ -> create a task that will + suspend, then create a normal task, which will cause an extra task + slave to be created + +=================== +To have explicit VPs as well tasks.. add a field to semantic data holds type +of VP: whether it's for running tasks, vs an explicit VP. when an +explicit dissipates, then switch it to a task VP that has no suspended +tasks.. + +So, in the semantic data, have: +-> taskVP vs explicitVP +-> has suspended task vs idle + +Then fix the assigner logic: +When task suspends, get next readyVP, + check if it's an explicit + and if yes, resume it, + if no, then it's a taskVP, so get next task from taskQ and do it. + Check whether taskQ empty + if yes, then in the state: suspended taskVP, have empty taskVP, no tasks + so, + +If taskQ empty, and VP Q empty, return NULL, which will trigger the + back-to-back Master backoff. + +If assigner called and no suspended slaves and taskQ empty.. does it have +a "current task slave"? If not, create one in the semantic Env. +================================== diff -r 000000000000 -r 7a85919442f2 VSs__Test_App/EntryPoint.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/VSs__Test_App/EntryPoint.c Wed Aug 01 01:08:02 2012 -0700 @@ -0,0 +1,37 @@ +/* + * Copyright 2009 OpenSourceStewardshipFoundation.org + * Licensed under GNU General Public License version 2 + * + * Author: seanhalle@yahoo.com + * + */ + +#include + +#include "VSs__Hello_World.h" + + + +/*This "entry point" function creates the first + * processor, which starts the chain of creating more processors.. + * eventually all of the processors will dissipate themselves, and + * return. + * + *This entry-point function follows the same pattern as all entry-point + * functions do: + *1) it creates the params for the seed processor, from the + * parameters passed into the entry-point function + *2) it calls SSR__create_seed_slave_and_do_work + *3) it gets the return value from the params struc, frees the params struc, + * and returns the value from the function + * + */ +void +VSs__Test_App( ) + { + //create seed processor, start doing the work, and wait till done + //This function is the "border crossing" between normal code and SSR + VSs__create_seed_slave_and_do_work( &test_app, NULL ); + + return; + } diff -r 000000000000 -r 7a85919442f2 VSs__Test_App/SeedVP.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/VSs__Test_App/SeedVP.c Wed Aug 01 01:08:02 2012 -0700 @@ -0,0 +1,48 @@ +/* + * Copyright 2009 OpenSourceResearchInstitute.org + * Licensed under GNU General Public License version 2 + * + * Author: seanhalle@yahoo.com + * + */ + + +#include +#include +#include "VSs__Hello_World.h" + +/*Global vars are part of the hello world task type.. ctld args MUST always + * be the first ones in the array*/ +int32 testAppArgTypes[3] = {IN, NONCTLD, NONCTLD }; +int32 testAppArgSizes[3] = {16*16*sizeof(float), sizeof(int32), sizeof(int32)}; + +void test_app( void *_params, SlaveVP *animSlv ) + { int32 i, *taskID; + + DEBUG__printf( dbgAppFlow, "start test_app"); + + //params = (VSsTestAppParams*)_params; + + // create all the task types + testAppTaskType = VMS_App__malloc( sizeof(VSsTaskType) ); + testAppTaskType->fn = &test_app_task; + testAppTaskType->numCtldArgs = 1; + testAppTaskType->numTotalArgs = 3; + testAppTaskType->sizeOfArgs = sizeof(TestAppArgs); + testAppTaskType->argTypes = testAppArgTypes; + testAppTaskType->argSizes = testAppArgSizes; + + TestAppArgs args; //allocate on stack, VSs copies internally + + for( i = 0; i < 5; i++ ) + { + args.controlledArg = VMS_App__malloc( testAppTaskType->argSizes[0] ); + args.taskNum = i; + args.numTasks = 5; + taskID = VSs__create_taskID_of_size( 1, animSlv ); + taskID[1] = i; + VSs__submit_task_with_ID( testAppTaskType, &args, taskID, animSlv ); + } + VSs__dissipate_slave( animSlv ); + } + diff -r 000000000000 -r 7a85919442f2 VSs__Test_App/Task.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/VSs__Test_App/Task.c Wed Aug 01 01:08:02 2012 -0700 @@ -0,0 +1,40 @@ +/* + * Copyright 2009 OpenSourceStewardshipFoundation.org + * Licensed under GNU General Public License version 2 + * + * Author: seanhalle@yahoo.com + * + */ + + +#include +#include +#include "VSs__Hello_World.h" + +void test_app_task( void *_args, SlaveVP *animSlv ) + { TestAppArgs *args; + int32 *selfTaskID, *receiveFromTaskID, *sendToTaskID; + int32 numTasks; + + args = (TestAppArgs *)_args; + numTasks = args->numTasks; + + selfTaskID = VSs__give_self_taskID( animSlv ); + + receiveFromTaskID = VSs__create_taskID_of_size( 1, animSlv ); + receiveFromTaskID[1] = selfTaskID[1] - 1; + + sendToTaskID = VSs__create_taskID_of_size( 1, animSlv ); + sendToTaskID[1] = selfTaskID[1] + 1; + + if( receiveFromTaskID[1] >= 0 ) + VSs__receive_from_to( receiveFromTaskID, selfTaskID, animSlv ); + if( sendToTaskID[1] < numTasks ) + VSs__send_from_to( NULL, selfTaskID, sendToTaskID, animSlv ); + printf("Hello World: %llu, %d", (uint64)args->controlledArg, args->taskNum); + + fflush(stdout); + + VSs__end_task( animSlv ); + } + diff -r 000000000000 -r 7a85919442f2 VSs__Test_App/VSs__Test_App.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/VSs__Test_App/VSs__Test_App.h Wed Aug 01 01:08:02 2012 -0700 @@ -0,0 +1,38 @@ +/* + * Copyright Oct 24, 2009 OpenSourceStewardshipFoundation.org + * Licensed under GNU General Public License version 2 + */ + +#ifndef _VSs_TEST_APP_H_ +#define _VSs_TEST_APP_H_ + +#include + +#include "VSs_impl/VSs.h" + + +//=============================== Defines ============================== + +//============================== Structures ============================== + +//NOTE: controlled args must come first, accessible as array of ptrs +typedef struct + { int32 *controlledArg; //This is a controlled arg -- VSs uses to calc depenencies + int32 taskNum; //This is a normal arg, ignored by VSs + int32 numTasks; //This is a normal arg, ignored by VSs + } +TestAppArgs; + +//============================= Processor Functions ========================= +void test_app( void *data, SlaveVP *animatingSlv ); //seed VP function +void test_app_task( void *data, SlaveVP *animatingSlv ); + + +//================================ Entry Point ============================== +void +VSs__Test_App( ); + +//================================ Global Vars ============================== +VSsTaskType *testAppTaskType; + +#endif /*_SSR_MATRIX_MULT_H_*/ diff -r 000000000000 -r 7a85919442f2 __brch__default --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/__brch__default Wed Aug 01 01:08:02 2012 -0700 @@ -0,0 +1,1 @@ +Applications normally have only the default branch -- they shouldn't be affected by any choices in VMS or language.. diff -r 000000000000 -r 7a85919442f2 main.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.c Wed Aug 01 01:08:02 2012 -0700 @@ -0,0 +1,24 @@ +/* + * Copyright 2012 OpenSourceResearchInstitute.org + * Licensed under GNU General Public License version 2 + * + * author seanhalle@yahoo.com + */ + +#include +#include + +#include "VSs__Test_App/VSs__Test_App.h" + +/* + * + */ +int main( int argc, char **argv ) + { + + DEBUG__printf2(TRUE, "arguments: %s | %s", argv[0], argv[1] ); + + VSs__Test_App( ); + + exit(0); //cleans up + }