Skip to content

Commit 627f1ef

Browse files
authored
upgrade tutorial link to 1.11.200 (#766)
* upgrade tutorial link to 1.11.200 * fix bug issue 227 for launch script
1 parent c7fa838 commit 627f1ef

File tree

2 files changed

+8
-26
lines changed

2 files changed

+8
-26
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ python -m pip install intel_extension_for_pytorch -f https://software.intel.com/
2020

2121
**Note:** Intel® Extension for PyTorch\* has PyTorch version requirement. Please check more detailed information via the URL below.
2222

23-
More installation methods can be found at [Installation Guide](https://intel.github.io/intel-extension-for-pytorch/1.11.0/tutorials/installation.html)
23+
More installation methods can be found at [Installation Guide](https://intel.github.io/intel-extension-for-pytorch/1.11.200/tutorials/installation.html)
2424

2525
## Getting Started
2626

2727
Minor code changes are required for users to get start with Intel® Extension for PyTorch\*. Both PyTorch imperative mode and TorchScript mode are supported. You just need to import Intel® Extension for PyTorch\* package and apply its optimize function against the model object. If it is a training workload, the optimize function also needs to be applied against the optimizer object.
2828

29-
The following code snippet shows an inference code with FP32 data type. More examples, including training and C++ examples, are available at [Example page](https://intel.github.io/intel-extension-for-pytorch/1.11.0/tutorials/examples.html).
29+
The following code snippet shows an inference code with FP32 data type. More examples, including training and C++ examples, are available at [Example page](https://intel.github.io/intel-extension-for-pytorch/1.11.200/tutorials/examples.html).
3030

3131
```python
3232
import torch

intel_extension_for_pytorch/cpu/launch.py

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -138,39 +138,24 @@ def __init__(self):
138138
regex_out = re.search(pattern, line)
139139
if regex_out:
140140
self.cpuinfo.append(regex_out.group(1).strip().split(","))
141+
assert len(self.cpuinfo) > 0, "cpuinfo is empty"
141142
self.get_socket_info()
142143

143144
def get_socket_info(self):
144-
self.sockets = int(max([line[2] for line in self.cpuinfo])) + 1
145-
self.socket_physical_cores = [] # socket_id is index
146-
self.socket_logical_cores = [] # socket_id is index
147-
self.physical_core_socket_map = {} # phyical core to numa node id
148-
self.logical_core_socket_map = {} # logical core to numa node id
149-
150-
self.nodes = int(max([line[3] for line in self.cpuinfo])) + 1
145+
idx_active = 3
146+
if self.cpuinfo[0][idx_active] == '':
147+
idx_active = 2
148+
self.nodes = int(max([line[idx_active] for line in self.cpuinfo])) + 1
151149
self.node_physical_cores = [] # node_id is index
152150
self.node_logical_cores = [] # node_id is index
153151
self.physical_core_node_map = {} # phyical core to numa node id
154152
self.logical_core_node_map = {} # logical core to numa node id
155153

156-
for socket_id in range(self.sockets):
157-
cur_socket_physical_core = []
158-
cur_socket_logical_core = []
159-
for line in self.cpuinfo:
160-
if socket_id == int(line[2]):
161-
if int(line[1]) not in cur_socket_physical_core:
162-
cur_socket_physical_core.append(int(line[1]))
163-
self.physical_core_socket_map[int(line[1])] = int(socket_id)
164-
cur_socket_logical_core.append(int(line[0]))
165-
self.logical_core_socket_map[int(line[0])] = int(socket_id)
166-
self.socket_physical_cores.append(cur_socket_physical_core)
167-
self.socket_logical_cores.append(cur_socket_logical_core)
168-
169154
for node_id in range(self.nodes):
170155
cur_node_physical_core = []
171156
cur_node_logical_core = []
172157
for line in self.cpuinfo:
173-
nid = line[3] if line[3] != '' else '0'
158+
nid = line[idx_active] if line[idx_active] != '' else '0'
174159
if node_id == int(nid):
175160
if int(line[1]) not in cur_node_physical_core:
176161
cur_node_physical_core.append(int(line[1]))
@@ -180,9 +165,6 @@ def get_socket_info(self):
180165
self.node_physical_cores.append(cur_node_physical_core)
181166
self.node_logical_cores.append(cur_node_logical_core)
182167

183-
def socket_nums(self):
184-
return self.sockets
185-
186168
def node_nums(self):
187169
return self.nodes
188170

0 commit comments

Comments
 (0)