Can you post the logs from doing sage -python setup.py instasll, as well
as explicit instructions (where to download, etc.) for how to duplicate
the error?
Thanks,
Jason
Can you post the logs from doing sage -python setup.py instasll, as well
as explicit instructions (where to download, etc.) for how to duplicate
the error?
By the way, if you just want a quick way to call a (slow) SDP solver in Sage,
you can use CVXOPT, which is a standard package in Sage.
(You need to disable Sage's preparser though)
yes, absolutely.
> Do I need to build sage from source to do this?
no, not really (but YMMV, as always :))
> 2) download http://www.coin-or.org/download/source/Csdp/Csdp-6.1.1.tgz
> unzip and install using the instructions. This is straightforward process
> make
> make install
>
> 3) download
> http://ifatwww.et.uni-magdeburg.de/syst/about_us/people/kern/downloads/pycsdp-0.10.zip
> unzip, edit the setup.py to point to the Csdp library and includes, then run
> python setup.py install as a root to install "to the system" .
>
> To install to sage I tried
> sage -python setup.py install
> but I believe now that already here is a problem (or the problem?):
> the installation using python finds the ATLAS library
> FOUND:
> libraries = ['lapack', 'ptf77blas', 'ptcblas', 'atlas']
> library_dirs = ['/usr/lib/atlas-base/atlas', '/usr/lib/atlas-base']
> language = f77
> include_dirs = ['/usr/include/atlas']
indeed, it's a problem. More than one, actually. To fix paths, you can
do the following: somewhere at the top
of setup.py, insert lines
import os
SAGE_LIB = os.environ['SAGE_LOCAL']+'/lib'
SAGE_INCLUDE = os.environ['SAGE_LOCAL']+'/include'
then replace
library_dirs = ['/usr/lib/atlas-base/atlas', '/usr/lib/atlas-base']
with
library_dirs = [SAGE_LIB+'/atlas-base/atlas', SAGE_LIB+'/atlas-base']
and
include_dirs = ['/usr/include/atlas']
with
include_dirs = [SAGE_INCLUDE+'/atlas']
But Sage does not have 'ptf77blas', 'ptcblas', it has 'blas',
'cblas' (i.e. non-multithreaded versions of them).
Perhaps replacing
libraries = ['lapack', 'ptf77blas', 'ptcblas', 'atlas']
with
libraries = ['lapack', 'blas', 'cblas', 'atlas']
would still work. You should also have just
library_dirs = [SAGE_LIB]
(not what I posted above).
An alternative would be to install these 'pt'*blas in Sage, doing
this in Sage shell (i.e. sage -sh), but I have no idea whether this will
work out of the box, if at all (multithreading is tricky...).
Best,
Dmitrii
I have had success with installing and running this extenstion on MacOSX
10.6.8, under Sage 4.8. (That is, I didn't even use Atlas - Sage uses
native MacOSX lapack/blas)
Instructions:
fire up Sage shell: sage -sh
1) Compile Csdp static lib in lib/ subdirectory of Csdp distibution and
copy it (i.e. libcsdp.a) to $SAGE_LOCAL/lib/
2) mkdir $SAGE_LOCAL/incluce/sdp/
3) Copy Csdp .h files in include to $SAGE_LOCAL/incluce/sdp/
4) in pycsdp, edit setup.py as follows:
add at the line 3:
import os
SAGE_LIB = os.environ['SAGE_LOCAL']+'/lib'
SAGE_INCLUDE = os.environ['SAGE_LOCAL']+'/include'
replace the lines
library_dir = ['/usr/local/numerics/lib']
includes = ['/usr/local/numerics/include/',
with
library_dir = [SAGE_LIB]
includes = [SAGE_INCLUDE+'/sdp',
5) run python setup.py install
6) Done! Now you can do python examples/example.py and see it running
(or you can start Sage proper and try doing
from pycsdp import _csdp, etc)
I imagine this should work on Linux too. No parallel/multithreaded blas,
though; one has to work on adding parallel Atlas libs to Sage in order
to fix this.
--------------------
We should definitely think of making this a Sage package, perhaps even a
standard one, as Csdp is really fast!
Dmitrii
> 2) mkdir $SAGE_LOCAL/incluce/sdp/
> 3) Copy Csdp .h files in include to $SAGE_LOCAL/incluce/sdp/
> 4) in pycsdp, edit setup.py as follows:
> add at the line 3:
> import os
> SAGE_LIB = os.environ['SAGE_LOCAL']+'/lib'
> SAGE_INCLUDE = os.environ['SAGE_LOCAL']+'/include'
>
> replace the lines
> library_dir = ['/usr/local/numerics/lib']
> includes = ['/usr/local/numerics/include/',
> with
> library_dir = [SAGE_LIB]
> includes = [SAGE_INCLUDE+'/sdp',
> 5) run python setup.py install
> 6) Done! Now you can do python examples/example.py and see it running
> (or you can start Sage proper and try doing
> from pycsdp import _csdp, etc)
>
>
> I imagine this should work on Linux too.
I just checked, and it does. (With a minor tweak, see above).
> No parallel/multithreaded blas,
> though; one has to work on adding parallel Atlas libs to Sage in order
> to fix this.
Actually, I am told on sage-devel (see a thread on multithreaded Atlas)
that Sage's Atlas blas/lapack are multi-threaded,
assuming one can build such libbraries on the system.
Best,
Dmitrii
I was wondering whether using pycsdp is the right way to go though.
Wouldn't it be best to write a small Cython wrapper for the C library?
(I was planning at some point to do this myself.)
Emil
well, if pycsdp works, then why you might want another interface?
For efficiency?
You still would have basically the same overhead of
converting Python matrices into C arrays needed by Csdp,
I think...
Indeed, if you'd start from scratch then Cython is easier to
use, but otherwise?
Dmitrii
>
> Emil
>
Well, you can't stop/pause/save intermediate solutions. Changing
options means writing to a parameters file. Precision could be lost in
the double->string->double translations (?).
>> I was wondering whether using pycsdp is the right way to go though.
>> Wouldn't it be best to write a small Cython wrapper for the C library?
>> (I was planning at some point to do this myself.)
>
> well, if pycsdp works, then why you might want another interface?
I don't know, i was only asking a question! (I guess I looked at the
code and thought that it would be lot simpler in Cython, but as you
say it is already written in the way it is...)
Emil
> Changing
> options means writing to a parameters file.
parameters *file* ?
Well, this does not look nice, but perhaps it's again
a limitation of Csdp? Which would be easy to fix, of course.
> Precision could be lost in
> the double->string->double translations (?).
why would you think there is such a translation?
IMHO Python has bindings (PyFloat_FromDouble, etc) allowing one to go from its
floats to C floats/doubles
and back without resorting to this.
I imagine Cython uses these bindings too.
>>> I was wondering whether using pycsdp is the right way to go though.
>>> Wouldn't it be best to write a small Cython wrapper for the C library?
>>> (I was planning at some point to do this myself.)
>>
>> well, if pycsdp works, then why you might want another interface?
>
> I don't know, i was only asking a question! (I guess I looked at the
> code and thought that it would be lot simpler in Cython, but as you
> say it is already written in the way it is...)
I was just answering a qiestion :)
Dmitrii
>
> Emil
>
I'm referring to using the stand-alone CSDP. You have to write your
matrices, and read the solution matrix, as a text file. pycsdp avoids
this, as would a Cython interface. Emil
On 2012-03-23, Dima Pasechnik <> wrote: