星期五 十月 31, 2008

I finally got some clues about how to build scipy with SunStudio and Sun Performance library from this discussion thread. And here are the steps I sumerized:

1. Download the source tar file of scipy, SciPy 0.6.0 tarball, and extract it to anywhere. Apply the following changes to /usr/lib/python2.4/vendor-packages/numpy/distutils/fcompiler/sun.py, since f77compat library is not available on x86/x64 platform,
--- sun.py.orig	2008-10-31 18:30:17.519425733 +0800
+++ sun.py	2008-10-31 18:30:23.842495794 +0800
@@ -38,7 +38,7 @@
         return ['-xtarget=generic']
     def get_libraries(self):
         opt = []
-        opt.extend(['fsu','sunmath','mvec','f77compat'])
+        opt.extend(['fsu','sunmath','mvec'])
         return opt
 
 if __name__ == '__main__':
and apply the following patch,

--- scipy/sparse/sparsetools/sparsetools.h    2007-09-22 15:55:25.000000000 +0800
+++ scipy/sparse/sparsetools/sparsetools.h    2008-10-31 17:54:47.317379521 +0800
@@ -22,6 +22,7 @@

 #include <vector>
 #include <algorithm>
+#include <functional>


 /*


2. Set CBE environment (/opt/jdsbld/bin/env.sh), and the following environment variables,
$ export LDFLAGS="-lCrun -lCstd"
$ export LAPACK=/opt/SUNWspro/lib/libsunmath.so
$ export BLAS=/opt/SUNWspro/lib/libsunperf.so
3. Then build, install, and test
$ python setup.py build
$ pfexec setup.py install
$ cd ~ # don't run the test under the source directory
$ python
>>> import scipy
>>> scipy.test()
Though, you would see several errors, most of the tests passed.

This blog copyright 2009 by yongsun