Пример #1
0
int
main(int argc, char** argv)
{
	double *A;
	int n, ret, event;
	double startTime;
	double endTime;
	long long value;

	n = atoi(argv[2]);
	A = load_matrix(argv[1], n);
	event = atoi(argv[3]);
	if (event != 5) {
  		papi_init(event);
	  	papi_start();
	} else {
		startTime = dclock();
	}
	ret = chol(A, n);
	if (event != 5) {
		value = papi_stop();
		printf("%lld\n", value);
	} else {
		endTime = dclock();
		printf("%lf\n", endTime - startTime);
	}
	fprintf(stderr, "RET:%d\n", ret);
	check(A,n);
	free(A);
	return 0;
}
Пример #2
0
int main(int argc, const char *argv[]) {
    int i, j, iret;
    double first[SIZE][SIZE];
    double second[SIZE][SIZE];
    double multiply[SIZE][SIZE];
    double dtime;
    for (i = 0; i < SIZE; i++) {     // rows in first
        for (j = 0; j < SIZE; j++) { // columns in first
            first[i][j] = i + j;
            second[j][i] = i - j;
            multiply[i][j] = 0.0;
        }
    }
    papi_init(atoi(argv[1]));
    papi_start();
    iret = mm(first, second, multiply);
    papi_stop();

    double check = 0.0;
    for (i = 0; i < SIZE; i++) {
        for (j = 0; j < SIZE; j++) {
            check += multiply[i][j];
        }
    }
    fprintf(stderr, "check %le \n", check);

    return iret;
}
Пример #3
0
int main( int argc, const char* argv[] )
{

	papi_init();
	int i,j,iret,w;
	for(w = 320;w<640;w+=64){
		SIZE = w;
		double first[SIZE][SIZE];
		double second[SIZE][SIZE];
		double multiply[SIZE][SIZE];
		double dtime;
		for (i = 0; i < SIZE; i++) { //rows in first
			for (j = 0; j < SIZE; j++) { //columns in first
				first[i][j]=i+j;
				second[i][j]=i-j;
				multiply[i][j]=0.0;
			}
		}
		papi_start();
		iret=mm(first,second,multiply); 
		papi_stop((w-320)/64);
	}
	print_papi_results();
	return iret;
}
Пример #4
0
int main(int argc, char *argv[]) {
  unsigned n;
  int evt;
  double *A;
  int i, j;
  double checksum = 0;
  double startTime, endTime;
  long long counter;

  if (argc < 2) {
    return -1;
  }

  n = atoi(argv[1]);
  evt = (argc > 2) ? atoi(argv[2]) : -1;

  A = randomMatrix(n);
  assert(A != NULL);

  if (evt == -1) {
    startTime = dclock();
  } else {
    papi_init(evt);
    papi_start();
  }

  if (chol(A, n)) {
    fprintf(stderr, "Error: matrix is either not symmetric or not positive definite.\n");
  } else {
    for (i = 0; i < n; i++) {
        for (j = i; j < n; j++) {
            checksum += A[IDX(i, j, n)];
        }
    }
    printf("Checksum: %f \n", checksum);
  }

  if (evt == -1) {
    endTime = dclock();
    fprintf(stderr, "%f\n", endTime - startTime);

  } else {
    counter = papi_stop();
    fprintf(stderr, "%lld\n", counter);
  }

  free(A);
  return 0;
}
Пример #5
0
int main( int argc, const char* argv[] )
{
  int i,j,iret;
  if (argc > 1) {
    double first[SIZE][SIZE];
    double second[SIZE][SIZE];
    double multiply[SIZE][SIZE];
    double dtime;
    for (i = 0; i < SIZE; i++) { //rows in first
      for (j = 0; j < SIZE; j++) { //columns in first
        first[i][j]=i+j;
        second[i][j]=i-j;
        multiply[i][j]=0.0;
      }
    }
    struct papi_context context = papi_start(argv[1]);
    dtime = dclock();
    iret=mm(first,second,multiply); 
    dtime = dclock()-dtime;
    papi_stop(context);
    printf( "Time: %le \n", dtime);

    double check=0.0;
    for(i=0;i<SIZE;i++){
      for(j=0;j<SIZE;j++){
        check+=multiply[i][j];
      }
    }
    printf("check %le \n",check); 
    fflush( stdout );
  } else {
    printf ("%s <event_name>\n", argv[0]);
  }

  return iret;
}