JP7271957B2 - Dynamic link device, dynamic load device, computer system, dynamic link method, dynamic load method, dynamic link program, and dynamic load program - Google Patents
Dynamic link device, dynamic load device, computer system, dynamic link method, dynamic load method, dynamic link program, and dynamic load program Download PDFInfo
- Publication number
- JP7271957B2 JP7271957B2 JP2019003516A JP2019003516A JP7271957B2 JP 7271957 B2 JP7271957 B2 JP 7271957B2 JP 2019003516 A JP2019003516 A JP 2019003516A JP 2019003516 A JP2019003516 A JP 2019003516A JP 7271957 B2 JP7271957 B2 JP 7271957B2
- Authority
- JP
- Japan
- Prior art keywords
- shared library
- function
- dynamic
- calling
- program
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Landscapes
- Advance Control (AREA)
- Stored Programmes (AREA)
Description
本発明は、動的リンク装置、動的ロード装置、計算機システム、動的リンク方法、動的ロード方法、動的リンクプログラム、および動的ロードプログラムに関する。 The present invention relates to a dynamic linking device, a dynamic loading device, a computer system, a dynamic linking method, a dynamic loading method, a dynamic linking program, and a dynamic loading program.
今日の計算機システムでは、半導体技術や電力の制約によって、汎用計算機の周波数を高めることによる性能向上が飽和してきている。そのため、処理に適したアクセラレータなど、特性の異なる計算機によって構成されたヘテロな計算機システムが拡大している。一例として、通常の計算や入出力を行う汎用プロセッサを備えるホストと、数値計算に適したプロセッサを備えるアクセラレータとで構成される計算機システムがある。アクセラレータには、Intel Xeon Phi(登録商標)やNEC SX-Aurora TSUBASA(登録商標)のように、オペレーティングシステムの機能、および共有ライブラリをサポートするものがある。 In today's computer systems, due to limitations in semiconductor technology and power, the performance improvement achieved by increasing the frequency of general-purpose computers is becoming saturated. As a result, heterogeneous computer systems composed of computers with different characteristics, such as accelerators suitable for processing, are expanding. As an example, there is a computer system composed of a host having a general-purpose processor for normal calculation and input/output, and an accelerator having a processor suitable for numerical calculation. Some accelerators, such as Intel Xeon Phi (registered trademark) and NEC SX-Aurora TSUBASA (registered trademark), support operating system functions and shared libraries.
共有ライブラリは、プログラムの再利用性を高めることでソフトウェアの生産性を向上させ、かつ、複数のプログラムで使用する関数によって重複するコードによるストレージやメモリの消費を削減するために、計算機システムにおいて広く普及している。標準的なオペレーティングシステムは、共有ライブラリをサポートしている。例えば、Linux(登録商標)およびUnix(登録商標)系オペレーティングシステムでは、ELF(Executable and Linking Format)およびELF shared objectという動的リンク・動的ロード可能な共有ライブラリがサポートされている。 Shared libraries are widely used in computer systems to improve software productivity by increasing program reusability, and to reduce storage and memory consumption due to code duplicated by functions used by multiple programs. Widespread. Standard operating systems support shared libraries. For example, Linux (registered trademark) and Unix (registered trademark) operating systems support dynamically linkable and dynamically loadable shared libraries called ELF (Executable and Linking Format) and ELF shared objects.
ヘテロな計算機システムは、プログラムの実行を開始する計算機(ホスト)上で動作する実行ファイルから、特定の処理に適した別の計算機(アクセラレータ)を起動する。この特定の処理は、最適化されたコードの再利用性のために共有ライブラリとして提供されることがある。 A heterogeneous computer system activates another computer (accelerator) suitable for specific processing from an executable file running on a computer (host) that starts execution of a program. This particular process is sometimes provided as a shared library for optimized code reusability.
ヘテロな計算機システムに用いられる複数の計算機で動作する分散プログラムにおいて、自身の計算機以外の計算機(以下、サーバとも呼ばれる)で動作する機能(たとえば、関数・メソッド)を使用する場合、RPC(Remote Procedure Call)が使用される。RPCでは、通常の関数呼び出しとは異なる煩雑な記述・処理の追加が必要である。たとえば、RPCを使用するときは、クライアントがリモートで呼び出すべき関数に渡す引数を、マーシャリングまたはシリアライズと呼ばれる、転送するためのデータの塊に変換する処理を実行し、変換したデータを、関数を実行するサーバに転送する。サーバは、マーシャリングまたはシリアライズされたデータを元の形に復元(アンマーシャリング、デシリアライズ)し、実際に関数を呼び出す。サーバは、関数を呼び出し実行した結果をマーシャリングしてクライアントに返信する。クライアントはサーバから返された結果をアンマーシャリングする。 In a distributed program that operates on multiple computers used in a heterogeneous computer system, when using a function (for example, function / method) that operates on a computer other than its own computer (hereinafter also referred to as a server), RPC (Remote Procedure Call) is used. RPC requires addition of complicated descriptions and processes that are different from normal function calls. For example, when using RPC, a process called marshalling or serialization is performed to convert the arguments passed to the function to be called remotely by the client into chunks of data for transfer, and the converted data is used to execute the function. transfer to a server that The server restores (unmarshals, deserializes) the marshalled or serialized data to its original form, and actually calls the function. The server calls the function, marshals the result, and sends it back to the client. The client unmarshals the results returned by the server.
一般に、RPCによって他の計算機の関数を呼び出すプログラムでは、クライアントスタブとサーバスタブとが用いられる。クライアントスタブは、クライアント側でマーシャリングを行い、サーバに要求を発行し、サーバから戻り値を受信し、その値を返す。サーバスタブは、サーバ側で要求を受け付け、アンマーシャリングを行い、サーバ上の関数に引数として渡し、関数を実行し、戻り値をクライアントに送信する。開発者は、クライアントスタブを呼び出すプログラムを記述し、クライアントスタブをリンクする。 Generally, a client stub and a server stub are used in a program that calls functions of other computers by RPC. The client stub does the marshalling on the client side, issues requests to the server, receives return values from the server, and returns the values. The server stub receives the request on the server side, unmarshals it, passes it as an argument to a function on the server, executes the function, and sends the return value to the client. A developer writes a program that calls the client stub and links the client stub.
非特許文献1には、RPCの一例としてのONC(Open Network Computing) RPCについての説明がある。 Non-Patent Document 1 describes ONC (Open Network Computing) RPC as an example of RPC.
また、特許文献1には、ホストとホストに接続されるアクセラレータとを含むグラフィックシステムについての記載がある。このグラフィックシステムは、ホストのライブラリにストラクチャ管理部を設ける。クライアントは、ストラクチャ管理部により、直接、アクセラレータ内の共有メモリ上にストラクチャ編集リクエストを格納することができる。 Further, Patent Document 1 describes a graphic system including a host and an accelerator connected to the host. This graphics system provides a structure manager in the host's library. The structure manager allows clients to store structure edit requests directly on the shared memory within the accelerator.
特許文献2に記載の技術は、ゲストプラットフォームのライブラリをロードする必要があるとき、ホスト用の代替のライブラリがあるかを判別し、有れば当該代替のライブラリをロードして使用する。さらに、特許文献2に記載の技術は、ホスト用の代替のライブラリが無ければ、エミュレーション・バイナリ変換によりゲスト用のライブラリを使用する。 The technology described in Patent Document 2 determines whether there is an alternative library for the host when it is necessary to load the guest platform library, and if so, loads and uses the alternative library. Furthermore, the technology described in Patent Document 2 uses a guest library by emulation/binary conversion if there is no alternative library for the host.
RPCに使用するクライアントスタブとサーバスタブ(以下、これらを纏めてスタブと呼ぶ)とを自動生成することで、スタブの開発にかかるコストが軽減される。たとえば、IDL(Interface Definition Language)で関数のインタフェースが記述され、IDLコンパイラによって、スタブが生成される。詳細には、ONC RPCに使用するIDLコンパイラとして、RPCGENが知られている。RPCGENは、インタフェース定義ファイルを使って、サーバおよびクライアントのC言語スタブを生成するコンパイラである。 By automatically generating a client stub and a server stub (hereinafter collectively referred to as stubs) used for RPC, the cost of developing stubs can be reduced. For example, a function interface is described in IDL (Interface Definition Language), and a stub is generated by an IDL compiler. Specifically, RPCGEN is known as an IDL compiler used for ONC RPC. RPCGEN is a compiler that uses an interface definition file to generate server and client C language stubs.
しかしながら、IDLによるスタブの自動生成では、スタブ開発のコストは軽減されるものの、依然としてプログラムによってスタブをリンクさせなければならない。 However, although automatic generation of stubs by IDL reduces the cost of stub development, stubs must still be linked programmatically.
本発明は、上記課題を解決するためになされたものであり、アクセラレータのプログラムが、スタブを記述することなく、ホストの共有ライブラリをリンクすることができる技術を提供することを目的とする。 The present invention has been made to solve the above problems, and an object of the present invention is to provide a technology that enables an accelerator program to link a shared library of a host without writing a stub.
本発明の動的リンク装置は、共有ライブラリを自装置のメモリにロードし、呼び出し元のプログラムからリンクするロード手段と、共有ライブラリのターゲットを識別し、呼び出し元のプログラムから共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替えるプラットフォーム切替手段と、を備える。 The dynamic linking device of the present invention loads a shared library into its own memory, identifies loading means for linking from a caller program, identifies a target of the shared library, and allows the caller program to call functions of the shared library. and platform switching means for switching the function to the own device or another device.
本発明の動的ロード装置は、共有ライブラリを自装置のメモリにロードし、呼び出し元のプログラムからリンクするロード手段と、共有ライブラリのターゲットを識別し、呼び出し元のプログラムから共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替えるプラットフォーム切替手段と、を備える。 The dynamic loading device of the present invention loads a shared library into its own memory, identifies loading means for linking from a caller program, and a target of the shared library, and allows the caller program to call functions of the shared library. and platform switching means for switching the function to the own device or another device.
本発明の計算機システムは、第1の情報処理装置と、第1の情報処理装置に接続された第2の情報処理装置と、を含む計算機システムであって、第1の情報処理装置は、共有ライブラリを第1の情報処理装置のメモリにロードし、呼び出し元のプログラムからリンクするロード手段と、共有ライブラリのターゲットを識別し、呼び出し元のプログラムから共有ライブラリの関数呼び出しの機能を第1の情報処理装置または第2の情報処理装置に切り替えるプラットフォーム切替手段と、を備える。 A computer system of the present invention is a computer system including a first information processing device and a second information processing device connected to the first information processing device, wherein the first information processing device is a shared A loading means for loading the library into the memory of the first information processing device and linked from the caller program, identifying the target of the shared library, and specifying the functions of function calls of the shared library from the caller program as the first information. platform switching means for switching to the processing device or the second information processing device.
本発明の動的リンク方法は、共有ライブラリを自装置のメモリにロードし、呼び出し元のプログラムからリンクし、共有ライブラリのターゲットを識別し、呼び出し元のプログラムから共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替える。 The dynamic linking method of the present invention loads a shared library into the memory of its own device, links from a calling program, identifies a target of the shared library, and automatically functions to call functions of the shared library from the calling program. Switch to a device or other device.
本発明の動的ロード方法は、共有ライブラリを自装置のメモリにロードし、呼び出し元のプログラムからリンクし、共有ライブラリのターゲットを識別し、呼び出し元のプログラムから共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替える。 The dynamic loading method of the present invention loads the shared library into the memory of its own device, links from the calling program, identifies the target of the shared library, and automatically allows the function of the shared library to be called from the calling program. Switch to a device or other device.
本発明の動的リンクプログラムは、共有ライブラリを自装置のメモリにロードし、呼び出し元のプログラムからリンクする機能と、共有ライブラリのターゲットを識別し、呼び出し元のプログラムから共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替える機能と、をコンピュータに実行させる。 The dynamic link program of the present invention has a function of loading a shared library into the memory of its own device and linking it from a caller program, and a function of identifying a target of the shared library and calling a function of the shared library from the caller program. to the own device or another device.
本発明の動的ロードプログラムは、共有ライブラリを自装置のメモリにロードし、呼び出し元のプログラムからリンクする機能と、共有ライブラリのターゲットを識別し、呼び出し元のプログラムから共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替える機能と、をコンピュータに実行させる。 The dynamic loading program of the present invention has a function of loading a shared library into the memory of its own device, linking from the calling program, identifying the target of the shared library, and calling the function of the shared library from the calling program. to the own device or another device.
本発明によれば、アクセラレータのプログラムは、スタブを記述することなく、ホストの共有ライブラリをリンクすることができる。 According to the present invention, accelerator programs can link host shared libraries without writing stubs.
[第1の実施形態]
(構成の説明)
図1は、本発明の第1の実施形態に係る動的リンク装置10の構成例を示すブロック図である。図1に示す動的リンク装置10は、ロード部11(ロード手段の一例)と、プラットフォーム切替部12(プラットフォーム切替手段の一例)と、を備える。
[First embodiment]
(Description of configuration)
FIG. 1 is a block diagram showing a configuration example of a
ロード部11は、共有ライブラリをアクセラレータのメモリにロードし、呼び出し元のプログラムからリンクする動的リンカまたは動的ローダである。ロード部11は、アクセラレータをターゲットとする共有ライブラリとしての動的オブジェクトと、ホストをターゲットとする共有ライブラリとしての動的オブジェクトとの両方をロードする。
The
プラットフォーム切替部12は、ロード部11がロードした共有ライブラリのターゲットを識別する。また、プラットフォーム切替部12は、呼び出し元のプログラムにより共有ライブラリの関数を呼び出すための関数呼び出し機能を切り替える。
The
本実施形態における上記各部は、ハードウェア、またはハードウェアおよびソフトウェアの組み合わせた環境下で実現可能である。たとえば、上記各部は、図2に示す環境下で実現可能である。 Each unit described above in the present embodiment can be realized in an environment of hardware or a combination of hardware and software. For example, the above units can be implemented under the environment shown in FIG.
図2は、図1に示す動的リンク装置10が動作する環境の一例としての計算機システム20の構成例を示すブロック図である。図2に示す計算機システム20は、ホスト21とアクセラレータ22とを備える。ホスト21とアクセラレータ22とは、I/O(Input/Output)インタフェース23を介して接続される。ホスト21とアクセラレータ22とは、それぞれ、1つまたは複数のプロセッサとメモリとを備える。図2に示す例では、ホスト21は、n個のプロセッサ211-1~211-nと、メモリ212と、を備える。アクセラレータ22は、プロセッサ221とメモリ222とを備える。ホスト21は、ディスク装置213を備える。ディスク装置213により、ホスト21が使用するファイルシステムが、構築される。ディスク装置213には、ホスト21のオペレーティングシステムや、ホスト21およびアクセラレータ22が実行するプログラムや、共有ライブラリの情報が格納される。共有ライブラリは、読み出し元のプログラムに動的リンクしている。
FIG. 2 is a block diagram showing a configuration example of a
ホスト21およびアクセラレータ22は、たとえば、ネットワーク上で情報(データやサービス等)を提供しているハードウェアが搭載された機器のことである。ここで、ハードウェアとは、たとえば、ICやFPGA等の電子回路、またはコンピュータ(たとえば、CPUやGPUがメモリに記憶されたプログラムを実行することにより機能を実現する装置)である。あるいは、ハードウェアとは、たとえば、電子回路とコンピュータとが組み合わせされた装置のことを指す。上記において、ICはIntegrated Circuitの略であり、FPGAはField Programmable Gate Arrayの略である。また、CPUはCentral Processing Unitの略であり、GPUはGraphics Processing Unitの略である。
The
以下の説明において、動的リンク装置10は、アクセラレータ22において実現される場合について説明する。ただし、これは、第1の実施形態を限定するものではない。動的リンク装置10は、ホスト21において動作してもよい。すなわち、動的リンク装置10は、アクセラレータ22またはホスト21(以下、第1の情報処理装置または自装置と呼ぶ場合もある)のいずれかにおいて動作すればよい。そして、動的リンク装置10は、第1の情報処理装置における共有ライブラリの関数呼び出しを、第1の情報処理装置および第1の情報処理装置に接続される装置(以下、第2の情報処理装置または他の装置と呼ぶ場合もある)とのどちらかに切り替える。例えば、動的リンク装置10がアクセラレータ22において動作する場合、アクセラレータ22が第1の情報処理装置であり、ホスト21が第2の情報処理装置である。動的リンク装置10がホスト21において動作する場合、ホスト21が第1の情報処理装置であり、アクセラレータ22が第2の情報処理装置である。
In the following description, the case where the
(動作の説明)
図3は、図2に示す計算機システム20上で動作する動的リンク装置10の動作例を説明するフローチャートである。すなわち、本フローチャートは、動的リンク方法、動的ロード方法、動的リンクプログラム、動的ロードプログラムを説明するものに他ならない。
(Description of operation)
FIG. 3 is a flow chart explaining an operation example of the
アクセラレータ22上でプログラム“a.out”が開始されると、ロード部11は、プログラム“a.out”が動的リンクしているライブラリをロードする(ステップS10)。
When the program "a.out" is started on the
動的リンクしているライブラリがロードされると、プラットフォーム切替部12はライブラリのターゲットがホスト21であるかアクセラレータ22であるかを判別する(ステップS11)。
When the dynamically linked library is loaded, the
ライブラリのターゲットがホスト用であれば(ステップS11のYes)、プラットフォーム切替部12は、ホスト21上でも同じライブラリをロードするよう要求する(ステップS14)。ライブラリをロードした後、プログラム“a.out”がホスト21のライブラリに含まれる関数を呼び出すと、プラットフォーム切替部12は、ホスト用スタブへジャンプするよう設定する。詳細には、プラットフォーム切替部12は、当該関数の呼び出しのためのコードを格納するPLT(Procedure Linkage Table)からホスト用スタブへジャンプするよう設定する(ステップS15)。
If the target of the library is for the host (Yes in step S11), the
一方、ライブラリのターゲットがアクセラレータ用であれば(ステップS11のNo)、プラットフォーム切替部12は、ステップS10でロードしたライブラリの初期化処理を実行する(ステップS12)。さらに、プラットフォーム切替部12は、GOT(Global Offset Table)を設定することで、後述される図5のようにメモリの再配置を完了させる(ステップS13)。ステップS12およびステップS13の処理は、一般的な動的リンカでも実行される処理である。
On the other hand, if the target of the library is for the accelerator (No in step S11), the
図4および図5を用いて、図3で示されるステップS10の詳細な処理について説明する。 Detailed processing of step S10 shown in FIG. 3 will be described with reference to FIGS. 4 and 5. FIG.
図4は、本実施形態において、プログラム“a.out”を起動した際の初期状態における、アクセラレータ22のメモリ222のメモリ空間3の配置例を示す図である。本実施例における“a.out”は、たとえば、ELF動的リンク実行ファイルである。
FIG. 4 is a diagram showing an arrangement example of the
図4に示すように、アクセラレータ22のメモリ空間3には、プログラム“a.out”のヘッダおよびテキストを保持する領域であるテキスト領域311と、“a.out”のデータを格納する領域であるデータ領域312とが配置される。さらに、アクセラレータ22のメモリ空間3には、プログラム“a.out”をロードした動的リンカ“ld.so”のヘッダおよびテキストを保持するテキスト領域321と、動的リンカ“ld.so”のデータを格納するデータ領域322とが配置される。
As shown in FIG. 4, the
プログラム“a.out”は、共有ライブラリ“libhost.so”をリンクし、“libhost.so”に含まれる関数funcを呼び出している。 Program "a.out" links shared library "libhost.so" and calls function func included in "libhost.so".
テキスト領域311は、動的リンクした関数を呼び出すためのPLTを含む。関数funcを呼び出すPLTは、func@plt3111を含む。
また、データ領域312は、動的リンクしたライブラリにおける関数のアドレスを格納する“.got.plt”において関数funcに対応するエントリであるGOT3121を有する。GOT3121は、func@pltで指示される領域に格納される間接ジャンプ命令のオペランドとして使用される。GOT3121の初期値は、func@plt3111中の間接ジャンプ命令の次の命令のアドレスである。これは、遅延リンクに使用するためである。
The
動的リンカのテキスト領域321は、共有ライブラリ用スタブ3211と、ホスト用スタブ3212とを含む。
The dynamic
共有ライブラリ用スタブ3211は、動的リンカ“ld.so”のシンボルテーブルから、所定のPLTエントリの関数の配置されたアドレスを解決してPLTの再配置を行う。すなわち、共有ライブラリ用スタブ3211は、“.got.plt”の対応するエントリを更新して、当該関数のアドレスにジャンプする。共有ライブラリ用スタブ3211による再配置の後は、共有ライブラリ中の関数は、PLTからジャンプ命令により、共有ライブラリ用のスタブを経由せずに呼び出される。
The shared
ホスト用スタブ3212は、関数呼び出しの引数として渡された値を、ホスト21側で呼び出す関数とともにアクセラレータ22からホスト21に通知して、ホスト21上での関数の呼び出しを要求する。一例としては、ホスト用スタブ3212は、ABI(Application Binary Interface)で規定されたレジスタの値および呼び出す関数のアドレスをマーシャリングし、I/Oインタフェース23を介してホスト21に転送する。
The
ロード部11は、プログラム“a.out”が要求している、すなわち動的リンクしているライブラリをファイルシステムからメモリ空間3にロードする。そして、ロード部11は、“a.out”の初期化ルーチンを実行する。本実施例において、“libhost.so”のテキスト領域およびデータ領域は、ディスク装置213上のファイルシステムからアクセラレータ22のメモリ空間3にマップされる。
The
図5は、本実施例において動的リンカ“ld.so”による初期化処理によって、動的リンクされた共有ライブラリのロード後における、アクセラレータ22のメモリ空間3の配置の一例を示す図である。図4と同じ領域については、図4と同じ番号を付与し、その詳細な説明を省略する。図5に示すアクセラレータ22のメモリ空間3には、図4と同様に、“a.out”のテキスト領域311およびデータ領域312、並びに、動的リンカ“ld.so”のテキスト領域321およびデータ領域322が配置されている。さらに、図5に示すメモリ空間3には、“libhost.so”のヘッダおよびテキストを格納するテキスト領域431と、“libtest.so”のデータを格納するデータ領域432とが配置されている。テキスト領域431には、関数func4311が含まれる。ただし、関数func4311は、ホスト21で実行するバイナリであり、アクセラレータ22のプロセッサ221では実行できない。
FIG. 5 is a diagram showing an example of the allocation of the
図6を参照して、本実施例におけるプラットフォーム切替部12によるPLTの設定処理、すなわち遅延リンク(ステップS15)の詳細を説明する。
With reference to FIG. 6, the details of the PLT setting process, that is, the delay link (step S15) by the
図6は、本実施形態において関数呼び出し時にプラットフォーム切替部12が行う遅延リンク完了時における、アクセラレータ22のメモリ222のメモリ空間3、およびホスト21のメモリ212のメモリ空間5の配置の一例を示す図である。図4および図5と同じ領域については、図4および図5と同じ番号を付し、その説明を省略する。ホスト21のメモリ空間5には、“libhost.so”のテキスト領域531とデータ領域532とが配置されている。テキスト領域531およびデータ領域532は、ステップS14においてロード部11がロードした領域である。テキスト領域531は、関数func5311を含んでいる。アクセラレータ22のメモリ空間3に配置されたfunc用スタブ541は、ホスト21の関数func5311を呼び出すためのスタブである。
FIG. 6 is a diagram showing an example of the arrangement of the
プログラム“a.out”が関数funcを呼び出すと、アクセラレータ22は、まず、“a.out”のテキスト領域311にあるfunc@plt3111のコードを実行する。動的リンクをサポートするプログラムにおいて、PLTには、“.got.plt”のエントリに保持されたアドレスへの間接ジャンプ命令と、PLTの番号を設定して共有ライブラリ用スタブ3211にジャンプする命令とが含まれる。データ領域312にある“.got.plt”のエントリGOT3121が未設定であるため、アクセラレータ22は、間接ジャンプにより次の命令を実行する。アクセラレータ22の処理は、共有ライブラリ用スタブ3211へジャンプする。
When the program "a.out" calls the function func, the
本実施形態における共有ライブラリ用スタブ3211の処理を説明する。共有ライブラリ用スタブ3211は、シンボルテーブルから対応するアドレスを検索する。プラットフォーム切替部12は、検索した結果得られたアドレスを含むテキスト領域が、ホスト用のライブラリのものか、アクセラレータ用のライブラリのものかを識別する。
The processing of the shared
アクセラレータ用であれば、プラットフォーム切替部12は、一般的な動的リンカと同様に、“.got.plt”のエントリであるGOT3121を、得られたアドレスで更新する。
For the accelerator, the
ホスト用であれば、プラットフォーム切替部12は、アクセラレータ22のメモリ空間3に領域を割り当て、func用スタブ541を作成する。func用スタブ541は、ホスト21の関数func5311のアドレスをセットしてホスト用スタブ3212にジャンプするアクセラレータ用の命令列である。ホスト21の関数func5311のアドレスは、ABI上における関数呼び出しによって、破壊してよいレジスタの一つにセットされる。あるいは、ホスト21の関数func5311のアドレスは、スタックのトップにセットされてもよい。あるいは、本用途のために、アドレス1つ分のTLS(Thread Local Storage)の領域が予約されてもよい。プラットフォーム切替部12がfunc用スタブ541を作成した後、“.got.plt”のエントリであるGOT3121をfunc用スタブ541のアドレスにセットし、アクセラレータ22は、ホスト用スタブ3212にジャンプする。ホスト用スタブ3212は、ホスト21の関数func5311を呼び出す。
For the host, the
また、2回目以降の関数funcの呼び出しでは、“.got.plt”が更新されているので、アクセラレータ22は、PLTからfunc用スタブ541で関数func5311のアドレスを指定して、ホスト用スタブ3212にジャンプする。これによって、ホスト用スタブ3212からホスト21の関数func5311が呼び出される。
Also, in the second and subsequent calls to function func, ".got.plt" is updated. to jump As a result, the
(効果の説明)
以上説明した第1の実施形態によれば、プラットフォーム切替部12を備えることで、アクセラレータ22のプログラムは、スタブを記述することなく、ホスト21の共有ライブラリをリンクできる。
(Explanation of effect)
According to the first embodiment described above, by providing the
(変形例)
以上説明した第1の実施形態では、動的リンカが、スタンダードなLinux(登録商標)の動的リンカである場合を例に挙げた。しかしながら、これはあくまで一例であり、第1の実施形態は、上記のような動的リンカに限定されない。
(Modification)
In the first embodiment described above, the dynamic linker is a standard Linux (registered trademark) dynamic linker. However, this is only an example, and the first embodiment is not limited to the dynamic linker as described above.
また、動的ローダは、たとえば、プログラムのロード時に依存関係に基づいてロードする代わりに、dlopen関数のようなAPI(Application Programming Interface)の呼び出しを用いて動作してもよい。 Also, the dynamic loader may operate using an API (Application Programming Interface) call such as the dlopen function instead of loading based on dependencies when the program is loaded, for example.
また、遅延リンクは、必須ではない。たとえば、最初の呼び出しより前に、ロード直後にfunc用スタブ541が生成され、“.got.plt”のエントリがfunc用スタブ541のアドレスにセットされてもよい。
Also, a delayed link is not required. For example, the
また、ISA(Instruction Set Architecture)やABIによっては、各関数用のスタブ(func用スタブ541相当)を用意せず、直接ホスト用スタブにセットできる場合がある。例えば、スタブにジャンプした時点で関数呼び出しのアドレス(func@plt)が残っていれば、そのアドレスから対応するPLTがわかる、つまり、呼び出すべき関数funcを特定することが可能である。 Also, depending on the ISA (Instruction Set Architecture) or ABI, there are cases where a stub for each function (corresponding to the func stub 541) can be set directly in the host stub without preparing it. For example, if the function call address (func@plt) remains at the time of jumping to the stub, the corresponding PLT can be known from that address, that is, the function func to be called can be specified.
また、以上説明した実施形態の場合、汎用レジスタにおける数値引数になる可能性のあるものは、すべて転送することを前提としているが、本実施形態は、これに限定されることはない。 In addition, in the embodiment described above, it is assumed that all possible numerical arguments in general-purpose registers are transferred, but the present embodiment is not limited to this.
たとえば、動的ローダは、x86-64のように引数の型によって異なるレジスタに引数が保存されるABIでは、すべての引数をマーシャリングして送る。なお、x86-64は、インテル(登録商標)社の命令セットアーキテクチャを64ビットに拡張した命令セットの一つである。 For example, the dynamic loader marshals and sends all arguments in ABIs where arguments are stored in different registers depending on the argument type, such as x86-64. The x86-64 is one of the instruction sets obtained by extending the instruction set architecture of Intel (registered trademark) to 64 bits.
また、動的ローダは、Dwarfのデバッグ情報または名前修飾(name mangling)された関数名(たとえばC++の場合)などを用いる場合、次のように動作してもよい。すなわち、動的ローダは、バイナリに含まれている情報から、引数の型およびサイズを取得し、構造体ポインタの引数がある場合にデータをコピーインおよびマーシャリングして転送することも可能である。なお、Dwarfは、広く使われているデバッグ用データフォーマットの規格である。 The dynamic loader may also behave as follows when using Dwarf debug information or name mangling function names (eg in C++). That is, the dynamic loader can also obtain the type and size of the arguments from the information contained in the binary, and copy-in and marshal the data for transfer if there are structure pointer arguments. Dwarf is a widely used debug data format standard.
[第2の実施形態]
図7は、本発明の第2の実施形態に係る動的リンク装置300の構成例を示すブロック図である。動的リンク装置300は、ロード部302(ロード手段の一例)と、プラットフォーム切替部304(プラットフォーム切替手段の一例)と、を備える。
[Second embodiment]
FIG. 7 is a block diagram showing a configuration example of a
ロード部302は、共有ライブラリをアクセラレータ22のメモリ222にロードし、呼び出し元のプログラムからリンクする。プラットフォーム切替部304は、共有ライブラリのターゲットを識別し、呼び出し元のプログラムから共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替える。すなわち、ロード部302とプラットフォーム切替部304は、ロード部11とプラットフォーム切替部12と、それぞれ同様に動作する。
The
本実施形態によれば、アクセラレータ22のプログラムは、スタブを記述することなく、ホスト21の共有ライブラリをリンクすることができる。その理由は、動的リンク装置300のロード部302とプラットフォーム切替部304が、第1の実施形態における対応する構成とそれぞれ同様に動作するためである。
According to this embodiment, the program of the
[第3の実施形態]
図8は、本発明の第3の実施形態に係る動的ロード装置400の構成例を示すブロック図である。動的ロード装置400は、ロード部402(ロード手段の一例)と、プラットフォーム切替部404(プラットフォーム切替手段の一例)と、を備える。
[Third embodiment]
FIG. 8 is a block diagram showing a configuration example of a
ロード部402は、共有ライブラリをアクセラレータ22のメモリ222にロードし、呼び出し元のプログラムからリンクする。プラットフォーム切替部404は、共有ライブラリのターゲットを識別し、呼び出し元のプログラムから共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替える。すなわち、ロード部402とプラットフォーム切替部404は、ロード部11とプラットフォーム切替部12と、それぞれ同様に動作する。
The
本実施形態によれば、アクセラレータ22のプログラムは、スタブを記述することなく、ホスト21の共有ライブラリをリンクすることができる。その理由は、動的ロード装置400のロード部402とプラットフォーム切替部404が、第1の実施形態における対応する構成とそれぞれ同様に動作するためである。
According to this embodiment, the program of the
[第4の実施形態]
図9は、本発明の第4の実施形態に係る計算機システム500の構成例を示すブロック図である。
[Fourth embodiment]
FIG. 9 is a block diagram showing a configuration example of a
計算機システム500は、ホスト600と、ホスト600に接続されたアクセラレータ700と、を含む。
A
動的リンク装置10などがアクセラレータ700に含まれる場合、アクセラレータ700は、共有ライブラリをアクセラレータ700のメモリにロードし、呼び出し元のプログラムからリンクする。さらに、アクセラレータ700は、共有ライブラリのターゲットを識別し、呼び出し元のプログラムから共有ライブラリの関数呼び出しの機能をアクセラレータ700またはホスト600に切り替える。つまり、アクセラレータ700は、関数呼び出しの機能を第1の情報処理装置または第2の情報処理装置に切り替える。このように、アクセラレータ700は、アクセラレータ22と同様に動作する。
When the
本実施形態によれば、アクセラレータ700のプログラムは、スタブを記述することなく、ホスト600の共有ライブラリをリンクすることができる。その理由は、アクセラレータ700が、第1の実施形態のアクセラレータ22と同様に動作するためである。
According to this embodiment, the program of the
なお、動的リンク装置10などがホスト600に含まれる場合、ホスト600は、共有ライブラリをホスト600のメモリにロードし、呼び出し元のプログラムからリンクする。さらに、ホスト600は、共有ライブラリのターゲットを識別し、呼び出し元のプログラムから共有ライブラリの関数呼び出しの機能を切り替える。この場合、ホスト600が、動的リンク装置10などと同様の機能を実現する。
If the
以上説明した各実施形態は、共有ライブラリをサポートするヘテロな計算機システム、そのオペレーティングシステム、動的リンカ、または動的ローダなどに広く適用可能である。 Each of the embodiments described above can be widely applied to heterogeneous computer systems that support shared libraries, their operating systems, dynamic linkers, dynamic loaders, and the like.
以上、各実施形態を用いて本発明を説明したが、本発明の技術的範囲は、上記各実施形態の記載に限定されない。上記各実施形態に多様な変更又は改良を加えることが可能であることは当業者にとって自明である。従って、そのような変更又は改良を加えた形態もまた本発明の技術的範囲に含まれることは説明するまでもない。また、以上説明した各実施形態において使用される、数値や各構成の名称等は例示的なものであり適宜変更可能である。また、図面中の矢印の方向は、一例を示すものであり、ブロック間の信号の向きを限定するものではない。 Although the present invention has been described using each embodiment, the technical scope of the present invention is not limited to the description of each embodiment. It is obvious to those skilled in the art that various modifications or improvements can be made to each of the above embodiments. Therefore, it is needless to say that the forms with such changes or improvements are also included in the technical scope of the present invention. Numerical values, names of components, and the like used in each of the embodiments described above are examples and can be changed as appropriate. Also, the directions of the arrows in the drawings are only examples, and do not limit the directions of signals between blocks.
3 メモリ空間
5 メモリ空間
10 動的リンク装置
11 ロード部
12 プラットフォーム切替部
20 計算機システム
21 ホスト
22 アクセラレータ
23 I/Oインタフェース
211-1~211-n プロセッサ
212 メモリ
213 ディスク装置
221 プロセッサ
222 メモリ
300 動的リンク装置
302 ロード部
304 プラットフォーム切替部
400 動的ロード装置
402 ロード部
404 プラットフォーム切替部
500 計算機システム
600 ホスト
700 アクセラレータ
3
Claims (7)
前記共有ライブラリのターゲットを識別し、呼び出し元の前記プログラムから前記共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替え、
前記共有ライブラリの前記ターゲットが自装置用である場合、ロードした前記共有ライブラリの初期化処理を実行し、GOT(Global Offset Table)を設定することで前記共有ライブラリの前記関数呼び出し機能の再配置を完了させ、さらに、
前記他の装置のスタブにジャンプするように、前記GOTを設定する
プラットフォーム切替手段と
を備える動的リンク装置。 a loading means for loading the shared library into the memory of its own device and linking it from the calling program;
identifying the target of the shared library, and switching the function of calling the function of the shared library from the calling program to its own device or another device;
When the target of the shared library is for the own device, the loaded shared library is initialized and a GOT (Global Offset Table) is set to rearrange the function calling function of the shared library. complete, and
configure the GOT to jump to the other device's stub
A dynamic linker comprising platform switching means and .
前記共有ライブラリのターゲットを識別し、呼び出し元の前記プログラムから前記共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替え、
前記共有ライブラリの前記ターゲットが自装置用である場合、ロードした前記共有ライブラリの初期化処理を実行し、GOT(Global Offset Table)を設定することで前記共有ライブラリの前記関数呼び出し機能の再配置を完了させ、さらに、
前記他の装置のスタブにジャンプするように、前記GOTを設定する
プラットフォーム切替手段と
を備える動的ロード装置。 a loading means for loading the shared library into the memory of its own device and linking it from the calling program;
identifying the target of the shared library, and switching the function of calling the function of the shared library from the calling program to its own device or another device;
When the target of the shared library is for the own device, the loaded shared library is initialized and a GOT (Global Offset Table) is set to rearrange the function calling function of the shared library. complete, and
Configure the GOT to jump to the other device's stub
A dynamic loading device comprising: a platform switching means;
前記第1の情報処理装置は、
共有ライブラリを前記第1の情報処理装置のメモリにロードし、呼び出し元のプログラムからリンクし、
前記共有ライブラリのターゲットを識別し、呼び出し元の前記プログラムから前記共有ライブラリの関数呼び出しの機能を前記第1の情報処理装置または前記第2の情報処理装置に切り替え、
前記共有ライブラリの前記ターゲットが第1の情報処理装置用である場合、ロードした前記共有ライブラリの初期化処理を実行し、GOT(Global Offset Table)を設定することで前記共有ライブラリの前記関数呼び出し機能の再配置を完了させ、さらに、
前記第2の情報処理装置のスタブにジャンプするように、前記GOTを設定する
計算機システム。 A computer system including a first information processing device and a second information processing device connected to the first information processing device,
The first information processing device is
loading the shared library into the memory of the first information processing device and linking from the calling program;
identifying a target of the shared library, and switching a function of calling the function of the shared library from the calling program to the first information processing device or the second information processing device;
When the target of the shared library is for the first information processing device, the function calling function of the shared library is performed by executing initialization processing of the loaded shared library and setting a GOT (Global Offset Table). to complete the relocation of the
setting the GOT to jump to the stub of the second information processing device
computer system.
呼び出し元のプログラムからリンクし、
前記共有ライブラリのターゲットを識別し、
呼び出し元の前記プログラムから前記共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替え、
前記共有ライブラリの前記ターゲットが自装置用である場合、ロードした前記共有ライブラリの初期化処理を実行し、GOT(Global Offset Table)を設定することで前記共有ライブラリの前記関数呼び出し機能の再配置を完了させ、さらに、
前記他の装置のスタブにジャンプするように、前記GOTを設定する
動的リンク方法。 Load the shared library into your device's memory,
link from the calling program,
identifying a target of said shared library;
switching the calling function of the shared library from the calling program to its own device or another device;
When the target of the shared library is for the own device, the loaded shared library is initialized and a GOT (Global Offset Table) is set to rearrange the function calling function of the shared library. complete, and
configure the GOT to jump to the other device's stub
Dynamic link method.
呼び出し元のプログラムからリンクし、
前記共有ライブラリのターゲットを識別し、
呼び出し元の前記プログラムから前記共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替え、
前記共有ライブラリの前記ターゲットが自装置用である場合、ロードした前記共有ライブラリの初期化処理を実行し、GOT(Global Offset Table)を設定することで前記共有ライブラリの前記関数呼び出し機能の再配置を完了させ、さらに、
前記他の装置のスタブにジャンプするように、前記GOTを設定する
動的ロード方法。 Load the shared library into your device's memory,
link from the calling program,
identifying a target for said shared library;
switching the calling function of the shared library from the calling program to its own device or another device;
When the target of the shared library is for the own device, the loaded shared library is initialized and a GOT (Global Offset Table) is set to rearrange the function calling function of the shared library. complete, and
Configure the GOT to jump to the other device's stub
Dynamic loading method.
前記共有ライブラリのターゲットを識別し、呼び出し元の前記プログラムから前記共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替え、
前記共有ライブラリの前記ターゲットが自装置用である場合、ロードした前記共有ライブラリの初期化処理を実行し、GOT(Global Offset Table)を設定することで前記共有ライブラリの前記関数呼び出し機能の再配置を完了させ、さらに、
前記他の装置のスタブにジャンプするように、前記GOTを設定する機能と
をコンピュータに実行させる動的リンクプログラム。 A function to load a shared library into the memory of its own device and link it from the calling program;
identifying the target of the shared library, and switching the function of calling the function of the shared library from the calling program to its own device or another device;
When the target of the shared library is for the own device, the loaded shared library is initialized and a GOT (Global Offset Table) is set to rearrange the function calling function of the shared library. complete, and
a dynamic link program that causes a computer to perform the functions of configuring said GOT to jump to said other device's stub .
前記共有ライブラリのターゲットを識別し、呼び出し元の前記プログラムから前記共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替え、
前記共有ライブラリの前記ターゲットが自装置用である場合、ロードした前記共有ライブラリの初期化処理を実行し、GOT(Global Offset Table)を設定することで前記共有ライブラリの前記関数呼び出し機能の再配置を完了させ、さらに、
前記他の装置のスタブにジャンプするように、前記GOTを設定する機能と
をコンピュータに実行させる動的ロードプログラム。 A function to load a shared library into the memory of its own device and link it from the calling program;
identifying the target of the shared library, and switching the function of calling the function of the shared library from the calling program to its own device or another device;
When the target of the shared library is for the own device, the loaded shared library is initialized and a GOT (Global Offset Table) is set to rearrange the function calling function of the shared library. complete, and
a dynamic load program that causes a computer to perform the functions of configuring said GOT to jump to said other device's stub .
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2019003516A JP7271957B2 (en) | 2019-01-11 | 2019-01-11 | Dynamic link device, dynamic load device, computer system, dynamic link method, dynamic load method, dynamic link program, and dynamic load program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2019003516A JP7271957B2 (en) | 2019-01-11 | 2019-01-11 | Dynamic link device, dynamic load device, computer system, dynamic link method, dynamic load method, dynamic link program, and dynamic load program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2020113050A JP2020113050A (en) | 2020-07-27 |
JP7271957B2 true JP7271957B2 (en) | 2023-05-12 |
Family
ID=71667567
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2019003516A Active JP7271957B2 (en) | 2019-01-11 | 2019-01-11 | Dynamic link device, dynamic load device, computer system, dynamic link method, dynamic load method, dynamic link program, and dynamic load program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP7271957B2 (en) |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006048431A (en) | 2004-08-05 | 2006-02-16 | Matsushita Electric Ind Co Ltd | Dynamic link library processor |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH11338704A (en) * | 1998-05-25 | 1999-12-10 | Casio Comput Co Ltd | Network computer system and storage medium |
-
2019
- 2019-01-11 JP JP2019003516A patent/JP7271957B2/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006048431A (en) | 2004-08-05 | 2006-02-16 | Matsushita Electric Ind Co Ltd | Dynamic link library processor |
Also Published As
Publication number | Publication date |
---|---|
JP2020113050A (en) | 2020-07-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7562349B2 (en) | Version adaptation interface for integration of different virtual machines | |
US7533388B1 (en) | Method and apparatus for dynamic Stubs and Ties in RMI-IIOP | |
US8359570B2 (en) | Adaptive scripting tool | |
US8285780B2 (en) | State sharing in a distributed data stream processing system | |
US11301562B2 (en) | Function execution based on data locality and securing integration flows | |
JP2000020487A (en) | Distributed software system for plural computer machines connected as network and method for realizing the same | |
US8695014B2 (en) | Distributed function execution for hybrid systems | |
US9116855B2 (en) | Data processing system and data processing method | |
US10891214B2 (en) | Transferring a debug configuration amongst carrier threads for debugging a carried thread | |
KR20230138031A (en) | Dynamic allocation of executable code for multi-architecture heterogeneous computing. | |
JP7271957B2 (en) | Dynamic link device, dynamic load device, computer system, dynamic link method, dynamic load method, dynamic link program, and dynamic load program | |
CN108647087B (en) | Method, device, server and storage medium for realizing reentry of PHP kernel | |
US9361266B2 (en) | System and method for distributed computing | |
US20120324457A1 (en) | Using compiler-generated tasks to represent programming elements | |
CN113867776A (en) | Method and device for publishing middle station application, electronic equipment and storage medium | |
Vivek et al. | Payload fragmentation framework for high-performance computing in cloud environment | |
Kamil et al. | Optimization of asynchronous communication operations through eager notifications | |
US7908375B2 (en) | Transparently externalizing plug-in computation to cluster | |
US20210055971A1 (en) | Method and node for managing a request for hardware acceleration by means of an accelerator device | |
US11537411B1 (en) | Inter-environment communication with environment isolation | |
Kocoloski et al. | Hobbes: A multi-kernel infrastructure for application composition | |
US11537457B2 (en) | Low latency remoting to accelerators | |
US10891213B2 (en) | Converting between a carried thread and a carrier thread for debugging the carried thread | |
JP6902580B2 (en) | Systems and methods for providing distributed caching in transaction processing environments | |
Mukherjee et al. | Develop once deploy anywhere achieving adaptivity with a runtime linker/loader framework |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
RD01 | Notification of change of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7421 Effective date: 20211015 |
|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20211215 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20221006 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20221011 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20221208 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20230328 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20230410 |
|
R151 | Written notification of patent or utility model registration |
Ref document number: 7271957 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |