Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > DKU > DKU__Test_App
comparison 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 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:117c86687eca |
|---|---|
| 1 /* | |
| 2 * Copyright 2009 OpenSourceResearchInstitute.org | |
| 3 * Licensed under GNU General Public License version 2 | |
| 4 * | |
| 5 * Author: seanhalle@yahoo.com | |
| 6 * | |
| 7 */ | |
| 8 | |
| 9 | |
| 10 #include <math.h> | |
| 11 #include <string.h> | |
| 12 #include "DKU__Test_App.h" | |
| 13 | |
| 14 /*Bare smoke test of DKU wrapper library functions. | |
| 15 * Create one DKU instance, with a dummy kernel | |
| 16 * Bare bones divider and undivider | |
| 17 * simple root piece maker | |
| 18 * dummy serial kernel | |
| 19 */ | |
| 20 | |
| 21 //==================================================================== | |
| 22 #define NO_INPUT NULL | |
| 23 /*Just to get proto-runtime built and run, to test it.. | |
| 24 */ | |
| 25 void test_app_seed_Fn( void *_params, SlaveVP *seedVP ) | |
| 26 { DKUInstance *dkuInstance; | |
| 27 DKUPiece *rootPiece; | |
| 28 int32 size = 1000; | |
| 29 int32 *data = (int32 *) PR__malloc (size * sizeof(int32)) ; | |
| 30 | |
| 31 DEBUG__printf(dbgAppFlow, "In seed Fn") | |
| 32 | |
| 33 SeedParams *seedParams = (SeedParams *)_params; //used to comm with main() | |
| 34 | |
| 35 dkuInstance = PRServ__DKU_make_empty_DKU_instance( seedVP ); | |
| 36 PRServ__DKU_set_root_piece_maker( dkuInstance, &rootPieceMakerFn, seedVP ); | |
| 37 PRServ__DKU_set_kernel( dkuInstance, &kernelFn, seedVP ); | |
| 38 PRServ__DKU_set_serial_kernel( dkuInstance, &serialKernelFn, seedVP ); | |
| 39 PRServ__DKU_set_divider( dkuInstance, ÷rFn, seedVP ); | |
| 40 PRServ__DKU_set_undivider( dkuInstance, &undividerFn, seedVP ); | |
| 41 | |
| 42 rootPiece = | |
| 43 make_root_dku_piece_for_test_inst( data, size, dkuInstance ); | |
| 44 // rootPiece = PRServ__DKU_make_root_piece( dkuInstance, data, seedVP ); | |
| 45 | |
| 46 PRServ__DKU_perform_work_on( rootPiece, seedVP ); | |
| 47 | |
| 48 PRServ__DKU_wait_for_result_to_be_complete( rootPiece, seedVP ); | |
| 49 | |
| 50 seedParams->data = data; //sends results back to main() | |
| 51 | |
| 52 //Tells PR to end the process, which it will do even | |
| 53 // if work is active, or suspended work entities are still live, or the | |
| 54 // process has input ports that could trigger future work. | |
| 55 PR__end_process_from_inside( seedVP ); | |
| 56 | |
| 57 //This ends the last live entity capable of work, in a process | |
| 58 // that has no external input ports.. hence, no activity can take place | |
| 59 // past that point.. PR detects that, and then automatically ends the | |
| 60 // process. | |
| 61 PR__end_seedVP( seedVP ); | |
| 62 } | |
| 63 |
