From c1f3b1ec98b142d1b571086dbdb9c65a0b1cd2ed Mon Sep 17 00:00:00 2001 From: Jiri Pittner Date: Sat, 25 Sep 2021 05:39:55 +0200 Subject: [PATCH] improved diagnostics in laerror - command line --- laerror.cc | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/laerror.cc b/laerror.cc index 7a0a9d5..a116280 100644 --- a/laerror.cc +++ b/laerror.cc @@ -31,6 +31,7 @@ #include #include #include +#include #include "cuda_la.h" @@ -99,15 +100,20 @@ if(sigaction(sig,&action,NULL)) perror("cannot install signal handler"); void laerror2(const char *s1, const char *s2) { + std::cout<<"\n"; + std::cerr<<"\n"; std::cout.flush(); std::cerr.flush(); - std::cerr << "LA:ERROR - "; - std::cout << "LA:ERROR - "; if(s1) { - std::cerr << s2 << ": " << s1 << "\n"; - std::cout << s2 << ": " << s1 << "\n"; + std::cerr <<"LA:ERROR - "<< s2 << ": " << s1 << "\n"; + std::cout <<"LA:ERROR - "<< s2 << ": " << s1 << "\n"; } + else + { + std::cerr <<"LA:ERROR - unspecified\n"; + std::cout <<"LA:ERROR - unspecified\n"; + } #ifdef CUDALA { cublasStatus s = cublasGetError(); @@ -117,6 +123,22 @@ std::cout << "CUBLAS status = " << s << std::endl; #endif if(errno) perror("system error"); +int f=open("/proc/self/cmdline",O_RDONLY); +if(f) + { + std::string line; + char z; + while(1==read(f,&z,1)) + { + line+= z?z:' '; + } + close(f); + std::cout<<"Command LINE: "<