1
/* chrono - demo of GRAS benchmarking features */
3
/* Copyright (c) 2005, 2010. The SimGrid Team.
4
* All rights reserved. */
6
/* This program is free software; you can redistribute it and/or modify it
7
* under the terms of the license (GNU LGPL) which comes with this package. */
12
XBT_LOG_NEW_DEFAULT_CATEGORY(Chrono, "Messages specific to this example");
15
void cblas_dgemm(const enum CBLAS_ORDER Order,
16
const enum CBLAS_TRANSPOSE TransA,
17
const enum CBLAS_TRANSPOSE TransB, const int M,
18
const int N, const int K, const double alpha,
19
const double *A, const int lda, const double *B,
20
const int ldb, const double beta, double *C,
24
/* Function prototypes */
25
static int mat_mult(int n)
32
A = malloc(n * n * sizeof(double));
33
B = malloc(n * n * sizeof(double));
34
C = malloc(n * n * sizeof(double));
36
start = now = gras_os_time();
38
XBT_INFO("Matrix size: %d", n);
39
/* XBT_INFO("Before computation: %lg", start); */
41
for (l = 0; l < 40; l++) {
43
GRAS_BENCH_ONCE_RUN_ONCE_BEGIN();
44
for (i = 0; i < n; i++)
45
for (j = 0; j < n; j++) {
51
cblas_dgemm(CblasRowMajor,
52
CblasNoTrans, CblasNoTrans, n, n, n,
53
1.0, A, n, B, n, 0.0, C, n);
54
GRAS_BENCH_ONCE_RUN_ONCE_END();
55
now = gras_os_time() - now;
56
/* XBT_INFO("Iteration %d : %lg ", l, now); */
59
now = gras_os_time() - start;
60
XBT_INFO("Duration: %lg ", now);
67
int multiplier(int argc, char *argv[])
69
gras_init(&argc, argv);