-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbasic_tests_aiml.py
More file actions
89 lines (74 loc) · 2.78 KB
/
Copy pathbasic_tests_aiml.py
File metadata and controls
89 lines (74 loc) · 2.78 KB
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
import os
import sys
import warnings
import scipy as sp
import sklearn as sk
import matplotlib as matplt
#supress Tensorflow warnings
os.environ['TF_CPP_MIN_LOG_LEVEL'] = "3"
import warnings
warnings.filterwarnings('ignore') # Ignores all warnings
# Specific warning types can be ignored by specifying the category
#warnings.filterwarnings('ignore', category=DeprecationWarning)
import logging
logging.getLogger('tensorflow').disabled = True
print("SciPy version #:{:>12}".format(sp.__version__))
print("Sk-Learn version #:{:>12}".format(sk.__version__))
print("Matplotlib version#:{:>12}".format(matplt.__version__))
print ("")
print (f"Importing Numpy, Pandas, and Tensorflow library.")
try:
import numpy as np;
print("Numpy version #:{:>12}".format(np.__version__))
except ImportError as e:
print("ERROR: Importing Numpy, " + str(e))
print("Please install Numpy library and check your PATH and PYTHONPATH variables.")
sys.exit(1)
try:
import pandas as pd;
print("Pandas version #:{:>12}".format(pd.__version__))
except ImportError as e:
print("ERROR: Importing Pandas, " + str(e))
print("Please install Pandas library and check your PATH and PYTHONPATH variables.")
sys.exit(1)
try:
import tensorflow as tf;
print("Tensorflow version#:{:>12}".format(tf.__version__))
except ImportError as e:
print("ERROR: Importing Tensorflow, " + str(e))
print("Please install tensorflow library and check your PATH and PYTHONPATH variables.")
sys.exit(1)
try:
print("")
print(f"Tensorflow System Report.")
print("Num GPUs Available: " + str(len(tf.config.experimental.list_physical_devices('GPU'))))
print("Num CPUs Available: " + str(len(tf.config.experimental.list_physical_devices('CPU'))))
except Exception as e:
print("ERROR: Tensorflow API invocation error, " + str(e))
sys.exit(1)
try:
import torch;
print("Torch version#:{:>12}".format(torch.__version__))
except ImportError as e:
print("ERROR: Importing Torch, " + str(e))
print("Please install tensorflow library and check your PATH and PYTHONPATH variables.")
sys.exit(1)
try:
print("")
gpu_count=0
current_gpu=""
num_cpus_torch = torch.get_num_threads()
if torch.cuda.is_available():
gpu_count=torch.cuda.device_count()
current_gpu=torch.cuda.get_device_name(0)
device=torch.device("cuda")
else:
device=torch.device("cpu")
print(f"Torch System Report.")
print("Num GPUs Available: " + str(gpu_count))
print(" GPUs Name: " + str(current_gpu))
print("Num CPUs Available: " + str(num_cpus_torch))
except Exception as e:
print("ERROR: Importing Torch, " + str(e))
print("Please install tensorflow library and check your PATH and PYTHONPATH variables.")
sys.exit(1)