From 4de869aa8bcf5a24acf31227f46f577e4bdb1479 Mon Sep 17 00:00:00 2001 From: alegrand Date: Wed, 23 Feb 2005 00:59:12 +0000 Subject: [PATCH 1/1] Similar to chrono.c but should be linked with atlas. It is not intended to be distributed. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1040 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- examples/gras/chrono/chrono2.c | 85 ++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 examples/gras/chrono/chrono2.c diff --git a/examples/gras/chrono/chrono2.c b/examples/gras/chrono/chrono2.c new file mode 100644 index 0000000000..147fb4e041 --- /dev/null +++ b/examples/gras/chrono/chrono2.c @@ -0,0 +1,85 @@ +/* $Id$ */ + +/* chrono - demo of GRAS benchmarking features */ + +/* Copyright (c) 2005 Martin Quinson, Arnaud Legrand. All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#include "gras.h" +#include "xbt/log.h" + +XBT_LOG_NEW_DEFAULT_CATEGORY(Chrono,"Messages specific to this example"); + +#include +void cblas_dgemm(const enum CBLAS_ORDER Order, + const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_TRANSPOSE TransB, const int M, + const int N, const int K, const double alpha, + const double *A, const int lda, const double *B, + const int ldb, const double beta, double *C, + const int ldc); + + +/* Function prototypes */ +static int mat_mult(int n) +{ + int i,j,k,l; + double *A,*B,*C; + double start = 0.0; + double now = 0.0; + + A = malloc(n*n*sizeof(double)); + B = malloc(n*n*sizeof(double)); + C = malloc(n*n*sizeof(double)); + + start=now=gras_os_time(); + + INFO1("Matrix size: %d",n); +/* INFO1("Before computation: %lg", start); */ + + for(l=0; l<40; l++) { + now=gras_os_time(); + GRAS_BENCH_ONCE_RUN_ONCE_BEGIN(); + for(i=0; i