訳あって再投稿になります
ここでインストールするもの
nariaki3551
氏の制作されたcmapdeepbkz
です:
下準備
$\texttt{GMP}$,$\texttt{MPFR}$,$\texttt{GSL}$,$\texttt{OpenMPI}$のライブラリが必要みたいなので,もしインストールしていない方はインストールしてください.
# GMPのインストール
$ sudo apt install libgmp-dev
# MPFRのインストール
$ sudo apt install libmpfr-dev
# GSLのインストール
$ sudo apt install libgsl-dev
# OpenMPIのインストール
$ sudo apt install openmpi-bin libopenmpi-dev
cmapdeepbkz
では$\texttt{NTL}$ライブラリ,$\texttt{Eigen}$ライブラリ,及びboost
を使用しているので,これらをインストールしておきます.
NTL
$ sudo apt-get install -y libntl-dev
でインストールされるはずです.
Eigenのインストール
$ sudo apt install libeigen3-dev
でインストールできるはずです.
boostのインストール
cmapdeepbkzのREADMEを見る限り,boostのversionは1.75.0じゃないといけなそうなので,これをインストールします.
上のリンクからboost_1_75_0.tar.gz
をダウンロードし解凍します.
# ダウンロード
$ wget https://archives.boost.io/release/1.75.0/source/boost_1_75_0.tar.gz
# 解凍
$ tar -zxvf boost_1_75_0.tar.gz
cmapdeepbkzのインストール
まず,cmapdeepbkzのレポジトリをGitHubから引っ張ってきます.
$ git clone https://github.com/nariaki3551/cmapdeepbkz.git
そしたら,コンパイルします.コンパイル前にbuild
というディレクトリを作る必要があるので,忘れないように.
# buildディレクトリを作成し移動
$ cd cmapdeepbkz
cmapdeepbkz$ mkdir build
cmapdeepbkz$ cd build
# コンパイル
cmapdeepbkz/build$ cmake .. -DBOOST_DIR=../../boost_1_75_0 -DCMAKE_CXX_COMPILER=mpicxx
cmapdeepbkz/build$ make
問題なくコンパイルできたらcmapdeepbkz/bin
に色々とファイルが作成されるはずです.
cmapdeepbkz/bin$ ls
fcmapdeepbkz fcmaptest paracmapdeepbkz paracmaptest seqcmaplap synchronous_cmapdeepbkz synchronous_cmapdeepbkz_identity
テスト
test.py
が用意されているので,これでテストができます.
cmapdeepbkz$ python test.py
(1/4 thread -- normal)[OK] time 1.32s ./bin/fcmapdeepbkz ./settings/default.set ./storage/sample_mats/dim80.txt -ntpr 1 -sth 4 -o 2 ./settings/test/debug.set ./settings/test/short.set
(2/4 thread -- with lower bound of approximated factor)[OK] time 1.27s ./bin/fcmapdeepbkz ./settings/default.set ./storage/sample_mats/dim80.txt -ntpr 1 -sth 4 -o 3 ./settings/test/debug.set ./settings/test/short.set ./settings/test/loweralpha.set
(3/4 mpi -- noamal)[OK] time 1.82s mpirun -n 4 ./bin/paracmapdeepbkz ./settings/default.set ./storage/sample_mats/dim80.txt -ntpr 1 -o 2 ./settings/test/debug.set ./settings/test/short.set
(4/4 mpi-- with lower bound of approximated factor)[OK] time 1.72s mpirun -n 4 ./bin/paracmapdeepbkz ./settings/default.set ./storage/sample_mats/dim80.txt -ntpr 1 -o 3 ./settings/test/debug.set ./settings/test/short.set ./settings/test/loweralpha.set
使ってみる
cmapdeepbkz$ mpirun -np 3 ./bin/paracmapdeepbkz settings/default.set storage/sample_mats/dim80.txt
The following solver is parallelized by UG version 1.0.0 [GitHash: ]
*** CMapLap loads storage/sample_mats/dim80.txt as problem file ***
*** The value of MAXTIME is now 150000 ***
*** CMapLap runs with 1 threads ***
** Initiatior was initilized after 0.00147342 sec.
** Instance data were sent to all solvers after 0.00210598 sec.
*** CMapLap sets globalLowerBoundOfSquaredNorm to 5.41955e+06 from lowerBoundOfApproxFactor 1.02 ***
rank 1: NTL::LLL start
rank 2: NTL::LLL start
*** Time 5.269e-06 CMapLapParaCheckpointWriter start
rank 2: NTL::BKZ20 start
rank 1: NTL::BKZ20 start
rank 2: DeepBKZ-50, average:1.06894
Replace,Rank,2,Thread,0,Time,0.0882741,unupdate,0,nShared,16,index,3
rank 2: Time 0.351077, Norm = 2484.3, [374 119 21 -11 -21 181 286 383 -213 31 99 -25 54 61 109 250 477 159 -53 -27 -197 316 224 467 218 -193 -318 353 -98 -22 -285 -530 -222 78 -476 -91 -495 109 169 59 -189 95 -134 -10 -345 220 110 272 461 37 -274 9 -29 295 530 193 151 -296 -463 261 170 -136 326 -289 -49 41 -195 -270 428 66 174 -82 -263 -474 -68 -588 -667 280 -288 -679]
rank 1: DeepBKZ-50, average:1.05589
Replace,Rank,1,Thread,0,Time,0.490212,unupdate,0,nShared,16,index,0
Norm = 2602, AF = 1.14005, RHF = 1.01179, Vec = [-301 301 93 860 87 -193 67 -321 -20 462 42 -86 -313 -222 -159 202 548 -498 14 -195 313 -444 349 -388 129 -201 -534 -202 257 -36 5 256 133 -239 38 398 -12 493 245 216 -601 -70 302 186 -129 159 -224 258 138 -377 326 -503 -2 -153 66 25 548 -101 333 23 -645 185 47 -155 -72 62 2 -48 28 -153 -99 -381 -421 -222 207 290 495 -305 -60 -120]
rank 2: Time 0.576155, Norm = 2279.05, [171 510 189 275 -170 -86 167 903 -285 230 90 396 336 -120 346 3 -127 423 278 -74 230 589 235 -57 -13 334 8 -66 36 130 201 -48 -238 -232 -236 310 -253 -222 -3 -220 369 297 267 -34 -160 -365 192 401 -349 114 78 -258 88 40 107 144 208 -443 51 107 81 -28 -558 -37 109 295 -143 494 -18 128 -58 12 151 81 -91 135 10 -311 55 124]
*** Time 0.689536 CMapLapParaLoadCoordinator::updateCheckpointFiles send currentCheckpointElement ***
*** Time 0.677288 CMapLapParaCheckpointWriter::run receive currentCheckpointElement
*** Time 0.687081 CMapLapParaCheckpointWriter::updateCheckpointFiles finish lastCheckpointTimeStr <- Apr__9_17:12:13_2025
rank 1: Time 0.253916, Norm = 2486.11, [1 135 -380 -136 -454 -227 -150 -332 246 132 749 -340 130 -409 34 -21 -67 325 -225 413 393 449 158 -410 196 561 -22 -321 379 -191 -347 -113 -182 104 -268 256 -159 277 234 -349 294 157 -671 23 -85 -332 -205 380 -33 -5 -239 229 110 -8 53 -37 -123 394 -332 -136 -149 -7 -172 -44 -143 -146 189 -3 378 -142 -173 4 202 -120 282 -266 529 -386 15 555]
*** Time 0.745495 CMapLapParaCheckpointWriter::run receive UG::TagTerminateRequest from LC
*** Time 0.745559 CMapLapParaCheckpointWriter::run send UG::TagTerminated to LC
CMapLap Status : solving was interrupted [ lower bound reached ]
Total Wall Time : 0.758077
LC process : 0
solving : 0.758077
Total CPU Time : 1.45386
total DeepBkz time : 1.45386
total Enum time : 0
total Sieve time : 0
Task :
tasks (total) : 0
Best Objective : 2279.05
Approx. Factor : 0.998558
Hermite Factor : 2.23714
Root Hermite Factor : 1.01012
*** Time 0.758111 CMapLapParaLoadCoordinator::deconstructor receive 11 from CheckpointWriter ***
[ Rank: 1 ], UTime = 0.9, STime = 0.36, RTime = 0.81
[ Rank: 2 ], UTime = 0.85, STime = 0.3, RTime = 0.84
[ Rank: 0 ], UTime = 0.88, STime = 0.33, RTime = 0.85
これを見る限りではSVP-challengeにおける80次元格子を簡約し,Hermite因子は$1.01012$程度になり,第一基底ベクトルのノルムは$2279.05$程度になったようです.最短な非零ベクトルのノルムが$2272$ですので,そこそこよさそうです
余談
$\texttt{Google Colab}$でもできるようにしたかったのですが、全くもって使い物になりませんでした.皆さんもこのライブラリを使用する際は,colabではなく普通にUbuntuとかでやりましょう.