Hi Mac Special Interest Group folks, We've noticed some curious behavior of the veclib BLAS implementation in the development of the OpenMx library. The daxpy implementation appears to be twice as slow in the veclib implementation as compared to the reference implementation. Attached is a test kernel that has been run under both implementations. The kernel consists of repeated calls to daxpy with vectors of varying size. In the output files, the first column is the dimension of the vector. The 2nd-4th column report the runtime in seconds of the kernel; three identical trials per vector size.
It may be more appropriate to send this information upstream to the veclib persons. However, I thought it would be of interest to Mac R folks, too. For our own project, our workaround will be to create our own basic implementation of daxpy, and continue to link against the veclib BLAS library so we can get a speedup on dgemm and the other functions. The benchmarks were executed on a Mac Pro with 2 Quad-Core Xeons @ 3 GHz (MacPro2,1) running OS X 10.5.8. It was tested with R 2.12.0 and the same behavior has been observed with R 2.10.1. Thanks, --Michael
#include "R.h" #include <R_ext/BLAS.h> #include <sys/time.h> void test() { static const double minusoned = - 1.0; static const int onei = 1; srand48(123456789); for(int dimension = 50; dimension <= 1000; dimension += 50) { double *vector1 = Calloc(dimension, double); double *vector2 = Calloc(dimension, double); for(int j = 0; j < dimension; j++) { vector1[j] = drand48() * 200.0 - 100.0; vector2[j] = drand48() * 200.0 - 100.0; } struct timeval start, end; Rprintf("%i", dimension); for(int repeat = 0; repeat < 3; repeat++) { gettimeofday(&start, NULL); for(int i = 0; i < 10000000; i++) { F77_CALL(daxpy)(&dimension, &minusoned, vector1, &onei, vector2, &onei); } gettimeofday(&end, NULL); Rprintf("\t%f", (end.tv_sec - start.tv_sec) + 1e-6 * (end.tv_usec - start.tv_usec)); } Rprintf("\n"); Free(vector1); Free(vector2); } }
daxpy.veclib.results
Description: Binary data
daxpy.refblas.results
Description: Binary data
_______________________________________________ R-SIG-Mac mailing list R-SIG-Mac@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-mac