int main (int argc, char *argv[]) { pthread_t t[MAX_THREADS]; int i; // Barrier initialization if(pthread_barrier_init(&barrier, NULL, MAX_THREADS)) { printf("Could not create a barrier\n"); return -1; } Extrae_init (); for (i = 0; i < MAX_THREADS; i++) pthread_create (&t[i], NULL, routine1, (void*) ((long) i)); for (i = 0; i < MAX_THREADS; i++) pthread_join (t[i], NULL); sleep (1); for (i = 0; i < MAX_THREADS; i++) pthread_create (&t[i], NULL, routine2, NULL); for (i = 0; i < MAX_THREADS; i++) pthread_join (t[i], NULL); Extrae_fini(); return 0; }
int main(int argc, char **argv) { // Start Paraver tracing #ifdef PARAVERTRACE Extrae_init(); #endif init(argc, argv); omp_init_lock(&lock); /* GENERATE NEW REFERENCE TIME */ reference("reference time 2", &referatom); /* TEST ATOMIC */ benchmark("ATOMIC", &testatom); #ifdef PARAVERTRACE Extrae_fini(); #endif finalise(); return EXIT_SUCCESS; }
int main(int argc, char *argv[]) { int x = argc; int X[300000]; int a,b,c,d,e,f,g,h; int i; printf("starting program\n"); Extrae_init(); for (i=0; i<3; ++i) { #pragma omp task out (b,c) inout(a) some_work(X, '1'); #pragma omp task inout (b,c) some_work(X, '2'); #pragma omp task inout (b,c) out (a,d) some_work(X, '3'); #pragma omp task in (d) some_work(X, '4'); #pragma omp task in (d) some_work(X, '5'); #pragma omp task inout (a) in(d) some_work(X, '6'); } Extrae_fini(); return 0; }
int main(int argc, char **argv) { // Start Paraver tracing #ifdef PARAVERTRACE Extrae_init(); #endif init(argc, argv); omp_init_lock(&lock); /* GENERATE REFERENCE TIME */ reference("reference time 1", &refer); /* TEST LOCK/UNLOCK */ benchmark("LOCK/UNLOCK", &testlock); #ifdef PARAVERTRACE Extrae_fini(); #endif finalise(); return EXIT_SUCCESS; }
JNIEXPORT void JNICALL Java_es_bsc_cepbatools_extrae_Wrapper_Fini (JNIEnv *env, jclass jc) { UNREFERENCED(env); UNREFERENCED(jc); Extrae_fini(); }
int main (int argc, char *argv[]) { pthread_t t[2]; Extrae_init(); pthread_create (&t[0], NULL, Task0, NULL); pthread_create (&t[1], NULL, Task1, NULL); pthread_join (t[0], NULL); pthread_join (t[1], NULL); Extrae_fini(); return 0; }
int Extrae_CMD_Init (int i, int argc, char *argv[]) { int taskid, nthreads; char *endptr; if (argc-i < 2) { fprintf (stderr, CMD_INIT" command requires 2 parameters TASKID and Number of Threads/Slots\n"); return 0; } taskid = strtol (argv[i], &endptr, 10); if (endptr == &argv[i][strlen(argv[i])]) { if (taskid < 0) { fprintf (stderr, CMD_INIT" command cannot handle negative TASKID\n"); return 0; } else _TASKID = taskid; } nthreads = strtol (argv[i+1], &endptr, 10); if (endptr == &argv[i+1][strlen(argv[i+1])]) { if (nthreads < 0) { fprintf (stderr, CMD_INIT" command cannot handle negative Number of Threads/Slots\n"); return 0; } else _NTHREADS = nthreads; } Extrae_set_taskid_function (CMD_INIT_TASKID); Extrae_set_numthreads_function (CMD_INIT_NUMTHREADS); _NTASKS = _TASKID+1; Extrae_set_numtasks_function (CMD_INIT_NUMTASKS); putenv ("EXTRAE_ON=1"); Extrae_init(); Extrae_CMD_Init_dump_info(); Extrae_fini(); return 2; }
int main(int argc, char *argv[]) { int x = argc; int X[100000]; int a, b, c, d, e, f, g; printf("starting program\n"); Extrae_init(); #pragma omp task inout(X) { some_work(X, 'a'); } #pragma omp task inout(X) { some_work(X, 'b'); } #pragma omp task inout(X) { some_work(X, 'c'); } #pragma omp task inout(X) { some_work(X, 'd'); } #pragma omp task inout(X) { some_work(X, 'e'); } #pragma omp task inout(X) { some_work(X, 'f'); } #pragma omp task inout(X) { some_work(X, 'g'); } Extrae_fini(); #pragma omp taskwait return 0; }
int main(int argc, char **argv) { unsigned long long t1, t2; struct timespec start, stop; int n = 1000000, i; Extrae_init(); clock_gettime (CLOCK_MONOTONIC, &start); for (i = 0; i < n; i++) Extrae_get_caller (2); clock_gettime (CLOCK_MONOTONIC, &stop); t1 = start.tv_nsec; t1 += start.tv_sec * 1000000000ULL; t2 = stop.tv_nsec; t2 += stop.tv_sec * 1000000000ULL; printf ("RESULT : Extrae_eventandcounters() %Lu ns\n", (t2 - t1) / n); Extrae_fini(); }
int main(int argc, char **argv) { int n = 1000000; double PI25DT = 3.141592653589793238462643; double pi, h, area, x; Extrae_init(); h = 1.0 / (double) n; Extrae_event (1000, 1); area = pi_kernel (n, h); Extrae_event (1000, 0); pi = h * area; printf("pi is approximately %.16f, Error is %.16f\n",pi,fabs(pi - PI25DT)); Extrae_fini(); }
int main(int argc, char *argv[]) { int x = argc; int aX[300000]; int bX[300000]; int i; printf("starting program\n"); Extrae_init(); // for (i=0; i<1; ++i) { #pragma omp task inout (aX) some_work(aX, 'a'); #pragma omp task inout (bX) some_work(bX, 'b'); // } Extrae_fini(); return 0; }
int main(int argc, char **argv) { int n = 1000000; double PI25DT = 3.141592653589793238462643; double pi, h, area, x; extrae_type_t type = 1000; int nvalues = 2; extrae_value_t values[2] = {0, 1}; char * description_values[2] = {"End", "Begin" }; Extrae_init(); Extrae_define_event_type (&type, "Kernel execution", &nvalues, values, description_values); h = 1.0 / (double) n; Extrae_event (1000, 1); area = pi_kernel (n, h); Extrae_event (1000, 0); pi = h * area; printf("pi is approximately %.16f, Error is %.16f\n",pi,fabs(pi - PI25DT)); Extrae_fini(); }
int main( int argc, char *argv[] ) { unsigned iter; FILE *infile, *resfile; char *resfilename; // algorithmic parameters algoparam_t param; int np; double runtime, flop; double residual=0.0; // check arguments if( argc < 2 ) { usage( argv[0] ); return 1; } // check input file if( !(infile=fopen(argv[1], "r")) ) { fprintf(stderr, "\nError: Cannot open \"%s\" for reading.\n\n", argv[1]); usage(argv[0]); return 1; } // check result file resfilename= (argc>=3) ? argv[2]:"heat.ppm"; if( !(resfile=fopen(resfilename, "w")) ) { fprintf(stderr, "\nError: Cannot open \"%s\" for writing.\n\n", resfilename); usage(argv[0]); return 1; } // check input if( !read_input(infile, ¶m) ) { fprintf(stderr, "\nError: Error parsing input file.\n\n"); usage(argv[0]); return 1; } print_params(¶m); if( !initialize(¶m) ) { fprintf(stderr, "Error in Solver initialization.\n\n"); usage(argv[0]); return 1; } // full size (param.resolution are only the inner points) np = param.resolution + 2; #if _EXTRAE_ Extrae_init(); #endif // starting time runtime = wtime(); iter = 0; while(1) { switch( param.algorithm ) { case 0: // JACOBI residual = relax_jacobi(param.u, param.uhelp, np, np); // Copy uhelp into u copy_mat(param.uhelp, param.u, np, np); break; case 1: // GAUSS residual = relax_gauss(param.u, np, np); break; } iter++; // solution good enough ? if (residual < 0.00005) break; // max. iteration reached ? (no limit with maxiter=0) if (param.maxiter>0 && iter>=param.maxiter) break; } // Flop count after iter iterations flop = iter * 11.0 * param.resolution * param.resolution; // stopping time runtime = wtime() - runtime; #if _EXTRAE_ Extrae_fini(); #endif fprintf(stdout, "Time: %04.3f \n", runtime); fprintf(stdout, "Flops and Flops per second: (%3.3f GFlop => %6.2f MFlop/s)\n", flop/1000000000.0, flop/runtime/1000000); fprintf(stdout, "Convergence to residual=%f: %d iterations\n", residual, iter); // for plot... coarsen( param.u, np, np, param.uvis, param.visres+2, param.visres+2 ); write_image( resfile, param.uvis, param.visres+2, param.visres+2 ); finalize( ¶m ); return 0; }
int main(int argc, char **argv) { if (argc != 4) { fprintf(stderr, "Usage: %s <vector size in K> <sort size in K> <merge size in K>\n", argv[0]); return 1; } #if _EXTRAE_ Extrae_init(); #endif N = atol(argv[1]) * 1024L; MIN_SORT_SIZE = atol(argv[2]) * 1024L; MIN_MERGE_SIZE = atol(argv[3]) * 1024L; T *data = malloc(N*sizeof(T)); T *tmp = malloc(N*sizeof(T)); #if _TAREADOR_ tareador_ON(); #endif #if _EXTRAE_ Extrae_event(PROGRAM, INITIALIZE); #else double init_time = omp_get_wtime(); #endif initialize(N, data); clear(N, tmp); #if _EXTRAE_ Extrae_event(PROGRAM, END); #else init_time = omp_get_wtime() - init_time; fprintf(stdout, "Initialization time in seconds = %g\n", init_time); #endif fprintf(stdout, "Multisort execution time using randomly generated data = "); do_sort(N, data, tmp); //sort randomly generated data #if _TAREADOR_ tareador_OFF(); #endif #if _EXTRAE_ Extrae_event(PROGRAM, INITIALIZE); Extrae_event(PROGRAM, END); #endif fprintf(stdout, "Multisort execution time using already sorted data = "); do_sort(N, data, tmp); // sort already sorted #if _EXTRAE_ Extrae_event(PROGRAM, INITIALIZE); #endif for (int i=0; i<N/2; i++) { // Reverse order double tmp =data[N-1-i]; data[N-1-i] = data[i]; data[i]=tmp; } #if _EXTRAE_ Extrae_event(PROGRAM, END); #endif fprintf(stdout, "Multisort execution time using reverse order data = "); do_sort(N, data, tmp); //sort data in inverted order #if _EXTRAE_ Extrae_fini(); #endif fprintf(stdout, "Multisort program finished\n"); return 0; }
JNIEXPORT void JNICALL Java_es_bsc_tools_extrae_Wrapper_Fini(JNIEnv *env, jclass jc) { Extrae_fini(); }
int Extrae_CMD_Emit (int i, int argc, char *argv[]) { int threadid; int type; long long value; extrae_type_t TYPE = 0; extrae_value_t VALUE = 0; char *endptr; char extrae_append_pid[128]; if (argc-i < 3) { fprintf (stderr, CMD_EMIT" command requires 3 parameters SLOT, TYPE and VALUE\n"); return 0; } Extrae_CMD_Emit_get_info(); threadid = strtol (argv[i], &endptr, 10); if (endptr == &argv[i][strlen(argv[i])]) { if (threadid < 0) { fprintf (stderr, CMD_EMIT" command cannot handle negative SLOT\n"); return 0; } else _THREADID = threadid; } type = strtol (argv[i+1], &endptr, 10); if (endptr == &argv[i+1][strlen(argv[i+1])]) { if (type < 0) { fprintf (stderr, CMD_EMIT" command cannot handle negative TYPE\n"); return 0; } else TYPE = type; } value = strtoll (argv[i+2], &endptr, 10); if (endptr == &argv[i+2][strlen(argv[i+2])]) { if (value < 0) { fprintf (stderr, CMD_EMIT" command cannot handle negative VALUE\n"); return 0; } else VALUE = value; } Extrae_set_taskid_function (CMD_EMIT_TASKID); Extrae_set_numthreads_function (CMD_EMIT_NUMTHREADS); Extrae_set_threadid_function (CMD_EMIT_NUMTHREAD); _NTASKS = _TASKID+1; Extrae_set_numtasks_function (CMD_EMIT_NUMTASKS); putenv ("EXTRAE_ON=1"); sprintf (extrae_append_pid, "EXTRAE_APPEND_PID=%u", pid); putenv (extrae_append_pid); Extrae_init (); Extrae_event (TYPE, VALUE); Extrae_fini (); return 3; }
int main(int argc, char* argv[]) { // if (argc != 7) { // fprintf(stderr, "Usage: %s <N> <N> <block size> <block size> <index> <B|PW|SEQ>\n", argv[0]); // return 1; // } parseInitializationType("SEQ"); long N = 100; long BS = 20; // long L = atol(argv[4]); long L = 16; if (BS > N) { printf("0"); return 1; } typedef double (*m_t)[N/BS + 2][BS][BS]; m_t A = (m_t) alloc_and_gen_matrix(N + BS*2, BS); for (int i=0; i<N/BS; ++i) { for (int j=0; j<N/BS; ++j) { for (int k=0; k<BS; ++k) { for (int l=0; l<BS; ++l) { //printf (" %f", A[i][j][k][l]); } } // printf ("\n"); } } // printf ("\n"); #pragma omp taskwait Extrae_init(); printf("extrae init\n"); START_TIME(); for (int iters=0; iters<L; iters++) { for (long i=1; i <= N/BS; i++) { for (long j=1; j <= N/BS; j++) { wrapperxxxxxxx(i, j, (N+BS+BS), BS, A[i][j], A[i-1][j], A[i][j-1], A[i+1][j], A[i][j+1]); } } } printf("extrae fini\n"); Extrae_fini(); #pragma omp taskwait STOP_TIME(); //#pragma omp critical { for (int iters=0; iters<N; iters++) { for (int i=0; i <= N; i++) { //printf (" %f", *A[iters][i]); } // printf ("\n"); } // printf ("\n"); } if (getenv("MEASURE_TIME") == NULL) { // Megaelements per second printf("%f", ((double)(L*N*N))/GET_TIME()); } else { printf("%f", GET_TIME() / 1000000.0); } return 0; }
int main(int argc, char **argv) { if (argc != 4) { fprintf(stderr, "Usage: %s <vector size in K> <sort size in K> <merge size in K>\n", argv[0]); return 1; } N = atol(argv[1]) * BLOCK_SIZE; MIN_SORT_SIZE = atol(argv[2]) * BLOCK_SIZE; MIN_MERGE_SIZE = atol(argv[3]) * BLOCK_SIZE; T *data = malloc(N*sizeof(T)); T *tmp = malloc(N*sizeof(T)); #if _EXTRAE_ Extrae_init(); Extrae_event(PROGRAM, INITIALIZE); #else double stamp; START_COUNT_TIME; #endif initialize(N, data); clear(N, tmp); #if _EXTRAE_ Extrae_event(PROGRAM, END); #else STOP_COUNT_TIME("Initialization time in seconds"); #endif #if _EXTRAE_ Extrae_event(PROGRAM, MULTISORT); #else START_COUNT_TIME; #endif #pragma omp parallel #pragma omp single { multisort(N, data, tmp); } #if _EXTRAE_ Extrae_event(PROGRAM,END); #else STOP_COUNT_TIME("Multisort execution time"); #endif #if _EXTRAE_ Extrae_event(PROGRAM,CHECK); #else START_COUNT_TIME; #endif check_sorted (N, data); #if _EXTRAE_ Extrae_event(PROGRAM,END); Extrae_fini(); #else STOP_COUNT_TIME("Check sorted data execution time"); #endif fprintf(stdout, "Multisort program finished\n"); return 0; }