JP2020113050A - 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
- JP2020113050A JP2020113050A JP2019003516A JP2019003516A JP2020113050A JP 2020113050 A JP2020113050 A JP 2020113050A JP 2019003516 A JP2019003516 A JP 2019003516A JP 2019003516 A JP2019003516 A JP 2019003516A JP 2020113050 A JP2020113050 A JP 2020113050A
- Authority
- JP
- Japan
- Prior art keywords
- shared library
- function
- program
- dynamic
- calling
- 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.)
- Granted
Links
Images
Abstract
Description
本発明は、動的リンク装置、動的ロード装置、計算機システム、動的リンク方法、動的ロード方法、動的リンクプログラム、および動的ロードプログラムに関する。 The present invention relates to a dynamic link device, a dynamic load device, a computer system, a dynamic link method, a dynamic load method, a dynamic link program, and a dynamic load program.
今日の計算機システムでは、半導体技術や電力の制約によって、汎用計算機の周波数を高めることによる性能向上が飽和してきている。そのため、処理に適したアクセラレータなど、特性の異なる計算機によって構成されたヘテロな計算機システムが拡大している。一例として、通常の計算や入出力を行う汎用プロセッサを備えるホストと、数値計算に適したプロセッサを備えるアクセラレータとで構成される計算機システムがある。アクセラレータには、Intel Xeon Phi(登録商標)やNEC SX−Aurora TSUBASA(登録商標)のように、オペレーティングシステムの機能、および共有ライブラリをサポートするものがある。 In today's computer systems, performance improvement by increasing the frequency of general-purpose computers is saturated due to semiconductor technology and power constraints. Therefore, 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 including a host including a general-purpose processor that performs normal calculation and input/output, and an accelerator including 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という動的リンク・動的ロード可能な共有ライブラリがサポートされている。 The shared library is widely used in computer systems in order to improve software reusability by improving program reusability and reduce storage and memory consumption due to duplicated code depending on functions used in multiple programs. It is popular. Standard operating systems support shared libraries. For example, Linux (registered trademark) and Unix (registered trademark) operating systems support ELF (Executable and Linking Format) and ELF shared object, which are dynamically linkable and dynamically loadable shared libraries.
ヘテロな計算機システムは、プログラムの実行を開始する計算機(ホスト)上で動作する実行ファイルから、特定の処理に適した別の計算機(アクセラレータ)を起動する。この特定の処理は、最適化されたコードの再利用性のために共有ライブラリとして提供されることがある。 A heterogeneous computer system starts another computer (accelerator) suitable for a specific process from an execution file that runs on a computer (host) that starts executing a program. This particular process may be 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, a function/method) that operates on a computer (hereinafter, also referred to as a server) other than its own computer, RPC (Remote Procedure) Call) is used. In RPC, it is necessary to add complicated description and processing different from the normal function call. For example, when using RPC, the argument passed to the function that the client should call remotely is converted into a chunk of data for transfer called marshalling or serialization, and the converted data is executed. Transfer to the server. The server restores the marshalled or serialized data to the original form (unmarshalling, deserialization), and actually calls the function. The server marshals the result of calling the function and returns it to the client. The client unmarshalls the results returned by the server.
一般に、RPCによって他の計算機の関数を呼び出すプログラムでは、クライアントスタブとサーバスタブとが用いられる。クライアントスタブは、クライアント側でマーシャリングを行い、サーバに要求を発行し、サーバから戻り値を受信し、その値を返す。サーバスタブは、サーバ側で要求を受け付け、アンマーシャリングを行い、サーバ上の関数に引数として渡し、関数を実行し、戻り値をクライアントに送信する。開発者は、クライアントスタブを呼び出すプログラムを記述し、クライアントスタブをリンクする。 Generally, a client stub and a server stub are used in a program that calls a function of another computer by RPC. The client stub performs marshaling on the client side, issues a request to the server, receives a return value from the server, and returns that value. The server stub receives the request on the server side, unmarshalls it, passes it as an argument to a function on the server, executes the function, and sends the return value to the client. The 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 graphic system has a structure management unit in the host library. The client can directly store the structure edit request on the shared memory in the accelerator by the structure management unit.
特許文献2に記載の技術は、ゲストプラットフォームのライブラリをロードする必要があるとき、ホスト用の代替のライブラリがあるかを判別し、有れば当該代替のライブラリをロードして使用する。さらに、特許文献2に記載の技術は、ホスト用の代替のライブラリが無ければ、エミュレーション・バイナリ変換によりゲスト用のライブラリを使用する。 The technique described in Patent Document 2 determines whether or not there is a substitute library for the host when it is necessary to load the library of the guest platform, and if there is, the substitute library is loaded and used. Further, the technique described in Patent Document 2 uses the guest library by emulation/binary conversion if there is no substitute library for the host.
RPCに使用するクライアントスタブとサーバスタブ(以下、これらを纏めてスタブと呼ぶ)とを自動生成することで、スタブの開発にかかるコストが軽減される。たとえば、IDL(Interface Definition Language)で関数のインタフェースが記述され、IDLコンパイラによって、スタブが生成される。詳細には、ONC RPCに使用するIDLコンパイラとして、RPCGENが知られている。RPCGENは、インタフェース定義ファイルを使って、サーバおよびクライアントのC言語スタブを生成するコンパイラである。 By automatically generating the client stub and the server stub used for the RPC (hereinafter collectively referred to as a stub), the cost for developing the stub can be reduced. For example, a function interface is described in IDL (Interface Definition Language), and a stub is generated by the IDL compiler. In detail, RPCGEN is known as an IDL compiler used for ONC RPC. RPCGEN is a compiler that uses the interface definition file to generate C language stubs for the server and client.
しかしながら、IDLによるスタブの自動生成では、スタブ開発のコストは軽減されるものの、依然としてプログラムによってスタブをリンクさせなければならない。 However, although automatic generation of stubs by IDL reduces the cost of stub development, the stubs still have to be linked programmatically.
本発明は、上記課題を解決するためになされたものであり、アクセラレータのプログラムが、スタブを記述することなく、ホストの共有ライブラリをリンクすることができる技術を提供することを目的とする。 The present invention has been made to solve the above problems, and an object thereof is to provide a technique in which an accelerator program can link a shared library of a host without writing a stub.
本発明の動的リンク装置は、共有ライブラリを自装置のメモリにロードし、呼び出し元のプログラムからリンクするロード手段と、共有ライブラリのターゲットを識別し、呼び出し元のプログラムから共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替えるプラットフォーム切替手段と、を備える。 The dynamic link device of the present invention identifies the load means for loading the shared library into the memory of the device itself and linking it from the calling program and the target of the shared library, and the function call of the shared library from the calling program. Platform switching means for switching the function to its own device or another device.
本発明の動的ロード装置は、共有ライブラリを自装置のメモリにロードし、呼び出し元のプログラムからリンクするロード手段と、共有ライブラリのターゲットを識別し、呼び出し元のプログラムから共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替えるプラットフォーム切替手段と、を備える。 The dynamic loading device of the present invention identifies the loading means for loading the shared library into the memory of its own device and linking it from the calling program, and the target of the shared library, and the function call of the shared library from the calling program. Platform switching means for switching the function to its 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 shared. The first means for loading the library into the memory of the first information processing device and identifying the load means for linking from the calling program and the target of the shared library, and the function calling function of the shared library from the calling program Platform switching means for switching to the processing device or the second information processing device.
本発明の動的リンク方法は、共有ライブラリを自装置のメモリにロードし、呼び出し元のプログラムからリンクし、共有ライブラリのターゲットを識別し、呼び出し元のプログラムから共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替える。 According to the dynamic linking method of the present invention, the shared library is loaded into the memory of its own device, linked from the calling program, the target of the shared library is identified, and the function of function call of the shared library is called from the calling program. Switch to a device or other device.
本発明の動的ロード方法は、共有ライブラリを自装置のメモリにロードし、呼び出し元のプログラムからリンクし、共有ライブラリのターゲットを識別し、呼び出し元のプログラムから共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替える。 According to the dynamic loading method of the present invention, the shared library is loaded into the memory of its own device, linked from the calling program, the target of the shared library is identified, and the function of the shared library function call is automatically executed from the calling program. Switch to a device or other device.
本発明の動的リンクプログラムは、共有ライブラリを自装置のメモリにロードし、呼び出し元のプログラムからリンクする機能と、共有ライブラリのターゲットを識別し、呼び出し元のプログラムから共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替える機能と、をコンピュータに実行させる。 The dynamic link program of the present invention has a function of loading the shared library into the memory of the own device and linking it from the calling program, and a function of identifying the target of the shared library and calling the function of the shared library from the calling program. Causes the computer to execute the function of switching the device to its own device or another device.
本発明の動的ロードプログラムは、共有ライブラリを自装置のメモリにロードし、呼び出し元のプログラムからリンクする機能と、共有ライブラリのターゲットを識別し、呼び出し元のプログラムから共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替える機能と、をコンピュータに実行させる。 The dynamic load program of the present invention has a function of loading the shared library into the memory of its own device and linking it from the calling program, and a function of identifying the target of the shared library and calling the function of the shared library from the calling program. Causes the computer to execute the function of switching the device to its own device or another device.
本発明によれば、アクセラレータのプログラムは、スタブを記述することなく、ホストの共有ライブラリをリンクすることができる。 According to the present invention, the accelerator program can link the shared library of the host without writing the stub.
[第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 of the above units in this embodiment can be realized in hardware or in an environment in which hardware and software are combined. For example, each unit described above can be realized 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の動作例を説明するフローチャートである。すなわち、本フローチャートは、動的リンク方法、動的ロード方法、動的リンクプログラム、動的ロードプログラムを説明するものに他ならない。
(Explanation of operation)
FIG. 3 is a flowchart for 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.
図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を呼び出している。 The program “a.out” links the shared library “libhost.so” and calls the function func included in “libhost.so”.
テキスト領域311は、動的リンクした関数を呼び出すためのPLTを含む。関数funcを呼び出すPLTは、func@plt3111を含む。
The
また、データ領域312は、動的リンクしたライブラリにおける関数のアドレスを格納する“.got.plt”において関数funcに対応するエントリであるGOT3121を有する。GOT3121は、func@pltで指示される領域に格納される間接ジャンプ命令のオペランドとして使用される。GOT3121の初期値は、func@plt3111中の間接ジャンプ命令の次の命令のアドレスである。これは、遅延リンクに使用するためである。
In addition, 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 layout of the
図6を参照して、本実施例におけるプラットフォーム切替部12によるPLTの設定処理、すなわち遅延リンク(ステップS15)の詳細を説明する。
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 an 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が呼び出される。
In addition, since ".got.plt" is updated in the second and subsequent calls to the function func, the
(効果の説明)
以上説明した第1の実施形態によれば、プラットフォーム切替部12を備えることで、アクセラレータ22のプログラムは、スタブを記述することなく、ホスト21の共有ライブラリをリンクできる。
(Explanation of effects)
According to the first embodiment described above, by including the
(変形例)
以上説明した第1の実施形態では、動的リンカが、スタンダードなLinux(登録商標)の動的リンカである場合を例に挙げた。しかしながら、これはあくまで一例であり、第1の実施形態は、上記のような動的リンカに限定されない。
(Modification)
In the first embodiment described above, the case where the dynamic linker is a standard Linux (registered trademark) dynamic linker is taken as an example. However, this is merely an example, and the first embodiment is not limited to the dynamic linker as described above.
また、動的ローダは、たとえば、プログラムのロード時に依存関係に基づいてロードする代わりに、dlopen関数のようなAPI(Application Programming Interface)の呼び出しを用いて動作してもよい。 Further, the dynamic loader may operate by using an API (Application Programming Interface) call such as a dropen function instead of loading the program based on the dependency when the program is loaded.
また、遅延リンクは、必須ではない。たとえば、最初の呼び出しより前に、ロード直後にfunc用スタブ541が生成され、“.got.plt”のエントリがfunc用スタブ541のアドレスにセットされてもよい。
Also, the delayed link is not mandatory. For example, before the first call, the
また、ISA(Instruction Set Architecture)やABIによっては、各関数用のスタブ(func用スタブ541相当)を用意せず、直接ホスト用スタブにセットできる場合がある。例えば、スタブにジャンプした時点で関数呼び出しのアドレス(func@plt)が残っていれば、そのアドレスから対応するPLTがわかる、つまり、呼び出すべき関数funcを特定することが可能である。 Further, depending on ISA (Instruction Set Architecture) or ABI, it may be possible to directly set the stub for the host without preparing the stub for each function (corresponding to the func stub 541). 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.
また、以上説明した実施形態の場合、汎用レジスタにおける数値引数になる可能性のあるものは、すべて転送することを前提としているが、本実施形態は、これに限定されることはない。 Further, in the case of the above-described embodiment, it is premised that all the numerical arguments in the general-purpose register may be transferred, but the present embodiment is not limited to this.
たとえば、動的ローダは、x86−64のように引数の型によって異なるレジスタに引数が保存されるABIでは、すべての引数をマーシャリングして送る。なお、x86−64は、インテル(登録商標)社の命令セットアーキテクチャを64ビットに拡張した命令セットの一つである。 For example, the dynamic loader marshalls and sends all the arguments in the ABI in which the arguments are stored in different registers depending on the argument types, such as x86-64. It should be noted that x86-64 is one of the instruction sets obtained by expanding the instruction set architecture of Intel (registered trademark) company to 64 bits.
また、動的ローダは、Dwarfのデバッグ情報または名前修飾(name mangling)された関数名(たとえばC++の場合)などを用いる場合、次のように動作してもよい。すなわち、動的ローダは、バイナリに含まれている情報から、引数の型およびサイズを取得し、構造体ポインタの引数がある場合にデータをコピーインおよびマーシャリングして転送することも可能である。なお、Dwarfは、広く使われているデバッグ用データフォーマットの規格である。 In addition, the dynamic loader may operate as follows when using debug information of Dwarf or a name-modified function name (for example, C++). That is, the dynamic loader can acquire the type and size of the argument from the information included in the binary, and can copy in and marshal the data when the argument of the structure pointer is present and transfer the data. Dwarf is a widely used standard for debugging data format.
[第2の実施形態]
図7は、本発明の第2の実施形態に係る動的リンク装置300の構成例を示すブロック図である。動的リンク装置300は、ロード部302(ロード手段の一例)と、プラットフォーム切替部304(プラットフォーム切替手段の一例)と、を備える。
[Second Embodiment]
FIG. 7: is a block diagram which shows the structural example of the
ロード部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 which shows the structural example of the
ロード部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と、を含む。
The
動的リンク装置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などと同様の機能を実現する。
When the
以上説明した各実施形態は、共有ライブラリをサポートするヘテロな計算機システム、そのオペレーティングシステム、動的リンカ、または動的ローダなどに広く適用可能である。 The embodiments described above are widely applicable to a heterogeneous computer system that supports a shared library, its operating system, a dynamic linker, a dynamic loader, and the like.
以上、各実施形態を用いて本発明を説明したが、本発明の技術的範囲は、上記各実施形態の記載に限定されない。上記各実施形態に多様な変更又は改良を加えることが可能であることは当業者にとって自明である。従って、そのような変更又は改良を加えた形態もまた本発明の技術的範囲に含まれることは説明するまでもない。また、以上説明した各実施形態において使用される、数値や各構成の名称等は例示的なものであり適宜変更可能である。また、図面中の矢印の方向は、一例を示すものであり、ブロック間の信号の向きを限定するものではない。 Although the present invention has been described above 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 changes or improvements can be added to each of the above embodiments. Therefore, it is needless to say that a mode in which such changes or improvements are made is also included in the technical scope of the present invention. Further, the numerical values, the names of the components, and the like used in each of the embodiments described above are merely examples, and can be changed as appropriate. Further, the directions of the arrows in the drawings show an example, and do not limit the direction 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 (8)
前記共有ライブラリのターゲットを識別し、呼び出し元の前記プログラムから前記共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替えるプラットフォーム切替手段と
を備える動的リンク装置。 Load means that loads the shared library into the memory of the device itself and links from the calling program,
And a platform switching unit that identifies a target of the shared library and switches the function calling function of the shared library from the calling source program to its own device or another device.
請求項1記載の動的リンク装置。 When the target of the shared library is for its own device, the platform switching means executes initialization processing of the loaded shared library and completes relocation by setting a GOT (Global Offset Table). Item 1. The dynamic link device according to item 1.
前記共有ライブラリのターゲットを識別し、呼び出し元の前記プログラムから前記共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替えるプラットフォーム切替手段と
を備える動的ロード装置。 Load means that loads the shared library into the memory of the device itself and links from the calling program,
A platform switching unit that identifies a target of the shared library and switches a function calling function of the shared library from the calling source program to its own device or another device.
前記第1の情報処理装置は、
共有ライブラリを前記第1の情報処理装置のメモリにロードし、呼び出し元のプログラムからリンクし、
前記共有ライブラリのターゲットを識別し、呼び出し元の前記プログラムから前記共有ライブラリの関数呼び出しの機能を前記第1の情報処理装置または前記第2の情報処理装置に切り替える
計算機システム。 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
The shared library is loaded into the memory of the first information processing device, linked from the calling program,
A computer system that identifies a target of the shared library and switches the function calling function of the shared library from the calling program to the first information processing apparatus or the second information processing apparatus.
呼び出し元のプログラムからリンクし、
前記共有ライブラリのターゲットを識別し、
呼び出し元の前記プログラムから前記共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替える
動的リンク方法。 Load the shared library into the memory of your device,
Link from the calling program,
Identify the target of the shared library,
A dynamic linking method for switching the function call function of the shared library from the calling program to its own device or another device.
呼び出し元のプログラムからリンクし、
前記共有ライブラリのターゲットを識別し、
呼び出し元の前記プログラムから前記共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替える
動的ロード方法。 Load the shared library into the memory of your device,
Link from the calling program,
Identify the target of the shared library,
A dynamic loading method in which the function of function call of the shared library is switched from the calling program to its own device or another device.
前記共有ライブラリのターゲットを識別し、呼び出し元の前記プログラムから前記共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替える機能と
をコンピュータに実行させる動的リンクプログラム。 A function to load the shared library into the memory of the device itself and link from the calling program,
A dynamic link program that causes a computer to execute a function of identifying a target of the shared library and switching a function calling function of the shared library from the calling source program to its own device or another device.
前記共有ライブラリのターゲットを識別し、呼び出し元の前記プログラムから前記共有ライブラリの関数呼び出しの機能を自装置または他の装置に切り替える機能と
をコンピュータに実行させる動的ロードプログラム。 A function to load the shared library into the memory of the device itself and link from the calling program,
A dynamic load program for causing a computer to execute a function of identifying a target of the shared library and switching a function calling function of the shared library from the calling source program to its own device or another device.
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 true JP2020113050A (en) | 2020-07-27 |
JP7271957B2 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 (2)
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 |
JP2006048431A (en) * | 2004-08-05 | 2006-02-16 | Matsushita Electric Ind Co Ltd | Dynamic link library processor |
-
2019
- 2019-01-11 JP JP2019003516A patent/JP7271957B2/en active Active
Patent Citations (2)
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 |
JP2006048431A (en) * | 2004-08-05 | 2006-02-16 | Matsushita Electric Ind Co Ltd | Dynamic link library processor |
Also Published As
Publication number | Publication date |
---|---|
JP7271957B2 (en) | 2023-05-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10990423B2 (en) | Performance optimizations for emulators | |
US11733985B2 (en) | Accessing a migrated member in an updated type | |
US7533388B1 (en) | Method and apparatus for dynamic Stubs and Ties in RMI-IIOP | |
US8560602B2 (en) | Data sharing in a stream processing system | |
US8695014B2 (en) | Distributed function execution for hybrid systems | |
US20100077378A1 (en) | Virtualised Application Libraries | |
Falkner et al. | Implementing asynchronous remote method invocation in Java | |
JP5811088B2 (en) | Data processing system and data processing method | |
Hall et al. | Performance optimization and tuning techniques for IBM Power Systems processors including IBM POWER8 | |
US10891214B2 (en) | Transferring a debug configuration amongst carrier threads for debugging a carried thread | |
JP5886450B2 (en) | Hybrid emulation and kernel function processing system and method | |
US8201185B2 (en) | COM object and managed code object interoperability | |
JP7271957B2 (en) | Dynamic link device, dynamic load device, computer system, dynamic link method, dynamic load method, dynamic link program, and dynamic load program | |
US20120324457A1 (en) | Using compiler-generated tasks to represent programming elements | |
Park et al. | MpiPython: A robust python MPI binding | |
US20130326191A1 (en) | System and method for distributed computing | |
US11003488B2 (en) | Memory-fabric-based processor context switching system | |
Kamil et al. | Optimization of asynchronous communication operations through eager notifications | |
US11537457B2 (en) | Low latency remoting to accelerators | |
US20210055971A1 (en) | Method and node for managing a request for hardware acceleration by means of an accelerator device | |
US7908375B2 (en) | Transparently externalizing plug-in computation to cluster | |
US10891213B2 (en) | Converting between a carried thread and a carrier thread for debugging the carried thread | |
US11537411B1 (en) | Inter-environment communication with environment isolation | |
JP2009512030A (en) | Duplicate object graph | |
CN112256455A (en) | Method, medium and electronic device for optimizing transaction remote procedure call |
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 |