Skip to content

Commit

Permalink
Merge pull request #220 from elemental/something_new
Browse files Browse the repository at this point in the history
Cherry-picking commits from master into 0.87
  • Loading branch information
poulson authored Feb 7, 2017
2 parents 704694a + 6e928be commit 477e503
Show file tree
Hide file tree
Showing 15 changed files with 169 additions and 392 deletions.
2 changes: 1 addition & 1 deletion cmake/configure_files/ElVars.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# To help simplify including Elemental in external projects

EL_INC = @CMAKE_INSTALL_PREFIX@/include
EL_LIB = @CMAKE_INSTALL_PREFIX@/lib
EL_LIB = @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@

CC = @CMAKE_C_COMPILER@
CXX = @CMAKE_CXX_COMPILER@
Expand Down
71 changes: 21 additions & 50 deletions examples/interface/LPAffine.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
m = 2000
n = 4000
k = 3000
testMehrotra = True
testIPF = False
manualInit = False
display = False
progress = True
Expand Down Expand Up @@ -98,55 +96,28 @@ def Rectang(height,width):
z = El.DistMultiVec()
s = El.DistMultiVec()

if testMehrotra:
ctrl.approach = El.LP_MEHROTRA
ctrl.mehrotraCtrl.primalInit = manualInit
ctrl.mehrotraCtrl.dualInit = manualInit
ctrl.mehrotraCtrl.progress = progress
El.Copy( xOrig, x )
El.Copy( yOrig, y )
El.Copy( zOrig, z )
El.Copy( sOrig, s )
startMehrotra = El.mpi.Time()
El.LPAffine(A,G,b,c,h,x,y,z,s,ctrl)
endMehrotra = El.mpi.Time()
if worldRank == 0:
print('Mehrotra time: {} seconds'.format(endMehrotra-startMehrotra))
ctrl.approach = El.LP_MEHROTRA
ctrl.mehrotraCtrl.primalInit = manualInit
ctrl.mehrotraCtrl.dualInit = manualInit
ctrl.mehrotraCtrl.progress = progress
El.Copy( xOrig, x )
El.Copy( yOrig, y )
El.Copy( zOrig, z )
El.Copy( sOrig, s )
startMehrotra = El.mpi.Time()
El.LPAffine(A,G,b,c,h,x,y,z,s,ctrl)
endMehrotra = El.mpi.Time()
if worldRank == 0:
print('Mehrotra time: {} seconds'.format(endMehrotra-startMehrotra))

if display:
El.Display( x, "x Mehrotra" )
El.Display( y, "y Mehrotra" )
El.Display( z, "z Mehrotra" )
El.Display( s, "s Mehrotra" )

obj = El.Dot(c,x)
if worldRank == 0:
print('Mehrotra c^T x = {}'.format(obj))

if testIPF:
ctrl.approach = El.LP_IPF
ctrl.ipfCtrl.primalInit = manualInit
ctrl.ipfCtrl.dualInit = manualInit
ctrl.ipfCtrl.progress = progress
ctrl.ipfCtrl.lineSearchCtrl.progress = progress
El.Copy( xOrig, x )
El.Copy( yOrig, y )
El.Copy( zOrig, z )
El.Copy( sOrig, s )
startIPF = El.mpi.Time()
El.LPAffine(A,G,b,c,h,x,y,z,s,ctrl)
endIPF = El.mpi.Time()
if worldRank == 0:
print('IPF time: {} seconds'.format(endIPF-startIPF))

if display:
El.Display( x, "x IPF" )
El.Display( y, "y IPF" )
El.Display( z, "z IPF" )
El.Display( s, "s IPF" )
if display:
El.Display( x, "x Mehrotra" )
El.Display( y, "y Mehrotra" )
El.Display( z, "z Mehrotra" )
El.Display( s, "s Mehrotra" )

obj = El.Dot(c,x)
if worldRank == 0:
print('IPF c^T x = {}'.format(obj))
obj = El.Dot(c,x)
if worldRank == 0:
print('Mehrotra c^T x = {}'.format(obj))

El.Finalize()
71 changes: 21 additions & 50 deletions examples/interface/LPAffineDense.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
m = 500
n = 1000
k = 750
testMehrotra = True
testIPF = False
manualInit = False
display = False
progress = True
Expand Down Expand Up @@ -80,55 +78,28 @@ def RectangDense(height,width):
z = El.DistMatrix()
s = El.DistMatrix()

if testMehrotra:
ctrl.approach = El.LP_MEHROTRA
ctrl.mehrotraCtrl.primalInit = manualInit
ctrl.mehrotraCtrl.dualInit = manualInit
ctrl.mehrotraCtrl.progress = progress
El.Copy( xOrig, x )
El.Copy( yOrig, y )
El.Copy( zOrig, z )
El.Copy( sOrig, s )
startMehrotra = El.mpi.Time()
El.LPAffine(A,G,b,c,h,x,y,z,s,ctrl)
endMehrotra = El.mpi.Time()
if worldRank == 0:
print('Mehrotra time: {} seconds'.format(endMehrotra-startMehrotra))
ctrl.approach = El.LP_MEHROTRA
ctrl.mehrotraCtrl.primalInit = manualInit
ctrl.mehrotraCtrl.dualInit = manualInit
ctrl.mehrotraCtrl.progress = progress
El.Copy( xOrig, x )
El.Copy( yOrig, y )
El.Copy( zOrig, z )
El.Copy( sOrig, s )
startMehrotra = El.mpi.Time()
El.LPAffine(A,G,b,c,h,x,y,z,s,ctrl)
endMehrotra = El.mpi.Time()
if worldRank == 0:
print('Mehrotra time: {} seconds'.format(endMehrotra-startMehrotra))

if display:
El.Display( x, "x Mehrotra" )
El.Display( y, "y Mehrotra" )
El.Display( z, "z Mehrotra" )
El.Display( s, "s Mehrotra" )

obj = El.Dot(c,x)
if worldRank == 0:
print('Mehrotra c^T x = {}'.format(obj))

if testIPF:
ctrl.approach = El.LP_IPF
ctrl.ipfCtrl.primalInit = manualInit
ctrl.ipfCtrl.dualInit = manualInit
ctrl.ipfCtrl.progress = progress
ctrl.ipfCtrl.lineSearchCtrl.progress = progress
El.Copy( xOrig, x )
El.Copy( yOrig, y )
El.Copy( zOrig, z )
El.Copy( sOrig, s )
startIPF = El.mpi.Time()
El.LPAffine(A,G,b,c,h,x,y,z,s,ctrl)
endIPF = El.mpi.Time()
if worldRank == 0:
print('IPF time: {} seconds'.format(endIPF-startIPF))

if display:
El.Display( x, "x IPF" )
El.Display( y, "y IPF" )
El.Display( z, "z IPF" )
El.Display( s, "s IPF" )
if display:
El.Display( x, "x Mehrotra" )
El.Display( y, "y Mehrotra" )
El.Display( z, "z Mehrotra" )
El.Display( s, "s Mehrotra" )

obj = El.Dot(c,x)
if worldRank == 0:
print('IPF c^T x = {}'.format(obj))
obj = El.Dot(c,x)
if worldRank == 0:
print('Mehrotra c^T x = {}'.format(obj))

El.Finalize()
65 changes: 19 additions & 46 deletions examples/interface/LPDirect.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

m = 2000
n = 4000
testMehrotra = True
testIPF = False
manualInit = False
display = False
progress = True
Expand Down Expand Up @@ -79,51 +77,26 @@ def Rectang(height,width):
y = El.DistMultiVec()
z = El.DistMultiVec()

