Two ways to enable GPU in Kubernetes:
If you want to enable GPU resource in Kubernetes and want Kubelet to allocate it. You need config it as following ways:
Kubernetes 1.7: Using NVidia container and enable Kuberlet config feature-gates=Accelerators=true
Kubernetes 1.9: Using Device Plugin with Kuberlet specific config feature-gates=DevicePlugins=true
Check node if it has GPU resource:
Using kubectl command kubectl get node YOUR_NODE_NAME -o json to export all node info as json format. You should see something like:
## If you use Kubernetes Accelerator after 1.7
"allocatable": {
"cpu": "32",
"memory": "263933300Ki",
"alpha.kubernetes.io/nvidia-gpu": "4",
"pods": "110"
},
Detail defined in k8s.io/api/core/v1/types.go
## If you use Kubernetes Device Plugin after 1.9
"allocatable": {
"cpu": "32",
"memory": "263933300Ki",
"nvidia.com/gpu": "4",
"pods": "110"
}, ## Reference:
Managing Compute Resources for Containers
Kubernetes: Device Plugin
NVIDIA-k8s-device-plugin
中文前言: 在使用 Kubernetes 的時候,可以選擇透過 Job 的方式來跑一次性的工作.但是如果希望你的工作在特定時間內一定得結束來釋放資源, 就得透過這個方式. 最近在研究這個的時候,發現有些使用上的小技巧,紀錄一下. Preface: If you want to force to terminate your kubernetes jobs if it exceed specific time. (e.g.: run a job no longer than 2 mins). In this case you can use a watcher to monitor this Kubernetes jobs and terminate it if exceed specific time. Or you can refer K8S Doc:”Job Termination and Cleanup” use activeDeadlineSeconds to force terminare your jobs. How to use activeDeadlineSeconds: It is very easy to setup activeDeadlineSeconds in spec. apiVersion: batch/v1 kind: Job metadata: name: myjob spec: backoffLimit: 5 activeDeadlineSeconds: 100 template: spec: containers: - name: myjob image: busybox command: ["sleep", "300"] restartPolicy: Never In this example, this job will be terminated after 100 seconds (if it works well :p ) Before you use activeDeadlineSeconds If you ever run a job with activeDeadlineSeconds, you will need delete job before you run the same job again. The job...
論文原文: The Case for Learned Index Structures
Morning Paper Reading: part1, par2
參考文章:
arXiv: The Case for Learned Index Structures
Morning paper: The case for learned index structures – part I
Morning paper: The case for learned index structures – part II
論文原文: The Case for Learned Index Structures Morning Paper Reading: part1, par2 緣起: 剛好最近有幾次機會可以去工研院開會的路上,在高鐵的路途上可以好好的來欣賞這篇文章. 這篇文章是由 Google Brain 的大神 Jeff Dean 連署的論文之一.講的是透過 NN 的方式來讓大家熟知的 B-Tree, Hashing table 甚至是 Bloom Filter 更有效率… 2018 年第一篇好好閱讀的論文,當然要獻給有深度而且相當有趣的這篇文章.The Case for Learned Index Structures .主要的原因有以下: 這篇是講解一個新的機器學習的新領域(至少是相當有趣的觀點) 雖然有些限制跟品質的降低,但是讓我們對於 AI/Deep Learning 有了一個新領域的想法… 這篇是被稱為世界上最聰明的人 Google Brain 的主持人 - Jeff Dean 的論文( 編按: 這篇 Quora 有許多關於 Jeff Dean 的敘述文,相當的有趣 XD) Jeff Dean 是誰? 快來看他的 Quorahttps://www.quora.com/What-are-all-the-Jeff-Dean-facts - 他看得懂, 也寫 Binary code - 他的 PIN code 是 Pi 末四碼 先講講 B-Tree B-Tree 是大家相當熟知的資料結構,在此僅列出幾個需要知道的. 時間複雜度 \(O(log n)\) (Balanced B-Tree) 需要空間(cache) 代表存多少資訊在 B-Tree .當資料不在 cache 中,代表需要重新跑一次 re-balanced B-Tree traversal 無法分散式處理 (透過 GPU 來加速) 再來談 Learning Index Tree 回過來講 B-Tree Index 你可以把一個數值輸入 B-Tree ,透過搜尋過後可以傳回一個 Index (可能有 re-balanced). 換個角度,如過透過 NN (Neural Networking) model 的學習將一個數值輸入後,來預測 (predict) 它可能的索引位置 (index) .那麼我們就稱這個為 Learned Index 這邊有一些你需要知道關於 Learned Index 的部分: 由於直接運算,所以時間複雜度相當的低: \(O(1)\) 由於透過 NN 來運算,可以很輕易透過 GPU 來加速運算 空間要求相當的少 不像 B-Tree Index 需要一定的空間來儲存目前已知的數值來加速. (根據文章: cache size 128 是最快的) 關於 CDF (Cumulative Distribution Function) B-Tree...