Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > DKU > DKU__Test_App
diff SeedVP.c @ 0:efca8e7ec576
initial add -- working version
| author | Sean Halle <seanhalle@yahoo.com> |
|---|---|
| date | Tue, 24 Sep 2013 08:08:18 -0700 |
| parents | |
| children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/SeedVP.c Tue Sep 24 08:08:18 2013 -0700 1.3 @@ -0,0 +1,63 @@ 1.4 +/* 1.5 + * Copyright 2009 OpenSourceResearchInstitute.org 1.6 + * Licensed under GNU General Public License version 2 1.7 + * 1.8 + * Author: seanhalle@yahoo.com 1.9 + * 1.10 + */ 1.11 + 1.12 + 1.13 +#include <math.h> 1.14 +#include <string.h> 1.15 +#include "DKU__Test_App.h" 1.16 + 1.17 +/*Bare smoke test of DKU wrapper library functions. 1.18 + * Create one DKU instance, with a dummy kernel 1.19 + * Bare bones divider and undivider 1.20 + * simple root piece maker 1.21 + * dummy serial kernel 1.22 + */ 1.23 + 1.24 +//==================================================================== 1.25 +#define NO_INPUT NULL 1.26 + /*Just to get proto-runtime built and run, to test it.. 1.27 + */ 1.28 +void test_app_seed_Fn( void *_params, SlaveVP *seedVP ) 1.29 + { DKUInstance *dkuInstance; 1.30 + DKUPiece *rootPiece; 1.31 + int32 size = 1000; 1.32 + int32 *data = (int32 *) PR__malloc (size * sizeof(int32)) ; 1.33 + 1.34 + DEBUG__printf(dbgAppFlow, "In seed Fn") 1.35 + 1.36 + SeedParams *seedParams = (SeedParams *)_params; //used to comm with main() 1.37 + 1.38 + dkuInstance = PRServ__DKU_make_empty_DKU_instance( seedVP ); 1.39 + PRServ__DKU_set_root_piece_maker( dkuInstance, &rootPieceMakerFn, seedVP ); 1.40 + PRServ__DKU_set_kernel( dkuInstance, &kernelFn, seedVP ); 1.41 + PRServ__DKU_set_serial_kernel( dkuInstance, &serialKernelFn, seedVP ); 1.42 + PRServ__DKU_set_divider( dkuInstance, ÷rFn, seedVP ); 1.43 + PRServ__DKU_set_undivider( dkuInstance, &undividerFn, seedVP ); 1.44 + 1.45 + rootPiece = 1.46 + make_root_dku_piece_for_test_inst( data, size, dkuInstance ); 1.47 +// rootPiece = PRServ__DKU_make_root_piece( dkuInstance, data, seedVP ); 1.48 + 1.49 + PRServ__DKU_perform_work_on( rootPiece, seedVP ); 1.50 + 1.51 + PRServ__DKU_wait_for_result_to_be_complete( rootPiece, seedVP ); 1.52 + 1.53 + seedParams->data = data; //sends results back to main() 1.54 + 1.55 + //Tells PR to end the process, which it will do even 1.56 + // if work is active, or suspended work entities are still live, or the 1.57 + // process has input ports that could trigger future work. 1.58 + PR__end_process_from_inside( seedVP ); 1.59 + 1.60 + //This ends the last live entity capable of work, in a process 1.61 + // that has no external input ports.. hence, no activity can take place 1.62 + // past that point.. PR detects that, and then automatically ends the 1.63 + // process. 1.64 + PR__end_seedVP( seedVP ); 1.65 + } 1.66 +
