Skip to content

Commit

Permalink
Trac #34749: Packages dsdp, scip_sdp
Browse files Browse the repository at this point in the history
http://www.opt.tu-darmstadt.de/scipsdp/#about

https://github.com/scipopt/SCIP-SDP

used to be LGPL license, changed to Apache 2.0 in Dec 2022

For full functionality, needs an SDP solver, one of:
- DSDP - https://repology.org/project/dsdp/versions -- added here as a
Sage package
- SDPA - https://repology.org/project/sdpa/versions
- MOSEK (non-free)

URL: https://trac.sagemath.org/34749
Reported by: mkoeppe
Ticket author(s): Matthias Koeppe
Reviewer(s): Dima Pasechnik
  • Loading branch information
Release Manager committed Jan 5, 2023
2 parents 64d232b + 544d123 commit 3d86126
Show file tree
Hide file tree
Showing 28 changed files with 401 additions and 0 deletions.
27 changes: 27 additions & 0 deletions build/pkgs/dsdp/SPKG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
dsdp: Semidefinite programming solver
=====================================

Description
-----------

Implementation of an interior-point method for semidefinite
programming. It provides primal and dual solutions, exploits low-rank
structure and sparsity in the data, and has relatively low memory
requirements for an interior-point method. It allows feasible and
infeasible starting points and provides approximate certificates of
infeasibility when no feasible solution exists. The dual-scaling
algorithm implemented in this package has a convergence proof and
worst-case polynomial complexity under mild assumptions on the data.


License
-------

Permissive open source license
https://www.mcs.anl.gov/hs/software/DSDP/Copyright.txt


Upstream Contact
----------------

https://www.mcs.anl.gov/hs/software/DSDP/
5 changes: 5 additions & 0 deletions build/pkgs/dsdp/checksums.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tarball=dsdp_VERSION.orig.tar.gz
sha1=d80b072acf5396561809266ff1c93e7927697aeb
md5=7f49a35f3fe7b5802d29ee2435fdb67e
cksum=955095458
upstream_url=http://deb.debian.org/debian/pool/main/d/dsdp/dsdp_VERSION.orig.tar.gz
1 change: 1 addition & 0 deletions build/pkgs/dsdp/dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$(BLAS) | cmake
1 change: 1 addition & 0 deletions build/pkgs/dsdp/distros/arch.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dsdp
1 change: 1 addition & 0 deletions build/pkgs/dsdp/distros/conda.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dsdp
1 change: 1 addition & 0 deletions build/pkgs/dsdp/distros/debian.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
libdsdp-dev
1 change: 1 addition & 0 deletions build/pkgs/dsdp/distros/fedora.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DSDP-devel
1 change: 1 addition & 0 deletions build/pkgs/dsdp/distros/freebsd.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
math/dsdp
1 change: 1 addition & 0 deletions build/pkgs/dsdp/distros/gentoo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sci-libs/dsdp
1 change: 1 addition & 0 deletions build/pkgs/dsdp/distros/macports.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DSDP
1 change: 1 addition & 0 deletions build/pkgs/dsdp/distros/repology.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dsdp
1 change: 1 addition & 0 deletions build/pkgs/dsdp/package-version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.8
52 changes: 52 additions & 0 deletions build/pkgs/dsdp/patches/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
cmake_minimum_required(VERSION 3.0)
project (dsdp VERSION 5.8 LANGUAGES C)

link_directories(${LIBRARY_PREFIX}/lib)

find_package(LAPACK REQUIRED)

