From e561cae2c69e1b3607e6799cdc53df456ac13601 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Tue, 10 Oct 2017 10:02:28 +0000 Subject: Removing warnings on debug.h assignment --- src/debug.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/debug.cpp b/src/debug.cpp index da0d06f..6fa17bc 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -23,8 +23,8 @@ void do_validate_K(const gsl_matrix *K, bool do_check, bool strict, const char * if (do_check) { // debug_msg("Validating K"); auto eigenvalues = getEigenValues(K); - uint count_small; - if (count_small = count_small_values(eigenvalues,EIGEN_MINVALUE)>1) { + const uint count_small = count_small_values(eigenvalues,EIGEN_MINVALUE); + if (count_small>1) { std::string msg = "K has "; msg += std::to_string(count_small); msg += " eigenvalues close to zero"; @@ -38,7 +38,7 @@ void do_validate_K(const gsl_matrix *K, bool do_check, bool strict, const char * if (negative_values = has_negative_values_but_one(eigenvalues)) { warning_at_msg(__file,__line,"K has more than one negative eigenvalues!"); } - if (count_small>=0 && negative_values && !isMatrixPositiveDefinite(K)) + if (count_small>0 && negative_values && !isMatrixPositiveDefinite(K)) fail_at_msg(strict,__file,__line,"K is not positive definite!"); gsl_vector_free(eigenvalues); } -- cgit v1.2.3 From 8295b73436d732ec048319c9df08f9ef5800cc35 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Tue, 10 Oct 2017 10:08:12 +0000 Subject: Make sure __ASSERT_VOID_CAST works --- src/debug.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/debug.h b/src/debug.h index e910a25..06ca5cb 100644 --- a/src/debug.h +++ b/src/debug.h @@ -28,6 +28,11 @@ inline void fail_at_msg(bool strict, const char *__file, int __line, const char if (strict) exit(1); } + +# ifndef __ASSERT_VOID_CAST +# define __ASSERT_VOID_CAST (void) +# endif + #if defined NDEBUG #define warning_msg(msg) cerr << "**** WARNING: " << msg << endl; -- cgit v1.2.3 From e87cfa17f11e8feb3fc0619507065da1de40ce58 Mon Sep 17 00:00:00 2001 From: Peter Carbonetto Date: Tue, 10 Oct 2017 13:07:14 -0500 Subject: Fixed warning with assignment in if statement. --- src/debug.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/debug.cpp b/src/debug.cpp index 6fa17bc..b7a69f1 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -34,8 +34,8 @@ void do_validate_K(const gsl_matrix *K, bool do_check, bool strict, const char * warning_at_msg(__file,__line,"K is ill conditioned!"); if (!isMatrixSymmetric(K)) fail_at_msg(strict,__file,__line,"K is not symmetric!" ); - bool negative_values; - if (negative_values = has_negative_values_but_one(eigenvalues)) { + bool negative_values = has_negative_values_but_one(eigenvalues); + if (negative_values) { warning_at_msg(__file,__line,"K has more than one negative eigenvalues!"); } if (count_small>0 && negative_values && !isMatrixPositiveDefinite(K)) -- cgit v1.2.3 From e16b0e5f41d2b65223e76f61c7554ee481b2e898 Mon Sep 17 00:00:00 2001 From: Peter Carbonetto Date: Tue, 10 Oct 2017 13:07:51 -0500 Subject: Change ulong type to long. --- src/io.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/io.cpp b/src/io.cpp index 6be01fd..1dc5642 100644 --- a/src/io.cpp +++ b/src/io.cpp @@ -283,7 +283,7 @@ bool ReadFile_anno(const string &file_anno, map &mapRS2chr, ch_ptr = strtok(NULL, " , \t"); enforce_str(ch_ptr, line + " Bad format"); - ulong b_pos; + long b_pos; if (strcmp(ch_ptr, "NA") == 0) { b_pos = -9; } else { -- cgit v1.2.3 From c15154696c150f3e620244baf4ef60322b0f8241 Mon Sep 17 00:00:00 2001 From: Peter Carbonetto Date: Tue, 10 Oct 2017 13:08:07 -0500 Subject: Bumped up version. --- Makefile | 4 ++-- src/gemma.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index dafcb38..176dd2c 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ # Set this variable to either LNX or MAC SYS = LNX # LNX|MAC (Linux is the default) # Leave blank after "=" to disable; put "= 1" to enable -DIST_NAME = gemma-0.97.2 +DIST_NAME = gemma-0.97.3 DEBUG = 1 # DEBUG mode, set DEBUG=0 for a release SHOW_COMPILER_WARNINGS = WITH_LAPACK = 1 @@ -92,7 +92,7 @@ HDR = LIBS_LNX_D_LAPACK = -llapack LIBS_LNX_D_BLAS = -lblas LIBS_LNX_D_OPENBLAS = -lopenblas -LIBS_MAC_D_LAPACK = -framework Veclib +LIBS_MAC_D_LAPACK = -framework Accelerate # LIBS_LNX_S_LAPACK = /usr/lib/libgsl.a /usr/lib/libgslcblas.a /usr/lib/lapack/liblapack.a -lz 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 diff --git a/src/gemma.cpp b/src/gemma.cpp index 2af8f8e..24173c3 100644 --- a/src/gemma.cpp +++ b/src/gemma.cpp @@ -49,7 +49,7 @@ using namespace std; -GEMMA::GEMMA(void) : version("0.97.2"), date("08/21/2017"), year("2017") {} +GEMMA::GEMMA(void) : version("0.97.3"), date("10/10/2017"), year("2017") {} void gemma_gsl_error_handler (const char * reason, const char * file, -- cgit v1.2.3 From 7e78870664ca33a365c609f348208fb8b534c856 Mon Sep 17 00:00:00 2001 From: Peter Carbonetto Date: Tue, 10 Oct 2017 13:08:28 -0500 Subject: Updated/revised Makefile for MacOSX. --- Makefile.macosx | 149 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 96 insertions(+), 53 deletions(-) diff --git a/Makefile.macosx b/Makefile.macosx index 5312288..d2c1d90 100644 --- a/Makefile.macosx +++ b/Makefile.macosx @@ -1,38 +1,78 @@ -#Makefile - +# Generic Makefile for GEMMA +# # Supported platforms -# Unix / Linux LNX +# +# Unix / Linux LNX (default) # Mac MAC +# # Compilation options -# link to LAPACK WITH_LAPACK -# 32-bit binary FORCE_32BIT -# dynamic compilation FORCE_DYNAMIC +# static compilation FORCE_STATIC +# +# Examples: +# +# Make GEMMA on Linux with OPENBLAS support: +# +# make WITH_OPENBLAS=1 +# +# Disable debug info and checks (slightly faster release mode) +# +# make WITH_OPENBLAS=1 DEBUG= +# +# Force static compilation +# +# make FORCE_STATIC=1 +# +# Run tests with +# +# make check +# +# See also the INSTALL.md document in the source tree at +# +# https://github.com/genetics-statistics/GEMMA/blob/master/INSTALL.md # Set this variable to either LNX or MAC -SYS = MAC +SYS = MAC # LNX|MAC (Linux is the default) # 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 -DIST_NAME = gemma-0.97.2 +DIST_NAME = gemma-0.97.2 +DEBUG = # DEBUG mode, set DEBUG= for a release +SHOW_COMPILER_WARNINGS = +WITH_LAPACK = 1 +WITH_OPENBLAS = # Defaults to LAPACK - OPENBLAS may be faster +FORCE_STATIC = # Static linking of libraries +GCC_FLAGS = -O3 -I/usr/local/Cellar/gsl/2.4/include -I./eigen +TRAVIS_CI = # used by TRAVIS for testing +EIGEN_INCLUDE_PATH= +CXX = g++ # -------------------------------------------------------------------- # Edit below this line with caution # -------------------------------------------------------------------- -BIN_DIR = ./bin +BIN_DIR = ./bin SRC_DIR = ./src +TEST_SRC_DIR = ./test/src -CPP = g++ +ifdef CXX # CXX defined in environment + CPP = $(CXX) + CC = $(CXX) +else + CPP = g++ +endif + +ifdef OPENBLAS + WITH_LAPACK = # OPENBLAS usually includes LAPACK +endif -CPPFLAGS = -F /System/Library/Frameworks \ - -O3 -I/usr/local/opt/gsl@1/include \ - -I./eigen -Wc++11-narrowing -Wno-unused-value +ifdef DEBUG + CPPFLAGS = -g $(GCC_FLAGS) -std=gnu++11 -isystem/$(EIGEN_INCLUDE_PATH) -Icontrib/catch-1.9.7 -Isrc +else + # release mode + CPPFLAGS = -DNDEBUG $(GCC_FLAGS) -std=gnu++11 -isystem/$(EIGEN_INCLUDE_PATH) -Icontrib/catch-1.9.7 -Isrc +endif -LIBS = /usr/local/opt/gsl@1/lib/libgsl.a \ - /usr/local/opt/gsl@1/lib/libgslcblas.a -lz +ifdef SHOW_COMPILER_WARNINGS + CPPFLAGS += -Wall +endif OUTPUT = $(BIN_DIR)/gemma @@ -41,55 +81,59 @@ SOURCES = $(SRC_DIR)/main.cpp HDR = # Detailed libary paths, D for dynamic and S for static +LIBS += -framework Accelerate \ + /usr/local/opt/zlib/lib/libz.a \ + /usr/local/Cellar/gsl/2.4/lib/libgsl.a \ + /usr/local/Cellar/gsl/2.4/lib/libgslcblas.a -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 - -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 - -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 +HDR = $(wildcard src/*.h) +SOURCES = $(wildcard src/*.cpp) # all OBJS = $(SOURCES:.cpp=.o) all: $(OUTPUT) +0 && negative_values && !isMatrixPositiveDefinite(K)) + if (count_small>1 && negative_values && !isMatrixPositiveDefinite(K)) fail_at_msg(strict,__file,__line,"K is not positive definite!"); gsl_vector_free(eigenvalues); } -- cgit v1.2.3 From cc840ea408a6dea80f41c308cdcbc0e9f146ccc1 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Wed, 11 Oct 2017 11:00:17 +0000 Subject: Fix embarrassing bug that broke BIMBAM for larger datasets - found it when porting Plink to the new Analyze function --- src/lmm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lmm.cpp b/src/lmm.cpp index 1193700..134fbf9 100644 --- a/src/lmm.cpp +++ b/src/lmm.cpp @@ -1414,7 +1414,7 @@ void LMM::AnalyzeBimbam(const gsl_matrix *U, const gsl_vector *eval, gsl_vector_memcpy(&Xlarge_col.vector, x); c++; // count SNPs going in - if (c == msize) + if (c % msize == 0) batch_compute(msize); } batch_compute(c % msize); -- cgit v1.2.3