Hi Sergio, I faced a similar problem one year ago. I solved it writing a C function receiving a pointer to the relevant linear algebra routine I needed.
Numpy does not offers the direct access to the underlying library functions, but scipy does it: from scipy.linalg.blas import fblas dgemm = fblas.dgemm._cpointer sgemm = fblas.sgemm._cpointer So I wrote a small extension receiving the data to operate with and the relevant pointer. The drawback of the approach is the dependency on scipy but it works nicely. Armando On 18/02/2013 16:38, Sergio Callegari wrote: > Hi, > > I have a project that includes a cython script which in turn does some direct > access to a couple of cblas functions. This is necessary, since some matrix > multiplications need to be done inside a tight loop that gets called thousands > of times. Speedup wrt calling scipy.linalg.blas.cblas routines is 10x to 20x. > > Now, all this is very nice on linux where the setup script can assure that the > cython code gets linked with the atlas dynamic library, which is the same > library that numpy and scipy link to on this platform. > > However, I now have trouble in providing easy ways to use my project in > windows. All the free windows distros for scientific python that I have > looked at (python(x,y) and winpython) seem to repackage the windows version of > numpy/scipy as it is built in the numpy/scipy development sites. These appear > to statically link atlas inside some pyd files. So I get no atlas to link > against, and I have to ship an additional pre-built atlas with my project. > > All this seems somehow inconvenient. > > In the end, when my code runs, due to static linking I get 3 replicas of 2 > slightly different atlas libs in memory. One coming with _dotblas.pyd in > numpy, > another one with cblas.pyd or fblas.pyd in scipy. And the last one as the one > shipped in my code. > > Would it be possible to have a win distro of scipy which provides some > pre built atlas dlls, and to have numpy and scipy dynamically link to them? > This would save memory and also provide a decent blas to link to for things > done in cython. But I believe there must be some problem since the scipy site > says > > "IMPORTANT: NumPy and SciPy in Windows can currently only make use of CBLAS > and > LAPACK as static libraries - DLLs are not supported." > > Can someone please explain why or link to an explanation? > > Unfortunately, not having a good, prebuilt and cheap blas implementation in > windows is really striking me as a severe limitation, since you loose the > ability to prototype in python/scipy and then move to C or Cython the major > bottlenecks to achieve speed. > > Many thanks in advance! > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > > _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion