サブロウ丸

Sabrou-mal サブロウ丸

主にプログラミングと数学

master mind by rust; part 8 logging

今回やること log コード 参考 前の記事: 次の記事: TBA 今回やること ログを出力する log Rustでは標準ライブラリにログを出力するためのlogというライブラリがあリます。 それに加えてenv_loggerというライブラリを使うと、環境変数を使ってログの出力レベ…

NetworkX: 'import networkx' fails: TypeError: entry_points() got an unexpected keyword argument 'group'

I encountered the following error in Python3.9 environment. NetworkX: 'import networkx' fails: TypeError: entry_points() got an unexpected keyword argument 'group' This error seems to be caused by the fact that NetworkX v3.3 does not suppo…

Master mind in Rust; part 7 HashMapとそれを用いたmin max policyの追加

今回やること minmax policy HashMap argument parserの更新 コード 参考 関連 前の記事: Master mind in Rust; part 6 ファイル分割とモジュール - Sabrou-mal サブロウ丸 次の記事: TBA 今回やること policyの追加 HashMapの説明 minmax policy いままでは…

Master mind in Rust; part 6 ファイル分割とモジュール

今回やること モジュール化 コード 参考 関連 前の記事: master mind by rust; part 5 単体テスト - Sabrou-mal サブロウ丸 次の記事: master mind by rust; part 7 HashMapとそれを用いたmin max policyの追加 - Sabrou-mal サブロウ丸 今回やること ファイ…

Master mind in Rust; part 5 単体テスト

今回やること 単体テスト 関数に#[test]属性をつける #[cfg(test)]属性をつけたモジュールを作る コード 参考 関連 前の記事: Master mind in Rust; part 4 argument parser - Sabrou-mal サブロウ丸 次の記事: Master mind in Rust; part 6 ファイル分割と…

Master mind in Rust; part 4 argument parser

今回やること Clap Cargo.tomlの変更 parserの作成 コード列挙の作成 重複がない場合 重複がある場合 コード 参考 関連 前の記事: Master mind in Rust; part 3 型エイリアス - Sabrou-mal サブロウ丸 次の記事: master mind by rust; part 5 単体テスト - S…

Master mind in Rust; part 3 型エイリアス

今回やること 型エイリアス コード 関連 関連 前の記事: Master mind in Rust; part 2 Cargoビルドツール - Sabrou-mal サブロウ丸 次の記事: Master mind in Rust; part 4 argument parser - Sabrou-mal サブロウ丸 今回やること 型エイリアスを使って、コ…

Master mind in Rust; part 2 Cargoビルドツール

今回やること Cargo インストール プロジェクトの作成 まとめ コード 関連 前の記事: Master mind in Rust; part 1 - Sabrou-mal サブロウ丸 次の記事: master mind by rust; part 3 型エイリアス - Sabrou-mal サブロウ丸 今回やること Cargoビルドツールで…

Master mind in Rust; part 1

これからRustでmaster mindというボードゲームの実装をしていきます。以前C++で実装したもののRust版ですね。なるべく標準でシンプルな実装を目指します。C++版はこちら↓↓ master mind ( マスターマインド ) とは 実装 用語 全体の流れ 全体のコード policy …

Rust: 所有権

所有権と借用 ルール 例 借用 コピー OptionとResult型 Option型 Result型 Rustについての勉強ログ。 所有権と借用 RustはC/C++並みの高速化をもちながら、メモリ安全性を担保するように設計されたプログラミング言語です。C/C++ではユーザーがメモリ確保と…

master mind by C++ まとめ

レポジトリ 記事一覧

Summarize ibstat information of all servers in multi-node environment

ibstat command provides us detailed information about the InfiniBand adapter connected to the server. I'd like to share a script that outputs the ibstat information of all servers in a multi-node environment in CSV format. import subproces…

マルチノード環境においてibstat 情報をcsv形式にまとめる

ibstat はコンピュータに接続されている InfiniBand アダプタの詳しい情報を表示します。 マルチノード環境において全てのマシンのibstat情報をcsv形式で表示するスクリプトを共有します。 import subprocess import csv import sys username = "YOUR_USERNA…

gurobipy.GurobiError: Version number is 11.0, license is for version 10.0

I encountered the following error when attempting to run GUROBI via gurobipy interface. gurobipy.GurobiError: Version number is 11.0, license is for version 10.0 Resolved by: pip install gurobipy==10.0.3 In my environment, python installed…

gurobipy.GurobiError: Version number is 11.0, license is for version 10.0

gurobipy経由でGUROBIを実行しようとしたときのエラー。 gurobipy.GurobiError: Version number is 11.0, license is for version 10.0 pip install gurobipy==10.0.3 で解決。gurobipy v11.0がインストールされていたので、ライセンスに合わせてバージョン…

Read and Docs: How to fix "Config validation error in build.os. Value build not found."

Recently, I encountered a build error whiling using the Read the Docs service. The error message displayed was as follows. Error Config validation error in build.os. Value build not found. After some investigation, I discovered that the ro…

Read and Docs: Config validation error in build.os. Value build not found.

Read the Docsでの次のようなビルドエラー。 Error Config validation error in build.os. Value build not found. 次の変更で対処できました。 github.com

Benders DecompositionのGurobipy実装例

Benders Decomposition(ベンダー分解)は問題を二つのmain, sub問題に分割することで問題を解きやすくするテクニックです。次のような性質がある問題に有効です。Kohji Nishimuraさんの「双対変数を直感的に理解したい」から引用しています。 決定変数にyが一…

分散深層学習に現れる最適化

本記事は数理最適化 Advent Calendar 2023の18日目の記事です。分散深層学習に使われる最適化について紹介します。 分散深層学習は、複数の計算ユニット(GPU、CPUなど)を活用して深層学習モデルを訓練する手法のことで、特にLLMのような巨大モデルの訓練に…

データセンタトラフィックの推移

Networking, Cisco Visual."Forecast and methodology, 2010-2015." White paper. (2011). Networking, Cisco Visual. "Cisco global cloud index: Forecast and methodology, 2016–2021." White paper. Cisco Public, San Jose 1 (2016). を元に可視化。 ta…

GUROBIのログについて

Gurobiのログに出てくる項目について。 Nodes | Current Node | Objective Bounds | Work Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time Nodes: 解探索の過程で考慮されたノード数。これは分枝限定法で生成される。 Expl: 既に探索…

NetworkxでKautzグラフを構築する。

igraph経由で行うと楽です。 pythonパッケージ↓ import igraph as ig # m = the size of the alphabet minus one # n = the length of the strings minus one # total nodes = (m+1)m^n # degree = m G = ig.Graph.Kautz(3, 1) nx_G = G.to_networkx() # con…

サーベイ: Efficient MPI-AllReduce for large-scale deep learning on GPU-clusters (2021)

@article{thao2021efficient, title={Efficient MPI-AllReduce for large-scale deep learning on GPU-clusters}, author={Thao Nguyen, Truong and Wahib, Mohamed and Takano, Ryousei}, journal={Concurrency and Computation: Practice and Experience},…

floptで双対問題の作成とその求解

本稿ではfloptを用いて双対問題の作成のその求解を行います。 双対問題 実装 制約を不等式に変換 ラグランジュ関数の生成 双対問題の作成 線形計画法の双対問題 双対問題 min f(x) s.t. g_i(x) <= 0 (for all i) x is continuous vector このような問題の場…

floptで単体法(Simplex)実装

本稿では、floptモデリングツールで定義した線形計画問題に対し単体法を実行して解の取得を行います。Wikipediaにある問題を例に実装してみましょう。 主問題の定義 単体法(Simplex) 等式制約に変換 線形計画の形式に変換 基底変数と非基底変数の設定 Step1:…

サーベイ: On Optimizing the Communication of Model Parallelism

@article{zhuang2023optimizing, title={On optimizing the communication of model parallelism}, author={Zhuang, Yonghao and Zheng, Lianmin and Li, Zhuohan and Xing, Eric and Ho, Qirong and Gonzalez, Joseph and Stoica, Ion and Zhang, Hao and Z…

fzf フィルタコマンド

便利かもしれない(?)、フィルタコマンドのfzfの軽い紹介 install mac brew install fzf ubuntu apt-get install fzf 実行方法 標準出力をパイプさせる。 例えば下記の通り。あとは検索ワードを打ち込むと画面上で絞り込まれる。 ls | fzf 他には様々なレ…

flopt v0.5.6; Coordinate Descent

flopt v0.5.6で座標降下法(Coordinate Descent)の実行方法を示します。 2 x2 + y2 + xy の関数について、xとyの変数の片方のみを交互に移動させて局所最適解を目指します。 prob.solve(optimized_variables=[x[0]]) のようにoptimized_variablesに最適化対象…

集団通信の可視化方法について

故きを温ねて新しきを知る Fast Multi-GPU collectives with NCCL NCCL: Collective Operations Collective communication: theory, practice, and experience A Generalization of the Allreduce Operation TACCL: Guiding Collective Algorithm Synthesis …

サーベイ: Synthesizing Optimal Collective Algorithms (2021)

Cai, Zixian, et al. "Synthesizing optimal collective algorithms." Proceedings of the 26th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming. 2021. どんなもの? 詳細 論文メタ情報 AI向けハードウェア DGX-1 Gigabyte Z52 …