/* ============================================================================= * main * ============================================================================= */ MAIN(argc, argv) { manager_t* managerPtr; client_t** clients; TIMER_T start; TIMER_T stop; /* Initialization */ parseArgs(argc, (char** const)argv); SIM_GET_NUM_CPU(global_params[PARAM_CLIENTS]); managerPtr = initializeManager(); assert(managerPtr != NULL); clients = initializeClients(managerPtr); assert(clients != NULL); long numThread = global_params[PARAM_CLIENTS]; TM_STARTUP(numThread); P_MEMORY_STARTUP(numThread); thread_startup(numThread); /* Run transactions */ printf("Running clients... "); fflush(stdout); GOTO_SIM(); TIMER_READ(start); #ifdef OTM #pragma omp parallel { client_run(clients); } #else thread_start(client_run, (void*)clients); #endif TIMER_READ(stop); GOTO_REAL(); puts("done."); printf("Time = %0.6lf\n", TIMER_DIFF_SECONDS(start, stop)); fflush(stdout); checkTables(managerPtr); /* Clean up */ printf("Deallocating memory... "); fflush(stdout); freeClients(clients); /* * TODO: The contents of the manager's table need to be deallocated. */ manager_free(managerPtr); puts("done."); fflush(stdout); TM_SHUTDOWN(); P_MEMORY_SHUTDOWN(); thread_shutdown(); MAIN_RETURN(0); }
/* ============================================================================= * main * ============================================================================= */ MAIN(argc, argv) { GOTO_REAL(); SETUP_NUMBER_TASKS(6); /* * Initialization */ parseArgs(argc, (char** const)argv); SIM_GET_NUM_CPU(global_numThread); TM_STARTUP(global_numThread, 0); P_MEMORY_STARTUP(global_numThread); SETUP_NUMBER_THREADS(global_numThread); thread_startup(global_numThread); int repeat = global_repeats; double time_total = 0.0; double energy_total = 0.0; for (; repeat > 0; --repeat) { global_meshPtr = mesh_alloc(); assert(global_meshPtr); long initNumElement = mesh_read(global_meshPtr, global_inputPrefix); global_workHeapPtr = heap_alloc(1, &element_heapCompare); assert(global_workHeapPtr); long initNumBadElement = initializeWork(global_workHeapPtr, global_meshPtr); TIMER_T start; TIMER_READ(start); GOTO_SIM(); thread_start(process, NULL); GOTO_REAL(); TIMER_T stop; TIMER_READ(stop); double time_tmp = TIMER_DIFF_SECONDS(start, stop); PRINT_STATS(); time_total += time_tmp; } printf("Time = %0.3lf\n", time_total); fflush(stdout); TM_SHUTDOWN(); P_MEMORY_SHUTDOWN(); GOTO_SIM(); thread_shutdown(); MAIN_RETURN(0); }
MAIN(argc, argv) { TIMER_T start; TIMER_T stop; GOTO_REAL(); parseArgs(argc, (char** const)argv); long sz = (long)global_params[PARAM_SIZE]; global_array = (aligned_type_t*) malloc(sz * sizeof(aligned_type_t)); long k = 0; for (; k < sz; k++) { global_array[k].value = 0; } long numThread = global_params[PARAM_THREADS]; SIM_GET_NUM_CPU(numThread); TM_STARTUP(numThread); P_MEMORY_STARTUP(numThread); thread_startup(numThread); printf("Running clients... "); fflush(stdout); TIMER_READ(start); GOTO_SIM(); thread_start(client_run, (void*)&numThread); GOTO_REAL(); TIMER_READ(stop); puts("done."); printf("Time = %0.6lf\n", TIMER_DIFF_SECONDS(start, stop)); fflush(stdout); long i = 0; long sum = 0; for (;i < sz; i++) { sum += global_array[i].value; // printf("%ld\n", global_array[i].value); } if (sum != 0) { printf("Problem, sum was not zero!: %ld\n", sum); } TM_SHUTDOWN(); P_MEMORY_SHUTDOWN(); GOTO_SIM(); thread_shutdown(); MAIN_RETURN(0); }
static void timer_source_suspend(struct clocksource *cs) { struct timer_info *info = tm_source_info(); int ch = info->channel; info->rcount = (info->tcount - TIMER_READ(ch)); timer_stop(ch, 0); }
static cycle_t timer_source_read(struct clocksource *cs) { struct timer_info *info = tm_source_info(); int ch = info->channel; info->rcount = (info->tcount - TIMER_READ(ch)); return (cycle_t)info->rcount; }
ulong lltime_get(void) { int ch = CFG_TIMER_DBG_TICK_CH; ulong count = (-1UL); ulong tcnt = TIMER_READ(ch); if (false == __dbg_timer_run) return 0; return (count - tcnt)/TIMER_SYS_HZ; /* unit us */ }
static void test (long numVar, long numRecord) { random_t* randomPtr = random_alloc(); data_t* dataPtr = data_alloc(numVar, numRecord, randomPtr); assert(dataPtr); data_generate(dataPtr, 0, 10, 10); if (global_doPrint) { printData(dataPtr); } data_t* copyDataPtr = data_alloc(numVar, numRecord, randomPtr); assert(copyDataPtr); data_copy(copyDataPtr, dataPtr); adtree_t* adtreePtr = adtree_alloc(); assert(adtreePtr); TIMER_T start; TIMER_READ(start); adtree_make(adtreePtr, copyDataPtr); TIMER_T stop; TIMER_READ(stop); printf("%lf\n", TIMER_DIFF_SECONDS(start, stop)); if (global_doPrint) { printAdtree(adtreePtr); } testCounts(adtreePtr, dataPtr); adtree_free(adtreePtr); random_free(randomPtr); data_free(dataPtr); }
/* ============================================================================= * main * ============================================================================= */ MAIN(argc, argv) { GOTO_REAL(); /* * Initialization */ parseArgs(argc, (char** const)argv); long numThread = global_params[PARAM_THREAD]; SIM_GET_NUM_CPU(numThread); TM_STARTUP(numThread); P_MEMORY_STARTUP(numThread); thread_startup(numThread); long percentAttack = global_params[PARAM_ATTACK]; long maxDataLength = global_params[PARAM_LENGTH]; long numFlow = global_params[PARAM_NUM]; long randomSeed = global_params[PARAM_SEED]; printf("Percent attack = %li\n", percentAttack); printf("Max data length = %li\n", maxDataLength); printf("Num flow = %li\n", numFlow); printf("Random seed = %li\n", randomSeed); dictionary_t* dictionaryPtr = dictionary_alloc(); assert(dictionaryPtr); stream_t* streamPtr = stream_alloc(percentAttack); assert(streamPtr); long numAttack = stream_generate(streamPtr, dictionaryPtr, numFlow, randomSeed, maxDataLength); printf("Num attack = %li\n", numAttack); decoder_t* decoderPtr = decoder_alloc(); assert(decoderPtr); vector_t** errorVectors = (vector_t**)malloc(numThread * sizeof(vector_t*)); assert(errorVectors); long i; for (i = 0; i < numThread; i++) { vector_t* errorVectorPtr = vector_alloc(numFlow); assert(errorVectorPtr); errorVectors[i] = errorVectorPtr; } arg_t arg; arg.streamPtr = streamPtr; arg.decoderPtr = decoderPtr; arg.errorVectors = errorVectors; /* * Run transactions */ TIMER_T startTime; TIMER_READ(startTime); GOTO_SIM(); #ifdef OTM #pragma omp parallel { processPackets((void*)&arg); } #else thread_start(processPackets, (void*)&arg); #endif GOTO_REAL(); TIMER_T stopTime; TIMER_READ(stopTime); printf("\nTime = %lf\n", TIMER_DIFF_SECONDS(startTime, stopTime)); /* * Check solution */ /*long numFound = 0; for (i = 0; i < numThread; i++) { vector_t* errorVectorPtr = errorVectors[i]; long e; long numError = vector_getSize(errorVectorPtr); numFound += numError; for (e = 0; e < numError; e++) { long flowId = (long)vector_at(errorVectorPtr, e); bool_t status = stream_isAttack(streamPtr, flowId); assert(status); } }*/ /*printf("Num found = %li\n", numFound); assert(numFound == numAttack);*/ /* * Clean up */ for (i = 0; i < numThread; i++) { vector_free(errorVectors[i]); } free(errorVectors); decoder_free(decoderPtr); stream_free(streamPtr); dictionary_free(dictionaryPtr); TM_SHUTDOWN(); P_MEMORY_SHUTDOWN(); GOTO_SIM(); thread_shutdown(); MAIN_RETURN(0); }
/* ============================================================================= * main * ============================================================================= */ int main (int argc, char** argv) { int result = 0; TIMER_T start; TIMER_T stop; /* Initialization */ parseArgs(argc, (char** const)argv); printf("Creating gene and segments... "); fflush(stdout); long geneLength = global_params[PARAM_GENE]; long segmentLength = global_params[PARAM_SEGMENT]; long minNumSegment = global_params[PARAM_NUMBER]; long numThread = global_params[PARAM_THREAD]; thread_startup(numThread); random_t* randomPtr = random_alloc(); assert(randomPtr != NULL); random_seed(randomPtr, 0); gene_t* genePtr = gene_alloc(geneLength); assert( genePtr != NULL); gene_create(genePtr, randomPtr); char* gene = genePtr->contents; segments_t* segmentsPtr = segments_alloc(segmentLength, minNumSegment); assert(segmentsPtr != NULL); segments_create(segmentsPtr, genePtr, randomPtr); sequencer_t* sequencerPtr = sequencer_alloc(geneLength, segmentLength, segmentsPtr); assert(sequencerPtr != NULL); puts("done."); printf("Gene length = %li\n", genePtr->length); printf("Segment length = %li\n", segmentsPtr->length); printf("Number segments = %li\n", vector_getSize(segmentsPtr->contentsPtr)); fflush(stdout); /* Benchmark */ printf("Sequencing gene... "); fflush(stdout); TIMER_READ(start); #ifdef OTM #pragma omp parallel { sequencer_run(sequencerPtr); } #else thread_start(sequencer_run, (void*)sequencerPtr); #endif TIMER_READ(stop); puts("done."); printf("Time = %lf\n", TIMER_DIFF_SECONDS(start, stop)); fflush(stdout); /* Check result */ { char* sequence = sequencerPtr->sequence; result = strcmp(gene, sequence); printf("Sequence matches gene: %s\n", (result ? "no" : "yes")); if (result) { printf("gene = %s\n", gene); printf("sequence = %s\n", sequence); } fflush(stdout); assert(strlen(sequence) >= strlen(gene)); } /* Clean up */ printf("Deallocating memory... "); fflush(stdout); sequencer_free(sequencerPtr); segments_free(segmentsPtr); gene_free(genePtr); random_free(randomPtr); puts("done."); fflush(stdout); thread_shutdown(); return result; }
/* ============================================================================= * main * ============================================================================= */ MAIN(argc, argv) { char exitmsg[1024]; GOTO_REAL(); load_syncchar_map("sync_char.map.yada"); /* * Initialization */ parseArgs(argc, (char** const)argv); sprintf(exitmsg, "END BENCHMARK %s-parallel-phase\n", argv[0]); SIM_GET_NUM_CPU(global_numThread); TM_STARTUP(global_numThread); P_MEMORY_STARTUP(global_numThread); thread_startup(global_numThread); global_meshPtr = mesh_alloc(); assert(global_meshPtr); printf("Angle constraint = %lf\n", global_angleConstraint); printf("Reading input... "); long initNumElement = mesh_read(global_meshPtr, global_inputPrefix); puts("done."); global_workHeapPtr = heap_alloc(1, &element_heapCompare); assert(global_workHeapPtr); long initNumBadElement = initializeWork(global_workHeapPtr, global_meshPtr); printf("Initial number of mesh elements = %li\n", initNumElement); printf("Initial number of bad elements = %li\n", initNumBadElement); printf("Starting triangulation..."); fflush(stdout); /* * Run benchmark */ TIMER_T start; TIMER_READ(start); OSA_PRINT("entering parallel phase\n",0); START_INSTRUMENTATION(); GOTO_SIM(); #ifdef OTM #pragma omp parallel { process(); } #else thread_start(process, NULL); #endif GOTO_REAL(); OSA_PRINT("exiting parallel phase\n",0); OSA_PRINT(exitmsg,0); STOP_INSTRUMENTATION(); TIMER_T stop; TIMER_READ(stop) puts(" done."); printf("Elapsed time = %0.3lf\n", TIMER_DIFF_SECONDS(start, stop)); fflush(stdout); /* * Check solution */ long finalNumElement = initNumElement + global_totalNumAdded; printf("Final mesh size = %li\n", finalNumElement); printf("Number of elements processed = %li\n", global_numProcess); fflush(stdout); #if 0 bool_t isSuccess = mesh_check(global_meshPtr, finalNumElement); #else bool_t isSuccess = TRUE; #endif printf("Final mesh is %s\n", (isSuccess ? "valid." : "INVALID!")); fflush(stdout); assert(isSuccess); /* * TODO: deallocate mesh and work heap */ TM_SHUTDOWN(); P_MEMORY_SHUTDOWN(); GOTO_SIM(); thread_shutdown(); MAIN_RETURN(0); }
/* ============================================================================= * main * ============================================================================= */ MAIN (argc,argv) { TIMER_T start; TIMER_T stop; GOTO_REAL(); /* Initialization */ parseArgs(argc, (char** const)argv); SIM_GET_NUM_CPU(global_params[PARAM_THREAD]); printf("Creating gene and segments... "); fflush(stdout); long geneLength = global_params[PARAM_GENE]; long segmentLength = global_params[PARAM_SEGMENT]; long minNumSegment = global_params[PARAM_NUMBER]; long numThread = global_params[PARAM_THREAD]; TM_STARTUP(numThread); P_MEMORY_STARTUP(numThread); random_t* randomPtr = random_alloc(); assert(randomPtr != NULL); random_seed(randomPtr, 0); gene_t* genePtr = gene_alloc(geneLength); assert( genePtr != NULL); gene_create(genePtr, randomPtr); char* gene = genePtr->contents; segments_t* segmentsPtr = segments_alloc(segmentLength, minNumSegment); assert(segmentsPtr != NULL); segments_create(segmentsPtr, genePtr, randomPtr); sequencer_t* sequencerPtr = sequencer_alloc(geneLength, segmentLength, segmentsPtr); assert(sequencerPtr != NULL); puts("done."); printf("Gene length = %li\n", genePtr->length); printf("Segment length = %li\n", segmentsPtr->length); printf("Number segments = %li\n", vector_getSize(segmentsPtr->contentsPtr)); fflush(stdout); /* Benchmark */ printf("Sequencing gene... "); fflush(stdout); TIMER_READ(start); GOTO_SIM(); thread_startup(numThread, sequencer_run, (void*)sequencerPtr); thread_start(); GOTO_REAL(); TIMER_READ(stop); puts("done."); printf("Time = %lf\n", TIMER_DIFF_SECONDS(start, stop)); fflush(stdout); /* Check result */ { char* sequence = sequencerPtr->sequence; int result = strcmp(gene, sequence); printf("Sequence matches gene: %s\n", (result ? "no" : "yes")); if (result) { printf("gene = %s\n", gene); printf("sequence = %s\n", sequence); } fflush(stdout); assert(strlen(sequence) >= strlen(gene)); } /* Clean up */ printf("Deallocating memory... "); fflush(stdout); sequencer_free(sequencerPtr); segments_free(segmentsPtr); gene_free(genePtr); random_free(randomPtr); puts("done."); fflush(stdout); al_dump(&sequencerLock); TM_SHUTDOWN(); P_MEMORY_SHUTDOWN(); GOTO_SIM(); thread_shutdown(); MAIN_RETURN(0); }
/* ============================================================================= * main * ============================================================================= */ MAIN(argc, argv) { GOTO_REAL(); /* * Initialization */ parseArgs(argc, (char** const)argv); long numThread = global_params[PARAM_THREAD]; long numVar = global_params[PARAM_VAR]; long numRecord = global_params[PARAM_RECORD]; long randomSeed = global_params[PARAM_SEED]; long maxNumParent = global_params[PARAM_NUMBER]; long percentParent = global_params[PARAM_PERCENT]; global_insertPenalty = global_params[PARAM_INSERT]; global_maxNumEdgeLearned = global_params[PARAM_EDGE]; SIM_GET_NUM_CPU(numThread); TM_STARTUP(numThread); P_MEMORY_STARTUP(numThread); thread_startup(numThread); printf("Random seed = %li\n", randomSeed); printf("Number of vars = %li\n", numVar); printf("Number of records = %li\n", numRecord); printf("Max num parents = %li\n", maxNumParent); printf("%% chance of parent = %li\n", percentParent); printf("Insert penalty = %li\n", global_insertPenalty); printf("Max num edge learned / var = %li\n", global_maxNumEdgeLearned); printf("Operation quality factor = %f\n", global_operationQualityFactor); fflush(stdout); /* * Generate data */ printf("Generating data... "); fflush(stdout); random_t* randomPtr = random_alloc(); assert(randomPtr); random_seed(randomPtr, randomSeed); data_t* dataPtr = data_alloc(numVar, numRecord, randomPtr); assert(dataPtr); net_t* netPtr = data_generate(dataPtr, -1, maxNumParent, percentParent); puts("done."); fflush(stdout); /* * Generate adtree */ adtree_t* adtreePtr = adtree_alloc(); assert(adtreePtr); printf("Generating adtree... "); fflush(stdout); TIMER_T adtreeStartTime; TIMER_READ(adtreeStartTime); adtree_make(adtreePtr, dataPtr); TIMER_T adtreeStopTime; TIMER_READ(adtreeStopTime); puts("done."); fflush(stdout); printf("Adtree time = %f\n", TIMER_DIFF_SECONDS(adtreeStartTime, adtreeStopTime)); fflush(stdout); /* * Score original network */ float actualScore = score(netPtr, adtreePtr); net_free(netPtr); /* * Learn structure of Bayesian network */ learner_t* learnerPtr = learner_alloc(dataPtr, adtreePtr, numThread); assert(learnerPtr); data_free(dataPtr); /* save memory */ printf("Learning structure..."); fflush(stdout); TIMER_T learnStartTime; TIMER_READ(learnStartTime); GOTO_SIM(); learner_run(learnerPtr); GOTO_REAL(); TIMER_T learnStopTime; TIMER_READ(learnStopTime); puts("done."); fflush(stdout); printf("Time = %f\n", TIMER_DIFF_SECONDS(learnStartTime, learnStopTime)); fflush(stdout); /* * Check solution */ bool_t status = net_isCycle(learnerPtr->netPtr); assert(!status); #ifndef SIMULATOR float learnScore = learner_score(learnerPtr); printf("Learn score = %f\n", learnScore); #endif printf("Actual score = %f\n", actualScore); /* * Clean up */ fflush(stdout); random_free(randomPtr); #ifndef SIMULATOR adtree_free(adtreePtr); # if 0 learner_free(learnerPtr); # endif #endif TM_SHUTDOWN(); P_MEMORY_SHUTDOWN(); GOTO_SIM(); thread_shutdown(); MAIN_RETURN(0); }
MAIN(argc, argv) { GOTO_REAL(); SETUP_NUMBER_TASKS(10); /* * Tuple for Scalable Data Generation * stores startVertex, endVertex, long weight and other info */ graphSDG* SDGdata; /* * The graph data structure for this benchmark - see defs.h */ graph* G; #ifdef ENABLE_KERNEL2 /* * Kernel 2 */ edge* maxIntWtList; edge* soughtStrWtList; long maxIntWtListSize; long soughtStrWtListSize; #endif /* ENABLE_KERNEL2 */ #ifdef ENABLE_KERNEL3 # ifndef ENABLE_KERNEL2 # error KERNEL3 requires KERNEL2 # endif /* * Kernel 3 */ V* intWtVList = NULL; V* strWtVList = NULL; Vl** intWtVLList = NULL; Vl** strWtVLList = NULL; Vd* intWtVDList = NULL; Vd* strWtVDList = NULL; #endif /* ENABLE_KERNEL3 */ double totalTime = 0.0; /* ------------------------------------------------------------------------- * Preamble * ------------------------------------------------------------------------- */ /* * User Interface: Configurable parameters, and global program control */ getUserParameters(argc, (char** const) argv); SIM_GET_NUM_CPU(THREADS); TM_STARTUP(THREADS, 0); P_MEMORY_STARTUP(THREADS); SETUP_NUMBER_THREADS(THREADS); thread_startup(THREADS); double time_total = 0.0; int repeat = REPEATS; for (; repeat > 0; --repeat) { SDGdata = (graphSDG*)malloc(sizeof(graphSDG)); assert(SDGdata); genScalData_seq(SDGdata); G = (graph*)malloc(sizeof(graph)); assert(G); computeGraph_arg_t computeGraphArgs; computeGraphArgs.GPtr = G; computeGraphArgs.SDGdataPtr = SDGdata; TIMER_T start; TIMER_READ(start); GOTO_SIM(); thread_start(computeGraph, (void*)&computeGraphArgs); GOTO_REAL(); TIMER_T stop; TIMER_READ(stop); double time_tmp = TIMER_DIFF_SECONDS(start, stop); PRINT_STATS(); time_total += time_tmp; } totalTime += time_total; #ifdef ENABLE_KERNEL2 /* ------------------------------------------------------------------------- * Kernel 2 - Find Max weight and sought string * ------------------------------------------------------------------------- */ printf("\nKernel 2 - getStartLists() beginning execution...\n"); maxIntWtListSize = 0; soughtStrWtListSize = 0; maxIntWtList = (edge*)malloc(sizeof(edge)); assert(maxIntWtList); soughtStrWtList = (edge*)malloc(sizeof(edge)); assert(soughtStrWtList); getStartLists_arg_t getStartListsArg; getStartListsArg.GPtr = G; getStartListsArg.maxIntWtListPtr = &maxIntWtList; getStartListsArg.maxIntWtListSize = &maxIntWtListSize; getStartListsArg.soughtStrWtListPtr = &soughtStrWtList; getStartListsArg.soughtStrWtListSize = &soughtStrWtListSize; TIMER_READ(start); GOTO_SIM(); #ifdef OTM #pragma omp parallel { getStartLists((void*)&getStartListsArg); } #else thread_start(getStartLists, (void*)&getStartListsArg); #endif GOTO_REAL(); TIMER_T stop; TIMER_READ(stop); time = TIMER_DIFF_SECONDS(start, stop); totalTime += time; printf("\n\tgetStartLists() completed execution.\n"); printf("\nTime taken for kernel 2 is %9.6f sec.\n\n", time); #endif /* ENABLE_KERNEL2 */ #ifdef ENABLE_KERNEL3 /* ------------------------------------------------------------------------- * Kernel 3 - Graph Extraction * ------------------------------------------------------------------------- */ printf("\nKernel 3 - findSubGraphs() beginning execution...\n"); if (K3_DS == 0) { intWtVList = (V*)malloc(G->numVertices * maxIntWtListSize * sizeof(V)); assert(intWtVList); strWtVList = (V*)malloc(G->numVertices * soughtStrWtListSize * sizeof(V)); assert(strWtVList); findSubGraphs0_arg_t findSubGraphs0Arg; findSubGraphs0Arg.GPtr = G; findSubGraphs0Arg.intWtVList = intWtVList; findSubGraphs0Arg.strWtVList = strWtVList; findSubGraphs0Arg.maxIntWtList = maxIntWtList; findSubGraphs0Arg.maxIntWtListSize = maxIntWtListSize; findSubGraphs0Arg.soughtStrWtList = soughtStrWtList; findSubGraphs0Arg.soughtStrWtListSize = soughtStrWtListSize; TIMER_READ(start); GOTO_SIM(); #ifdef OTM #pragma omp parallel { findSubGraphs0((void*)&findSubGraphs0Arg); } #else thread_start(findSubGraphs0, (void*)&findSubGraphs0Arg); #endif GOTO_REAL(); TIMER_READ(stop); } else if (K3_DS == 1) { intWtVLList = (Vl**)malloc(maxIntWtListSize * sizeof(Vl*)); assert(intWtVLList); strWtVLList = (Vl**)malloc(soughtStrWtListSize * sizeof(Vl*)); assert(strWtVLList); findSubGraphs1_arg_t findSubGraphs1Arg; findSubGraphs1Arg.GPtr = G; findSubGraphs1Arg.intWtVLList = intWtVLList; findSubGraphs1Arg.strWtVLList = strWtVLList; findSubGraphs1Arg.maxIntWtList = maxIntWtList; findSubGraphs1Arg.maxIntWtListSize = maxIntWtListSize; findSubGraphs1Arg.soughtStrWtList = soughtStrWtList; findSubGraphs1Arg.soughtStrWtListSize = soughtStrWtListSize; TIMER_READ(start); GOTO_SIM(); #ifdef OTM #pragma omp parallel { findSubGraphs1((void*)&findSubGraphs1Arg); } #else thread_start(findSubGraphs1, (void*)&findSubGraphs1Arg); #endif GOTO_REAL(); TIMER_READ(stop); /* Verification on_one_thread { for (i=0; i<maxIntWtListSize; i++) { printf("%ld -- ", i); currV = intWtVLList[i]; while (currV != NULL) { printf("[%ld %ld] ", currV->num, currV->depth); currV = currV->next; } printf("\n"); } for (i=0; i<soughtStrWtListSize; i++) { printf("%ld -- ", i); currV = strWtVLList[i]; while (currV != NULL) { printf("[%ld %ld] ", currV->num, currV->depth); currV = currV->next; } printf("\n"); } } */ } else if (K3_DS == 2) { intWtVDList = (Vd *) malloc(maxIntWtListSize * sizeof(Vd)); assert(intWtVDList); strWtVDList = (Vd *) malloc(soughtStrWtListSize * sizeof(Vd)); assert(strWtVDList); findSubGraphs2_arg_t findSubGraphs2Arg; findSubGraphs2Arg.GPtr = G; findSubGraphs2Arg.intWtVDList = intWtVDList; findSubGraphs2Arg.strWtVDList = strWtVDList; findSubGraphs2Arg.maxIntWtList = maxIntWtList; findSubGraphs2Arg.maxIntWtListSize = maxIntWtListSize; findSubGraphs2Arg.soughtStrWtList = soughtStrWtList; findSubGraphs2Arg.soughtStrWtListSize = soughtStrWtListSize; TIMER_READ(start); GOTO_SIM(); #ifdef OTM #pragma omp parallel { findSubGraphs2((void*)&findSubGraphs2Arg); } #else thread_start(findSubGraphs2, (void*)&findSubGraphs2Arg); #endif GOTO_REAL(); TIMER_READ(stop); /* Verification */ /* on_one_thread { printf("\nInt weight sub-graphs \n"); for (i=0; i<maxIntWtListSize; i++) { printf("%ld -- ", i); for (j=0; j<intWtVDList[i].numArrays; j++) { printf("\n [Array %ld] - \n", j); for (k=0; k<intWtVDList[i].arraySize[j]; k++) { printf("[%ld %ld] ", intWtVDList[i].vList[j][k].num, intWtVDList[i].vList[j][k].depth); } } printf("\n"); } printf("\nStr weight sub-graphs \n"); for (i=0; i<soughtStrWtListSize; i++) { printf("%ld -- ", i); for (j=0; j<strWtVDList[i].numArrays; j++) { printf("\n [Array %ld] - \n", j); for (k=0; k<strWtVDList[i].arraySize[j]; k++) { printf("[%ld %ld] ", strWtVDList[i].vList[j][k].num, strWtVDList[i].vList[j][k].depth); } } printf("\n"); } } */ } else { assert(0); } time = TIMER_DIFF_SECONDS(start, stop); totalTime += time; printf("\n\tfindSubGraphs() completed execution.\n"); printf("\nTime taken for kernel 3 is %9.6f sec.\n\n", time); #endif /* ENABLE_KERNEL3 */ #ifdef ENABLE_KERNEL4 /* ------------------------------------------------------------------------- * Kernel 4 - Graph Clustering * ------------------------------------------------------------------------- */ printf("\nKernel 4 - cutClusters() beginning execution...\n"); TIMER_READ(start); GOTO_SIM(); #ifdef OTM #pragma omp parallel { cutClusters((void*)G); } #else thread_start(cutClusters, (void*)G); #endif GOTO_REAL(); TIMER_READ(stop); time = TIMER_DIFF_SECONDS(start, stop); totalTime += time; printf("\n\tcutClusters() completed execution.\n"); printf("\nTime taken for Kernel 4 is %9.6f sec.\n\n", time); #endif /* ENABLE_KERNEL4 */ printf("Time = %9.6f \n", totalTime); /* ------------------------------------------------------------------------- * Cleanup * ------------------------------------------------------------------------- */ P_FREE(G->outDegree); P_FREE(G->outVertexIndex); P_FREE(G->outVertexList); P_FREE(G->paralEdgeIndex); P_FREE(G->inDegree); P_FREE(G->inVertexIndex); P_FREE(G->inVertexList); P_FREE(G->intWeight); P_FREE(G->strWeight); #ifdef ENABLE_KERNEL3 LONGINT_T i; LONGINT_T j; Vl* currV; Vl* tempV; if (K3_DS == 0) { P_FREE(strWtVList); P_FREE(intWtVList); } if (K3_DS == 1) { for (i = 0; i < maxIntWtListSize; i++) { currV = intWtVLList[i]; while (currV != NULL) { tempV = currV->next; P_FREE(currV); currV = tempV; } } for (i = 0; i < soughtStrWtListSize; i++) { currV = strWtVLList[i]; while (currV != NULL) { tempV = currV->next; P_FREE(currV); currV = tempV; } } P_FREE(strWtVLList); P_FREE(intWtVLList); } if (K3_DS == 2) { for (i = 0; i < maxIntWtListSize; i++) { for (j = 0; j < intWtVDList[i].numArrays; j++) { P_FREE(intWtVDList[i].vList[j]); } P_FREE(intWtVDList[i].vList); P_FREE(intWtVDList[i].arraySize); } for (i = 0; i < soughtStrWtListSize; i++) { for (j = 0; j < strWtVDList[i].numArrays; j++) { P_FREE(strWtVDList[i].vList[j]); } P_FREE(strWtVDList[i].vList); P_FREE(strWtVDList[i].arraySize); } P_FREE(strWtVDList); P_FREE(intWtVDList); } P_FREE(soughtStrWtList); P_FREE(maxIntWtList); #endif /* ENABLE_KERNEL2 */ P_FREE(SOUGHT_STRING); P_FREE(G); P_FREE(SDGdata); TM_SHUTDOWN(); P_MEMORY_SHUTDOWN(); GOTO_SIM(); thread_shutdown(); MAIN_RETURN(0); }
/* ============================================================================= * main * ============================================================================= */ MAIN (argc,argv) { TIMER_T start; TIMER_T stop; /* Initialization */ parseArgs(argc, (char** const)argv); SIM_GET_NUM_CPU(global_params[PARAM_THREAD]); printf("Creating gene and segments... "); fflush(stdout); long geneLength = global_params[PARAM_GENE]; long segmentLength = global_params[PARAM_SEGMENT]; long minNumSegment = global_params[PARAM_NUMBER]; long numThread = global_params[PARAM_THREAD]; random_t* randomPtr; gene_t* genePtr; char* gene; segments_t* segmentsPtr; sequencer_t* sequencerPtr; TM_STARTUP(numThread); P_MEMORY_STARTUP(numThread); TM_THREAD_ENTER(); // TM_BEGIN(); randomPtr= random_alloc(); assert(randomPtr != NULL); random_seed(randomPtr, 0); genePtr = gene_alloc(geneLength); assert( genePtr != NULL); gene_create(genePtr, randomPtr); gene = genePtr->contents; segmentsPtr = segments_alloc(segmentLength, minNumSegment); assert(segmentsPtr != NULL); segments_create(segmentsPtr, genePtr, randomPtr); sequencerPtr = sequencer_alloc(geneLength, segmentLength, segmentsPtr); assert(sequencerPtr != NULL); //TM_END(); thread_startup(numThread); puts("done."); printf("Gene length = %li\n", genePtr->length); printf("Segment length = %li\n", segmentsPtr->length); printf("Number segments = %li\n", vector_getSize(segmentsPtr->contentsPtr)); fflush(stdout); /* Benchmark */ printf("Sequencing gene... "); fflush(stdout); // NB: Since ASF/PTLSim "REAL" is native execution, and since we are using // wallclock time, we want to be sure we read time inside the // simulator, or else we report native cycles spent on the benchmark // instead of simulator cycles. GOTO_SIM(); TIMER_READ(start); #ifdef OTM #pragma omp parallel { sequencer_run(sequencerPtr); } #else thread_start(sequencer_run, (void*)sequencerPtr); #endif TIMER_READ(stop); // NB: As above, timer reads must be done inside of the simulated region // for PTLSim/ASF GOTO_REAL(); puts("done."); printf("Time = %lf\n", TIMER_DIFF_SECONDS(start, stop)); fflush(stdout); /* Check result */ { char* sequence; int result; //TM_BEGIN(); sequence= sequencerPtr->sequence; result = strcmp(gene, sequence); //TM_END(); printf("Sequence matches gene: %s\n", (result ? "no" : "yes")); if (result) { printf("gene = %s\n", gene); printf("sequence = %s\n", sequence); } fflush(stdout); assert(strlen(sequence) >= strlen(gene)); } /* Clean up */ printf("Deallocating memory... "); fflush(stdout); sequencer_free(sequencerPtr); segments_free(segmentsPtr); gene_free(genePtr); random_free(randomPtr); puts("done."); fflush(stdout); TM_SHUTDOWN(); P_MEMORY_SHUTDOWN(); thread_shutdown(); MAIN_RETURN(0); }
/* ============================================================================= * main * ============================================================================= */ MAIN(argc, argv) { /* * Initialization */ parseArgs(argc, (char** const)argv); long numThread = global_params[PARAM_THREAD]; SIM_GET_NUM_CPU(numThread); TM_STARTUP(numThread); P_MEMORY_STARTUP(numThread); thread_startup(numThread); maze_t* mazePtr = maze_alloc(); assert(mazePtr); long numPathToRoute = maze_read(mazePtr, global_inputFile); router_t* routerPtr = router_alloc(global_params[PARAM_XCOST], global_params[PARAM_YCOST], global_params[PARAM_ZCOST], global_params[PARAM_BENDCOST]); assert(routerPtr); list_t* pathVectorListPtr = list_alloc(NULL); assert(pathVectorListPtr); /* * Run transactions */ router_solve_arg_t routerArg = {routerPtr, mazePtr, pathVectorListPtr}; // NB: Since ASF/PTLSim "REAL" is native execution, and since we are using // wallclock time, we want to be sure we read time inside the // simulator, or else we report native cycles spent on the benchmark // instead of simulator cycles. GOTO_SIM(); TIMER_T startTime; TIMER_READ(startTime); #ifdef OTM #pragma omp parallel { router_solve((void *)&routerArg); } #else thread_start(router_solve, (void*)&routerArg); #endif TIMER_T stopTime; TIMER_READ(stopTime); // NB: As above, timer reads must be done inside of the simulated region // for PTLSim/ASF GOTO_REAL(); long numPathRouted = 0; list_iter_t it; list_iter_reset(&it, pathVectorListPtr); while (list_iter_hasNext(&it, pathVectorListPtr)) { vector_t* pathVectorPtr = (vector_t*)list_iter_next(&it, pathVectorListPtr); numPathRouted += vector_getSize(pathVectorPtr); } printf("Paths routed = %li\n", numPathRouted); printf("Elapsed time = %f seconds\n", TIMER_DIFF_SECONDS(startTime, stopTime)); /* * Check solution and clean up */ assert(numPathRouted <= numPathToRoute); bool status = maze_checkPaths(mazePtr, pathVectorListPtr, global_doPrint); assert(status); puts("Verification passed."); maze_free(mazePtr); router_free(routerPtr); TM_SHUTDOWN(); P_MEMORY_SHUTDOWN(); thread_shutdown(); MAIN_RETURN(0); }
/* ============================================================================= * main * ============================================================================= */ MAIN(argc, argv) { GOTO_REAL(); /* * Initialization */ SETUP_NUMBER_TASKS(3); parseArgs(argc, (char** const)argv); long numThread = global_params[PARAM_THREAD]; SETUP_NUMBER_THREADS(numThread); SIM_GET_NUM_CPU(numThread); TM_STARTUP(numThread, 0); P_MEMORY_STARTUP(numThread); thread_startup(numThread); long percentAttack = global_params[PARAM_ATTACK]; long maxDataLength = global_params[PARAM_LENGTH]; long numFlow = global_params[PARAM_NUM]; long randomSeed = global_params[PARAM_SEED]; /* printf("Percent attack = %li\n", percentAttack); printf("Max data length = %li\n", maxDataLength); printf("Num flow = %li\n", numFlow); printf("Random seed = %li\n", randomSeed); */ double time_total = 0.0; int repeats = global_params[PARAM_REPEAT]; for (; repeats > 0; --repeats) { dictionary_t* dictionaryPtr = dictionary_alloc(); assert(dictionaryPtr); stream_t* streamPtr = stream_alloc(percentAttack); assert(streamPtr); long numAttack = stream_generate(streamPtr, dictionaryPtr, numFlow, randomSeed, maxDataLength); // printf("Num attack = %li\n", numAttack); decoder_t* decoderPtr = decoder_alloc(); assert(decoderPtr); vector_t** errorVectors = (vector_t**)malloc(numThread * sizeof(vector_t*)); assert(errorVectors); long i; for (i = 0; i < numThread; i++) { vector_t* errorVectorPtr = vector_alloc(numFlow); assert(errorVectorPtr); errorVectors[i] = errorVectorPtr; } arg_t arg; arg.streamPtr = streamPtr; arg.decoderPtr = decoderPtr; arg.errorVectors = errorVectors; /* * Run transactions */ TIMER_T startTime; TIMER_READ(startTime); tm_time_t start_clock=TM_TIMER_READ(); GOTO_SIM(); thread_start(processPackets, (void*)&arg); GOTO_REAL(); TIMER_T stopTime; tm_time_t end_clock=TM_TIMER_READ(); TIMER_READ(stopTime); double time_tmp = TIMER_DIFF_SECONDS(startTime, stopTime); time_total += time_tmp; PRINT_STATS(); PRINT_CLOCK_THROUGHPUT(end_clock-start_clock); /* * Check solution */ long numFound = 0; for (i = 0; i < numThread; i++) { vector_t* errorVectorPtr = errorVectors[i]; long e; long numError = vector_getSize(errorVectorPtr); numFound += numError; for (e = 0; e < numError; e++) { long flowId = (long)vector_at(errorVectorPtr, e); bool_t status = stream_isAttack(streamPtr, flowId); assert(status); } } // printf("Num found = %li\n", numFound); assert(numFound == numAttack); /* * Clean up */ for (i = 0; i < numThread; i++) { vector_free(errorVectors[i]); } free(errorVectors); decoder_free(decoderPtr); stream_free(streamPtr); dictionary_free(dictionaryPtr); } printf("Time = %f\n", time_total); TM_SHUTDOWN(); P_MEMORY_SHUTDOWN(); GOTO_SIM(); thread_shutdown(); MAIN_RETURN(0); }
/* ============================================================================= * main * ============================================================================= */ int main (int argc, char** argv) { /* * Initialization */ parseArgs(argc, (char** const)argv); thread_startup(global_numThread); global_meshPtr = mesh_alloc(); assert(global_meshPtr); printf("Angle constraint = %lf\n", global_angleConstraint); printf("Reading input... "); long initNumElement = mesh_read(global_meshPtr, global_inputPrefix); puts("done."); global_workHeapPtr = heap_alloc(1, &element_heapCompare); assert(global_workHeapPtr); long initNumBadElement = initializeWork(global_workHeapPtr, global_meshPtr); printf("Initial number of mesh elements = %li\n", initNumElement); printf("Initial number of bad elements = %li\n", initNumBadElement); printf("Starting triangulation..."); fflush(stdout); /* * Run benchmark */ TIMER_T start; TIMER_READ(start); #ifdef OTM #pragma omp parallel { process(); } #else thread_start(process, NULL); #endif TIMER_T stop; TIMER_READ(stop); puts(" done."); printf("Time = %0.3lf\n", TIMER_DIFF_SECONDS(start, stop)); fflush(stdout); /* * Check solution */ long finalNumElement = initNumElement + global_totalNumAdded; printf("Final mesh size = %li\n", finalNumElement); printf("Number of elements processed = %li\n", global_numProcess); fflush(stdout); #if 0 bool_t isSuccess = mesh_check(global_meshPtr, finalNumElement); #else bool_t isSuccess = TRUE; #endif printf("Final mesh is %s\n", (isSuccess ? "valid." : "INVALID!")); fflush(stdout); assert(isSuccess); /* * TODO: deallocate mesh and work heap */ thread_shutdown(); return 0; }
int main(int argc, char* argv[]) { TIMER_T start; TIMER_T stop; struct option long_options[] = { // These options don't set a flag {"help", no_argument, NULL, 'h'}, {"duration", required_argument, NULL, 'd'}, {"initial-size", required_argument, NULL, 'i'}, {"num-threads", required_argument, NULL, 'n'}, {"range", required_argument, NULL, 'r'}, {"seed", required_argument, NULL, 's'}, {"buckets", required_argument, NULL, 'b'}, {"update-rate", required_argument, NULL, 'u'}, {NULL, 0, NULL, 0} }; int i, c; long val; operations = DEFAULT_DURATION; unsigned int initial = DEFAULT_INITIAL; nb_threads = DEFAULT_NB_THREADS; range = DEFAULT_RANGE; update = DEFAULT_UPDATE; while(1) { i = 0; c = getopt_long(argc, argv, "hd:i:n:b:r:s:u:", long_options, &i); if(c == -1) break; if(c == 0 && long_options[i].flag == 0) c = long_options[i].val; switch(c) { case 0: /* Flag is automatically set */ break; case 'h': printf("intset -- STM stress test " "(linked list)\n" "\n" "Usage:\n" " intset [options...]\n" "\n" "Options:\n" " -h, --help\n" " Print this message\n" " -d, --duration <int>\n" " Test duration in milliseconds (0=infinite, default=" XSTR(DEFAULT_DURATION) ")\n" " -i, --initial-size <int>\n" " Number of elements to insert before test (default=" XSTR(DEFAULT_INITIAL) ")\n" " -n, --num-threads <int>\n" " Number of threads (default=" XSTR(DEFAULT_NB_THREADS) ")\n" " -r, --range <int>\n" " Range of integer values inserted in set (default=" XSTR(DEFAULT_RANGE) ")\n" " -s, --seed <int>\n" " RNG seed (0=time-based, default=" XSTR(DEFAULT_SEED) ")\n" " -u, --update-rate <int>\n" " Percentage of update transactions (default=" XSTR(DEFAULT_UPDATE) ")\n" ); exit(0); case 'd': operations = atoi(optarg); break; case 'i': initial = atoi(optarg); break; case 'n': nb_threads = atoi(optarg); break; case 'r': range = atoi(optarg); break; case 's': seed = atoi(optarg); break; case 'u': update = atoi(optarg); break; case '?': printf("Use -h or --help for help\n"); exit(0); default: exit(1); } } if (seed == 0) srand((int)time(0)); else srand(seed); thread_startup(nb_threads); set = set_new(); /* Populate set */ printf("Adding %d entries to set\n", initial); for (i = 0; i < initial; i++) { val = (rand() % range) + 1; set_seq_add(val); } printf("Initial size: %d\n", set_size(set)); seed = rand(); TIMER_READ(start); startEnergyIntel(); thread_start(test, NULL); TIMER_READ(stop); double energy = endEnergyIntel(); puts("done."); printf("\nTime = %0.6lf\n", TIMER_DIFF_SECONDS(start, stop)); printf("Energy = %0.6lf\n", energy); fflush(stdout); printf("Final size: %d\n", set_size(set)); }
/* ============================================================================= * main * ============================================================================= */ MAIN(argc, argv) { int i; //FILE * wfile; # ifdef SIMULATOR printf("SIMULATOR is defined\n"); # else printf("SIMULATOR is not defined\n"); # endif /* !SIMULATOR */ #if defined(STM) printf("STM is defined\n"); # else printf("STM is not defined\n"); # endif /* !SIMULATOR */ GOTO_REAL(); /* * Initialization */ if(argc !=3) printf("needs two input arguments, \"max_count, num_threads\",argc=%d\n\n", argc); max_count = atoi(argv[1]); long numThread = atoi(argv[2]); if(numThread > MAX_NUM_OF_THREADS) printf("num_threads can be at most %d\n\n", MAX_NUM_OF_THREADS); //else //printf("numThread = %d\n\n", (int)numThread); for(i=0; i<MAX_NUM_OF_THREADS; i++) threads_arg[i]=i; SIM_GET_NUM_CPU(numThread); TM_STARTUP(numThread); P_MEMORY_STARTUP(numThread); thread_startup(numThread); /* * Run transactions */ //router_solve_arg_t routerArg = {routerPtr, mazePtr, pathVectorListPtr}; TIMER_T startTime; TIMER_READ(startTime); GOTO_SIM(); thread_start(func_count, (void*)threads_arg); GOTO_REAL(); TIMER_T stopTime; TIMER_READ(stopTime); //printf("Elapsed time = %f seconds\n", TIMER_DIFF_SECONDS(startTime, stopTime)); /* * Check solution and clean up */ TM_SHUTDOWN(); P_MEMORY_SHUTDOWN(); GOTO_SIM(); thread_shutdown(); //wfile = fopen ("exe_time.txt","a"); //fprintf(wfile, "Elapsed time = %f, Aborts/starts=%f, Aborts=%f, starts=%f\n", TIMER_DIFF_SECONDS(startTime, stopTime), (float)((float)(AbortTally*100)/((float)StartTally)), (float)AbortTally, (float)StartTally); //fclose(wfile); //printf("final value of counter=%d\n\n", my_counter); MAIN_RETURN(0); }
/* ============================================================================= * main * ============================================================================= */ MAIN(argc, argv) { GOTO_REAL(); /* * Initialization */ parseArgs(argc, (char** const)argv); long numThread = global_params[PARAM_THREAD]; SIM_GET_NUM_CPU(numThread); TM_STARTUP(numThread); P_MEMORY_STARTUP(numThread); thread_startup(numThread); maze_t* mazePtr = maze_alloc(); assert(mazePtr); long numPathToRoute = maze_read(mazePtr, global_inputFile); router_t* routerPtr = router_alloc(global_params[PARAM_XCOST], global_params[PARAM_YCOST], global_params[PARAM_ZCOST], global_params[PARAM_BENDCOST]); assert(routerPtr); list_t* pathVectorListPtr = list_alloc(NULL); assert(pathVectorListPtr); /* * Run transactions */ router_solve_arg_t routerArg = {routerPtr, mazePtr, pathVectorListPtr}; TIMER_T startTime; TIMER_READ(startTime); GOTO_SIM(); #ifdef OTM #pragma omp parallel { router_solve((void *)&routerArg); } #else thread_start(router_solve, (void*)&routerArg); #endif GOTO_REAL(); TIMER_T stopTime; TIMER_READ(stopTime); long numPathRouted = 0; list_iter_t it; list_iter_reset(&it, pathVectorListPtr); while (list_iter_hasNext(&it, pathVectorListPtr)) { vector_t* pathVectorPtr = (vector_t*)list_iter_next(&it, pathVectorListPtr); numPathRouted += vector_getSize(pathVectorPtr); } printf("Paths routed = %li\n", numPathRouted); printf("Elapsed time = %f seconds\n", TIMER_DIFF_SECONDS(startTime, stopTime)); /* * Check solution and clean up */ assert(numPathRouted <= numPathToRoute); bool_t status = maze_checkPaths(mazePtr, pathVectorListPtr, global_doPrint); assert(status == TRUE); puts("Verification passed."); maze_free(mazePtr); router_free(routerPtr); TM_SHUTDOWN(); P_MEMORY_SHUTDOWN(); GOTO_SIM(); thread_shutdown(); MAIN_RETURN(0); }
/* ============================================================================= * main * ============================================================================= */ MAIN(argc, argv) { /* * Initialization */ parseArgs(argc, (char** const)argv); SIM_GET_NUM_CPU(global_numThread); TM_STARTUP(global_numThread); P_MEMORY_STARTUP(global_numThread); thread_startup(global_numThread); global_meshPtr = mesh_alloc(); assert(global_meshPtr); printf("Angle constraint = %lf\n", global_angleConstraint); printf("Reading input... "); long initNumElement = mesh_read(global_meshPtr, (char*)global_inputPrefix); puts("done."); global_workHeapPtr = heap_alloc(1, &yada_heapcompare); assert(global_workHeapPtr); long initNumBadElement = initializeWork(global_workHeapPtr, global_meshPtr); printf("Initial number of mesh elements = %li\n", initNumElement); printf("Initial number of bad elements = %li\n", initNumBadElement); printf("Starting triangulation..."); fflush(stdout); /* * Run benchmark */ // NB: Since ASF/PTLSim "REAL" is native execution, and since we are using // wallclock time, we want to be sure we read time inside the // simulator, or else we report native cycles spent on the benchmark // instead of simulator cycles. GOTO_SIM(); TIMER_T start; TIMER_READ(start); #ifdef OTM #pragma omp parallel { process(); } #else thread_start((void(*)(void*))process, NULL); #endif TIMER_T stop; TIMER_READ(stop); // NB: As above, timer reads must be done inside of the simulated region // for PTLSim/ASF GOTO_REAL(); puts(" done."); printf("Elapsed time = %0.3lf\n", TIMER_DIFF_SECONDS(start, stop)); fflush(stdout); /* * Check solution */ long finalNumElement = initNumElement + global_totalNumAdded; printf("Final mesh size = %li\n", finalNumElement); printf("Number of elements processed = %li\n", global_numProcess); fflush(stdout); #if 1 bool isSuccess = mesh_check(global_meshPtr, finalNumElement); #else bool isSuccess = true; #endif printf("Final mesh is %s\n", (isSuccess ? "valid." : "INVALID!")); fflush(stdout); assert(isSuccess); /* * TODO: deallocate mesh and work heap */ TM_SHUTDOWN(); P_MEMORY_SHUTDOWN(); GOTO_SIM(); thread_shutdown(); MAIN_RETURN(0); }