Opened 10 years ago

Closed 9 years ago

#44503 closed enhancement (fixed)

DSDP: Build with Apple's Accelerator.framework by default

Reported by: mbrethen Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: jjstickel (Jonathan Stickel)
Port: DSDP

Description

Port py-cvxopt uses optional solvers, one of which is DSDP, uses atlas' blas and lapack. Both py-cvxopt and py-numpy build with Apple's Accelerator.framework by default. DSDP however builds with macports' atlas. This breaks the install.

I was able to build DSDP with Apple's Accelerate.framework by patching 'make.include' at this line:

Code highlighting:

-LAPACKBLAS  = -llapack -lblas -lg2c -lm
+LAPACKBLAS  = -Wl,-framework -Wl,Accelerate -lm

and tested that it works with the following python program:

Code highlighting:

from cvxopt.base import matrix,spmatrix
from cvxopt import solvers

clst=[0.0, 0.0, 0.0, 0.0, 0.0, 2.0, 2.0, 2.0]
hlst=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
     0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
     0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
     0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
     0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
     0.0, 0.0, 0.0, 0.0, 0.0, -1.0]
Gr=[0, 7, 14, 21, 28, 1, 5, 8]+[35]*5
Gc=[0, 1, 2, 3, 4, 5, 6, 7]+range(5)
Gmtr=spmatrix([1.0]*8+[-1.0]*5,Gr,Gc,(36,8))
c=-matrix(clst)
Gs=[-Gmtr]
h=[-matrix(hlst,(6,6))]
try:
 sol=solvers.sdp(c,Gs=Gs,hs=h,solver='dsdp')
 print 'optimal value: %.2f'%(1+(matrix(clst,(1,8))*sol['x'])[0],)
except:
 print 'could not use dsdp'
 sol=solvers.sdp(c,Gs=Gs,hs=h)
 print 'optimal value: %.2f'%(1+(matrix(clst,(1,8))*sol['x'])[0],)
 raise 

For consistency, DSDP should build with the accelerator.framework by default, with a variant to build using macports' atlas port. The patch I applied conflicts with the existing patch, so a decision needs to made how best to implement either patch.

Change History (4)

comment:1 Changed 10 years ago by jjstickel (Jonathan Stickel)

Cc: jjstickel@… added

Cc Me!

comment:2 Changed 10 years ago by mf2k (Frank Schima)

Cc: nomaintainer@… removed
Version: 2.3.1

Please do not Cc nomaintainer@… because it is not a valid email address.

comment:3 Changed 9 years ago by jjstickel (Jonathan Stickel)

I think this ticket can be closed with r127980 (also see #37097).

comment:4 Changed 9 years ago by mf2k (Frank Schima)

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.