-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdsdp.patch
218 lines (207 loc) · 6.01 KB
/
dsdp.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
diff --color -ruN DSDP5.8/Makefile DSDP5.8_patched/Makefile
--- DSDP5.8/Makefile 2005-10-21 21:31:14
+++ DSDP5.8_patched/Makefile 2023-04-10 15:13:26
@@ -1,5 +1,5 @@
-default:
+default:
make all
D1 = src
@@ -10,51 +10,27 @@
include make.include
dsdplibrary: chkroot info
- cd ${D1}; make all
- ${RANLIB} ${DSDPLIB}
+ cd src; make all
+ mkdir -p objs
+ find src -name '*.o' -exec mv {} objs/ \;
-example:
- cd ${D2}; make most
+install: dsdplibrary
+ifdef IS_OSX
+ ${CC} $(ARCH_FLAGS) -dynamiclib -install_name $(PREFIX)/lib/libdsdp.dylib \
+ -current_version 5.8 -compatibility_version 5.8 \
+ -o $(PREFIX)/lib/libdsdp.dylib \
+ objs/*.o ${LAPACKBLAS}
+else
+ ${CC} -shared -Wl,-soname,libdsdp.so \
+ -o ${PREFIX}/lib/libdsdp.so \
+ objs/*.o ${LAPACKBLAS}
+endif
+ ${CP} include/*.h ${PREFIX}/include
-test:
- cd ${D4}; make all
-
-dmatlab:
- cd ${D2}; make dsdp
-
-dsdpmatlab: dsdplibrary
- make dmatlab
-
-dsdpapi: dsdplibrary
- make example
- make test;
-
-install:
- make dsdplibrary
- make example
- make test
- make dmatlab
-
-all:
- make install
-
clean:
cd ${D1}; make clean
cd ${D2}; make clean
cd ${D4}; make clean
${RM} lib/lib* matlab/dsdp.mex*
${RM} *~ */*~ */*/*~
-
-htmlzip:
- zip -r DSDP5-api-html.zip dox
- ${RM} -R dox
-
-oshared:
- -@${RM} tmp; \
- mkdir tmp; \
- cd tmp; \
- echo "building ${DSDPLIBSO}"; \
- ${AR} x ${DSDPLIB} ;\
- ${SH_LD} ${DSDPLIBSO} *.o -o ${DSDPLIBSO}; \
- cd ../ ; \
- ${RM} tmp
+ ${RM} objs/*.o
diff --color -ruN DSDP5.8/make.include DSDP5.8_patched/make.include
--- DSDP5.8/make.include 2005-10-21 21:31:14
+++ DSDP5.8_patched/make.include 2023-04-10 14:39:54
@@ -1,87 +1,10 @@
-# STEP 1: Set DSDPROOT in this file or comment out and make it an environment variable
-#DSDPROOT = /home/benson/dsdp/DSDP5.8
-#DSDPROOT = Y:\dsdp\DSDP5.8
-
-# LINUX and GCC USERS can probably stop here,
-# the defaults below should work, although fast BLAS and LAPACK recommended.
-
-# STEP 2: Set the name of the C compiler.
-CC = gcc
-#CC = cc
-#CC = g++
-#CC = mpicc
-#CC = g++ # GNU C++
-#CC = icc # INTEL
-#CC = pgcc # Portland Group
-#CC = ecc -KPIC
-#CC = cl # CYGWIN
-
-
-# STEP 3: Set three compiler options.
-
-# STEP 3a: Compiler Optimization. You should probably add a -On where
-# n is the maximum optimization allowed by your C compiler.
-OPTFLAGS = -O3
-#OPTFLAGS = /O2
-
-# STEP 3b: Add timing support by uncommenting one of the following lines.
-# no timing is completely portable, DSDP_MS_TIME for Microsoft compiler,
-# and DSDP_TIME for gcc and many other Linux/Unix compilers.
-#DSDPTIMER = NONE
+LAPACKBLAS = -L/usr/lib -llapack -lblas
+OPTFLAGS = -O2 -fPIC -mtune=generic
DSDPTIMER = DSDP_TIME
-#DSDPTIMER = DSDP_MS_TIME
-
-# STEP 3c: Add other compiler flags.
-DSDPCFLAGS =
-#DSDPCFLAGS = -Wall
-#DSDPCFLAGS = -DDSDPMATLAB
-# Other flags concern BLAS and LAPACK libraries -- see next step.
-# -DCAPSBLAS if BLAS and LAPACK routine names are capitalized.
-# -DNOUNDERBLAS if BLAS and LAPACK routine names have no underscore.
-# -D__DSDP_NONAMEMANGLING if using C++ compiler and BLAS LAPACK names should not be mangled. This should be picked up automatically.
-
-
-
-# STEP 4. Set Linker and FLAGS: Link the DSDP library to application
-CFLAGS = ${OPTFLAGS} -I. -I${DSDPROOT}/include ${DSDPCFLAGS}
+DSDPCFLAGS = -Wall
+CFLAGS = ${ARCH_FLAGS} ${OPTFLAGS} -I. -I${DSDPROOT}/include ${DSDPCFLAGS}
CLINKER = ${CC} ${OPTFLAGS}
-#CLINKER = ${CXX} ${OPTFLAGS} -static
-#CLINKER = link /out:dsdp5.exe
-#SH_LD = ${CC} -shared -W1,-soname,
-
-# STEP 5:
-# Location of BLAS AND LAPACK libraries.
-# Not needed to compile library or matlab executable
-# Needed to link DSDP library to the driver ( read SDPA files, maxcut example, ...)
-# Also include the math library and other libraries needed to link the BLAS to the C files that call them.
-LAPACKBLAS = -llapack -lblas -lg2c -lm
-#LAPACKBLAS = -L/usr/lib/ -llapack -lblas -lg2c -lm
-#LAPACKBLAS = -L/home/benson/ATLAS/Linux_P4SSE2/lib -llapack -lcblas -lf77blas -latlas -lg2c -lm
-#LAPACKBLAS = -L/sandbox/benson/ATLAS-3.6/lib/Linux_P4SSE2 -llapack -lcblas -lf77blas -latlas -lg2c -lm
-#LAPACKBLAS = /soft/apps/packages/lapack-3.0/lib/lapack_LINUX.a -L/soft/apps/packages/atlas-3.6.0/lib -lcblas -lf77blas -latlas -lg2c -lm
-
-
-# STEP 6, MATLAB MACROS - If compiling Matlab interface, check MEX flag.
-MEX = mex -O
-#MEX = C:\Matlab\bin\mex
-DSDPMATLABDIR = ${DSDPROOT}/matlab
-
-# Location of the DSDP library
-DSDPLIB = ${DSDPROOT}/lib/libdsdp.a
-DSDPLIBSO = ${DSDPROOT}/lib/libdsdp.so
-
-# Link drivers to the following libraries.
-# EXAMPLE_LIBS = ${DSDPLIB} ${LAPACKBLAS}
-
-#Directory to put the examples after compiling them.
-EXECDIR = ${DSDPROOT}/bin/
-
-# STEP 7 SET Operating system commands
-# Other build information, archive, remove, move, copy
-ARCH = ar cr
-RANLIB = ranlib
-#RANLIB = echo
RM = rm -f
MV = mv
CP = cp
@@ -90,11 +13,9 @@
PP = ../
dsdplib: ${DSDPOBJ}
- ${ARCH} ${DSDPLIB} ${DSDPOBJ}
- ${RANLIB} ${DSDPLIB}
- make clean
-.c.o:
+
+.c.o:
${CC} ${CFLAGS} ${DCFLAGS} -c $*.c
info:
@@ -108,7 +29,7 @@
-@echo On `date` on `hostname`
-@echo Machine characteristics: `uname -a`
-@echo "-----------------------------------------"
- -@echo "Using C compiler: ${CC}"
+ -@echo "Using C compiler: ${CC}"
-@echo "Using compiler options: ${CFLAGS}"
-@echo "-----------------------------------------"
-@echo "Current Directory: ${PWD}"
@@ -117,7 +38,7 @@
-@echo " "
#
-chkroot:
+chkroot:
@if [ ${DSDPROOT}foo = foo ] ; then \
echo "*********************** ERROR **********************" ; \
echo "Set the variable DSDPROOT " ; \
diff --color -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
+++ DSDP5.8_patched/src/sys/dsdploginfo.c 2023-04-10 14:39:54
@@ -6,7 +6,9 @@
#include <stdarg.h>
#include <sys/types.h>
#include <stdlib.h>
+#ifndef __APPLE__
#include <malloc.h>
+#endif
#include "dsdpsys.h"
#include "dsdpbasictypes.h"