diff options
author | Pjotr Prins | 2017-10-14 06:00:55 +0000 |
---|---|---|
committer | Pjotr Prins | 2017-10-14 06:00:55 +0000 |
commit | 0fe6d1332bf21a6be2c1beeb9fada6eb1a1ff244 (patch) | |
tree | a7699cf08b0547ea01ac1be82b15c55b1abecf69 /src | |
parent | fdb48997ee3ed2b326a92f8e0cc7f72a4b38d8c8 (diff) | |
download | pangemma-0fe6d1332bf21a6be2c1beeb9fada6eb1a1ff244.tar.gz |
More disabling of eigenlib (faster compilation) and avoid OPENBLAS_CONST which does not work on older cblas.h
Diffstat (limited to 'src')
-rw-r--r-- | src/fastblas.cpp | 27 | ||||
-rw-r--r-- | src/fastopenblas.h | 28 | ||||
-rw-r--r-- | src/gemma.cpp | 4 | ||||
-rw-r--r-- | src/io.cpp | 2 | ||||
-rw-r--r-- | src/ldr.cpp | 7 | ||||
-rw-r--r-- | src/mathfunc.cpp | 7 | ||||
-rw-r--r-- | src/mathfunc.h | 6 | ||||
-rw-r--r-- | src/vc.cpp | 4 |
8 files changed, 49 insertions, 36 deletions
diff --git a/src/fastblas.cpp b/src/fastblas.cpp index 0a4eba3..3fe712c 100644 --- a/src/fastblas.cpp +++ b/src/fastblas.cpp @@ -24,6 +24,7 @@ #include "debug.h" #include "fastblas.h" #include "mathfunc.h" +#include <string.h> #ifndef NDEBUG #include "eigenlib.h" #endif @@ -61,20 +62,20 @@ gsl_matrix *fast_copy(gsl_matrix *m, const double *mem) { /* Helper function fast_cblas_dgemm runs the local dgemm */ -void fast_cblas_dgemm(OPENBLAS_CONST enum CBLAS_ORDER Order, - OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, - OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, - OPENBLAS_CONST blasint M, - OPENBLAS_CONST blasint N, - OPENBLAS_CONST blasint K, - OPENBLAS_CONST double alpha, - OPENBLAS_CONST double *A, - OPENBLAS_CONST blasint lda, - OPENBLAS_CONST double *B, - OPENBLAS_CONST blasint ldb, - OPENBLAS_CONST double beta, +void fast_cblas_dgemm(const enum CBLAS_ORDER Order, + const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_TRANSPOSE TransB, + const blasint M, + const blasint N, + const blasint K, + const double alpha, + const double *A, + const blasint lda, + const double *B, + const blasint ldb, + const double beta, double *C, - OPENBLAS_CONST blasint ldc) { + const blasint ldc) { #ifndef NDEBUG size_t i,j; if (is_debug_mode()) { diff --git a/src/fastopenblas.h b/src/fastopenblas.h index 824b686..a0904c3 100644 --- a/src/fastopenblas.h +++ b/src/fastopenblas.h @@ -6,19 +6,21 @@ #include <cblas.h> // For OpenBlas #include "gsl/gsl_matrix.h" -void fast_cblas_dgemm(OPENBLAS_CONST enum CBLAS_ORDER Order, - OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, - OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, - OPENBLAS_CONST blasint M, - OPENBLAS_CONST blasint N, - OPENBLAS_CONST blasint K, - OPENBLAS_CONST double alpha, - OPENBLAS_CONST double *A, - OPENBLAS_CONST blasint lda, - OPENBLAS_CONST double *B, - OPENBLAS_CONST blasint ldb, - OPENBLAS_CONST double beta, +#ifndef + +void fast_cblas_dgemm(const enum CBLAS_ORDER Order, + const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_TRANSPOSE TransB, + const blasint M, + const blasint N, + const blasint K, + const double alpha, + const double *A, + const blasint lda, + const double *B, + const blasint ldb, + const double beta, double *C, - OPENBLAS_CONST blasint ldc); + const blasint ldc); #endif diff --git a/src/gemma.cpp b/src/gemma.cpp index e2881a4..a1aeaa3 100644 --- a/src/gemma.cpp +++ b/src/gemma.cpp @@ -3087,6 +3087,9 @@ void GEMMA::BatchRun(PARAM &cPar) { return; } +#include "Eigen/Dense" +// using namespace Eigen; + void GEMMA::WriteLog(int argc, char **argv, PARAM &cPar) { string file_str; file_str = cPar.path_out + "/" + cPar.file_out; @@ -3103,6 +3106,7 @@ void GEMMA::WriteLog(int argc, char **argv, PARAM &cPar) { outfile << "## GSL Version = " << GSL_VERSION << endl; outfile << "## Eigen Version = " << EIGEN_WORLD_VERSION << "." << EIGEN_MAJOR_VERSION << "." << EIGEN_MINOR_VERSION << endl; #ifdef OPENBLAS + outfile << "## OpenBlas = " << openblas_get_config() << " - " << openblas_get_corename() << endl; outfile << "## threads = " << openblas_get_num_threads() << endl; @@ -3017,7 +3017,7 @@ bool PlinkKin(const string &file_bed, const int display_pace, gsl_matrix_submatrix(Xlarge, 0, msize * i_vc, ni_test, msize); gsl_matrix_view kin_sub = gsl_matrix_submatrix(matrix_kin, 0, ni_test * i_vc, ni_test, ni_test); - eigenlib_dgemm("N", "T", 1.0, &X_sub.matrix, &X_sub.matrix, 1.0, + fast_dgemm("N", "T", 1.0, &X_sub.matrix, &X_sub.matrix, 1.0, &kin_sub.matrix); } } diff --git a/src/ldr.cpp b/src/ldr.cpp index 3554efa..f70eb85 100644 --- a/src/ldr.cpp +++ b/src/ldr.cpp @@ -29,7 +29,7 @@ #include <stdio.h> #include <stdlib.h> -#include "Eigen/Dense" +// #include "Eigen/Dense" #include "gsl/gsl_blas.h" #include "gsl/gsl_cdf.h" #include "gsl/gsl_eigen.h" @@ -46,7 +46,7 @@ #include "param.h" using namespace std; -using namespace Eigen; +// using namespace Eigen; void LDR::CopyFromParam(PARAM &cPar) { a_mode = cPar.a_mode; @@ -70,8 +70,10 @@ void LDR::CopyFromParam(PARAM &cPar) { return; } + void LDR::CopyToParam(PARAM &cPar) { return; } +/* // X is a p by n matrix. void LDR::VB(const vector<vector<unsigned char>> &Xt, const gsl_matrix *W_gsl, const gsl_vector *y_gsl) { @@ -107,3 +109,4 @@ void LDR::VB(const vector<vector<unsigned char>> &Xt, const gsl_matrix *W_gsl, return; } +*/ diff --git a/src/mathfunc.cpp b/src/mathfunc.cpp index d0a9d65..f55f3c6 100644 --- a/src/mathfunc.cpp +++ b/src/mathfunc.cpp @@ -32,7 +32,7 @@ #include <tuple> #include <vector> -#include "Eigen/Dense" +// #include "Eigen/Dense" #include "gsl/gsl_version.h" @@ -54,7 +54,7 @@ #include "mathfunc.h" using namespace std; -using namespace Eigen; +// using namespace Eigen; bool has_nan(const vector<double> v) { for (const auto& e: v) { @@ -524,6 +524,7 @@ unsigned char Double02ToUchar(const double dosage) { return (int)(dosage * 100); } +/* void uchar_matrix_get_row(const vector<vector<unsigned char>> &X, const size_t i_row, VectorXd &x_row) { if (i_row < X.size()) { @@ -535,3 +536,5 @@ void uchar_matrix_get_row(const vector<vector<unsigned char>> &X, exit(1); } } + +*/ diff --git a/src/mathfunc.h b/src/mathfunc.h index 804bc20..1319a64 100644 --- a/src/mathfunc.h +++ b/src/mathfunc.h @@ -19,7 +19,7 @@ #ifndef __MATHFUNC_H__ #define __MATHFUNC_H__ -#include "Eigen/Dense" +// #include "Eigen/Dense" #include "gsl/gsl_matrix.h" #include "gsl/gsl_vector.h" @@ -57,7 +57,7 @@ void KroneckerSym(const gsl_matrix *K, const gsl_matrix *V, gsl_matrix *H); double UcharToDouble02(const unsigned char c); unsigned char Double02ToUchar(const double dosage); -void uchar_matrix_get_row(const vector<vector<unsigned char>> &X, - const size_t i_row, Eigen::VectorXd &x_row); +// void uchar_matrix_get_row(const vector<vector<unsigned char>> &X, +// const size_t i_row, Eigen::VectorXd &x_row); #endif @@ -41,7 +41,7 @@ #include "gsl/gsl_min.h" #include "gsl/gsl_multiroots.h" -#include "Eigen/Dense" +// #include "Eigen/Dense" #include "eigenlib.h" #include "gzstream.h" @@ -53,7 +53,7 @@ #include "vc.h" using namespace std; -using namespace Eigen; +// using namespace Eigen; // In this file, X, Y are already transformed (i.e. UtX and UtY). void VC::CopyFromParam(PARAM &cPar) { |