comparison main.c @ 3:a6b3cab179b1

Added no-measurments option for platforms without support. Added static X86, ARM and basic Kalray build support. This branch requires the longjmp versions of libprt and libvreo
author Philipe Louchtch - de Raadt
date Sat, 12 Jul 2014 20:21:47 +0200
parents 1b61e0c00512
children
comparison
equal deleted inserted replaced
1:56c459606eb1 3:00abe98da05e
1 #include <malloc.h> 1 #ifdef RTEMS
2
3 #include <mppa/osconfig.h>
4
5 #endif
6
2 #include <stdlib.h> 7 #include <stdlib.h>
3 #include <PR__include/PR__WL.h> 8 #include <PR__include/PR__WL.h>
4 9
5 #include "Matrix_Mult.h" 10 #include "Matrix_Mult.h"
6 #include "Reo__Matrix_Mult/Reo__Matrix_Mult.h" 11 #include "Reo__Matrix_Mult/Reo__Matrix_Mult.h"
7 12
8 void set_up_performance_counters(); 13 void set_up_performance_counters();
9 14
10 // ============================================================================= 15 // =============================================================================
11 16
12 int NUM_ITER; 17 int numIterations;
13 18
14 19 int main(int argc, char **argv)
15 int main(int argc, char **argv)
16 { Matrix *leftMatrix, *rightMatrix, *resultMatrix; 20 { Matrix *leftMatrix, *rightMatrix, *resultMatrix;
17 ParamBag *paramBag; 21 ParamBag *paramBag;
18 MatrixMultWorkUnit **workUnits; 22 MatrixMultWorkUnit **workUnits;
19 VPParams *vpParams, **vpParamsArray; 23 VPParams *vpParams, **vpParamsArray;
20 // ProdParams *prodParams; 24 // ProdParams *prodParams;
22 int32 numUnitsToMake, vpIdx; 26 int32 numUnitsToMake, vpIdx;
23 PRProcess *matrixMultProcess; 27 PRProcess *matrixMultProcess;
24 28
25 DEBUG__printf(TRUE, "arguments -- numIter: %s | path: %s", argv[1], argv[2] ); 29 DEBUG__printf(TRUE, "arguments -- numIter: %s | path: %s", argv[1], argv[2] );
26 if(argc < 3) {printf("give: num iter and path to param file on cmd line\n"); exit(1);} 30 if(argc < 3) {printf("give: num iter and path to param file on cmd line\n"); exit(1);}
27 NUM_ITER = atoi(argv[1]); 31 numIterations = atoi(argv[1]);
28 numUnitsToMake = NUM_PROD; //defined by Reo circuit generator 32 numUnitsToMake = NUM_PROD-1; //defined by Reo circuit generator
29 33
30 printf("[reo] Settings: %i workers, %i iterations | file: %s \n", NUM_PROD, NUM_ITER, argv[2]); 34 printf("[reo] Settings: %i workers, %i iterations | file: %s \n", NUM_PROD, numIterations, argv[2]);
31 35
32 set_up_performance_counters(); 36 set_up_performance_counters();
33 37
34 //read parameters, from file whose path is given on command line 38 //read parameters, from file whose path is given on command line
35 paramBag = makeParamBag(); 39 paramBag = makeParamBag();
55 * along to the create_VP part of circuit creation, which will copy the 59 * along to the create_VP part of circuit creation, which will copy the
56 * elements of the array into the param structs given as initData to the 60 * elements of the array into the param structs given as initData to the
57 * VPs, as they are created. 61 * VPs, as they are created.
58 *Need a dummy work unit added to end of work-unit array, to avoid a seg 62 *Need a dummy work unit added to end of work-unit array, to avoid a seg
59 * fault -- just did a bad hack inside divideWork. 63 * fault -- just did a bad hack inside divideWork.
60 //Now, create params struct for each producer -- holds work unit 64 */
61 for( vpIdx=0; vpIdx<numUnitsToMake; vpIdx++)
62 {
63 vpParams = PR__malloc( sizeof(VPParams) );
64 prodParams = PR__malloc( sizeof(ProdParams) );
65
66 vpParams->initData = prodParams;
67 vpParamsArray[vpIdx] = vpParams;
68 }
69 //create params for consumer
70
71 vpParams = PR__malloc( sizeof(VPParams) );
72 = malloc( sizeof(ProdParams) );
73
74 vpParams->initData =
75 vpParamsArray[vpIdx] = vpParams; //this last entry is for the consumer
76 */
77
78 matrixMultProcess = PR__create_process( &matrix_mult__seed_Fn, 65 matrixMultProcess = PR__create_process( &matrix_mult__seed_Fn,
79 workUnits ); 66 workUnits );
80 67
81 PR__wait_for_process_to_end(matrixMultProcess); 68 PR__wait_for_process_to_end(matrixMultProcess);
82 PR__wait_for_all_activity_to_end(); 69 PR__wait_for_all_activity_to_end();
70 DEBUG__printf(dbgAppFlow, "activity ended, about to call PR__shutdown");
83 fflush(stdout); 71 fflush(stdout);
84 PR__shutdown(); 72 PR__shutdown();
85 73
74 printf("Something with done..\n\n");
75 usleep(1000);
76 fflush(stdout);
77
86 exit(0); 78 exit(0);
87 } 79 }
88 80
89 // ============================================================================= 81 // =============================================================================
90 82