This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T> | |
std::ostream& operator<<(std::ostream& os, std::vector<T> arr) { | |
os << "["; | |
for (int i = 0; i < arr.size(); ++i) { | |
if (i > 0) os << ","; | |
os << arr[i]; | |
} | |
os << "]"; | |
return os; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configure Linux for Neuron repository updates | |
sudo tee /etc/yum.repos.d/neuron.repo > /dev/null <<EOF | |
[neuron] | |
name=Neuron YUM Repository | |
baseurl=https://yum.repos.neuron.amazonaws.com | |
enabled=1 | |
metadata_expire=0 | |
EOF | |
sudo rpm --import https://yum.repos.neuron.amazonaws.com/GPG-PUB-KEY-AMAZON-AWS-NEURON.PUB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import time | |
utc = int(time.time()) | |
shell_script = """ | |
git for-each-ref --sort=taggerdate \ | |
--format '%(refname:short),%(taggerdate:unix),%(taggerdate:short)' refs/tags \ | |
| tail -40 \ | |
| tac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% pylint xla/python | |
************* Module python.xla_client_test | |
xla/python/xla_client_test.py:3177:0: C0301: Line too long (99/80) (line-too-long) | |
xla/python/xla_client_test.py:3180:0: C0301: Line too long (86/80) (line-too-long) | |
xla/python/xla_client_test.py:3355:0: C0301: Line too long (87/80) (line-too-long) | |
************* Module python.xla_client | |
xla/python/xla_client.pyi:74:0: C0301: Line too long (86/80) (line-too-long) | |
xla/python/xla_client.pyi:81:0: C0301: Line too long (81/80) (line-too-long) | |
xla/python/xla_client.pyi:107:0: C0301: Line too long (83/80) (line-too-long) | |
xla/python/xla_client.pyi:115:0: C0301: Line too long (96/80) (line-too-long) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pylint xla/python | |
************* Module python.xla_client_test | |
xla/python/xla_client_test.py:3177:0: C0301: Line too long (99/80) (line-too-long) | |
xla/python/xla_client_test.py:3180:0: C0301: Line too long (86/80) (line-too-long) | |
xla/python/xla_client_test.py:3355:0: C0301: Line too long (87/80) (line-too-long) | |
xla/python/xla_client_test.py:51:0: W0212: Access to a protected member _xla of a client class (protected-access) | |
xla/python/xla_client_test.py:54:0: W0212: Access to a protected member _xla of a client class (protected-access) | |
xla/python/xla_client_test.py:64:4: W0212: Access to a protected member _xla of a client class (protected-access) | |
xla/python/xla_client_test.py:70:8: W0212: Access to a protected member _single_device_array_to_np_array of a client class (protected-access) | |
xla/python/xla_client_test.py:77:9: W0212: Access to a protected member _device of a client class (protected-access) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake -S llvm -B build \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld" \ | |
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" \ | |
-DLLVM_TARGETS_TO_BUILD=host \ | |
-DLLVM_INCLUDE_TESTS=OFF | |
cmake --build build -j48 | |
sudo cmake --build build -j48 -t install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch_xla.core.xla_builder as xb | |
fname = "model.hlo.pb" | |
with open(fname, mode="rb") as f: | |
comp = xb.computation_from_module_proto("foo", f.read()) | |
print(xb.get_computation_hlo(comp)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jax.lib.xla_bridge import xla_client | |
fname = "model.hlo.pb" | |
with open(fname, mode="rb") as f: | |
comp = xla_client.XlaComputation(f.read()) | |
print(comp.as_hlo_text()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -ti --name u2204 -v ~/workspace:/home/joshcao/workspace ubuntu:22.04 | |
U=pivovaa | |
apt update | |
apt install -y adduser sudo vim wget curl \ | |
libssl-dev \ | |
python3 python3-pip | |
adduser $U |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This tool lets you run a given HloModule from a file (or stdin) and convert it | |
to expanded HLO, fully optimized HLO, or a binary depending on options. | |
HLO passes are always run, unless the HLO module is already scheduled (has | |
is_scheduled=True). | |
You can also pass in debug option flags for the HloModule. | |
Usage: |
NewerOlder