Re: BLAS vs CBLAS in C++
On 2007-09-04 01:12, nitroamos@gmail.com wrote:
hello --
i'm working on a C++ code that uses dgemm in a simple way, but i want
ports of my code to different machines to be easy.
further, i want to make compiling of my code easy for new users -- i
don't want them to compile more libraries than absolutely necessary
(compiling ATLAS or GotoBLAS is necessary).
i already have my code working with both BLAS and CBLAS interfaces,
but I have some questions.
You might also be interested in uBlas from Boost, which would remove the
dependency on external libraries (do not know how the compare
performance wise). There is also Lapack++ which provide both BLAS and
LAPACK, once again, I make no guarantees of performance.
1) can i expect cblas to be available on pretty much any machine i
want to use? because ATLAS packages CBLAS, it didn't occur to me that
CBLAS might be standard until now.
I don't have it on any of my computers, however you might be able to
assume that those computers where your program will run will have it, or
perhaps you cannot.
2) to use blas, I had to switch from using new [] to malloc, and
delete [] to free. why? once allocated, i didn't realize there was a
difference.
is it not possible to use new [] allocated arrays with fortran
libraries?
There should not be any problem as long as BLAS does not try to free or
reallocate memory (memory allocated with new[] must be freed with
delete[], using free() will not work). Are you sure it does not work?
3) once your code can is programmed to use either, is linking directly
to BLAS preferable in any way to using CBLAS?
I seem to recall that CBLAS is BLAS converted to C, and I seem to recall
that there are certain features (or lack thereof) in Fortran that allows
for better optimisations in Fortran than C. So it probably depends on
how good your Fortran compiler is compared to your C compiler.
--
Erik Wikstr?m