if testMehrotra:
ctrl.approach = El.LP_MEHROTRA
ctrl.mehrotraCtrl.primalInit = manualInit
ctrl.mehrotraCtrl.dualInit = manualInit
ctrl.mehrotraCtrl.progress = progress
El.Copy( xOrig, x )
El.Copy( yOrig, y )
El.Copy( zOrig, z )
startMehrotra = El.mpi.Time()
El.LPDirect(A,b,c,x,y,z,ctrl)
endMehrotra = El.mpi.Time()
if worldRank == 0:
print('Mehrotra time: {} seconds'.format(endMehrotra-startMehrotra))
ctrl.approach = El.LP_MEHROTRA
ctrl.mehrotraCtrl.primalInit = manualInit
ctrl.mehrotraCtrl.dualInit = manualInit
ctrl.mehrotraCtrl.progress = progress
El.Copy( xOrig, x )
El.Copy( yOrig, y )
El.Copy( zOrig, z )
startMehrotra = El.mpi.Time()
El.LPDirect(A,b,c,x,y,z,ctrl)
endMehrotra = El.mpi.Time()
if worldRank == 0:
print('Mehrotra time: {} seconds'.format(endMehrotra-startMehrotra))

if display:
El.Display( x, "x Mehrotra" )
El.Display( y, "y Mehrotra" )
El.Display( z, "z Mehrotra" )

obj = El.Dot(c,x)
if worldRank == 0:
print('Mehrotra c^T x = {}'.format(obj))

if testIPF:
ctrl.approach = El.LP_IPF
ctrl.ipfCtrl.primalInit = manualInit
ctrl.ipfCtrl.dualInit = manualInit
ctrl.ipfCtrl.progress = progress
ctrl.ipfCtrl.lineSearchCtrl.progress = progress
El.Copy( xOrig, x )
El.Copy( yOrig, y )
El.Copy( zOrig, z )
startIPF = El.mpi.Time()
El.LPDirect(A,b,c,x,y,z,ctrl)
endIPF = El.mpi.Time()
if worldRank == 0:
print('IPF time: {} seconds'.format(endIPF-startIPF))

if display:
El.Display( x, "x IPF" )
El.Display( y, "y IPF" )
El.Display( z, "z IPF" )
if display:
El.Display( x, "x Mehrotra" )
El.Display( y, "y Mehrotra" )
El.Display( z, "z Mehrotra" )

obj = El.Dot(c,x)
if worldRank == 0:
print('IPF c^T x = {}'.format(obj))
obj = El.Dot(c,x)
if worldRank == 0:
print('Mehrotra c^T x = {}'.format(obj))

El.Finalize()
25 changes: 0 additions & 25 deletions examples/interface/LPDirectDense.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
m = 1000
n = 2000
testMehrotra = True
testIPF = False
testADMM = False
manualInit = False
display = False
Expand Down Expand Up @@ -85,30 +84,6 @@ def RectangDense(height,width):
if worldRank == 0:
print('Mehrotra c^T x = {}'.format(obj))

if testIPF:
ctrl.approach = El.LP_IPF
ctrl.ipfCtrl.primalInit = manualInit
ctrl.ipfCtrl.dualInit = manualInit
ctrl.ipfCtrl.progress = progress
ctrl.ipfCtrl.lineSearchCtrl.progress = progress
El.Copy( xOrig, x )
El.Copy( yOrig, y )
El.Copy( zOrig, z )
startIPF = El.mpi.Time()
El.LPDirect(A,b,c,x,y,z,ctrl)
endIPF = El.mpi.Time()
if worldRank == 0:
print('IPF time: {} seconds'.format(endIPF-startIPF))

if display:
El.Display( x, "x IPF" )
El.Display( y, "y IPF" )
El.Display( z, "z IPF" )

obj = El.Dot(c,x)
if worldRank == 0:
print('IPF c^T x = {}'.format(obj))

if testADMM:
ctrl.approach = El.LP_ADMM
ctrl.admmCtrl.progress = progress
Expand Down
86 changes: 27 additions & 59 deletions examples/interface/QPAffine.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
m = 2000
n = 4000
k = 3000
testMehrotra = True
testIPF = False
manualInit = False
display = False
progress = True
Expand Down Expand Up @@ -114,63 +112,33 @@ def Rectang(height,width):
z = El.DistMultiVec()
s = El.DistMultiVec()

