Skip to content

Commit

Permalink
upgrade tutorial link to 1.11.200 (#766)
Browse files Browse the repository at this point in the history
* upgrade tutorial link to 1.11.200

* fix bug issue 227 for launch script
  • Loading branch information
jingxu10 authored May 17, 2022
1 parent c7fa838 commit 627f1ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ python -m pip install intel_extension_for_pytorch -f https://software.intel.com/

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

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

## Getting Started

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.

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).
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).

```python
import torch
Expand Down
30 changes: 6 additions & 24 deletions intel_extension_for_pytorch/cpu/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,39 +138,24 @@ def __init__(self):
regex_out = re.search(pattern, line)
if regex_out:
self.cpuinfo.append(regex_out.group(1).strip().split(","))
assert len(self.cpuinfo) > 0, "cpuinfo is empty"
self.get_socket_info()

def get_socket_info(self):
self.sockets = int(max([line[2] for line in self.cpuinfo])) + 1
self.socket_physical_cores = [] # socket_id is index
self.socket_logical_cores = [] # socket_id is index
self.physical_core_socket_map = {} # phyical core to numa node id
self.logical_core_socket_map = {} # logical core to numa node id

self.nodes = int(max([line[3] for line in self.cpuinfo])) + 1
idx_active = 3
if self.cpuinfo[0][idx_active] == '':
idx_active = 2
self.nodes = int(max([line[idx_active] for line in self.cpuinfo])) + 1
self.node_physical_cores = [] # node_id is index
self.node_logical_cores = [] # node_id is index
self.physical_core_node_map = {} # phyical core to numa node id
self.logical_core_node_map = {} # logical core to numa node id

for socket_id in range(self.sockets):
cur_socket_physical_core = []
cur_socket_logical_core = []
for line in self.cpuinfo:
if socket_id == int(line[2]):
if int(line[1]) not in cur_socket_physical_core:
cur_socket_physical_core.append(int(line[1]))
self.physical_core_socket_map[int(line[1])] = int(socket_id)
cur_socket_logical_core.append(int(line[0]))
self.logical_core_socket_map[int(line[0])] = int(socket_id)
self.socket_physical_cores.append(cur_socket_physical_core)
self.socket_logical_cores.append(cur_socket_logical_core)

for node_id in range(self.nodes):
cur_node_physical_core = []
cur_node_logical_core = []
for line in self.cpuinfo:
nid = line[3] if line[3] != '' else '0'
nid = line[idx_active] if line[idx_active] != '' else '0'
if node_id == int(nid):
if int(line[1]) not in cur_node_physical_core:
cur_node_physical_core.append(int(line[1]))
Expand All @@ -180,9 +165,6 @@ def get_socket_info(self):
self.node_physical_cores.append(cur_node_physical_core)
self.node_logical_cores.append(cur_node_logical_core)

def socket_nums(self):
return self.sockets

def node_nums(self):
return self.nodes

Expand Down

0 comments on commit 627f1ef

Please sign in to comment.