From 7f1be7fc3cf51cc7c3b37b88b808c44f2fbf1add Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Thu, 20 Nov 2025 11:05:57 +0100 Subject: Comments --- src/checkpoint.h | 8 ++++++++ src/debug.cpp | 2 ++ src/gemma.cpp | 8 ++++---- src/gemma_io.cpp | 2 ++ src/lmm.cpp | 3 +++ 5 files changed, 19 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/checkpoint.h b/src/checkpoint.h index c2457d9..ae46361 100644 --- a/src/checkpoint.h +++ b/src/checkpoint.h @@ -26,6 +26,14 @@ using namespace std; extern string checkpoint_name; +/* + Checkpoint functions display a message in debug mode when + reached. If the (unique) msg (tag) is equal to the global + checkpoint_name the program will stop. The idea is that we can + stop computation at any checkpoint. Later we can write the code to + restart at a checkpoint. + */ + void checkpoint_run(string msg, string filename, string srcfilename, int line, string funcname); #define checkpoint(msg, fname) \ diff --git a/src/debug.cpp b/src/debug.cpp index 0aa4bfc..b26e173 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -139,6 +139,7 @@ inline int fedisableexcept(unsigned int excepts) #endif +/* void enable_segfpe() { if (!is_fpe_check_mode() || is_legacy_mode()) return; #ifdef __GNUC__ @@ -159,6 +160,7 @@ void disable_segfpe() { #endif #endif } +*/ void write(const char *s, const char *msg) { if (!is_debug_data_mode() && !is_debug_dump_mode()) return; diff --git a/src/gemma.cpp b/src/gemma.cpp index 6c2b3f4..63f952e 100644 --- a/src/gemma.cpp +++ b/src/gemma.cpp @@ -84,7 +84,7 @@ void gemma_gsl_error_handler (const char * reason, void GEMMA::PrintHeader(void) { cout << - "GEMMA forked executable --- part of PanGEMMA " << version << " (" << date << ") by Xiang Zhou, Pjotr Prins and team (C) 2012-" << year << endl; + "Pangemma --- GEMMA 0.98.5 compatible executable " << version << " (" << date << ") by Xiang Zhou, Pjotr Prins and team (C) 2012-" << year << endl; return; } @@ -1653,7 +1653,7 @@ void GEMMA::BatchRun(PARAM &cPar) { clock_t time_begin, time_start; time_begin = clock(); - if (is_check_mode()) enable_segfpe(); // fast NaN checking by default + // if (is_check_mode()) enable_segfpe(); // fast NaN checking by default // Read Files. cout << "Reading Files ... " << endl; @@ -1943,7 +1943,7 @@ void GEMMA::BatchRun(PARAM &cPar) { VARCOV cVarcov; cVarcov.CopyFromParam(cPar); - if (is_check_mode()) disable_segfpe(); // disable fast NaN checking for now + // if (is_check_mode()) disable_segfpe(); // disable fast NaN checking for now if (!cPar.file_bfile.empty()) { cVarcov.AnalyzePlink(); @@ -2058,7 +2058,7 @@ void GEMMA::BatchRun(PARAM &cPar) { VARCOV cVarcov; cVarcov.CopyFromParam(cPar); - if (is_check_mode()) disable_segfpe(); // fast NaN checking for now + // if (is_check_mode()) disable_segfpe(); // fast NaN checking for now if (!cPar.file_bfile.empty()) { cVarcov.AnalyzePlink(); diff --git a/src/gemma_io.cpp b/src/gemma_io.cpp index f5a79a2..76f8a35 100644 --- a/src/gemma_io.cpp +++ b/src/gemma_io.cpp @@ -1431,6 +1431,7 @@ bool BimbamKin(const string file_geno, const set ksnps, auto infilen = file_geno.c_str(); igzstream infile(infilen, igzstream::in); enforce_msg(infilen, "error reading genotype file"); + checkpoint("read-geno-file",file_geno); size_t n_miss; double geno_mean, geno_var; @@ -1758,6 +1759,7 @@ bool ReadFile_geno(const string file_geno, vector &indicator_idv, cout << "error reading genotype file:" << file_geno << endl; return false; } + checkpoint("read-geno-file",file_geno); string line; char *ch_ptr; diff --git a/src/lmm.cpp b/src/lmm.cpp index 85e92fe..ccf880a 100644 --- a/src/lmm.cpp +++ b/src/lmm.cpp @@ -44,6 +44,7 @@ #include "gzstream.h" #include "gemma.h" #include "gemma_io.h" +#include "checkpoint.h" #include "fastblas.h" #include "lapack.h" #include "lmm.h" @@ -1663,6 +1664,7 @@ void LMM::AnalyzeBimbam(const gsl_matrix *U, const gsl_vector *eval, const set gwasnps) { debug_msg(file_geno); auto infilen = file_geno.c_str(); + checkpoint("start-read-geno-file",file_geno); igzstream infile(infilen, igzstream::in); enforce_msg(infile, "error reading genotype file"); @@ -2291,6 +2293,7 @@ void LMM::AnalyzeBimbamGXE(const gsl_matrix *U, const gsl_vector *eval, cout << "error reading genotype file:" << file_geno << endl; return; } + checkpoint("start-read-geno-file",file_geno); clock_t time_start = clock(); -- cgit 1.4.1