include_directories(include src/vecmat src/solver src/sdp)
FILE (GLOB_RECURSE SRCS src/*.c)
if(WIN32)
list(APPEND SRCS dsdp.def)
endif()

## DSDP shared library
add_library(dsdp ${SRCS})
target_link_libraries(dsdp ${LAPACK_LIBRARIES})
target_include_directories(dsdp PUBLIC include src/vecmat src/solver src/sdp)
target_compile_options(dsdp PUBLIC -O2)

if(WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
target_compile_definitions(dsdp PUBLIC DSDP_MS_TIME)
else()
target_link_libraries(dsdp m)
target_compile_definitions(dsdp PUBLIC DSDP_TIME)
endif()

## DSDP5 executable
if(NOT WIN32)
add_executable(dsdp5 examples/readsdpa.c)
add_dependencies(dsdp5 dsdp)
target_link_libraries(dsdp5 dsdp)
target_include_directories(dsdp5 PUBLIC include)
endif()
if(APPLE)
target_compile_definitions(dsdp5 PUBLIC _FORTIFY_SOURCE=0)
endif()

if(WIN32)
install(TARGETS dsdp
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
else()
install(TARGETS dsdp5 dsdp
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif()

FILE (GLOB DSDP_HEADERS include/*.h)
INSTALL(FILES ${DSDP_HEADERS} DESTINATION include)
11 changes: 11 additions & 0 deletions build/pkgs/dsdp/patches/conda-forge-malloc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
diff -ruN DSDP5.8/src/sys/dsdploginfo.c DSDP5.8_patched/src/sys/dsdploginfo.c
--- DSDP5.8/src/sys/dsdploginfo.c 2005-10-21 21:31:15.000000000 +0200
+++ DSDP5.8_patched/src/sys/dsdploginfo.c 2018-04-30 09:34:52.000000000 +0200
@@ -6,7 +6,6 @@
#include <stdarg.h>
#include <sys/types.h>
#include <stdlib.h>
-#include <malloc.h>
#include "dsdpsys.h"
#include "dsdpbasictypes.h"

39 changes: 39 additions & 0 deletions build/pkgs/dsdp/patches/debian-type-mismatch.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Description: Use correct integer type for Fortran prototypes and variables
GNU Fortran's default integer width is 32-bit, the same as GCC, therefore use
int rather than long int when interfacing with Fortran. This was an issue on
64-bit big-endian systems, since the upper 32 bits of the long would be set,
which would also be lost when truncating to a 32-bit integer.
Author: James Clarke <jrtc27@debian.org>
Bug-Debian: https://bugs.debian.org/857067
Last-Update: 2017-03-28
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/include/dsdplapack.h
+++ b/include/dsdplapack.h
@@ -4,11 +4,11 @@
\file dsdplapack.h
\brief DSDP uses BLAS and LAPACK for many of its operations.
*/
-
-typedef long int ffinteger;
/*
-typedef int ffinteger;
+typedef long int ffinteger;
*/
+typedef int ffinteger;
+
/*
#define __DSDP_NONAMEMANGLING
#undef __DSDP_NONAMEMANGLING
--- a/src/vecmat/dtrsm2.c
+++ b/src/vecmat/dtrsm2.c
@@ -1,7 +1,7 @@
#include "dsdplapack.h"

-typedef long int integer;
-typedef long int logical;
+typedef int integer;
+typedef int logical;

#define max(a,b) ((a) >= (b) ? (a) : (b))
#define dmax(a,b) (double)max(a,b)
9 changes: 9 additions & 0 deletions build/pkgs/dsdp/spkg-install.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cd src
cp ../patches/CMakeLists.txt .
sdh_cmake -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DBLA_VENDOR=OpenBLAS \
-DBLAS_LIBRARIES="$(pkg-config --libs blas)" \
-DLAPACK_LIBRARIES="$(pkg-config --libs lapack)"
sdh_make
sdh_make_install
1 change: 1 addition & 0 deletions build/pkgs/dsdp/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
optional
32 changes: 32 additions & 0 deletions build/pkgs/scip_sdp/SPKG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
scip_sdp: Mixed integer semidefinite programming plugin for SCIP
================================================================

Description
-----------

SCIP-SDP allows to solve MISDPs using a nonlinear branch-and-bound
approach or a linear programming cutting-plane approach.

- In the first case (the default), the semidefinite programming (SDP)
relaxations are solve using interior-point SDP-solvers.

- In the second case, cutting planes based on eigenvector are
generated.

SCIP-SDP is based on the branch-and-cut framework SCIP. In addition to
providing a constraint handler for SDP-constraints and a relaxator to
solve continuous SDP-relaxations using interior-point solvers,
SCIP-SDP adds several heuristics and propagators to SCIP.

License
-------

Apache 2.0


Upstream Contact
----------------

http://www.opt.tu-darmstadt.de/scipsdp/

https://github.com/scipopt/SCIP-SDP
5 changes: 5 additions & 0 deletions build/pkgs/scip_sdp/checksums.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tarball=scipsdp-VERSION.tgz
sha1=dcfb090a95f79df8524bcc63d34d7ddc6692924e
md5=4f900c60456b3f08160ca494bec8e9f4
cksum=2622380399
upstream_url=http://www.opt.tu-darmstadt.de/scipsdp/downloads/scipsdp-VERSION.tgz
1 change: 1 addition & 0 deletions build/pkgs/scip_sdp/dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
scip dsdp | cmake
1 change: 1 addition & 0 deletions build/pkgs/scip_sdp/package-version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
From 09e79cf75146ca34c637f919d1f4527a63743300 Mon Sep 17 00:00:00 2001
From: Marc Pfetsch <pfetsch@mathematik.tu-darmstadt.de>
Date: Fri, 9 Dec 2022 18:52:09 +0100
Subject: [PATCH] use cmake FindLAPACK

---
CMakeLists.txt | 14 +++++---------
src/CMakeLists.txt | 6 +++---
2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 15e4edc..d4f14f5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -79,16 +79,12 @@ add_custom_target(scip_update_githash
COMMAND ${CMAKE_COMMAND} -DDST=${PROJECT_SOURCE_DIR}/scipsdpgithash.c
-P ${CMAKE_BINARY_DIR}/scip_update_githash.cmake)

-
# find lapack and blas
-find_library(LAPACK_LIBRARY lapack)
-if(LAPACK_LIBRARY)
- message(STATUS "Found lapack library: " ${LAPACK_LIBRARY})
-endif()
-
-find_library(BLAS_LIBRARY blas)
-if(BLAS_LIBRARY)
- message(STATUS "Found blas library: " ${BLAS_LIBRARY})
+find_package(LAPACK REQUIRED)
+if(LAPACK_FOUND)
+ message(STATUS "Found lapack library: " ${LAPACK_LIBRARIES})
+else()
+ message(FATAL_ERROR "Lapack not found")
endif()

# search the selected symmetry computation program
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 30c66b7..5e5d7d3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -125,11 +125,11 @@ setLibProperties(libscipsdp "scipsdp")
#put binary in bin directory
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(SHARED)
- target_link_libraries(libscipsdp PRIVATE ${ZIMPL_PIC_LIBRARIES} ${SDPS_PIC_LIBRARIES} ${SYM_LIBRARIES} ${LAPACK_LIBRARY} ${BLAS_LIBRARY} m)
+ target_link_libraries(libscipsdp PRIVATE ${ZIMPL_PIC_LIBRARIES} ${SDPS_PIC_LIBRARIES} ${SYM_LIBRARIES} ${LAPACK_LIBRARIES} m)
add_executable(scipsdp scipsdp/main.c ${scipsdpsources} ${objscipsdpsources} ${sdpisources} ${sym})
- target_link_libraries(scipsdp ${ZLIB_LIBRARIES} ${Readline_LIBRARY} ${GMP_LIBRARIES} ${ZIMPL_LIBRARIES} ${SDPS_LIBRARIES} ${SCIP_LIBRARIES} ${SYM_LIBRARIES} ${LAPACK_LIBRARY} ${BLAS_LIBRARY} m)
+ target_link_libraries(scipsdp ${ZLIB_LIBRARIES} ${Readline_LIBRARY} ${GMP_LIBRARIES} ${ZIMPL_LIBRARIES} ${SDPS_LIBRARIES} ${SCIP_LIBRARIES} ${SYM_LIBRARIES} ${LAPACK_LIBRARIES} m)
else()
- target_link_libraries(libscipsdp PRIVATE ${ZIMPL_LIBRARIES} ${SDPS_LIBRARIES} ${SYM_LIBRARIES} ${LAPACK_LIBRARY} ${BLAS_LIBRARY} m)
+ target_link_libraries(libscipsdp PRIVATE ${ZIMPL_LIBRARIES} ${SDPS_LIBRARIES} ${SYM_LIBRARIES} ${LAPACK_LIBRARIES} m)
add_executable(scipsdp scipsdp/main.c ${scipsdpsources} ${objscipsdpsources} ${sdpisources} ${sym})
target_link_libraries(scipsdp libscipsdp ${SCIP_LIBRARIES})
endif()
19 changes: 19 additions & 0 deletions build/pkgs/scip_sdp/patches/macos_link.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
commit 09f4b596870a2774f7104e318d9812cd5c7ace4a
Author: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
Date: Wed Dec 7 14:59:49 2022 -0800

src/CMakeLists.txt: Link libscipsdp through with libscip

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5e5d7d3..ac3841e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -125,7 +125,7 @@ setLibProperties(libscipsdp "scipsdp")
#put binary in bin directory
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(SHARED)
- target_link_libraries(libscipsdp PRIVATE ${ZIMPL_PIC_LIBRARIES} ${SDPS_PIC_LIBRARIES} ${SYM_LIBRARIES} ${LAPACK_LIBRARIES} m)
+ target_link_libraries(libscipsdp PRIVATE ${ZIMPL_PIC_LIBRARIES} ${SDPS_PIC_LIBRARIES} ${SCIP_LIBRARIES} ${SYM_LIBRARIES} ${LAPACK_LIBRARIES} m)
add_executable(scipsdp scipsdp/main.c ${scipsdpsources} ${objscipsdpsources} ${sdpisources} ${sym})
target_link_libraries(scipsdp ${ZLIB_LIBRARIES} ${Readline_LIBRARY} ${GMP_LIBRARIES} ${ZIMPL_LIBRARIES} ${SDPS_LIBRARIES} ${SCIP_LIBRARIES} ${SYM_LIBRARIES} ${LAPACK_LIBRARIES} m)
else()
35 changes: 35 additions & 0 deletions build/pkgs/scip_sdp/patches/no_rpath.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
commit b12db4b95295fec9b32131039a6ee4a746c6f832
Author: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
Date: Wed Dec 7 15:03:48 2022 -0800

src/CMakeLists.txt: Remote hardcoded RPATH settings

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f293115..64ac3d1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -5,8 +5,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
#
function(setLibProperties targetname outputname)
set_target_properties(${targetname} PROPERTIES
- OUTPUT_NAME ${outputname}
- MACOSX_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+ OUTPUT_NAME ${outputname})
endfunction(setLibProperties)

set(CMAKE_C_STANDARD 99)
@@ -141,13 +140,7 @@ target_compile_definitions(scipsdp PRIVATE EXTERN=extern)

set_target_properties(libscipsdp PROPERTIES
VERSION ${SCIPSDP_VERSION_MAJOR}.${SCIPSDP_VERSION_MINOR}.${SCIPSDP_VERSION_PATCH}
- SOVERSION ${SCIPSDP_VERSION_MAJOR}.${SCIPSDP_VERSION_MINOR}
- INSTALL_RPATH_USE_LINK_PATH TRUE)
-
-# set the install rpath to the installed destination
-set_target_properties(scipsdp PROPERTIES
- INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib"
- INSTALL_RPATH_USE_LINK_PATH TRUE)
+ SOVERSION ${SCIPSDP_VERSION_MAJOR}.${SCIPSDP_VERSION_MINOR})

# install the header files of scip
install(FILES ${sdpiheaders} DESTINATION include/sdpi)
Loading

0 comments on commit 3d86126

Please sign in to comment.