[Genabel-commits] r1263 - pkg/OmicABEL/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jul 1 10:50:00 CEST 2013
Author: dfabregat
Date: 2013-07-01 10:50:00 +0200 (Mon, 01 Jul 2013)
New Revision: 1263
Modified:
pkg/OmicABEL/src/GWAS.c
pkg/OmicABEL/src/REML.c
pkg/OmicABEL/src/fgls_chol.c
pkg/OmicABEL/src/fgls_eigen.c
pkg/OmicABEL/src/ooc_BLAS.c
pkg/OmicABEL/src/ooc_BLAS.h
pkg/OmicABEL/src/utils.c
pkg/OmicABEL/src/utils.h
Log:
Parallelizing the impute of data.
Modified: pkg/OmicABEL/src/GWAS.c
===================================================================
--- pkg/OmicABEL/src/GWAS.c 2013-06-30 18:53:54 UTC (rev 1262)
+++ pkg/OmicABEL/src/GWAS.c 2013-07-01 08:50:00 UTC (rev 1263)
@@ -121,7 +121,7 @@
load_file ( cf->XL_data_path, "rb", cf->XL, cf->n * cf->wXL );
// Sanity check (XL)
average( cf->XL, cf->n, cf->wXL, cf->threshold, "Covariate",
- &cf->XL_fvi->fvi_data[cf->n*NAMELENGTH], NAMELENGTH, 1 );
+ &cf->XL_fvi->fvi_data[cf->n*NAMELENGTH], NAMELENGTH, 1, cf->num_threads );
cf->ZtXL = NULL;
cf->Z = NULL;
cf->W = NULL;
Modified: pkg/OmicABEL/src/REML.c
===================================================================
--- pkg/OmicABEL/src/REML.c 2013-06-30 18:53:54 UTC (rev 1262)
+++ pkg/OmicABEL/src/REML.c 2013-07-01 08:50:00 UTC (rev 1263)
@@ -84,7 +84,7 @@
premultiplyXL( data.n, data.wXL, data.Z, data.X, data.ZtX );
// Premultiply ZtY
ooc_gemm( data.n, cf->t, cf->ooc_b, data.Z, cf->Y_data_path, cf->ZtY_path,
- cf->threshold, "TRAIT", &cf->Y_fvi->fvi_data[cf->n*NAMELENGTH], NAMELENGTH);
+ cf->threshold, "TRAIT", &cf->Y_fvi->fvi_data[cf->n*NAMELENGTH], NAMELENGTH, cf->num_threads);
// Iterate over phenotypes (Y)
data.Y = fgls_malloc( data.n * sizeof(double) );
@@ -95,7 +95,7 @@
{
sync_read( data.Y, cf->Y, cf->n, cf->n * j );
// Sanity
- average( data.Y, cf->n, 1, cf->threshold, "TRAIT", &cf->Y_fvi->fvi_data[(cf->n+j)*NAMELENGTH], NAMELENGTH, 0 );
+ average( data.Y, cf->n, 1, cf->threshold, "TRAIT", &cf->Y_fvi->fvi_data[(cf->n+j)*NAMELENGTH], NAMELENGTH, 0, cf->num_threads );
sync_read( data.ZtY, cf->ZtY, cf->n, cf->n * j );
data.sigma = variance(data.Y, data.n);
Modified: pkg/OmicABEL/src/fgls_chol.c
===================================================================
--- pkg/OmicABEL/src/fgls_chol.c 2013-06-30 18:53:54 UTC (rev 1262)
+++ pkg/OmicABEL/src/fgls_chol.c 2013-07-01 08:50:00 UTC (rev 1263)
@@ -216,7 +216,7 @@
Y_comp = double_buffering_get_comp_buffer( &db_Y );
// Sanity check
average( Y_comp, n, 1, cf.threshold, "TRAIT",
- &cf.Y_fvi->fvi_data[n*NAMELENGTH], NAMELENGTH, 0 );
+ &cf.Y_fvi->fvi_data[n*NAMELENGTH], NAMELENGTH, 0, cf.num_threads );
dtrsv_(LOWER, NO_TRANS, NON_UNIT, &n, M, &n, Y_comp, &iONE);
/* B_t := XL' * y */
@@ -264,7 +264,7 @@
int rhss = wXR * x_inc;
// Sanity check
average( XR_comp, n, x_inc, cf.threshold, "SNP",
- &cf.XR_fvi->fvi_data[(n+ib)*NAMELENGTH], NAMELENGTH, 1 );
+ &cf.XR_fvi->fvi_data[(n+ib)*NAMELENGTH], NAMELENGTH, 1, cf.num_threads );
// Computation
dtrsm_(LEFT, LOWER, NO_TRANS, NON_UNIT, &n, &rhss, &ONE, M, &n, XR_comp, &n);
Modified: pkg/OmicABEL/src/fgls_eigen.c
===================================================================
--- pkg/OmicABEL/src/fgls_eigen.c 2013-06-30 18:53:54 UTC (rev 1262)
+++ pkg/OmicABEL/src/fgls_eigen.c 2013-07-01 08:50:00 UTC (rev 1263)
@@ -73,7 +73,7 @@
// Premultiply Z' XR
ooc_gemm( cf->n, cf->m * cf->wXR, cf->ooc_b, cf->Z, cf->XR_data_path, cf->ZtXR_path,
- cf->threshold, "SNP", &cf->XR_fvi->fvi_data[cf->n*NAMELENGTH], NAMELENGTH );
+ cf->threshold, "SNP", &cf->XR_fvi->fvi_data[cf->n*NAMELENGTH], NAMELENGTH, cf->num_threads );
#if VAMPIR
VT_USER_END("PRELOOP");
Modified: pkg/OmicABEL/src/ooc_BLAS.c
===================================================================
--- pkg/OmicABEL/src/ooc_BLAS.c 2013-06-30 18:53:54 UTC (rev 1262)
+++ pkg/OmicABEL/src/ooc_BLAS.c 2013-07-01 08:50:00 UTC (rev 1263)
@@ -52,7 +52,8 @@
* The other matrix is m x n
*/
void ooc_gemm( int m, int n, int ooc_b, double *Z, char *in, char *out,
- int threshold, const char *obj_type, char *obj_name, int namelength )
+ int threshold, const char *obj_type, char *obj_name, int namelength,
+ int nths )
{
/* Files */
FILE *fp_in = fgls_fopen( in, "rb" );
@@ -105,7 +106,7 @@
/*printf("Compute\n");*/
// Sanity check
- average( in_comp, m, cur_n, threshold, obj_type, &obj_name[i*namelength], namelength, 1 );
+ average( in_comp, m, cur_n, threshold, obj_type, &obj_name[i*namelength], namelength, 1, nths );
#if VAMPIR
VT_USER_START("OOC_GEMM");
#endif
Modified: pkg/OmicABEL/src/ooc_BLAS.h
===================================================================
--- pkg/OmicABEL/src/ooc_BLAS.h 2013-06-30 18:53:54 UTC (rev 1262)
+++ pkg/OmicABEL/src/ooc_BLAS.h 2013-07-01 08:50:00 UTC (rev 1263)
@@ -26,6 +26,7 @@
#define OOC_BLAS_H
void ooc_gemm( int m, int n, int ooc_b, double *Z, char *in, char *out,
- int threshold, const char *obj_type, char *obj_name, int namelength );
+ int threshold, const char *obj_type, char *obj_name, int namelength,
+ int nths );
#endif // OOC_BLAS_H
Modified: pkg/OmicABEL/src/utils.c
===================================================================
--- pkg/OmicABEL/src/utils.c 2013-06-30 18:53:54 UTC (rev 1262)
+++ pkg/OmicABEL/src/utils.c 2013-07-01 08:50:00 UTC (rev 1263)
@@ -321,12 +321,13 @@
printf( "%lld:%lld seconds\n", (long long)t.tv_sec, (long long)t.tv_usec );
}
-void average( double *data, int n, int ncols, int threshold, const char *obj_type, char *obj_name, int namelength, int verbose )
+void average( double *data, int n, int ncols, int threshold, const char *obj_type, char *obj_name, int namelength, int verbose, int nths )
{
int i, j;
double sum, avg;
int nans, infs;
+ #pragma omp parallel for private(j, sum, nans, infs, i, avg) schedule(static, 4) num_threads(nths)
for ( j = 0; j < ncols; j++ )
{
sum = 0.0;
Modified: pkg/OmicABEL/src/utils.h
===================================================================
--- pkg/OmicABEL/src/utils.h 2013-06-30 18:53:54 UTC (rev 1262)
+++ pkg/OmicABEL/src/utils.h 2013-07-01 08:50:00 UTC (rev 1263)
@@ -45,7 +45,7 @@
void print_timestamp( void );
// Sanity
-void average( double *data, int n, int ncols, int threshold, const char *obj_type, char *obj_name, int namelength, int verbose );
+void average( double *data, int n, int ncols, int threshold, const char *obj_type, char *obj_name, int namelength, int verbose, int nths );
void checkNoNans( size_t n, double *buff, const char* err_msg);
#endif // UTILS_H
More information about the Genabel-commits
mailing list