TEXT 23
GPU_detect.pl Guest on 8th February 2021 09:29:34 AM
  1. #!/usr/bin/perl -w
  2. ###############################################################################
  3. # Name %n  : GPU_detect.pl
  4. # Desc %d  : A special script to check if cudamat can be run in computer
  5. #
  6. # Author: Jie Hou
  7. # Date: 2016/02/02
  8. ###############################################################################
  9.  
  10. my $GLOBAL_PATH='/home/casp11/casp12/tools/dncon1.1/';
  11.  
  12. $SCRIPT_DIR=$GLOBAL_PATH."scripts/";
  13.  
  14. # check GPU is detected
  15. print "Checking GPU\n";
  16. my $cmd = $SCRIPT_DIR."check_GPU.py 1>GPU.log  2>GPU.Err";
  17. print("python2 $cmd \n");
  18. system("python2 $cmd");
  19. open(FILE,"GPU.Err");
  20. my $errinfo = 'cannot open shared object';
  21. if (grep{/$errinfo/} <FILE>){
  22.       print "Cudamat failed to run on this computer, setting to CPU to run models\n";
  23.       $device = 'CPU';
  24. }else{
  25.       print "GPU is detected to run cudamat. GPU enabled!\n";
  26.       $device = 'GPU';
  27. }
  28. close FILE;
  29.  
  30.  
  31. print "DNcon can be run on ".$device."\n";

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.