Permalink
Browse files

Updated Makefiles to new scheme where CFLAGS and LIBS are set in top …

…level
  • Loading branch information...
brianborchers committed Jul 17, 2017
1 parent 8b11d84 commit eaacb0276b7a7d080a0cfc0e931b97778b3a1e85
Showing with 34 additions and 469 deletions.
  1. +11 −4 INSTALL
  2. +23 −38 Makefile
  3. +0 −103 example/Makefile
  4. +0 −100 lib/Makefile
  5. +0 −115 solver/Makefile
  6. +0 −109 theta/Makefile
15 INSTALL
@@ -133,10 +133,17 @@ LIBS=-static -L../lib -lsdp -llapack -lblas -lm
-llapack -lblas LAPACK and BLAS libraries
-lm C standard math library

The LIBS variable will have to be edited if your LAPACK and BLAS libraries
are not in the standard location or have different names. For example,
on my system, the OpenBLAS library is in /opt/OpenBLAS/lib/libopenblas.a.
This library contains both LAPACK and BLAS routines. Thus I use the flags:
In many cases it will be necessary to add the Fortran run time library:

-lgfortran

The LIBS variable will also have to be edited if your LAPACK and BLAS libraries
are not in the standard location or have different names.

For example, on my system, the OpenBLAS library is located in
/opt/OpenBLAS/lib/libopenblas.a. This OpenBLAS library contains both
LAPACK and BLAS routines, so I don't need to specify a spearate LAPACK
library. Thus I use the flags:

LIBS=-static -L../lib -L/opt/OpenBLAS/lib -lopenblas -lm

@@ -1,51 +1,36 @@
#
# This Makefile can be used to automatically build the entire package.
# Target all builds everything.
#
# If you make changes in the "Makefile" under any subdirectory, you can
# rebuild the system with "make clean" followed by "make all".
all: theta complement rand_graph graphtoprob
#
# This builds the theta number code.
#
# Generic. On most systems, this should handle everything.
theta: theta.o
$(CC) $(CFLAGS) theta.o $(LIBS) -o theta
#
all:
cd lib; make libsdp.a
cd solver; make csdp
cd theta; make all
cd example; make all

# Complement computes the complement of a graph.
#
# Perform a unitTest
complement: complement.o
$(CC) $(CFLAGS) complement.o $(LIBS) -o complement
#

unitTest:
cd test; make all

# rand_graph generates a random graph.
#
# Install the executables in /usr/local/bin.
rand_graph: rand_graph.o
$(CC) $(CFLAGS) rand_graph.o $(LIBS) -o rand_graph
#

install:
cp -f solver/csdp /usr/local/bin
cp -f theta/theta /usr/local/bin
cp -f theta/graphtoprob /usr/local/bin
cp -f theta/complement /usr/local/bin
cp -f theta/rand_graph /usr/local/bin

# graphtoprob converts a file in the graph format to an SDP problem in our
# SDP format.
#
graphtoprob: graphtoprob.o
$(CC) $(CFLAGS) graphtoprob.o $(LIBS) -o graphtoprob
#
# To clean up the directory.
#
# Clean out all of the directories.
#

clean:
cd lib; make clean
cd solver; make clean
cd theta; make clean
cd test; make clean
cd example; make clean






rm -f *.o
rm -f theta
rm -f complement
rm -f rand_graph
rm -f graphtoprob