if testMehrotra:
ctrl.approach = El.QP_MEHROTRA
ctrl.mehrotraCtrl.solveCtrl.progress = progress
ctrl.mehrotraCtrl.primalInit = manualInit
ctrl.mehrotraCtrl.dualInit = manualInit
ctrl.mehrotraCtrl.progress = progress
ctrl.mehrotraCtrl.time = True
El.Copy( xOrig, x )
El.Copy( yOrig, y )
El.Copy( zOrig, z )
El.Copy( sOrig, s )
startMehrotra = El.mpi.Time()
El.QPAffine(Q,A,G,b,c,h,x,y,z,s,ctrl)
endMehrotra = El.mpi.Time()
if worldRank == 0:
print('Mehrotra time: {} seconds'.format(endMehrotra-startMehrotra))
ctrl.approach = El.QP_MEHROTRA
ctrl.mehrotraCtrl.solveCtrl.progress = progress
ctrl.mehrotraCtrl.primalInit = manualInit
ctrl.mehrotraCtrl.dualInit = manualInit
ctrl.mehrotraCtrl.progress = progress
ctrl.mehrotraCtrl.time = True
El.Copy( xOrig, x )
El.Copy( yOrig, y )
El.Copy( zOrig, z )
El.Copy( sOrig, s )
startMehrotra = El.mpi.Time()
El.QPAffine(Q,A,G,b,c,h,x,y,z,s,ctrl)
endMehrotra = El.mpi.Time()
if worldRank == 0:
print('Mehrotra time: {} seconds'.format(endMehrotra-startMehrotra))

if display:
El.Display( x, "x Mehrotra" )
El.Display( y, "y Mehrotra" )
El.Display( z, "z Mehrotra" )
El.Display( s, "s Mehrotra" )

d = El.DistMultiVec()
El.Zeros( d, n, 1 )
El.Multiply( El.NORMAL, 1., Q, x, 0., d )
obj = El.Dot(x,d)/2 + El.Dot(c,x)
if worldRank == 0:
print('Mehrotra (1/2) x^T Q x + c^T x = {}'.format(obj))

if testIPF:
ctrl.approach = El.QP_IPF
ctrl.ipfCtrl.primalInit = manualInit
ctrl.ipfCtrl.dualInit = manualInit
ctrl.ipfCtrl.progress = progress
ctrl.ipfCtrl.lineSearchCtrl.progress = progress
El.Copy( xOrig, x )
El.Copy( yOrig, y )
El.Copy( zOrig, z )
El.Copy( sOrig, s )
startIPF = El.mpi.Time()
El.QPAffine(Q,A,G,b,c,h,x,y,z,s,ctrl)
endIPF = El.mpi.Time()
if worldRank == 0:
print('IPF time: {}'.format(endIPF-startIPF))

if display:
El.Display( x, "x IPF" )
El.Display( y, "y IPF" )
El.Display( z, "z IPF" )
El.Display( s, "s IPF" )

d = El.DistMultiVec()
El.Zeros( d, n, 1 )
El.Multiply( El.NORMAL, 1., Q, x, 0., d )
obj = El.Dot(x,d)/2 + El.Dot(c,x)
if worldRank == 0:
print('IPF (1/2) x^T Q x + c^T x = {}'.format(obj))
if display:
El.Display( x, "x Mehrotra" )
El.Display( y, "y Mehrotra" )
El.Display( z, "z Mehrotra" )
El.Display( s, "s Mehrotra" )

d = El.DistMultiVec()
El.Zeros( d, n, 1 )
El.Multiply( El.NORMAL, 1., Q, x, 0., d )
obj = El.Dot(x,d)/2 + El.Dot(c,x)
if worldRank == 0:
print('Mehrotra (1/2) x^T Q x + c^T x = {}'.format(obj))

El.Finalize()
Loading

0 comments on commit 477e503

Please sign in to comment.