@@ -95,37 +95,55 @@ def get_omp_env():
9595 return omp_env
9696
9797
98+ def parse_lscpu_lscl_info (command_output ):
99+ command_output = command_output .strip ().split ('\n ' )
100+ for i in range (len (command_output )):
101+ command_output [i ] = command_output [i ].split (':' )
102+ return {line [0 ].strip (): line [1 ].strip () for line in command_output }
103+
104+
98105def get_hw_parameters ():
99106 hw_params = {}
100107
101108 if 'Linux' in platform .platform ():
102109 # get CPU information
103110 lscpu_info , _ = read_output_from_command ('lscpu' )
104- # remove excess spaces in CPU info output
105- while ' ' in lscpu_info :
106- lscpu_info = lscpu_info .replace (' ' , ' ' )
107- lscpu_info = lscpu_info .split ('\n ' )
108- for i in range (len (lscpu_info )):
109- lscpu_info [i ] = lscpu_info [i ].split (': ' )
110- hw_params .update (
111- {'CPU' : {line [0 ]: line [1 ] for line in lscpu_info }})
111+ hw_params .update ({'CPU' : parse_lscpu_lscl_info (lscpu_info )})
112112 if 'CPU MHz' in hw_params ['CPU' ].keys ():
113113 del hw_params ['CPU' ]['CPU MHz' ]
114+
114115 # get RAM size
115116 mem_info , _ = read_output_from_command ('free -b' )
116117 mem_info = mem_info .split ('\n ' )[1 ]
117118 while ' ' in mem_info :
118119 mem_info = mem_info .replace (' ' , ' ' )
119120 mem_info = int (mem_info .split (' ' )[1 ]) / 2 ** 30
120121 hw_params .update ({'RAM size[GB]' : mem_info })
121- # get GPU information
122+
123+ # get Intel GPU information
124+ try :
125+ lsgpu_info , _ = read_output_from_command (
126+ 'lscl --device-type=gpu --platform-vendor=Intel' )
127+ device_num = 0
128+ start_idx = lsgpu_info .find ('Device ' )
129+ while start_idx >= 0 :
130+ start_idx = lsgpu_info .find (':' , start_idx ) + 1
131+ end_idx = lsgpu_info .find ('Device ' , start_idx )
132+ platform_info = parse_lscpu_lscl_info (lsgpu_info [start_idx :end_idx ])
133+ hw_params .update ({f'GPU Intel #{ device_num + 1 } ' : platform_info })
134+ device_num += 1
135+ start_idx = end_idx
136+ except (FileNotFoundError , json .JSONDecodeError ):
137+ pass
138+
139+ # get Nvidia GPU information
122140 try :
123141 gpu_info , _ = read_output_from_command (
124142 'nvidia-smi --query-gpu=name,memory.total,driver_version,pstate '
125143 '--format=csv,noheader' )
126144 gpu_info = gpu_info .split (', ' )
127145 hw_params .update ({
128- 'GPU' : {
146+ 'GPU Nvidia ' : {
129147 'Name' : gpu_info [0 ],
130148 'Memory size' : gpu_info [1 ],
131149 'Performance mode' : gpu_info [3 ]
0 commit comments