@@ -1,107 +1,4 @@
#
# Uncomment this line to specify the C compiler if the system default isn't
# what you want to use.
#
#CC=cc
#
# Use this line to specify options for the C compiler. You'll probably
# want to turn on optimizations. You may also have to use some of the
# following flags:
#
# -DCAPSBLAS if BLAS routine names are capitalized.
# -DCAPSLAPACK if LAPACK routine names are capitalized.
# -DNOUNDERBLAS if BLAS routine names have no underscore.
# -DNOUNDERLAPACK if LAPACK routine names have no underscore.
# -DBIT64 For I32LP64 systems.
# -DUSEOPENMP To turn on OpenMP parallelization
# -DSETNUMTHREADS To use with an OpenMP aware BLAS library.
#
# The default settings for gcc:
#
CFLAGS=-O3 -ansi -Wall -I../include
#
# Notes on CFLAGS.
#
# 2. By default, we assume that BLAS routines have names like ddot_(),
# but some systems use ddot(), DDOT(), or DDOT_() instead. A similar issue
# effects the LAPACK routines. The flags -DCAPSBLAS, -DCAPSLAPACK,
# -DNOUNDERBLAS. and -DNOUNDERLAPACK are used to handle such situations.
#
# 3. The code can be built on 64 bit systems that use an I32LP64 model
# in which int's are 32 bits, long's and pointers are 64 bits. Note that
# that is the model on all 64 bit Linux and Unix systems that I'm aware of,
# but it is not the model used by MS in its 64 bit Windows! To build a
# 64 bit version of the code, use -DBIT64. You may also need to add a CFLAG
# to tell your compiler to produce 64 bit code. For example, with gcc,
# you'll need to add "-m64" to CFLAGS to produce 64 bit code.
#
# 4. If you have multiple CPU's, and if your compiler supports OpenMP, then
# you should definitely build a parallel version of CSDP. To do this,
# add "-DUSEOPENMP" to CFLAGS. If your BLAS/LAPACK library routines
# use OpenMP's conventions for setting the number of threads to use, then
# you should also add "-DSETNUMTHREADS". Note that ATLAS does not
# currently work with "-DSETNUMTHREADS", but you can use SETNUMTHREADS
# on Solaris with -lsunperf and AIX systems with -lesslsmp.

