improved diagnostics in laerror - command line
This commit is contained in:
		
							parent
							
								
									5b3dced5bb
								
							
						
					
					
						commit
						c1f3b1ec98
					
				
							
								
								
									
										30
									
								
								laerror.cc
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								laerror.cc
									
									
									
									
									
								
							@ -31,6 +31,7 @@
 | 
				
			|||||||
#include <sys/stat.h>
 | 
					#include <sys/stat.h>
 | 
				
			||||||
#include <sys/wait.h>
 | 
					#include <sys/wait.h>
 | 
				
			||||||
#include <sys/prctl.h>
 | 
					#include <sys/prctl.h>
 | 
				
			||||||
 | 
					#include <fcntl.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "cuda_la.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)
 | 
					void laerror2(const char *s1, const char *s2)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  std::cout<<"\n";
 | 
				
			||||||
 | 
					  std::cerr<<"\n";
 | 
				
			||||||
  std::cout.flush();
 | 
					  std::cout.flush();
 | 
				
			||||||
  std::cerr.flush();
 | 
					  std::cerr.flush();
 | 
				
			||||||
  std::cerr << "LA:ERROR - ";
 | 
					 | 
				
			||||||
  std::cout << "LA:ERROR - ";
 | 
					 | 
				
			||||||
  if(s1)
 | 
					  if(s1)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    std::cerr << s2 << ": " << s1 << "\n";
 | 
					    std::cerr <<"LA:ERROR - "<< s2 << ": " << s1 << "\n";
 | 
				
			||||||
    std::cout << 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
 | 
					#ifdef CUDALA
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
cublasStatus s = cublasGetError();
 | 
					cublasStatus s = cublasGetError();
 | 
				
			||||||
@ -117,6 +123,22 @@ std::cout << "CUBLAS status = " << s << std::endl;
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
  if(errno) perror("system error");
 | 
					  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); 
 | 
					throw LAerror(s1); 
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user