# HG changeset patch # User Sean Halle # Date 1339724457 25200 # Node ID 8b7761919283cecbeaf7b7848c295a141f5eed05 # Parent 6643a6f4705087018fc191fba1ee577f42152d40 Works -- with send-receive plus normal dependencies diff -r 6643a6f47050 -r 8b7761919283 VSs__Hello_World/SeedVP.c --- a/VSs__Hello_World/SeedVP.c Wed Jun 06 18:00:58 2012 -0700 +++ b/VSs__Hello_World/SeedVP.c Thu Jun 14 18:40:57 2012 -0700 @@ -11,35 +11,38 @@ #include #include "VSs__Hello_World.h" -/*Global vars are part of the hello world task type.. NULL means not cntld - ctld args MUST always be the first ones in the array*/ -int32 helloWorldArgTypes[2] = {IN, (int32)NULL}; -int32 helloWorldArgSizes[2] = {16*16*sizeof(float), sizeof(int32)}; +/*Global vars are part of the hello world task type.. ctld args MUST always + * be the first ones in the array*/ +int32 helloWorldArgTypes[3] = {IN, NONCTLD, NONCTLD }; +int32 helloWorldArgSizes[3] = {16*16*sizeof(float), sizeof(int32), sizeof(int32)}; void hello_world( void *_params, SlaveVP *animSlv ) - { int32 i; + { int32 i, *taskID; DEBUG__printf( dbgAppFlow, "start hello_world"); + //params = (VSsHelloWorldParams*)_params; + // create all the task types - helloWorldTaskType = VMS_App__malloc( sizeof(VSsTaskType) ); - helloWorldTaskType->fn = &hello_world_task; + helloWorldTaskType = VMS_App__malloc( sizeof(VSsTaskType) ); + helloWorldTaskType->fn = &hello_world_task; helloWorldTaskType->numCtldArgs = 1; - helloWorldTaskType->numTotalArgs = 2; + helloWorldTaskType->numTotalArgs = 3; helloWorldTaskType->sizeOfArgs = sizeof(HelloWorldArgs); - helloWorldTaskType->argTypes = helloWorldArgTypes; - helloWorldTaskType->argSizes = helloWorldArgSizes; + helloWorldTaskType->argTypes = helloWorldArgTypes; + helloWorldTaskType->argSizes = helloWorldArgSizes; HelloWorldArgs args; //allocate on stack, VSs copies internally for( i = 0; i < 5; i++ ) { - args.dummy1 = VMS_App__malloc( helloWorldTaskType->argSizes[0] ); - args.dummy2 = i; - VSs__submit_task( helloWorldTaskType, &args, animSlv ); + args.controlledArg = VMS_App__malloc( helloWorldTaskType->argSizes[0] ); + args.taskNum = i; + args.numTasks = 5; + taskID = VSs__create_taskID_of_size( 1, animSlv ); + taskID[1] = i; + VSs__submit_task_with_ID( helloWorldTaskType, &args, taskID, animSlv ); } -// VSs__wait_for_all_tasks_to_complete(); -// VSs__shutdown( animSlv ); VSs__dissipate_slave( animSlv ); } diff -r 6643a6f47050 -r 8b7761919283 VSs__Hello_World/Task.c --- a/VSs__Hello_World/Task.c Wed Jun 06 18:00:58 2012 -0700 +++ b/VSs__Hello_World/Task.c Thu Jun 14 18:40:57 2012 -0700 @@ -13,10 +13,26 @@ void hello_world_task( void *_args, SlaveVP *animSlv ) { HelloWorldArgs *args; - + int32 *selfTaskID, *receiveFromTaskID, *sendToTaskID; + int32 numTasks; + args = (HelloWorldArgs *)_args; + numTasks = args->numTasks; - printf("Hello World: %llu, %d", (uint64)args->dummy1, args->dummy2); + 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 6643a6f47050 -r 8b7761919283 VSs__Hello_World/VSs__Hello_World.h --- a/VSs__Hello_World/VSs__Hello_World.h Wed Jun 06 18:00:58 2012 -0700 +++ b/VSs__Hello_World/VSs__Hello_World.h Thu Jun 14 18:40:57 2012 -0700 @@ -17,8 +17,9 @@ //NOTE: controlled args must come first, accessible as array of ptrs typedef struct - { int32 *dummy1; //This is a controlled arg -- VSs uses to calc depenencies - int32 dummy2; //This is a normal arg, ignored by VSs + { 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 } HelloWorldArgs;