6 MC-MPI/GXP 公式パッケージへの道

藤澤 徹

PIC
____________________________________________________________________

6.1 前回のおさらい

東京大学近山・田浦研究室で開発されているグリッド用の MPI ライブラリである MC-MPI, および MC-MPI を動作させる のに必要となる, 同じく近山・田浦研究室で開発されている並列分散シェルの GXP の 2 つを Debian パッケージにしてみま した.

6.2 今回やることその 1

前回つくったパッケージは割と適当なので, 公式にするには問題が残っています. まずはこれをちょくちょく解決しておきたい と思います.

といっても, とりあえず解決できたのは 1 つだけですが.

6.3 MC-MPI で FORTRAN 用ライブラリが無効

これは, 元々のコードが g77 用に書かれていたところを前回出した gFortran でコンパイルしようとしたため, 両者の互換性の 無い部分をモロの踏んでしまった事が原因でした.

6.3.1 gfortran_getarg, gfortran_iargc が無い?
fortran/.libs/libfortran.a(farg.o): In function ‘mpigxp_getarg’:
/home/arai/projects/deb/deb_mcmpi2/mcmpi-0.21.0/src/fortran/farg.f:9:
 undefined reference to ‘_gfortran_getarg_i4’
fortran/.libs/libfortran.a(farg.o): In function ‘mpigxp_iargc’:
/home/arai/projects/deb/deb_mcmpi2/mcmpi-0.21.0/src/fortran/farg.f:2:
 undefined reference to ‘_gfortran_iargc’

前回の発表では gFortran に getarg, iargc が無い, という風に言ってしまったのですが実際には gFortran に無 いわけではなく, gFortran で単体でコンパイルした場合にオブジェクトファイルに含められない事が原因で した.

というわけでライブラリを作る時に libgfortran をリンクする事で解決します.

LIBS = @LIBS@ -lgfortran
6.3.2 mpigxp_getarg, mpigxp_iargc が無い?
fortran/.libs/libfortran.a(initf.o): In function ‘mpi_init__’:
/home/arai/projects/deb/deb_mcmpi2/mcmpi-0.21.0/src/fortran/initf.c:16:
 undefined reference to ‘mpigxp_iargc__’
/home/arai/projects/deb/deb_mcmpi2/mcmpi-0.21.0/src/fortran/initf.c:20:
 undefined reference to ‘mpigxp_getarg__’

これも g77 と gFortran の互換性の問題で, g77 でコンパイルすると元の関数名にアンダースコアが 2 つ追加されるのに対し, gFortran でコンパイルするとアンダースコアが 1 つしか追加されない事が原因です.

というわけでこっちは呼び出し側のコードでアンダースコアの数を調整して解決します.

6.4 今回やることその 2

せっかくパッケージにしたので, これを公式パッケージにして, まっさらな Debian に apt-get でインストールできるようにし てみましょう.

6.5 ところで本当にまだ公式パッケージになってない?

もし他の人の手によって公式パッケージになってたり, 途中まで進んでたりしたらそれを知らないまま作業を進めるのは無駄 です.

以下のページで作業中のパッケージ等の一覧を見る事ができます.

Work-Needing and Prospective Packages; WNPP http://www.debian.org/devel/wnpp/

とりあえずひととおり検索して, 今から作るパッケージがここに無い事を確認しましょう.

6.6 作業開始を宣言するぞ

さきほどのページの下の方に新規項目追加のどうのこうのという節があります.

作業中のものが無いかどうかをこのページで見て確認したわけですから, いざ作業を開始するならばこのページで他の人が見 られるようにしなければなりません.

6.7 作業中のパッケージの管理体制

Debian では, 作業中のパッケージは Debian バグ追跡システムの上で WNPP という仮想パッケージのバグとして登録され, パッケージ化が完了した時点でこのバグが閉じられます.

つまり, さきほどみたページはこのシステムに登録されている WNPP のバグのリストを表示していた事になり ます.

6.8 パッケージの登録方法

WNPP にパッケージを登録するには 2 種類の方法が提供されています.

6.9 reportbug

reportbug はバグレポートの作成を支援するツールです.

一般的な環境には無いのでインストールしましょう.

$ sudo apt-get install reportbug

6.10 初期設定

とりあえず起動してみましょう

$ reportbug

Welcome to reportbug! Since it looks like this is the first time you have used
reportbug, we are configuring its behavior. These settings will be saved to the
file "/home/arai/.reportbugrc", which you will be free to edit further.
Please choose the default operating mode for reportbug.

1 novice    Offer simple prompts, bypassing technical questions.

2 standard  Offer more extensive prompts, including asking about things that a
            moderately sophisticated user would be expected to know about
            Debian.

3 advanced  Like standard, but assumes you know a bit more about Debian,
            including "incoming".

4 expert    Bypass most handholding measures and preliminary triage routines.
            This mode should not be used by people unfamiliar with Debian’s
            policies and operating procedures.

Select mode: [novice]

起動すると初期設定の方法を聞かれます. 正直に novice と答えましょう.

> novice

Please choose the default interface for reportbug.

1 gtk2  A graphical (GTK+) user interface

2 text  A text-oriented console user interface

Select interface:

使用するインターフェースは当然 text ですね.

> 2

Will reportbug often have direct Internet access? (You should answer yes to
this question unless you know what you are doing and plan to check whether
duplicate reports have been filed via some other channel.) [Y|n|q|?]?

> Y

回線が無いと生きていけません.

What real name should be used for sending bug reports?
[arai]>

> Tooru Fujisawa

Which of your email addresses should be used when sending bug reports? (Note
that this address will be visible in the bug tracking system, so you may want
to use a webmail address or another address with good spam filtering
capabilities.)
[arai@halko]>

> arai_a@mac.com

適当に個人情報を入力します.

Do you have a "mail transport agent" (MTA) like Exim, Postfix or SSMTP
configured on this computer to send mail to the Internet? [Y|n|q|?]?

このマシンはメールサーバじゃないので n を選択します.

> n

Traceback (most recent call last):
  File "/usr/bin/reportbug", line 1841, in <module>
    main()
  File "/usr/bin/reportbug", line 861, in main
    return iface.user_interface()
  File "/usr/bin/reportbug", line 965, in user_interface
    offer_configuration(self.options)
  File "/usr/bin/reportbug", line 496, in offer_configuration
    options=opts, empty_ok=True, force_prompt=True)
TypeError: get_string() got an unexpected keyword argument ’empty_ok’

落ちます.

6.11 何が起きたのだろう

... と思ったらアップデートがありました.

apt-get install python-reportbug

reportbug が 4.2 なのに python-reportbug が 4.0 というよく分からない状態になっていたのが原因のよう です.

6.12 初期設定ふたたび

もういちどやりなおしましょう.

$ reportbug

...

Do you have a "mail transport agent" (MTA) like Exim, Postfix or SSMTP
configured on this computer to send mail to the Internet? [Y|n|q|?]?

> n

Please enter the name of your SMTP host. Usually it’s called something like
"mail.example.org" or "smtp.example.org". If you need to use a different port
than default, use the <host>:<port> alternative format. Just press ENTER if you
don’t have one or don’t know.

MTA の設定は無事通過し, SMTP サーバを聞かれます. reportbug は自動でメールを送信してくれるのですが, 今回はこれ を使わずにメール送信は自分でやる事にしましょう.

> [RET]

Default preferences file written. To reconfigure, re-run reportbug with the "--
configure" option.

6.13 パッケージを登録する

さて, 初期設定ができたのでパッケージを登録する作業に移ります.

Please enter the name of the package in which you have found a problem, or type
’other’ to report a more general problem.

バグの対象のパッケージを聞かれるので, さきほどの話にあったとおり wnpp を指定します.

> wnpp

Are you sure you want to file a WNPP report? [y|N|q|?]?

確認されるので Y と入力します.

> Y

*** Welcome to reportbug.  Use ? for help at prompts. ***
Detected character set: UTF-8
Please change your locale if this is incorrect.

Using ’Tooru Fujisawa <arai_a@mac.com>’ as your from address.
Getting status for wnpp...
Will send report to Debian (per lsb_release).
What sort of request is this? (If none of these things mean anything to you, or
you are trying to report a bug in an existing package, please press Enter to
exit reportbug.)

1 ITP  This is an ‘Intent To Package’. Please submit a package description
       along with copyright and URL in such a report.
2 O    The package has been ‘Orphaned’. It needs a new maintainer as soon as
       possible.
3 RFA  This is a ‘Request for Adoption’. Due to lack of time, resources,
       interest or something similar, the current maintainer is asking for
       someone else to maintain this package. They will maintain it in the
       meantime, but perhaps not in the best possible way. In short: the
       package needs a new maintainer.
4 RFH  This is a ‘Request For Help’. The current maintainer wants to continue
       to maintain this package, but they needs some help to do this, because
       their time is limited or the package is quite big and needs several
       maintainers.
5 RFP  This is a ‘Request For Package’. You have found an interesting piece of
       software and would like someone else to maintain it for Debian. Please
       submit a package description along with copyright and URL in such a
       report.

Choose the request type:

まずバグの種類を聞かれます. wnpp に登録するバグには上記のように 5 種類あります. 簡単に説明すると以下のとおり です.

ITP
これからあるソフトウェアのパッケージを作成するぞ, という宣言
O
自分のパッケージを手放すという宣言
RFA
自分のパッケージの里親になってくれという要求
RFH
誰か手伝ってくれという要求
RFP
誰かパッケージにしてくれという要求

というわけで ITP を選びます

> 1

Please enter the proposed package name:

パッケージ名を要求されますまずは mcmpi のパッケージを作る事にしましょう.

> mcmpi

Checking status database...
Please briefly describe this package; this should be an appropriate short
description for the eventual package:

説明文はパッケージを作った時に決めたのでそのままです.

