improved diagnostics in laerror - command line

This commit is contained in:
Jiri Pittner 2021-09-25 05:39:55 +02:00
parent 5b3dced5bb
commit c1f3b1ec98

View File

@ -31,6 +31,7 @@
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/prctl.h>
#include <fcntl.h>
#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: "<<line <<"\n";
std::cerr<<"Command LINE: "<<line <<"\n";
std::cout.flush();
std::cerr.flush();
}
throw LAerror(s1);
}