# 5. Using gcc, you can greatly improve the efficency of the code if you
# specify your processor type. Examples are given below, use the default
# if you are unsure. More examples may be found at
#
# http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html
#
# An AMD Athlon XP based machine:
# CFLAGS=-march=athlon-xp -O3 -ansi -Wall -I../include
# An Intel Pentum 4 based amchine:
# CFLAGS=-march=pentum4 -O3 -ansi -Wall -I../include
#
# 6. If you change the CFLAGS, make sure that you use the same CFLAGS
# in the Makefiles in the solver and theta directories!
#
# The code depends on several libraries:
#
# sdp The CSDP subroutine library
# lapack The LAPACK linear algebra library
# blas The BLAS basic linear algebra library
#
# In addition, if you're using gcc to compile the C code, then you'll need:
#
# gfortran The gnu C/Fortran 77 compatibility library
# m The C math run time library.
#
#
# Use this line to specify where the SDP and linear algebra libraries are
# to be found.
#
# -L../lib look in the ../lib directory
# -lsdp get libsdp.a from the ../lib directory
# -llapack get liblapack.a or liblapack.so
# -lblas get libblas.a or libblas.so
# -lgfortran get libgfortran.a or libgfortran.so
# -lm get libm.a or libm.so
#
# The default settings for a Linux system with gcc3, lapack, blas, and
# gfortran:
#
LIBS=-L../lib -lsdp -llapack -lblas -lgfortran -lm
#
# 1. Warning about debian systems. For some absurb reason, the BLAS
# package in debian has the BLAS library named libblas-3.a, rather than
# libblas.a. You can either modify the LIBS= line, or you can create
# a symbolic link from /usr/lib/libblas.a to /usr/lib/libblas-3.a.
#
# 2. An alternative set of flags for use with the ATLAS BLAS on a Linux system.
#
# LIBS=-L../lib -lsdp -llapack -lf77blas -lcblas -latlas -lgfortran -lm
#
# 3. Special note on gcc 4. For gcc versions before gcc 4.0, -lgfortran
# should be replaced by -lg2c.
#
# 4. An alternative set of flags for use with the ATLAS BLAS, gcc 4.2, and
# OpenMP on a linux system.
#
# LIBS=-L../lib -lsdp -llapack -lptf77blas -lptcblas -latlas -lgomp -lrt -lpthread -lgfortran -lm
#
#
# Target all builds everything.
#
all: example
@@ -1,104 +1,4 @@
#
# Uncomment this line to specify the C compiler if the system default isn't
# what you want to use.
#
#CC=cc
#
# Use this line to specify options for the C compiler. You'll probably
# want to turn on optimizations. You may also have to use some of the
# following flags:
#
# -DCAPSBLAS if BLAS routine names are capitalized.
# -DCAPSLAPACK if LAPACK routine names are capitalized.
# -DNOUNDERBLAS if BLAS routine names have no underscore.
# -DNOUNDERLAPACK if LAPACK routine names have no underscore.
# -DBIT64 For I32LP64 systems.
# -DUSEOPENMP Build an OpenMP parallel version.
# -DSETNUMTHREADS Work with OpenMP aware BLAS.
# -DUSESIGTERM Terminate nicely at the end of the next iteration
# after receiving a SIGTERM signal
# -DUSEGETTIME Use ANSI C gettime() routine to determine clock
# time used in different parts of the code.
# -DUSEATLAS Turns on some special code for use with the ATLAS BLAS.
# -DHIDDENSTRLEN Calls BLAS/LAPACK routines with hidden string length
# arguments at the end of argument list. Used by some
# Fortran compilers and ACML BLAS/LAPCK.
#
# The default settings for gcc:
#
CFLAGS=-O3 -ansi -Wall -DUSEGETTIME -I../include
#
# Notes on CFLAGS.
#
#
# 2. -DUSEGETTIME is generally useful. However, this functionality isn't
# available under Windows/MSYS/MINGW, so you should remove it when compiling
# for that system.
#
# 3. By default, we assume that BLAS routines have names like ddot_(),
# but some systems use ddot(), DDOT(), or DDOT_() instead. A similar issue
# effects the LAPACK routines. The flags -DCAPSBLAS, -DCAPSLAPACK,
# -DNOUNDERBLAS. and -DNOUNDERLAPACK are used to handle such situations.
#
# 4. The code can be built on 64 bit systems that use an I32LP64 model
# in which int's are 32 bits, long's and pointers are 64 bits. Note that
# that is the model on all 64 bit Linux and Unix systems that I'm aware of,
# but it is not the model used by MS in its 64 bit Windows! To build a
# 64 bit version of the code, use -DBIT64. You may also need to add a CFLAG
# to tell your compiler to produce 64 bit code. For example, with gcc,
# you'll need to add "-m64" to CFLAGS to produce 64 bit code.
#
# 5. If you have multiple CPU's, and if your compiler supports OpenMP, then
# you should definitely build a parallel version of CSDP. To do this,
# add "-DUSEOPENMP" to CFLAGS. If your BLAS/LAPACK library routines
# use OpenMP's conventions for setting the number of threads to use, then
# you should also add "-DSETNUMTHREADS". Note that ATLAS does not
# currently work with "-DSETNUMTHREADS", but you can use SETNUMTHREADS
# on Solaris with -lsunperf and AIX systems with -lesslsmp.
#
# You will also have to add appropriate CFLAGS to tell your compiler
# to compile OpenMP code. This varies from system to system. However,
# with gcc4.2, you can use
#
# -static -fopenmp
#
# You may also have to add additional libraries when you link your
# OpenMP code. For example, gcc 4.2 with OpenMP needs
#
# -lgomp -lrt -lpthread
#
# 6. Using gcc, you can greatly improve the efficency of the code if you
# specify your processor type. Examples are given below, use the default
# if you are unsure. More examples may be found at
#
# http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html
#
# An AMD Athlon XP based machine:
# CFLAGS=-march=athlon-xp -O3 -ansi -Wall -I../include
# An Intel Pentum 4 based machine:
# CFLAGS=-march=pentum4 -O3 -ansi -Wall -I../include
#
# 7. The code can be built with Intel's icc C compiler and MKL BLAS/
# LAPACK libraries. This has been tested with icc 11.0 and should
# work with later versions as well.
#
# CC=icc
# CFLAGS=-O3 -m64 -openmp -DBIT64 -DUSEOPENMP -DSETNUMTHREADS
# -I../include
# LIBS=-openmp -L../lib -lsdp -mkl -lm
#
# 8. The can works particularly well with the ATLAS BLAS/LAPACK routines
# when compiled with gcc. There are some important optimizations in the
# code that depend on the availability of routines within ATLAS, so use
# use -DUSEATLAS to turn these on. e.g.
#
# CFLAGS=-O3 -fopenmp -ansi -Wall -DUSEATLAS -DBIT64
# -DUSEOPENMP -I../include
#
#
# 9. If you change the CFLAGS, make sure that you use the same CFLAGS
# in the Makefiles in the solver and theta directories!
#
# Build the library.
#
libsdp.a: readprob.o sdp.o op_o.o psd_feas.o op_a.o op_at.o Fnorm.o calc_pobj.o calc_dobj.o trace_prod.o zero_mat.o mat_mult.o sym_mat.o copy_mat.o addscaledmat.o user_exit.o make_i.o allocmat.o initsoln.o initparams.o add_mat.o writesol.o readsol.o easysdp.o writeprob.o solvesys.o makefill.o mat_multsp.o norms.o linesearch.o matvec.o chol.o qreig.o tweakgap.o freeprob.o packed.o sortentries.o
Oops, something went wrong.

0 comments on commit eaacb02

Please sign in to comment.