Top 8
Outer WildsストーリーMODを色々やってみた
June 18, 2023, 10:04 a.m.表面符号と戯れる【量子コンピューター Advent Calendar 2023 23 日目】
Dec. 23, 2023, 3:28 a.m.位数発見アルゴリズム ~Quantum Zooやっていく【特別編】~
Jan. 27, 2023, 2:50 p.m.ストーリー追加 Mod: The Outsider やっていく日記【Outer Wilds】
Feb. 19, 2023, 6:33 a.m.意識が量子効果で生じることを示す実験結果についてちょっと調べただけのメモ
April 21, 2022, 3:09 p.m.ストーリー追加 MOD: Astral Codec やっていく日記【Outer Wilds】
Feb. 25, 2024, 8:47 a.m.Outer Wilds の量子は計算能力が(ある程度)すごいのではという話
Jan. 15, 2022, 8:35 a.m.MacでAge of Empires 2 DE (AoE2DE)をCrossOverで動かす
May 31, 2021, 11:52 a.m.Run GPU Qiskit on IBM Power
Jan. 5, 2020, 4:41 a.m. edited Jan. 5, 2020, 5:26 a.m.This is memo. これはメモ.
Final structure 最終的な構成
- Client-server model. Server is docker container on IBM Power with GPU. Client is docker container on IBM Power without GPU.
- クライアント-サーバモデルとなる.サーバはIBM Power上でGPUありのdockerコンテナ.クライアントはIBM Power上でGPUなしのdockerコンテナ(nginxとかでリバースプロキシすればクライアントは外に出せるかも).
Method 手順
Server サーバ
- Run docker container with GPU. Like below command.
GPUが使えるdockerコンテナを立ち上げる.例えばこんなコマンド.
docker run -it -d -e NVIDIA_VISIBLE_DEVICES=all --name server_qiskit -p 8080:80 nvidia/cuda-ppc64le /bin/bash
docker exec -it server_qiskit bash
apt update
apt upgrade
apt install python3 python3-pip git
- Install Advance Toolchain. Read https://developer.ibm.com/linuxonpower/advance-toolchain/advtool-installation/. However, this maybe failed by
kernel is too old
(but no problem???). apt install cmake
apt install build-essential
apt install libopenblas-dev
git clone https://github.com/doichanj/qiskit-aer
mkdir out
cd out
cmake ..
make
However, this would failed, so fix the source code.
...
/* Around line:110 */
template <typename T>
void add_metadata(const std::string &key, T &&data);
void add_metadata_json(const std::string &key, json_t &&data); // add
void add_metadata_json(const std::string &key, const json_t &data); // add
...
/* Around line:784 */
template <typename T>
void ExperimentData::add_metadata(const std::string &key, T &&data) {
// Use implicit to_json conversion function for T
json_t jdata = data;
add_metadata_json(key, std::move(jdata)); // fix like it
}
void ExperimentData::add_metadata_json(const std::string &key, json_t &&data) { // fix like it
//template <>
//void ExperimentData::add_metadata(const std::string &key, json_t &&data) {
auto elt = metadata_.find("key");
if (elt == metadata_.end()) {
// If key doesn't already exist add new data
metadata_[key] = std::move(data);
} else {
// If key already exists append with additional data
elt->second.update(data.begin(), data.end());
}
}
void ExperimentData::add_metadata_json(const std::string &key, const json_t &data) { // fix like it
//template <>
//void ExperimentData::add_metadata(const std::string &key, const json_t &data) {
auto elt = metadata_.find("key");
if (elt == metadata_.end()) {
// If key doesn't already exist add new data
metadata_[key] = data;
} else {
// If key already exists append with additional data
elt->second.update(data.begin(), data.end());
}
}
...
/* Around line:49 */
template <typename T>
void add_metadata(const std::string &key, T &&data);
void add_metadata_json(const std::string &key, json_t &&meta); // add
void add_metadata_json(const std::string &key, const json_t &meta); // add
...
/* Around line:62 */
template <typename T>
void ExperimentResult::add_metadata(const std::string &key, T &&meta) {
// Use implicit to_json conversion function for T
json_t jdata = meta;
add_metadata_json(key, std::move(jdata)); // fix like it
}
void ExperimentResult::add_metadata_json(const std::string &key, json_t &&meta) { // fix like it
//template <>
//void ExperimentResult::add_metadata(const std::string &key, json_t &&meta) {
auto elt = metadata.find("key");
if (elt == metadata.end()) {
// If key doesn't already exist add new data
metadata[key] = std::move(meta);
} else {
// If key already exists append with additional data
elt->second.update(meta.begin(), meta.end());
}
}
void ExperimentResult::add_metadata_json(const std::string &key, const json_t &meta) { // fix like it
//template <>
//void ExperimentResult::add_metadata(const std::string &key, const json_t &meta) {
auto elt = metadata.find("key");
if (elt == metadata.end()) {
// If key doesn't already exist add new data
metadata[key] = meta;
} else {
// If key already exists append with additional data
elt->second.update(meta.begin(), meta.end());
}
}
make
mkdir /server-qiskit
cd /server-qiskit
git clone https://github.com/hitomitak/qiskit-aer
cd qiskit-aer
git checkout distribute
cd server
pip install flask
cp /qiskit-aer/out/Release/qasm_simulator .
Set port80
inserver.ini
.python3 server.py
Ctrl-p&Ctrl-q
Client クライアント
docker run -it -d --link server-qiskit:server-qiskit --name client-qiskit python:3.7 /bin/bash
docker exec -it client-qiskit bash
apt update
apt upgrade
apt install git cmake lib
git clone https://github.com/hitomitak/qiskit-aer
cd qiskit-aer
git checkout distribute
apt install build-essential
apt install libopenblas-dev
apt install gfortran
pip install pybind11
Install suitesparce and move headers likecp /usr/include/suitesparse/* /usr/include/.
.pip install qiskit-terra
pip install qiskit-ibmq-provider
pip install -r requirements-dev.txt
python ./setup.py bdist_wheel
cd dist
pip install *.whl
- Fix library source code in
/usr/local/lib/python3.7/site-packages/qiskit/providers/aer/backends/remote_node.py:113
fromqasm_simulator
intoremote_qasm_simulator
. - Make client program.
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, Aer, execute
qubits = QuantumRegister(2)
clbits = ClassicalRegister(2)
qc = QuantumCircuit(qubits, clbits)
qc.h(qubits[0])
qc.measure(qubits, clbits)
bkend = Aer.get_backend("remote_simulator", http_hosts=["http://server-qiskit:80"])
job = execute(qc, backend=bkend, shots=1024, run_config={"GPU": True})
result = job.result()
count = result.get_counts()
print(count)
python prog.py
Then, if you succeed, you can get like{'00': 507, '01': 517}
.
Other 他の方法
https://github.com/qiskit-community/qiskit-qcgpu-providerを頑張ってGoogle Colabとかで動かすのもありかもしれない(私は無理だった.とりあえずGitHubのコミット履歴見た感じqiskit==0.7.0
は必要そうだけどまだエラー出た)
Top 8
Outer WildsストーリーMODを色々やってみた
June 18, 2023, 10:04 a.m.表面符号と戯れる【量子コンピューター Advent Calendar 2023 23 日目】
Dec. 23, 2023, 3:28 a.m.位数発見アルゴリズム ~Quantum Zooやっていく【特別編】~
Jan. 27, 2023, 2:50 p.m.ストーリー追加 Mod: The Outsider やっていく日記【Outer Wilds】
Feb. 19, 2023, 6:33 a.m.意識が量子効果で生じることを示す実験結果についてちょっと調べただけのメモ
April 21, 2022, 3:09 p.m.ストーリー追加 MOD: Astral Codec やっていく日記【Outer Wilds】
Feb. 25, 2024, 8:47 a.m.Outer Wilds の量子は計算能力が(ある程度)すごいのではという話
Jan. 15, 2022, 8:35 a.m.MacでAge of Empires 2 DE (AoE2DE)をCrossOverで動かす
May 31, 2021, 11:52 a.m.Tags
- #Python (26)
- #量子力学 (25)
- #量子情報 (23)
- #Unity (11)
- #Outer Wilds (11)
- #数学 (9)
- #Mac (9)
- #AoE2 (8)
- #Linux (7)
- #Quantum Zoo (6)
- #意識 (5)
- #シミュレーション (5)
- #NumPy (5)
- #Bash (5)
- #相対論 (4)
- #Docker (4)
- #Android (4)
- #Qiskit (4)
- #Rust (3)
- #PyO3 (3)
- #GitHub (3)
- #Django (2)
- #情報理論 (2)
- #LaTeX (2)
- #AR (2)
- #Git (2)
- #iOS (2)
- #C++ (2)
- #正規表現 (2)
- #論文 (2)
- #電磁気学 (1)
- #Google Drive (1)
- #Overleaf (1)
- #Let's Encrypt (1)
- #ポケモン (1)
- #AdMob (1)
- #Autoya (1)
- #docopt (1)
- #SymPy (1)
- #AWS (1)
- #Twitter (1)
- #URP (1)
- #iMovie (1)
- #PyTorch (1)
- #C# (1)
- #Vim (1)