This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Multiply Matrix in GSL


Liu, Li writes:
 > Hi: I used MingW GCC 2.95 and VC 6.0 for testing.  The only
 > compilation option is O2.  This is default option for VC Release
 > version.  Yes, I use gsl_blas_dgemm, and I will try ATLAS later.
 > Because I use the same code on all testing platforms, I don't think
 > the reason is range checking.  I guess the reason maybe memory
 > pointer moving and cache.

My benchmark results for the two platforms are within about 15% of
each other.

Brian

500x500 dgemm (10 trials)

GSL-1.0 MSVC "Release" :  90s
GNU/Linux gcc 2.7.2 -O2:  78s

bjg|hppav> cat /proc/cpuinfo 
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 8
model name      : Celeron (Coppermine)
stepping        : 3
cpu MHz         : 567.972
cache size      : 128 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 mmx fxsr sse
bogomips        : 1133.77

#include <stdio.h>
#include <gsl/gsl_blas.h>

int
main (void)
{
  int i, j;

  gsl_matrix * A = gsl_matrix_alloc(500,500);
  gsl_matrix * B = gsl_matrix_alloc(500,500);
  gsl_matrix * C = gsl_matrix_alloc(500,500);

  for (i = 0; i < 500; i++)
    for (j = 0; j < 500; j++)
      gsl_matrix_set (A, i, j, 500*i+j);

  for (i = 0; i < 500; i++)
    for (j = 0; j < 500; j++)
      gsl_matrix_set (B, i, j, 500*i+j);

  printf("start\n");

  /* Compute C = A B */

  for (i = 0; i < 10; i++) {

    gsl_blas_dgemm (CblasNoTrans, CblasNoTrans,
                    1.0, A, B,
                    0.0, C);
        printf("%d\n",i);

  };

  printf("stop\n");

  return 0;  
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]