Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > DKU > DKU__Test_App
changeset 1:c6fc793f68a5
added rest of stuff
| author | Sean Halle <seanhalle@yahoo.com> |
|---|---|
| date | Tue, 24 Sep 2013 08:42:31 -0700 |
| parents | efca8e7ec576 |
| children | d561f123f9a6 |
| files | .hgeol .hgignore DKU_Fns.c DKU__Test_App.h DKU__Test_App/DKU_Fns.c DKU__Test_App/DKU__Test_App.h DKU__Test_App/SeedVP.c PR_defs__turn_on_and_off.h SeedVP.c __brch__default main.c |
| diffstat | 11 files changed, 412 insertions(+), 238 deletions(-) [+] |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/.hgeol Tue Sep 24 08:42:31 2013 -0700 1.3 @@ -0,0 +1,14 @@ 1.4 + 1.5 +[patterns] 1.6 +**.py = native 1.7 +**.txt = native 1.8 +**.c = native 1.9 +**.h = native 1.10 +**.cpp = native 1.11 +**.java = native 1.12 +**.class = bin 1.13 +**.jar = bin 1.14 +**.sh = native 1.15 +**.pl = native 1.16 +**.jpg = bin 1.17 +**.gif = bin
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/.hgignore Tue Sep 24 08:42:31 2013 -0700 2.3 @@ -0,0 +1,12 @@ 2.4 +nbproject 2.5 +Makefile 2.6 +build 2.7 +dist 2.8 +src/Default 2.9 +src/.settings 2.10 +src/.cproject 2.11 +src/.project 2.12 +.dep.inc 2.13 +glob:.cproject 2.14 +glob:.project 2.15 +glob:Debug
3.1 --- a/DKU_Fns.c Tue Sep 24 08:08:18 2013 -0700 3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 3.3 @@ -1,122 +0,0 @@ 3.4 -/* 3.5 - * Copyright 2009 OpenSourceResearchInstitute.org 3.6 - * Licensed under GNU General Public License version 2 3.7 - * 3.8 - * Author: seanhalle@yahoo.com 3.9 - * 3.10 - */ 3.11 - 3.12 - 3.13 -#include <math.h> 3.14 -#include <string.h> 3.15 -#include "DKU__Test_App.h" 3.16 - 3.17 -/*Bare smoke test of DKU wrapper library functions. 3.18 - * Create one DKU instance, with a dummy kernel 3.19 - * Bare bones divider and undivider 3.20 - * simple root piece maker 3.21 - * dummy serial kernel 3.22 - */ 3.23 - 3.24 -int 3.25 -square( int x ) 3.26 - { return x*x; 3.27 - } 3.28 - 3.29 - 3.30 -DKUPiece * 3.31 -rootPieceMakerFn( void *params, DKUInstance *dkuInstance ) 3.32 - { DKUPiece *rootPiece; 3.33 - 3.34 - rootPiece = PRServ__DKU_make_empty_DKU_piece(); 3.35 - rootPiece->parent = NULL; 3.36 - rootPiece->payload = params; 3.37 - rootPiece->dkuInstance = dkuInstance; 3.38 - 3.39 - return rootPiece; 3.40 - } 3.41 - 3.42 -DKUPiece * 3.43 -make_root_dku_piece_for_test_inst( int32 *data, int32 size, 3.44 - DKUInstance *dkuInstance ) 3.45 - { DKUPiece *rootPiece; 3.46 - TestAppStruct *params; 3.47 - 3.48 - params = PR__malloc( sizeof(TestAppStruct) ); 3.49 - params->startIter = 0; 3.50 - params->endIter = size-1; 3.51 - params->data = data; 3.52 - params->size = size; 3.53 - rootPiece = (*(dkuInstance->rootPieceMaker))( params, dkuInstance ); 3.54 - return rootPiece; 3.55 - } 3.56 - 3.57 - 3.58 -void 3.59 -kernelFn( void *_params, SlaveVP *animVP ) 3.60 - { int32 i; 3.61 - DKUPiece *piece = (DKUPiece *)_params; 3.62 - TestAppStruct *params = (TestAppStruct *)piece->payload; 3.63 - int32 *data = params->data; 3.64 - 3.65 - DEBUG__printf(dbgAppFlow, "Kernel %d", params->startIter); 3.66 - 3.67 - for( i=params->startIter; i <= params->endIter; ++i ) 3.68 - { data[i] = square(i); 3.69 - } 3.70 - PRServ__DKU_end_kernel( piece, animVP ); 3.71 - } 3.72 - 3.73 - 3.74 -/*Serial kernel is called with bare app-defined struct, not DKUPiece 3.75 - */ 3.76 -void 3.77 -serialKernelFn( void *_params, SlaveVP *animVP ) 3.78 - { int32 i; 3.79 - TestAppStruct *params = (TestAppStruct *)_params; 3.80 - int32 *data = params->data; 3.81 - 3.82 - DEBUG__printf(dbgAppFlow, "SerialKernel %d", params->startIter); 3.83 - 3.84 - for( i=params->startIter; i < params->endIter; ++i ) 3.85 - { data[i] = square(i); 3.86 - } 3.87 - PRServ__DKU_end_serial_kernel( animVP ); 3.88 - } 3.89 - 3.90 -void 3.91 -dividerFn( DKUPiece *pieceToDivide ) 3.92 - { 3.93 - int32 idx, childIdx, numChildren, size, *data; 3.94 - DKUPiece *childPiece, **childrenArray; 3.95 - TestAppStruct *params; 3.96 - DEBUG__printf(dbgAppFlow, "divider %p", pieceToDivide) 3.97 - 3.98 - numChildren = pieceToDivide->numChildren; 3.99 - childrenArray = PR__malloc( numChildren * sizeof(DKUPiece *) ); 3.100 - size = ((TestAppStruct*)pieceToDivide->payload)->size; 3.101 - data = ((TestAppStruct*)pieceToDivide->payload)->data; 3.102 - int chunkSize = size/numChildren; //for portability, lang would choose this dynamically at run time 3.103 - //note: should do processing to catch too small a chunksize and deal w/it 3.104 - for( childIdx = 0; childIdx < numChildren; childIdx++ ) 3.105 - { params = PR__malloc(sizeof(TestAppStruct)); //these define work the task performs 3.106 - idx = childIdx * chunkSize; 3.107 - params->startIter = idx; 3.108 - params->endIter = idx + chunkSize -1; 3.109 - params->data = data; 3.110 - params->size = size; 3.111 - childPiece = PRServ__DKU_make_child_piece_from( pieceToDivide ); 3.112 - childPiece->payload = params; 3.113 - childrenArray[childIdx] = childPiece; 3.114 - } 3.115 - params->endIter = size -1; //catch truncation error from chunkSize calc 3.116 - 3.117 - pieceToDivide->children = childrenArray; 3.118 - } 3.119 - 3.120 -void undividerFn( DKUPiece *piece ) 3.121 - { 3.122 - //DEBUG__printf(dbgAppFlow, "Undivider %p", piece) 3.123 - //nothing to do -- request handler does counting of completions 3.124 - } 3.125 -
4.1 --- a/DKU__Test_App.h Tue Sep 24 08:08:18 2013 -0700 4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 4.3 @@ -1,53 +0,0 @@ 4.4 -/* 4.5 - * Copyright 2013 OpenSourceResearchInstitute.org 4.6 - * Licensed under GNU General Public License version 2 4.7 - */ 4.8 - 4.9 -#ifndef _DKU_TEST_APP_H_ 4.10 -#define _DKU_TEST_APP_H_ 4.11 - 4.12 -#include <stdio.h> 4.13 - 4.14 -#include "../PR_defs__turn_on_and_off.h" 4.15 -#include <PR__include/langlets/PRServ__wrapper_library.h> 4.16 - 4.17 -/*Bare smoke test of DKU wrapper library functions. 4.18 - * Create one DKU instance, with a dummy kernel 4.19 - * Bare bones divider and undivider 4.20 - * simple root piece maker 4.21 - * dummy serial kernel 4.22 - */ 4.23 - 4.24 -//=============================== Defines ============================== 4.25 - 4.26 -//============================== Structures ============================== 4.27 -typedef struct 4.28 - { int32 *data; 4.29 - } 4.30 -SeedParams; 4.31 - 4.32 -typedef struct 4.33 - { 4.34 - int32 *data; 4.35 - int32 size; 4.36 - int32 startIter; 4.37 - int32 endIter; 4.38 - } 4.39 -TestAppStruct; 4.40 - 4.41 -//============================= Processor Functions ========================= 4.42 -void test_app_seed_Fn( void *data, SlaveVP *animatingVP ); //seed VP function 4.43 - 4.44 -DKUPiece *rootPieceMakerFn( void *data, DKUInstance *dkuInstance ); 4.45 -void kernelFn( void *_params, SlaveVP *animVP ); //used as task birth Fn 4.46 -void serialKernelFn( void *_params, SlaveVP *animVP ); //used as task birth Fn 4.47 -void dividerFn( DKUPiece *piece ); 4.48 -void undividerFn( DKUPiece *piece ); 4.49 - 4.50 -DKUPiece * 4.51 -make_root_dku_piece_for_test_inst( int32 *data, int32 size, 4.52 - DKUInstance *dkuInstance ); 4.53 - 4.54 -//================================ Global Vars ============================== 4.55 - 4.56 -#endif /*_SSR_MATRIX_MULT_H_*/
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/DKU__Test_App/DKU_Fns.c Tue Sep 24 08:42:31 2013 -0700 5.3 @@ -0,0 +1,122 @@ 5.4 +/* 5.5 + * Copyright 2009 OpenSourceResearchInstitute.org 5.6 + * Licensed under GNU General Public License version 2 5.7 + * 5.8 + * Author: seanhalle@yahoo.com 5.9 + * 5.10 + */ 5.11 + 5.12 + 5.13 +#include <math.h> 5.14 +#include <string.h> 5.15 +#include "DKU__Test_App.h" 5.16 + 5.17 +/*Bare smoke test of DKU wrapper library functions. 5.18 + * Create one DKU instance, with a dummy kernel 5.19 + * Bare bones divider and undivider 5.20 + * simple root piece maker 5.21 + * dummy serial kernel 5.22 + */ 5.23 + 5.24 +int 5.25 +square( int x ) 5.26 + { return x*x; 5.27 + } 5.28 + 5.29 + 5.30 +DKUPiece * 5.31 +rootPieceMakerFn( void *params, DKUInstance *dkuInstance ) 5.32 + { DKUPiece *rootPiece; 5.33 + 5.34 + rootPiece = PRServ__DKU_make_empty_DKU_piece(); 5.35 + rootPiece->parent = NULL; 5.36 + rootPiece->payload = params; 5.37 + rootPiece->dkuInstance = dkuInstance; 5.38 + 5.39 + return rootPiece; 5.40 + } 5.41 + 5.42 +DKUPiece * 5.43 +make_root_dku_piece_for_test_inst( int32 *data, int32 size, 5.44 + DKUInstance *dkuInstance ) 5.45 + { DKUPiece *rootPiece; 5.46 + TestAppStruct *params; 5.47 + 5.48 + params = PR__malloc( sizeof(TestAppStruct) ); 5.49 + params->startIter = 0; 5.50 + params->endIter = size-1; 5.51 + params->data = data; 5.52 + params->size = size; 5.53 + rootPiece = (*(dkuInstance->rootPieceMaker))( params, dkuInstance ); 5.54 + return rootPiece; 5.55 + } 5.56 + 5.57 + 5.58 +void 5.59 +kernelFn( void *_params, SlaveVP *animVP ) 5.60 + { int32 i; 5.61 + DKUPiece *piece = (DKUPiece *)_params; 5.62 + TestAppStruct *params = (TestAppStruct *)piece->payload; 5.63 + int32 *data = params->data; 5.64 + 5.65 + DEBUG__printf(dbgAppFlow, "Kernel %d", params->startIter); 5.66 + 5.67 + for( i=params->startIter; i <= params->endIter; ++i ) 5.68 + { data[i] = square(i); 5.69 + } 5.70 + PRServ__DKU_end_kernel( piece, animVP ); 5.71 + } 5.72 + 5.73 + 5.74 +/*Serial kernel is called with bare app-defined struct, not DKUPiece 5.75 + */ 5.76 +void 5.77 +serialKernelFn( void *_params, SlaveVP *animVP ) 5.78 + { int32 i; 5.79 + TestAppStruct *params = (TestAppStruct *)_params; 5.80 + int32 *data = params->data; 5.81 + 5.82 + DEBUG__printf(dbgAppFlow, "SerialKernel %d", params->startIter); 5.83 + 5.84 + for( i=params->startIter; i < params->endIter; ++i ) 5.85 + { data[i] = square(i); 5.86 + } 5.87 + PRServ__DKU_end_serial_kernel( animVP ); 5.88 + } 5.89 + 5.90 +void 5.91 +dividerFn( DKUPiece *pieceToDivide ) 5.92 + { 5.93 + int32 idx, childIdx, numChildren, size, *data; 5.94 + DKUPiece *childPiece, **childrenArray; 5.95 + TestAppStruct *params; 5.96 + DEBUG__printf(dbgAppFlow, "divider %p", pieceToDivide) 5.97 + 5.98 + numChildren = pieceToDivide->numChildren; 5.99 + childrenArray = PR__malloc( numChildren * sizeof(DKUPiece *) ); 5.100 + size = ((TestAppStruct*)pieceToDivide->payload)->size; 5.101 + data = ((TestAppStruct*)pieceToDivide->payload)->data; 5.102 + int chunkSize = size/numChildren; //for portability, lang would choose this dynamically at run time 5.103 + //note: should do processing to catch too small a chunksize and deal w/it 5.104 + for( childIdx = 0; childIdx < numChildren; childIdx++ ) 5.105 + { params = PR__malloc(sizeof(TestAppStruct)); //these define work the task performs 5.106 + idx = childIdx * chunkSize; 5.107 + params->startIter = idx; 5.108 + params->endIter = idx + chunkSize -1; 5.109 + params->data = data; 5.110 + params->size = size; 5.111 + childPiece = PRServ__DKU_make_child_piece_from( pieceToDivide ); 5.112 + childPiece->payload = params; 5.113 + childrenArray[childIdx] = childPiece; 5.114 + } 5.115 + params->endIter = size -1; //catch truncation error from chunkSize calc 5.116 + 5.117 + pieceToDivide->children = childrenArray; 5.118 + } 5.119 + 5.120 +void undividerFn( DKUPiece *piece ) 5.121 + { 5.122 + //DEBUG__printf(dbgAppFlow, "Undivider %p", piece) 5.123 + //nothing to do -- request handler does counting of completions 5.124 + } 5.125 +
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/DKU__Test_App/DKU__Test_App.h Tue Sep 24 08:42:31 2013 -0700 6.3 @@ -0,0 +1,53 @@ 6.4 +/* 6.5 + * Copyright 2013 OpenSourceResearchInstitute.org 6.6 + * Licensed under GNU General Public License version 2 6.7 + */ 6.8 + 6.9 +#ifndef _DKU_TEST_APP_H_ 6.10 +#define _DKU_TEST_APP_H_ 6.11 + 6.12 +#include <stdio.h> 6.13 + 6.14 +#include "../PR_defs__turn_on_and_off.h" 6.15 +#include <PR__include/langlets/PRServ__wrapper_library.h> 6.16 + 6.17 +/*Bare smoke test of DKU wrapper library functions. 6.18 + * Create one DKU instance, with a dummy kernel 6.19 + * Bare bones divider and undivider 6.20 + * simple root piece maker 6.21 + * dummy serial kernel 6.22 + */ 6.23 + 6.24 +//=============================== Defines ============================== 6.25 + 6.26 +//============================== Structures ============================== 6.27 +typedef struct 6.28 + { int32 *data; 6.29 + } 6.30 +SeedParams; 6.31 + 6.32 +typedef struct 6.33 + { 6.34 + int32 *data; 6.35 + int32 size; 6.36 + int32 startIter; 6.37 + int32 endIter; 6.38 + } 6.39 +TestAppStruct; 6.40 + 6.41 +//============================= Processor Functions ========================= 6.42 +void test_app_seed_Fn( void *data, SlaveVP *animatingVP ); //seed VP function 6.43 + 6.44 +DKUPiece *rootPieceMakerFn( void *data, DKUInstance *dkuInstance ); 6.45 +void kernelFn( void *_params, SlaveVP *animVP ); //used as task birth Fn 6.46 +void serialKernelFn( void *_params, SlaveVP *animVP ); //used as task birth Fn 6.47 +void dividerFn( DKUPiece *piece ); 6.48 +void undividerFn( DKUPiece *piece ); 6.49 + 6.50 +DKUPiece * 6.51 +make_root_dku_piece_for_test_inst( int32 *data, int32 size, 6.52 + DKUInstance *dkuInstance ); 6.53 + 6.54 +//================================ Global Vars ============================== 6.55 + 6.56 +#endif /*_SSR_MATRIX_MULT_H_*/
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/DKU__Test_App/SeedVP.c Tue Sep 24 08:42:31 2013 -0700 7.3 @@ -0,0 +1,63 @@ 7.4 +/* 7.5 + * Copyright 2009 OpenSourceResearchInstitute.org 7.6 + * Licensed under GNU General Public License version 2 7.7 + * 7.8 + * Author: seanhalle@yahoo.com 7.9 + * 7.10 + */ 7.11 + 7.12 + 7.13 +#include <math.h> 7.14 +#include <string.h> 7.15 +#include "DKU__Test_App.h" 7.16 + 7.17 +/*Bare smoke test of DKU wrapper library functions. 7.18 + * Create one DKU instance, with a dummy kernel 7.19 + * Bare bones divider and undivider 7.20 + * simple root piece maker 7.21 + * dummy serial kernel 7.22 + */ 7.23 + 7.24 +//==================================================================== 7.25 +#define NO_INPUT NULL 7.26 + /*Just to get proto-runtime built and run, to test it.. 7.27 + */ 7.28 +void test_app_seed_Fn( void *_params, SlaveVP *seedVP ) 7.29 + { DKUInstance *dkuInstance; 7.30 + DKUPiece *rootPiece; 7.31 + int32 size = 1000; 7.32 + int32 *data = (int32 *) PR__malloc (size * sizeof(int32)) ; 7.33 + 7.34 + DEBUG__printf(dbgAppFlow, "In seed Fn") 7.35 + 7.36 + SeedParams *seedParams = (SeedParams *)_params; //used to comm with main() 7.37 + 7.38 + dkuInstance = PRServ__DKU_make_empty_DKU_instance( seedVP ); 7.39 + PRServ__DKU_set_root_piece_maker( dkuInstance, &rootPieceMakerFn, seedVP ); 7.40 + PRServ__DKU_set_kernel( dkuInstance, &kernelFn, seedVP ); 7.41 + PRServ__DKU_set_serial_kernel( dkuInstance, &serialKernelFn, seedVP ); 7.42 + PRServ__DKU_set_divider( dkuInstance, ÷rFn, seedVP ); 7.43 + PRServ__DKU_set_undivider( dkuInstance, &undividerFn, seedVP ); 7.44 + 7.45 + rootPiece = 7.46 + make_root_dku_piece_for_test_inst( data, size, dkuInstance ); 7.47 +// rootPiece = PRServ__DKU_make_root_piece( dkuInstance, data, seedVP ); 7.48 + 7.49 + PRServ__DKU_perform_work_on( rootPiece, seedVP ); 7.50 + 7.51 + PRServ__DKU_wait_for_result_to_be_complete( rootPiece, seedVP ); 7.52 + 7.53 + seedParams->data = data; //sends results back to main() 7.54 + 7.55 + //Tells PR to end the process, which it will do even 7.56 + // if work is active, or suspended work entities are still live, or the 7.57 + // process has input ports that could trigger future work. 7.58 + PR__end_process_from_inside( seedVP ); 7.59 + 7.60 + //This ends the last live entity capable of work, in a process 7.61 + // that has no external input ports.. hence, no activity can take place 7.62 + // past that point.. PR detects that, and then automatically ends the 7.63 + // process. 7.64 + PR__end_seedVP( seedVP ); 7.65 + } 7.66 +
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/PR_defs__turn_on_and_off.h Tue Sep 24 08:42:31 2013 -0700 8.3 @@ -0,0 +1,90 @@ 8.4 +/* 8.5 + * Copyright 2009 OpenSourceResearchInstitute.org 8.6 + * Licensed under GNU General Public License version 2 8.7 + * 8.8 + * Author: seanhalle@yahoo.com 8.9 + * 8.10 + */ 8.11 + 8.12 +#ifndef _PR_DEFS_TURN_ON_AND_OFF_H 8.13 +#define _PR_DEFS_TURN_ON_AND_OFF_H 8.14 +#define _GNU_SOURCE 8.15 + 8.16 + 8.17 +#define MODE__MULTI_LANG 8.18 + 8.19 +//====================== Turn Debug things on and off ===================== 8.20 +/*When DEBUG__TURN_ON_SEQUENTIAL_MODE is defined, PR does sequential exe in the main thread 8.21 + * It still does co-routines and all the mechanisms are the same, it just 8.22 + * has only a single thread and animates Slvs one at a time 8.23 + */ 8.24 +//#define DEBUG__TURN_ON_SEQUENTIAL_MODE 8.25 + //check for sequential mode and redefine num cores to be 1 so that lang 8.26 + // code doesn't have to do special #ifdef for sequential mode 8.27 +#ifdef DEBUG__TURN_ON_SEQUENTIAL_MODE 8.28 + #ifdef NUM_CORES 8.29 + #undef NUM_CORES 8.30 + #define NUM_CORES 1 8.31 + #endif 8.32 +#endif 8.33 + 8.34 +/*turns on the probe-instrumentation in the application -- when not 8.35 + * defined, the calls to the probe functions turn into comments 8.36 + */ 8.37 +#define DEBUG__TURN_ON_DEBUG_PRINT 8.38 + 8.39 +/*These defines turn types of bug messages on and off 8.40 + */ 8.41 +#define dbgAppFlow TRUE /* Top level flow of application code -- general*/ 8.42 +#define dbgProbes FALSE /* for issues inside probes themselves*/ 8.43 +#define dbgMaster FALSE /* obsolete*/ 8.44 +#define dbgRqstHdlr TRUE /* in request handler code*/ 8.45 +#define dbgSS FALSE /* in request handler code*/ 8.46 +#define dbgInfra FALSE /* in request handler code*/ 8.47 + 8.48 +//#define DEBUG__TURN_ON_ERROR_MSGS 8.49 + 8.50 +//================== Turn Probe Things on and off ==================== 8.51 +/*Probes are used in the application as a cheap, convenient, and fast way 8.52 + * to collect statistics. Define this to enable them, else the probe 8.53 + * statements in the application code all turn into empty whitespace 8.54 + * in the pre-processor 8.55 + */ 8.56 +//#define PROBES__TURN_ON_STATS_PROBES 8.57 + 8.58 +/*When PROBES__TURN_ON_STATS_PROBES is defined, turn on one of these to choose 8.59 + * what kind of measurement the probes store 8.60 + */ 8.61 +//#define PROBES__USE_TSC_PROBES 8.62 +#define PROBES__USE_TIME_OF_DAY_PROBES 8.63 +//#define PROBES__USE_PERF_CTR_PROBES 8.64 + 8.65 + 8.66 +//============== Turn Internal Measurement Things on and off =============== 8.67 + 8.68 +//#define MEAS__TURN_ON_SUSP_MEAS 8.69 +//#define MEAS__TURN_ON_MASTER_MEAS 8.70 +//#define MEAS__TURN_ON_MASTER_LOCK_MEAS 8.71 +//#define MEAS__TURN_ON_MALLOC_MEAS 8.72 +//#define MEAS__TURN_ON_PLUGIN_MEAS 8.73 +//#define MEAS__TURN_ON_SYSTEM_MEAS 8.74 + /*turn on/off subtraction of create measurements from plugin meas*/ 8.75 +//#define MEAS__TURN_ON_EXCLUDE_CREATION_TIME 8.76 + 8.77 + 8.78 +//#define HOLISTIC__TURN_ON_PERF_COUNTERS 8.79 +//#define HOLISTIC__TURN_ON_OBSERVE_UCC 8.80 +//#define HOLISTIC__TURN_ON_DETECT_CONSTRAINT_GRAPH 8.81 + 8.82 +//=================== Turn on or off system options ======================= 8.83 +// 8.84 +/*Defining SYS__TURN_ON_WORK_STEALING causes the core controller behavior 8.85 + * to change. When it detects too many back-to-back masters, then it 8.86 + * searches the other core controllers, looking for work it can steal from 8.87 + * them. 8.88 + */ 8.89 +//#define SYS__TURN_ON_WORK_STEALING 8.90 + 8.91 +//=========================================================================== 8.92 +#endif /* */ 8.93 +
9.1 --- a/SeedVP.c Tue Sep 24 08:08:18 2013 -0700 9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 9.3 @@ -1,63 +0,0 @@ 9.4 -/* 9.5 - * Copyright 2009 OpenSourceResearchInstitute.org 9.6 - * Licensed under GNU General Public License version 2 9.7 - * 9.8 - * Author: seanhalle@yahoo.com 9.9 - * 9.10 - */ 9.11 - 9.12 - 9.13 -#include <math.h> 9.14 -#include <string.h> 9.15 -#include "DKU__Test_App.h" 9.16 - 9.17 -/*Bare smoke test of DKU wrapper library functions. 9.18 - * Create one DKU instance, with a dummy kernel 9.19 - * Bare bones divider and undivider 9.20 - * simple root piece maker 9.21 - * dummy serial kernel 9.22 - */ 9.23 - 9.24 -//==================================================================== 9.25 -#define NO_INPUT NULL 9.26 - /*Just to get proto-runtime built and run, to test it.. 9.27 - */ 9.28 -void test_app_seed_Fn( void *_params, SlaveVP *seedVP ) 9.29 - { DKUInstance *dkuInstance; 9.30 - DKUPiece *rootPiece; 9.31 - int32 size = 1000; 9.32 - int32 *data = (int32 *) PR__malloc (size * sizeof(int32)) ; 9.33 - 9.34 - DEBUG__printf(dbgAppFlow, "In seed Fn") 9.35 - 9.36 - SeedParams *seedParams = (SeedParams *)_params; //used to comm with main() 9.37 - 9.38 - dkuInstance = PRServ__DKU_make_empty_DKU_instance( seedVP ); 9.39 - PRServ__DKU_set_root_piece_maker( dkuInstance, &rootPieceMakerFn, seedVP ); 9.40 - PRServ__DKU_set_kernel( dkuInstance, &kernelFn, seedVP ); 9.41 - PRServ__DKU_set_serial_kernel( dkuInstance, &serialKernelFn, seedVP ); 9.42 - PRServ__DKU_set_divider( dkuInstance, ÷rFn, seedVP ); 9.43 - PRServ__DKU_set_undivider( dkuInstance, &undividerFn, seedVP ); 9.44 - 9.45 - rootPiece = 9.46 - make_root_dku_piece_for_test_inst( data, size, dkuInstance ); 9.47 -// rootPiece = PRServ__DKU_make_root_piece( dkuInstance, data, seedVP ); 9.48 - 9.49 - PRServ__DKU_perform_work_on( rootPiece, seedVP ); 9.50 - 9.51 - PRServ__DKU_wait_for_result_to_be_complete( rootPiece, seedVP ); 9.52 - 9.53 - seedParams->data = data; //sends results back to main() 9.54 - 9.55 - //Tells PR to end the process, which it will do even 9.56 - // if work is active, or suspended work entities are still live, or the 9.57 - // process has input ports that could trigger future work. 9.58 - PR__end_process_from_inside( seedVP ); 9.59 - 9.60 - //This ends the last live entity capable of work, in a process 9.61 - // that has no external input ports.. hence, no activity can take place 9.62 - // past that point.. PR detects that, and then automatically ends the 9.63 - // process. 9.64 - PR__end_seedVP( seedVP ); 9.65 - } 9.66 -
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/__brch__default Tue Sep 24 08:42:31 2013 -0700 10.3 @@ -0,0 +1,1 @@ 10.4 +Applications normally have only the default branch -- they shouldn't be affected by any choices in VMS or language..
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/main.c Tue Sep 24 08:42:31 2013 -0700 11.3 @@ -0,0 +1,57 @@ 11.4 +/* 11.5 + * Copyright 2012 OpenSourceResearchInstitute.org 11.6 + * Licensed under GNU General Public License version 2 11.7 + * 11.8 + * author seanhalle@yahoo.com 11.9 + */ 11.10 + 11.11 +#include <malloc.h> 11.12 +#include <stdlib.h> 11.13 + 11.14 +#include "DKU__Test_App/DKU__Test_App.h" 11.15 +#include <PR__include/PR__WL.h> //declares PR__create_process -- else get integer return value 11.16 + 11.17 +#define NO_INPUT_OR_OUTPUT NULL 11.18 + 11.19 +/*This demonstrates the use of the proto-runtime system. It allows multiple 11.20 + * languages to be mixed within a single sub-program. It also allows multiple 11.21 + * sub-programs to be started, where each uses its own set of languages. The 11.22 + * running sub-programs can then communicate with each other. 11.23 + * 11.24 + */ 11.25 +int main( int argc, char **argv ) 11.26 + { PRProcess *testProcess1, *testProcess2; 11.27 + 11.28 + DEBUG__printf2(TRUE, "arguments: %s | %s", argv[0], argv[1] ); 11.29 + 11.30 + //A proto-runtime based language sits on top of the proto-runtime. So, 11.31 + // first start the proto-runtime system, then create processes (which 11.32 + // start languages inside themselves) 11.33 + PR__start(); 11.34 + 11.35 + //This info shows up in the header of output files holding measurements 11.36 + //These calls MUST be made after PR__start and before creating a process 11.37 + PR__set_app_info("Test for developing VReo"); 11.38 + PR__set_input_info("no input"); 11.39 + 11.40 + 11.41 + //Now that PR is started, create processes. 11.42 + //Each process creates a seedVP and starts it running -- that then starts 11.43 + // the languages used inside the process.. 11.44 + //To get results from a process, it gets complicated.. simple soln is 11.45 + // just use PR's malloc and free, in the main thread, between PR__start 11.46 + // and PR__shutdown 11.47 + //The call returns a process struct 11.48 + SeedParams *params = PR__malloc( sizeof(SeedParams) ); 11.49 + testProcess1 = PR__create_process( &test_app_seed_Fn, params ); 11.50 + 11.51 + PR__wait_for_process_to_end( testProcess1 ); 11.52 + printf("\n\nresults: %d, %d\n\n", params->data[0], params->data[1] ); 11.53 + 11.54 + PR__free(params); 11.55 + 11.56 + PR__wait_for_all_activity_to_end(); //equivalent of detecting shutdown 11.57 + PR__shutdown(); 11.58 + 11.59 + exit(0); //cleans up 11.60 + }
