From 7c5767db7138c2ced3715d5504c050650b8f3544 Mon Sep 17 00:00:00 2001 From: Peter Carbonetto Date: Sun, 28 May 2017 10:49:45 -0500 Subject: Fixed d2f.sh; created new Makefile for single-precision floats. --- .gitignore | 2 + Makefile.float.linux | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile.linux | 2 +- Makefile.macosx | 114 ++++++++++++++++++++++++++++++++++++++++++++++ Makefile.osx | 114 ---------------------------------------------- src/d2f.sh | 30 ++++++------- 6 files changed, 257 insertions(+), 130 deletions(-) create mode 100644 Makefile.float.linux create mode 100644 Makefile.macosx delete mode 100644 Makefile.osx mode change 100644 => 100755 src/d2f.sh diff --git a/.gitignore b/.gitignore index 4fcf8a3..1b3dc47 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ *.o *.tar.gz +src/*_float.h +src/*_float.cpp example/output doc/manual.aux doc/manual.bbl diff --git a/Makefile.float.linux b/Makefile.float.linux new file mode 100644 index 0000000..5c82ede --- /dev/null +++ b/Makefile.float.linux @@ -0,0 +1,125 @@ +#Makefile + +# Supported platforms +# Unix / Linux LNX +# Mac MAC +# Compilation options +# link to LAPACK WITH_LAPACK +# 32-bit binary FORCE_32BIT +# dynamic compilation FORCE_DYNAMIC +# float precision FORCE_FLOAT + +# Set this variable to either LNX or MAC +SYS = LNX +# Leave blank after "=" to disable; put "= 1" to enable +# Disable WITH_LAPACK option can slow computation speed significantly and is not recommended +# Disable WITH_ARPACK option only disable -apprx option in the software +WITH_LAPACK = 1 +FORCE_32BIT = +FORCE_DYNAMIC = +FORCE_FLOAT = 1 +DIST_NAME = gemma-0.95.2alpha + +# -------------------------------------------------------------------- +# Edit below this line with caution +# -------------------------------------------------------------------- + + +BIN_DIR = ./bin + +SRC_DIR = ./src + +CPP = g++ + +CPPFLAGS = -Wall -Weffc++ -O3 -std=gnu++11 + +LIBS = /software/gsl-2.2.1-el7-x86_64/lib/libgslcblas.a \ + /software/gsl-2.2.1-el7-x86_64/lib/libgsl.a \ + -pthread -lz + +# ifdef FORCE_DYNAMIC +# LIBS = -lgsl -lgslcblas -lblas -pthread -lz +# else +# LIBS = -lgsl -lgslcblas -pthread -lz +# endif + +OUTPUT = $(BIN_DIR)/gemma + +ifdef FORCE_FLOAT +OUTPUT = $(BIN_DIR)/gemmaf +endif + +SOURCES = $(SRC_DIR)/main.cpp + +HDR = + +# Detailed libary paths, D for dynamic and S for static +LIBS_LNX_D_LAPACK = -llapack +LIBS_MAC_D_LAPACK = -framework Veclib +LIBS_LNX_S_LAPACK = /software/atlas-3.10.3-el7-x86_64/lib/liblapack.a \ + /software/atlas-3.10.3-el7-x86_64/lib/libcblas.a \ + /software/atlas-3.10.3-el7-x86_64/lib/libf77blas.a \ + /software/atlas-3.10.3-el7-x86_64/lib/libatlas.a -lgfortran \ + -Wl,--allow-multiple-definition + +# Options + +ifdef FORCE_FLOAT + CPPFLAGS += -DFORCE_FLOAT + SOURCES += $(SRC_DIR)/param_float.cpp $(SRC_DIR)/gemma_float.cpp $(SRC_DIR)/io_float.cpp $(SRC_DIR)/lm_float.cpp $(SRC_DIR)/vc_float.cpp $(SRC_DIR)/lmm_float.cpp $(SRC_DIR)/mvlmm_float.cpp $(SRC_DIR)/bslmm_float.cpp $(SRC_DIR)/prdt_float.cpp $(SRC_DIR)/mathfunc_float.cpp $(SRC_DIR)/gzstream.cpp $(SRC_DIR)/eigenlib.cpp + HDR += $(SRC_DIR)/param_float.h $(SRC_DIR)/gemma_float.h $(SRC_DIR)/io_float.h $(SRC_DIR)/lm_float.h $(SRC_DIR)/lmm_float.h $(SRC_DIR)/vc_float.h $(SRC_DIR)/mvlmm_float.h $(SRC_DIR)/bslmm_float.h $(SRC_DIR)/prdt_float.h $(SRC_DIR)/mathfunc_float.h $(SRC_DIR)/gzstream.h $(SRC_DIR)/eigenlib.h +else + SOURCES += $(SRC_DIR)/param.cpp $(SRC_DIR)/gemma.cpp $(SRC_DIR)/io.cpp $(SRC_DIR)/lm.cpp $(SRC_DIR)/lmm.cpp $(SRC_DIR)/vc.cpp $(SRC_DIR)/mvlmm.cpp $(SRC_DIR)/bslmm.cpp $(SRC_DIR)/prdt.cpp $(SRC_DIR)/mathfunc.cpp $(SRC_DIR)/gzstream.cpp $(SRC_DIR)/eigenlib.cpp $(SRC_DIR)/ldr.cpp $(SRC_DIR)/bslmmdap.cpp $(SRC_DIR)/logistic.cpp $(SRC_DIR)/varcov.cpp + HDR += $(SRC_DIR)/param.h $(SRC_DIR)/gemma.h $(SRC_DIR)/io.h $(SRC_DIR)/lm.h $(SRC_DIR)/lmm.h $(SRC_DIR)/vc.h $(SRC_DIR)/mvlmm.h $(SRC_DIR)/bslmm.h $(SRC_DIR)/prdt.h $(SRC_DIR)/mathfunc.h $(SRC_DIR)/gzstream.h $(SRC_DIR)/eigenlib.h +endif + +ifdef WITH_LAPACK + OBJS += $(SRC_DIR)/lapack.o + CPPFLAGS += -DWITH_LAPACK +ifeq ($(SYS), MAC) + LIBS += $(LIBS_MAC_D_LAPACK) +else +ifdef FORCE_DYNAMIC + LIBS += $(LIBS_LNX_D_LAPACK) +else + LIBS += $(LIBS_LNX_S_LAPACK) +endif +endif + SOURCES += $(SRC_DIR)/lapack.cpp + HDR += $(SRC_DIR)/lapack.h +endif + +ifdef FORCE_32BIT + CPPFLAGS += -m32 +else + CPPFLAGS += -m64 +endif + +# all +OBJS = $(SOURCES:.cpp=.o) + +all: $(OUTPUT) + +$(OUTPUT): $(OBJS) + $(CPP) $(CPPFLAGS) $(OBJS) $(LIBS) -o $(OUTPUT) + +$(OBJS) : $(HDR) + +.cpp.o: + $(CPP) $(CPPFLAGS) $(HEADERS) -c $*.cpp -o $*.o +.SUFFIXES : .cpp .c .o $(SUFFIXES) + + +clean: + rm -rf ${SRC_DIR}/*.o ${SRC_DIR}/*~ *~ ${SRC_DIR}/*_float.* $(OUTPUT) + +DIST_COMMON = COPYING.txt README.txt Makefile +DIST_SUBDIRS = src doc example bin + +tar: + mkdir -p ./$(DIST_NAME) + cp $(DIST_COMMON) ./$(DIST_NAME)/ + cp -r $(DIST_SUBDIRS) ./$(DIST_NAME)/ + tar cvzf $(DIST_NAME).tar.gz ./$(DIST_NAME)/ + rm -r ./$(DIST_NAME) + diff --git a/Makefile.linux b/Makefile.linux index 322f1e6..25a2e1b 100644 --- a/Makefile.linux +++ b/Makefile.linux @@ -18,7 +18,7 @@ WITH_LAPACK = 1 FORCE_32BIT = FORCE_DYNAMIC = FORCE_FLOAT = -DIST_NAME = gemma-0.95.2alpha +DIST_NAME = gemma-0.96alpha # -------------------------------------------------------------------- # Edit below this line with caution diff --git a/Makefile.macosx b/Makefile.macosx new file mode 100644 index 0000000..798f09c --- /dev/null +++ b/Makefile.macosx @@ -0,0 +1,114 @@ +#Makefile + +# Supported platforms +# Unix / Linux LNX +# Mac MAC +# Compilation options +# link to LAPACK WITH_LAPACK +# 32-bit binary FORCE_32BIT +# dynamic compilation FORCE_DYNAMIC +# float precision FORCE_FLOAT + +# Set this variable to either LNX or MAC +SYS = MAC +# Leave blank after "=" to disable; put "= 1" to enable +# Disable WITH_LAPACK option can slow computation speed significantly and is not recommended +# Disable WITH_ARPACK option only disable -apprx option in the software +WITH_LAPACK = 1 +FORCE_32BIT = +FORCE_DYNAMIC = 1 +FORCE_FLOAT = +DIST_NAME = gemma-0.96 + +# -------------------------------------------------------------------- +# Edit below this line with caution +# -------------------------------------------------------------------- +BIN_DIR = ./bin + +SRC_DIR = ./src + +CPP = g++ + +CPPFLAGS = -F /System/Library/Frameworks -Wall -Weffc++ \ + -O3 -I/usr/local/opt/gsl@1/include -Wc++11-narrowing + +LIBS = /usr/local/opt/gsl@1/lib/libgsl.a \ + /usr/local/opt/gsl@1/lib/libgslcblas.a -lz + +OUTPUT = $(BIN_DIR)/gemma + +ifdef FORCE_FLOAT +OUTPUT = $(BIN_DIR)/gemmaf +endif + +SOURCES = $(SRC_DIR)/main.cpp + +HDR = + +# Detailed libary paths, D for dynamic and S for static + +LIBS_LNX_D_LAPACK = -llapack +LIBS_MAC_D_LAPACK = -framework Accelerate +LIBS_LNX_S_LAPACK = /usr/lib/lapack/liblapack.a -lgfortran /usr/lib/atlas-base/libatlas.a /usr/lib/libblas/libblas.a -Wl,--allow-multiple-definition + +# Options + +ifdef FORCE_FLOAT + CPPFLAGS += -DFORCE_FLOAT + SOURCES += $(SRC_DIR)/param_float.cpp $(SRC_DIR)/gemma_float.cpp $(SRC_DIR)/io_float.cpp $(SRC_DIR)/lm_float.cpp $(SRC_DIR)/vc_float.cpp $(SRC_DIR)/lmm_float.cpp $(SRC_DIR)/mvlmm_float.cpp $(SRC_DIR)/bslmm_float.cpp $(SRC_DIR)/prdt_float.cpp $(SRC_DIR)/mathfunc_float.cpp $(SRC_DIR)/gzstream.cpp $(SRC_DIR)/eigenlib.cpp + HDR += $(SRC_DIR)/param_float.h $(SRC_DIR)/gemma_float.h $(SRC_DIR)/io_float.h $(SRC_DIR)/lm_float.h $(SRC_DIR)/lmm_float.h $(SRC_DIR)/vc_float.h $(SRC_DIR)/mvlmm_float.h $(SRC_DIR)/bslmm_float.h $(SRC_DIR)/prdt_float.h $(SRC_DIR)/mathfunc_float.h $(SRC_DIR)/gzstream.h $(SRC_DIR)/eigenlib.h +else + SOURCES += $(SRC_DIR)/param.cpp $(SRC_DIR)/gemma.cpp $(SRC_DIR)/io.cpp $(SRC_DIR)/lm.cpp $(SRC_DIR)/lmm.cpp $(SRC_DIR)/vc.cpp $(SRC_DIR)/mvlmm.cpp $(SRC_DIR)/bslmm.cpp $(SRC_DIR)/prdt.cpp $(SRC_DIR)/mathfunc.cpp $(SRC_DIR)/gzstream.cpp $(SRC_DIR)/eigenlib.cpp $(SRC_DIR)/ldr.cpp $(SRC_DIR)/bslmmdap.cpp $(SRC_DIR)/logistic.cpp $(SRC_DIR)/varcov.cpp + HDR += $(SRC_DIR)/param.h $(SRC_DIR)/gemma.h $(SRC_DIR)/io.h $(SRC_DIR)/lm.h $(SRC_DIR)/lmm.h $(SRC_DIR)/vc.h $(SRC_DIR)/mvlmm.h $(SRC_DIR)/bslmm.h $(SRC_DIR)/prdt.h $(SRC_DIR)/mathfunc.h $(SRC_DIR)/gzstream.h $(SRC_DIR)/eigenlib.h +endif + +ifdef WITH_LAPACK + OBJS += $(SRC_DIR)/lapack.o + CPPFLAGS += -DWITH_LAPACK +ifeq ($(SYS), MAC) + LIBS += $(LIBS_MAC_D_LAPACK) +else +ifdef FORCE_DYNAMIC + LIBS += $(LIBS_LNX_D_LAPACK) +else + LIBS += $(LIBS_LNX_S_LAPACK) +endif +endif + SOURCES += $(SRC_DIR)/lapack.cpp + HDR += $(SRC_DIR)/lapack.h +endif + +ifdef FORCE_32BIT + CPPFLAGS += -m32 +else + CPPFLAGS += -m64 +endif + +# all +OBJS = $(SOURCES:.cpp=.o) + +all: $(OUTPUT) + +$(OUTPUT): $(OBJS) + $(CPP) $(CPPFLAGS) $(OBJS) $(LIBS) -o $(OUTPUT) + +$(OBJS) : $(HDR) + +.cpp.o: + $(CPP) $(CPPFLAGS) $(HEADERS) -c $*.cpp -o $*.o +.SUFFIXES : .cpp .c .o $(SUFFIXES) + + +clean: + rm -rf ${SRC_DIR}/*.o ${SRC_DIR}/*~ *~ ${SRC_DIR}/*_float.* $(OUTPUT) + +DIST_COMMON = COPYING.txt README.txt Makefile +DIST_SUBDIRS = src doc example bin + +tar: + mkdir -p ./$(DIST_NAME) + cp $(DIST_COMMON) ./$(DIST_NAME)/ + cp -r $(DIST_SUBDIRS) ./$(DIST_NAME)/ + tar cvzf $(DIST_NAME).tar.gz ./$(DIST_NAME)/ + rm -r ./$(DIST_NAME) + diff --git a/Makefile.osx b/Makefile.osx deleted file mode 100644 index 798f09c..0000000 --- a/Makefile.osx +++ /dev/null @@ -1,114 +0,0 @@ -#Makefile - -# Supported platforms -# Unix / Linux LNX -# Mac MAC -# Compilation options -# link to LAPACK WITH_LAPACK -# 32-bit binary FORCE_32BIT -# dynamic compilation FORCE_DYNAMIC -# float precision FORCE_FLOAT - -# Set this variable to either LNX or MAC -SYS = MAC -# Leave blank after "=" to disable; put "= 1" to enable -# Disable WITH_LAPACK option can slow computation speed significantly and is not recommended -# Disable WITH_ARPACK option only disable -apprx option in the software -WITH_LAPACK = 1 -FORCE_32BIT = -FORCE_DYNAMIC = 1 -FORCE_FLOAT = -DIST_NAME = gemma-0.96 - -# -------------------------------------------------------------------- -# Edit below this line with caution -# -------------------------------------------------------------------- -BIN_DIR = ./bin - -SRC_DIR = ./src - -CPP = g++ - -CPPFLAGS = -F /System/Library/Frameworks -Wall -Weffc++ \ - -O3 -I/usr/local/opt/gsl@1/include -Wc++11-narrowing - -LIBS = /usr/local/opt/gsl@1/lib/libgsl.a \ - /usr/local/opt/gsl@1/lib/libgslcblas.a -lz - -OUTPUT = $(BIN_DIR)/gemma - -ifdef FORCE_FLOAT -OUTPUT = $(BIN_DIR)/gemmaf -endif - -SOURCES = $(SRC_DIR)/main.cpp - -HDR = - -# Detailed libary paths, D for dynamic and S for static - -LIBS_LNX_D_LAPACK = -llapack -LIBS_MAC_D_LAPACK = -framework Accelerate -LIBS_LNX_S_LAPACK = /usr/lib/lapack/liblapack.a -lgfortran /usr/lib/atlas-base/libatlas.a /usr/lib/libblas/libblas.a -Wl,--allow-multiple-definition - -# Options - -ifdef FORCE_FLOAT - CPPFLAGS += -DFORCE_FLOAT - SOURCES += $(SRC_DIR)/param_float.cpp $(SRC_DIR)/gemma_float.cpp $(SRC_DIR)/io_float.cpp $(SRC_DIR)/lm_float.cpp $(SRC_DIR)/vc_float.cpp $(SRC_DIR)/lmm_float.cpp $(SRC_DIR)/mvlmm_float.cpp $(SRC_DIR)/bslmm_float.cpp $(SRC_DIR)/prdt_float.cpp $(SRC_DIR)/mathfunc_float.cpp $(SRC_DIR)/gzstream.cpp $(SRC_DIR)/eigenlib.cpp - HDR += $(SRC_DIR)/param_float.h $(SRC_DIR)/gemma_float.h $(SRC_DIR)/io_float.h $(SRC_DIR)/lm_float.h $(SRC_DIR)/lmm_float.h $(SRC_DIR)/vc_float.h $(SRC_DIR)/mvlmm_float.h $(SRC_DIR)/bslmm_float.h $(SRC_DIR)/prdt_float.h $(SRC_DIR)/mathfunc_float.h $(SRC_DIR)/gzstream.h $(SRC_DIR)/eigenlib.h -else - SOURCES += $(SRC_DIR)/param.cpp $(SRC_DIR)/gemma.cpp $(SRC_DIR)/io.cpp $(SRC_DIR)/lm.cpp $(SRC_DIR)/lmm.cpp $(SRC_DIR)/vc.cpp $(SRC_DIR)/mvlmm.cpp $(SRC_DIR)/bslmm.cpp $(SRC_DIR)/prdt.cpp $(SRC_DIR)/mathfunc.cpp $(SRC_DIR)/gzstream.cpp $(SRC_DIR)/eigenlib.cpp $(SRC_DIR)/ldr.cpp $(SRC_DIR)/bslmmdap.cpp $(SRC_DIR)/logistic.cpp $(SRC_DIR)/varcov.cpp - HDR += $(SRC_DIR)/param.h $(SRC_DIR)/gemma.h $(SRC_DIR)/io.h $(SRC_DIR)/lm.h $(SRC_DIR)/lmm.h $(SRC_DIR)/vc.h $(SRC_DIR)/mvlmm.h $(SRC_DIR)/bslmm.h $(SRC_DIR)/prdt.h $(SRC_DIR)/mathfunc.h $(SRC_DIR)/gzstream.h $(SRC_DIR)/eigenlib.h -endif - -ifdef WITH_LAPACK - OBJS += $(SRC_DIR)/lapack.o - CPPFLAGS += -DWITH_LAPACK -ifeq ($(SYS), MAC) - LIBS += $(LIBS_MAC_D_LAPACK) -else -ifdef FORCE_DYNAMIC - LIBS += $(LIBS_LNX_D_LAPACK) -else - LIBS += $(LIBS_LNX_S_LAPACK) -endif -endif - SOURCES += $(SRC_DIR)/lapack.cpp - HDR += $(SRC_DIR)/lapack.h -endif - -ifdef FORCE_32BIT - CPPFLAGS += -m32 -else - CPPFLAGS += -m64 -endif - -# all -OBJS = $(SOURCES:.cpp=.o) - -all: $(OUTPUT) - -$(OUTPUT): $(OBJS) - $(CPP) $(CPPFLAGS) $(OBJS) $(LIBS) -o $(OUTPUT) - -$(OBJS) : $(HDR) - -.cpp.o: - $(CPP) $(CPPFLAGS) $(HEADERS) -c $*.cpp -o $*.o -.SUFFIXES : .cpp .c .o $(SUFFIXES) - - -clean: - rm -rf ${SRC_DIR}/*.o ${SRC_DIR}/*~ *~ ${SRC_DIR}/*_float.* $(OUTPUT) - -DIST_COMMON = COPYING.txt README.txt Makefile -DIST_SUBDIRS = src doc example bin - -tar: - mkdir -p ./$(DIST_NAME) - cp $(DIST_COMMON) ./$(DIST_NAME)/ - cp -r $(DIST_SUBDIRS) ./$(DIST_NAME)/ - tar cvzf $(DIST_NAME).tar.gz ./$(DIST_NAME)/ - rm -r ./$(DIST_NAME) - diff --git a/src/d2f.sh b/src/d2f.sh old mode 100644 new mode 100755 index 8267ee3..d3252e0 --- a/src/d2f.sh +++ b/src/d2f.sh @@ -5,21 +5,21 @@ do for extension in cpp h do cp ${prefix}.${extension} ${prefix}_float.${extension} -sed -i .bak 's/_vector_/_vector_float_/g' ${prefix}_float.${extension} -sed -i .bak 's/_vector /_vector_float /g' ${prefix}_float.${extension} -sed -i .bak 's/_matrix_/_matrix_float_/g' ${prefix}_float.${extension} -sed -i .bak 's/_matrix /_matrix_float /g' ${prefix}_float.${extension} -sed -i .bak 's/ddot/dsdot/g' ${prefix}_float.${extension} -sed -i .bak 's/dtrsv/strsv/g' ${prefix}_float.${extension} -sed -i .bak 's/dtrsy/strsy/g' ${prefix}_float.${extension} -sed -i .bak 's/dgemm/sgemm/g' ${prefix}_float.${extension} -sed -i .bak 's/dgemv/sgemv/g' ${prefix}_float.${extension} -sed -i .bak 's/dsyr/ssyr/g' ${prefix}_float.${extension} -sed -i .bak 's/dsyr2/ssyr2/g' ${prefix}_float.${extension} -sed -i .bak 's/ddot/sdot/g' ${prefix}_float.${extension} -sed -i .bak 's/dger/sger/g' ${prefix}_float.${extension} -sed -i .bak 's/dsyrk/ssyrk/g' ${prefix}_float.${extension} -sed -i .bak 's/daxpy/saxpy/g' ${prefix}_float.${extension} +sed -i.bak 's/_vector_/_vector_float_/g' ${prefix}_float.${extension} +sed -i.bak 's/_vector /_vector_float /g' ${prefix}_float.${extension} +sed -i.bak 's/_matrix_/_matrix_float_/g' ${prefix}_float.${extension} +sed -i.bak 's/_matrix /_matrix_float /g' ${prefix}_float.${extension} +sed -i.bak 's/ddot/dsdot/g' ${prefix}_float.${extension} +sed -i.bak 's/dtrsv/strsv/g' ${prefix}_float.${extension} +sed -i.bak 's/dtrsy/strsy/g' ${prefix}_float.${extension} +sed -i.bak 's/dgemm/sgemm/g' ${prefix}_float.${extension} +sed -i.bak 's/dgemv/sgemv/g' ${prefix}_float.${extension} +sed -i.bak 's/dsyr/ssyr/g' ${prefix}_float.${extension} +sed -i.bak 's/dsyr2/ssyr2/g' ${prefix}_float.${extension} +sed -i.bak 's/ddot/sdot/g' ${prefix}_float.${extension} +sed -i.bak 's/dger/sger/g' ${prefix}_float.${extension} +sed -i.bak 's/dsyrk/ssyrk/g' ${prefix}_float.${extension} +sed -i.bak 's/daxpy/saxpy/g' ${prefix}_float.${extension} rm ${prefix}_float.${extension}.bak done done -- cgit v1.2.3