Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build*
setup.py
1 change: 0 additions & 1 deletion Cgeom
Submodule Cgeom deleted from 2837c6
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ifeq ($(OS),Windows_NT)
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
include Makefile.Linux
include Makefile.ubuntu
endif
ifeq ($(UNAME_S),Darwin)
include Makefile.Darwin
Expand Down
4 changes: 2 additions & 2 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ modules: \
$(OBJDIR)/FunctionSampler2D.$(SHLIB_EXT)

$(OBJDIR)/RCWA.$(SHLIB_EXT):
$(CC) $(LUA_INC) -O3 $(SHLIB_FLAGS) -fpic S4/main_lua.c -o $@ $(LUA_MODULE_LIB) -L$(OBJDIR) -lS4 $(LA_LIBS) -lstdc++
$(CC) $(LUA_INC) -shared -O3 $(SHLIB_FLAGS) -fpic S4/main_lua.c -o $@ $(LUA_MODULE_LIB) -L$(OBJDIR) -lS4 $(LA_LIBS) -lstdc++
$(OBJDIR)/FunctionSampler1D.$(SHLIB_EXT): modules/function_sampler_1d.c modules/function_sampler_1d.h modules/lua_function_sampler_1d.c
$(CC) -c $(OPTFLAGS) -fpic -Wall -I. modules/function_sampler_1d.c -o $(OBJDIR)/modules/function_sampler_1d.o
$(CC) $(OPTFLAGS) $(SHLIB_FLAGS) -fpic -Wall $(LUA_INC) -o $@ $(OBJDIR)/modules/function_sampler_1d.o modules/lua_function_sampler_1d.c $(LUA_MODULE_LIB)
Expand All @@ -146,7 +146,7 @@ clean:

#### S4v2 extension
$(OBJDIR)/S4v2.$(SHLIB_EXT): $(OBJDIR)/$(S4_LIBNAME) S4/ext_lua.c
$(CC) $(SHLIB_FLAGS) $(LUA_INC) S4/ext_lua.c -o $@ $(LUA_MODULE_LIB) -L$(OBJDIR) -lS4 $(LA_LIBS) -lstdc++
$(CC) -shared $(SHLIB_FLAGS) $(LUA_INC) -fPIC S4/ext_lua.c -o $@ $(LUA_MODULE_LIB) -L$(OBJDIR) -lS4 $(LA_LIBS) -lstdc++
$(OBJDIR)/libS4_lua.a: $(OBJDIR)/$(S4_LIBNAME)
$(CC) -c $(LUA_INC) S4/ext_lua.c -o $(OBJDIR)/ext_lua.o
$(AR) crvs $@ $(OBJDIR)/ext_lua.o
100 changes: 100 additions & 0 deletions Makefile.ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# To build:
# make <target>
# Use the 'lib' target first to build the library, then either the Lua
# or Python targets are 'S4lua' and 'python_ext', respectively.

# Set these to the flags needed to link against BLAS and Lapack.
# If left blank, then performance may be very poor.
# On Mac OS,
# BLAS_LIB = -framework vecLib
# LAPACK_LIB = -framework vecLib
# On Debian, with reference BLAS and Lapack (slow)
# BLAS_LIB = -lblas
# LAPACK_LIB = -llapack
# MKL
# BLAS_LIB = -I${MKLROOT}/include -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm

# LAPACK_LIB = -I${MKLROOT}/include -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm
# Openblas
BLAS_LIB = -lopenblas
LAPACK_LIB = -lopenblas
#BLAS_LIB = -lblas
#LAPACK_LIB = -llapack

# Specify the flags for Lua headers and libraries (only needed for Lua frontend)
# On Debian,
LUA_INC = -I/usr/include/lua5.2
LUA_LIB = -llua5.2 -ldl -lm
#LUA_INC = -I/home/jmlloren/SOFTWARE/LUA/include
#LUA_LIB = -L/home/jmlloren/SOFTWARE/LUA/lib -llua -ldl -lm

# Typically if installed,
# FFTW3_INC can be left empty
# FFTW3_LIB = -lfftw3
FFTW3_INC =
FFTW3_LIB = -lfftw3

# Typically,
# PTHREAD_INC = -DHAVE_UNISTD_H -lpthread
# PTHREAD_LIB = -lpthread
PTHREAD_INC =
PTHREAD_LIB =

# Typically if installed,
CHOLMOD_INC = -I/usr/include/suitesparse
CHOLMOD_LIB = -lcholmod -lamd -lcolamd -lcamd -lccolamd
#CHOLMOD_INC =
#CHOLMOD_LIB =

# Specify the MPI library
MPI_INC =
MPI_LIB =

# Specify custom compilers if needed
CXX = /usr/bin/g++
CC = /usr/bin/gcc

#CFLAGS += -O3 -fPIC -march=native -fcx-limited-range -fno-exceptions -std=c99 -DENABLE_S4_TRACE
CFLAGS += -O3 -fPIC -march=native -fcx-limited-range -fno-exceptions -std=c99
#CFLAGS += -O0 -ggdb -fPIC -DDUMP_MATRICES -DENABLE_S4_TRACE

OBJDIR = ./build
S4_BINNAME = $(OBJDIR)/S4
S4_LIBNAME = $(OBJDIR)/libS4.a
S4r_LIBNAME = $(OBJDIR)/libS4r.a

##################### DO NOT EDIT BELOW THIS LINE #####################

#### Set the compilation flags

#CPPFLAGS = -I. -IS4 -IS4/RNP -IS4/kiss_fft -fPIC -DENABLE_S4_TRACE
CPPFLAGS = -I. -IS4 -IS4/RNP -IS4/kiss_fft -fPIC

ifdef BLAS_LIB
CPPFLAGS += -DHAVE_BLAS
endif

ifdef LAPACK_LIB
CPPFLAGS += -DHAVE_LAPACK
endif

ifdef FFTW3_LIB
CPPFLAGS += -DHAVE_FFTW3 $(FFTW3_INC)
endif

ifdef PTHREAD_LIB
CPPFLAGS += -DHAVE_LIBPTHREAD $(PTHREAD_INC)
endif

ifdef CHOLMOD_LIB
CPPFLAGS += -DHAVE_LIBCHOLMOD $(CHOLMOD_INC)
endif

ifdef MPI_LIB
CPPFLAGS += -DHAVE_MPI $(MPI_INC)
endif

LIBS = $(LAPACK_LIB) $(BLAS_LIB) $(LAPACK_LIB) $(FFTW3_LIB) $(PTHREAD_LIB) $(CHOLMOD_LIB) $(MPI_LIB)
LA_LIBS = $(LIBS)

SHLIB_EXT = so
Loading