有效分散應用程式至遠端裝置的方法
DOCL: A Framework for Distributing OpenCL Applications on GPU Cluster
摘要
隨著高效能運算的蓬勃發展下,機器學習、大數據處理,甚至是精細的電腦遊戲,都會使用大
量的圖形處理器資源,以達到最佳效能。然而,由於現今圖形處理器的程式語言的限制,如
OpenCL,目前的 OpenCL 僅支援本地端單一圖形處理器的使用。大部分的研究也集中於多項
OpenCL的應用程式在單一機器中圖形處理器的優化方法。使用者可能會面臨在一段時間內需
要處理多項 OpenCL 的應用程式,卻因語言限制而無法平行執行這些應用程式。因此,本論文
提供了一個讓待處理的應用程式能夠分散至遠端裝置的方法,稱 DOCL Scheduler。對於所有
可用裝置進行,並依照本地端及遠端的裝置的忙碌程度,提供每一個應用程式擁有最短的等待
時間,使之達到整體效能最佳化。對於使用圖形處理器裝置的應用程式進行排程是
NP-Complete 的問題,因此,我們將問題簡化:假設 CPU 資源足夠應付我們同時執行的 OpenCL
應用程式。DOCL Scheduler 包含三個元素互相合作:裝置管理、應用程式管理、排程器;裝
置管理動態地監控遠端的裝置忙碌狀況,提供排程器為應用程式挑選最小等待時間。應用程式
管理則是將應用程式轉換成可控制資源,以便未來排程至特定裝置時,可以按照排程器擬定的
順序進行執行。排程器為應用程式進行排程時,由於在本地端執行的成本較小,因此排程器會
先以本地端的裝置為初始選擇,進一步再檢查其餘遠端機器的狀況。本論文的重點在於排程,
因此在本論文中,應用程式本身之執行時間應當做已知。根據實驗結果顯示,DOCL Scheduler
擁有相當。模擬測試中,DOCL Scheduler能夠在系統附載高時,與一般排程 Round-Robin 策
略比較,能減少 63%等待時間。
量的圖形處理器資源,以達到最佳效能。然而,由於現今圖形處理器的程式語言的限制,如
OpenCL,目前的 OpenCL 僅支援本地端單一圖形處理器的使用。大部分的研究也集中於多項
OpenCL的應用程式在單一機器中圖形處理器的優化方法。使用者可能會面臨在一段時間內需
要處理多項 OpenCL 的應用程式,卻因語言限制而無法平行執行這些應用程式。因此,本論文
提供了一個讓待處理的應用程式能夠分散至遠端裝置的方法,稱 DOCL Scheduler。對於所有
可用裝置進行,並依照本地端及遠端的裝置的忙碌程度,提供每一個應用程式擁有最短的等待
時間,使之達到整體效能最佳化。對於使用圖形處理器裝置的應用程式進行排程是
NP-Complete 的問題,因此,我們將問題簡化:假設 CPU 資源足夠應付我們同時執行的 OpenCL
應用程式。DOCL Scheduler 包含三個元素互相合作:裝置管理、應用程式管理、排程器;裝
置管理動態地監控遠端的裝置忙碌狀況,提供排程器為應用程式挑選最小等待時間。應用程式
管理則是將應用程式轉換成可控制資源,以便未來排程至特定裝置時,可以按照排程器擬定的
順序進行執行。排程器為應用程式進行排程時,由於在本地端執行的成本較小,因此排程器會
先以本地端的裝置為初始選擇,進一步再檢查其餘遠端機器的狀況。本論文的重點在於排程,
因此在本論文中,應用程式本身之執行時間應當做已知。根據實驗結果顯示,DOCL Scheduler
擁有相當。模擬測試中,DOCL Scheduler能夠在系統附載高時,與一般排程 Round-Robin 策
略比較,能減少 63%等待時間。
As the trend of increasing parallel computation continues in the fields of machining learn-
ing, virtual reality, medical studies, sophisticated games, and so forth, we usually have
different kinds of GPU applications to execute at the same time. However, even with mul-
tiple GPUs, a single computer may not be powerful enough to run them efficiently. For the
purpose of achieving the demand in an excellent, cost-effective way, we connect computer
nodes which equipped GPU devices to form a GPU cluster, and distribute the applications
among the cluster to utilize the GPUs productively. In this thesis, we propose a framework,
called DOCL that transparently schedules an OpenCL application to a suitable computer
node so as to maximize the throughput of the cluster. The DOCL framework includes a
DOCL Framework, a application handler, and a device manager. The application handler
is responsible for instrumenting OpenCL source codes with a stub that controls the order
of kernel execution. the device manager is responsible for monitoring workloads of GPUs
among the cluster and dynamically providing the DOCL Framework ready-to-run work-
loads on remote devices. The DOCL Framework schedules an application to a computer
node with minimum waiting time to deliver total minimum waiting time by checking GPU
states provided by the device manager.The experiments indicated that the DOCL frame-
work introduced only a small overhead (with 5% on average). We also used a trace-based
simulation to evaluate our scheduler. The results indicated that the DOCL Framework per-
formed well under heavy-weight workloads. The DOCL Framework achieved up to 63%
waiting time improvement over other scheduling methods, such as the round-robin policy.
ing, virtual reality, medical studies, sophisticated games, and so forth, we usually have
different kinds of GPU applications to execute at the same time. However, even with mul-
tiple GPUs, a single computer may not be powerful enough to run them efficiently. For the
purpose of achieving the demand in an excellent, cost-effective way, we connect computer
nodes which equipped GPU devices to form a GPU cluster, and distribute the applications
among the cluster to utilize the GPUs productively. In this thesis, we propose a framework,
called DOCL that transparently schedules an OpenCL application to a suitable computer
node so as to maximize the throughput of the cluster. The DOCL framework includes a
DOCL Framework, a application handler, and a device manager. The application handler
is responsible for instrumenting OpenCL source codes with a stub that controls the order
of kernel execution. the device manager is responsible for monitoring workloads of GPUs
among the cluster and dynamically providing the DOCL Framework ready-to-run work-
loads on remote devices. The DOCL Framework schedules an application to a computer
node with minimum waiting time to deliver total minimum waiting time by checking GPU
states provided by the device manager.The experiments indicated that the DOCL frame-
work introduced only a small overhead (with 5% on average). We also used a trace-based
simulation to evaluate our scheduler. The results indicated that the DOCL Framework per-
formed well under heavy-weight workloads. The DOCL Framework achieved up to 63%
waiting time improvement over other scheduling methods, such as the round-robin policy.