> Grid-enabled implementation of MPI

Your report will be carbon-copied to debian-devel, per Debian policy.
Querying Debian BTS for reports on wnpp (source)...
3082 bug reports found:

Outstanding bugs -- Important bugs; Unclassified (1 bug)
     1) #502809  O: potracegui -- KDE frontend for potrace, severity it normal
(1-1/3082) Is the bug you found listed above [y|N|m|r|q|s|f|?]?

登録済みの 3082 個のバグに重複が無いかどうかチェックしろという大変素晴しい要請を受けました.

回避する策を探しましょう.

> ?

y - Problem already reported; optionally add extra information.
N - (default) Problem not listed above; possibly check more (skip to Next
    page).
m - Get more information about a bug (you can also enter a number without
    selecting "m" first).
r - Redisplay the last bugs shown.
q - I’m bored; quit please.
s - Skip remaining problems; file a new report immediately.
f - Filter bug list using a pattern.
? - Display this help.
(1-1/3082) Is the bug you found listed above [y|N|m|r|q|s|f|?]?

ほらあるじゃないですか.

> s

Spawning emacs...

ほら回避できた. まぁさきほどウェブ上でもチェックしたし, とりあえずは良しとしましょう.

さて, Emacs が起動されてバグレポートの雛形が表示されました. バージョン, 上流作者, URL, ライセンス, 使用言語, 長い 説明を書きましょう. どれもパッケージを作る時にもう書いたものなのでコピペで OK です.

Subject: ITP: mcmpi -- Grid-enabled implementation of MPI
Package: wnpp
Owner: Tooru Fujisawa <arai_a@mac.com>
Severity: wishlist

*** Please type your report below this line ***

* Package name    : mcmpi
  Version         : 0.21.0
  Upstream Author : Hideo Saito <h_saito@logos.ic.i.u-tokyo.ac.jp>
* URL             : http://www.logos.ic.i.u-tokyo.ac.jp/~h_saito/mcmpi/
* License         : GPL
  Programming Lang: C, FORTRAN
  Description     : Grid-enabled implementation of MPI

  MC-MPI is a Grid-enabled implementation of MPI, developed by Hideo
  Saito at the University of Tokyo.  Its main features include the
  following:
  - [Firewall and NAT traversal]: MC-MPI constructs an overlay
    network, allowing nodes behind firewalls and nodes without global
    IP addresses to participate in computations.  There is no need to
    perform maual configuration; MC-MPI automatically probes
    connectivity, selects which connections to establish, and performs
    routing.
  - [Locality-aware connection management]: Establishing too many
    connections, especially wide-area connections, results in many
    problems, including but not limited to the follwing: exhaustion of
    system resources (e.g., file descriptors, memory), high message
    reception overhead, and congestion between clusters during
    all-to-all communication.  Therefore, MC-MPI limits the number of
    connections that are established.  If we assume, for simplicity,
    that n processes are distributed equally among c clusters, then at
    most O(log n) connections are established by each process and at
    most O(n log c) connections are established between clusters.  As
    MC-MPI uses a lazy connect strategy, fewer connections are
    established for applications in which few process pairs
    communicate.  The maximum number of connections allowed can be
    controlled by passing the -beta option to mpirun (see Subsection 3).
  - [Locality-aware rank assignment]: Temporarily disabled in this
    version.

こんな感じで保存しましょう.

Report will be sent to "Debian Bug Tracking System" <submit@bugs.debian.org>
Submit this report on wnpp (e to edit) [Y|n|a|c|e|i|l|m|p|q|?]?

メールサーバは持っていないので Y は選べません.

> ?

Y - (default) Submit the bug report via email.
n - Don’t submit the bug report; instead, save it in a temporary file (exits
    reportbug).
a - Attach a file.
c - Change editor and re-edit.
e - Re-edit the bug report.
i - Include a text file.
l - Pipe the message through the pager.
m - Choose a mailer to edit the report.
p - Print message to stdout.
q - Save it in a temporary file and quit.
? - Display this help.
Submit this report on wnpp (e to edit) [Y|n|a|c|e|i|l|m|p|q|?]?

ファイルに保存してくれれば自分で送れるので, q を選びましょう.

> q

reportbug stopped; your incomplete report is stored as "/tmp/reportbug-
wnpp-20090516-28182-HoQ43f". This file may be located in a temporary directory;
if so, it might disappear without any further notice. To recover this file to
use it as bug report body, please take a look at the "-i FILE, --include=FILE"
option.

というわけでさっきのバグレポートを submit@bugs.debian.org に送って完了です.

reportbug を使わなくても自分で全部書くという手もあります.

メールを送るとバグに ID が振られ, そのスレッドのトップとしてさっきのメールが返ってきます.

しばらくするとウェブ上の WNPP からも参照可能になります.

さて, 表明もしてしまったところで, これからパッケージの手直しを頑張ろうと決意して今回はおしまい です.

第 52 回東京エリア Debian 勉強会 2009 年 5 月
____________________________________________________________________________________________