about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPjotr Prins2025-12-03 09:17:23 +0100
committerPjotr Prins2025-12-03 09:17:31 +0100
commit192ea67b10ed28fecf979d30972d19a7d518641c (patch)
tree65e5e58e00036ee04dd61c7e51be80d60dea0aa6 /src
parentbd38f2f2dada5cb64cc8ad18dbcfed6627b58da1 (diff)
downloadpangemma-192ea67b10ed28fecf979d30972d19a7d518641c.tar.gz
Some output
Diffstat (limited to 'src')
-rw-r--r--src/lmm.cpp26
-rw-r--r--src/param.cpp4
2 files changed, 10 insertions, 20 deletions
diff --git a/src/lmm.cpp b/src/lmm.cpp
index aa5036e..761eacf 100644
--- a/src/lmm.cpp
+++ b/src/lmm.cpp
@@ -1886,7 +1886,7 @@ void LMM::mdb_analyze(std::function< SnpNameValues2(size_t) >& fetch_snp,
 
   checkpoint_nofile("start-lmm-mdb-analyze");
   // Subset/LOCO support
-  bool process_gwasnps = gwasnps.size();
+  // bool process_gwasnps = gwasnps.size();
 
   // Calculate basic quantities.
   size_t n_index = (n_cvt + 2 + 1) * (n_cvt + 2) / 2;
@@ -2103,19 +2103,11 @@ void LMM::mdb_calc_gwa(const gsl_matrix *U, const gsl_vector *eval,
   // Get mmap info using lmdb++ wrapper
   MDB_envinfo info;
   mdb_env_info(env.handle(), &info);
-  // Aggressive readahead hints
-#ifndef MADV_SEQUENTIAL
-#define MADV_SEQUENTIAL 2
-#endif
-
-#ifndef MADV_WILLNEED
-#define MADV_WILLNEED 3
-#endif
+  // Linux kernel aggressive readahead hints
   madvise(info.me_mapaddr, info.me_mapsize, MADV_SEQUENTIAL);
   madvise(info.me_mapaddr, info.me_mapsize, MADV_WILLNEED);
 
-  std::cout << "LMDB opened with optimized readahead" << std::endl;
-  std::cout << "Map size: " << (info.me_mapsize / 1024 / 1024) << " MB" << std::endl;
+  std::cout << "## LMDB opened with optimized readahead; map size = " << (info.me_mapsize / 1024 / 1024) << " MB" << std::endl;
 
   auto rtxn = lmdb::txn::begin(env, nullptr, MDB_RDONLY);
   auto geno_mdb = lmdb::dbi::open(rtxn, "geno");
@@ -2128,12 +2120,12 @@ void LMM::mdb_calc_gwa(const gsl_matrix *U, const gsl_vector *eval,
   // fetch_snp is a callback function for every SNP row
   // returns typedef std::tuple<bool,string,std::vector<double> > SnpNameValues;
 
-  size_t prev_line = 0;
+  // size_t prev_line = 0;
   auto mdb_fetch = MDB_FIRST;
 
   auto cursor = lmdb::cursor::open(rtxn, geno_mdb);
   cout << "## number of total individuals = " << ni_total << endl;
-  cout << "## number of analyzed individuals = " << ni_total << endl;
+  cout << "## number of analyzed individuals = " << ni_test << endl;
   cout << "## number of analyzed SNPs/var = " << num_markers << endl;
 
   std::function<SnpNameValues2(size_t)>  fetch_snp = [&](size_t num) {
@@ -2146,15 +2138,14 @@ void LMM::mdb_calc_gwa(const gsl_matrix *U, const gsl_vector *eval,
       prev_line++;
     }
     */
-    auto result = cursor.get(key, value, mdb_fetch);
+    auto success = cursor.get(key, value, mdb_fetch);
     mdb_fetch = MDB_NEXT;
 
     string snp;
     vector<double> gs;
 
-    if (result) {
+    if (success) {
       size_t num_floats = value.size() / sizeof(float);
-      // cout << string(key) << ":" << num_floats << "," << ni_total << " " << endl;
       assert(num_floats == ni_total);
       const float* gsbuf = reinterpret_cast<const float*>(value.data());
       auto snp = string(key);
@@ -2166,8 +2157,7 @@ void LMM::mdb_calc_gwa(const gsl_matrix *U, const gsl_vector *eval,
       }
       // cout << "!!!!" << size << snp << ": " << gs[0] << "," << gs[1] << "," << gs[2] << "," << gs[3] << endl;
     }
-    // return { result,snp,gs };
-    return make_tuple(result, snp, gs);
+    return make_tuple(success, snp, gs);
   };
 
   LMM::mdb_analyze(fetch_snp,U,eval,UtW,Uty,W,y,gwasnps,num_markers);
diff --git a/src/param.cpp b/src/param.cpp
index 45904cd..74b2f9b 100644
--- a/src/param.cpp
+++ b/src/param.cpp
@@ -1276,8 +1276,8 @@ void PARAM::CheckData(void) {
 
 void PARAM::PrintSummary() {
   if (n_ph == 1) {
-    cout << "pve estimate =" << pve_null << endl;
-    cout << "se(pve) =" << pve_se_null << endl;
+    cout << "##   pve estimate = " << pve_null << endl;
+    cout << "##   se(pve) = " << pve_se_null << endl;
   } else {
   }
   return;