-
Notifications
You must be signed in to change notification settings - Fork 2
/
lib_check.py
executable file
·102 lines (77 loc) · 3.66 KB
/
lib_check.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#*******************************************************************************
#Author (C) 2019, Fabian Schoenfeld ([email protected])
#Copyright (C) 2019, Max Planck Institute of Molecular Physiology, Dortmund
# This program is free software: you can redistribute it and/or modify it
#under the terms of the GNU General Public License as published by the Free
#Software Foundation, either version 3 of the License, or (at your option) any
#later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
#ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
#FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with
#this program. If not, please visit: http://www.gnu.org/licenses/
#*******************************************************************************
from __future__ import print_function
import os
import sys
import subprocess
EXIT_SUCCESS = 0
EXIT_FAILURE = 1
def main(args):
# check SPHIRE
try:
import EMAN2
import sparx
import global_def
ver = global_def.SPARXVERSION
except Exception as err:
print( "\nSPHIRE available: .................................................... FAIL" )
print( " " + str(err))
return EXIT_FAILURE
print( "\nSPHIRE installation: .................................................check" )
print( " " + ver )
# check MPI
try:
ver = subprocess.check_output( "conda list pydusa", shell=True, stderr=subprocess.STDOUT )
ver = str(ver.decode('utf-8'))
ver = [ entry for entry in ver.split("\n") if not "#" in entry and entry != "" ][0]
ver = " ".join(ver.split())
import mpi
mpi.mpi_init(0, [])
mpi.mpi_finalize()
except Exception as err:
print( "\nMPI available: ....................................................... FAIL" )
print( " " + str(err))
print( " conda list pydusa --> ", ver )
return EXIT_FAILURE
print( "\nMPI available: .......................................................check" )
print( " " + ver )
# check CUDA installation
try:
ver = subprocess.check_output( "nvcc --version", shell=True, stderr=subprocess.STDOUT )
ver = str(ver.decode('utf-8'))
ver = [ entry for entry in ver.split("\n") if entry != "" ]
except subprocess.CalledProcessError as err:
print( "\nCUDA available: ...................................................... FAIL" )
print( " \""+err.cmd+"\" failed with:\n ", err.output)
# check path variables
path = subprocess.check_output( "echo $PATH", shell=True )
path = path.split(":")
print( " $PATH:" )
for i in path: print(" "+i)
path = subprocess.check_output( "echo $LD_LIBRARY_PATH", shell=True )
path = path.split(":")
print( " $LD_LIBRARY_PATH:" )
for i in path: print(" "+i)
# check system installation
ldconfig = subprocess.check_output( "ldconfig -p | grep cuda", shell=True ).split("\n")
print( " ldconfig -p | grep cuda:" )
for i in ldconfig: print(" "+i.lstrip())
return EXIT_FAILURE
print( "\nCUDA available: ......................................................check" )
for i in ver: print( " " + i )
# all done
print( "\nEverything looks good, good luck with your project! :)\n" )
return EXIT_SUCCESS
if __name__=="__main__":
sys.exit( main(sys.argv) )