VCS Hybrid Cloud Implementation Using Pure Storage on Microsoft Azure

From the “Key Highlights from SNUG 2022“:

“One of the most attractive uses of the cloud for chip development is bursting VCS workloads. “Bursting” to the cloud is all about dynamic deployment of applications and allows customers to leverage the huge scale of compute that the cloud offers. While hosting design data completely on the cloud is simpler and more efficient, many customers want a hybrid scenario where they can store data on a wholly owned storage solution while leveraging Cloud as a Service (CaaS).

Microsoft Azure has worked with Pure Storage and Equinix to offer such a colocation hybrid solution for customers to gain the desired performance for EDA workloads. On Day 2 of SNUG 2022, Microsoft’s senior program manager, Raymond Meng-Ru Tsai, and Pure Storage’s technical director, Bikash Roy Choudhury, led a joint session to provide attendees with an in-depth perspective of running the industry’s highest performance simulation solution, Synopsys VCS® via Microsoft Azure and Pure Storage FlashBlade® at scale. They discussed best practices to verify parameters such as completion time, storage throughput patterns, and network route capabilities. This discussion also provided attendees with granular details of a tried-and-tested method to store data on a wholly owned FlashBlade device located in an Equinix data center while being connected to the Azure cloud for compute."

microsoft azure cloud storage

Synopsys users will be able to access SNUG content at SolvNetPlus.

Disable Hyper-Threading (HT) on the Azure VM

You will need to create an Azure support ticket, specifying that you would like your subscription to be able to disable Hyper-Threading.

After that, you can disable Hyper-Threading (HT) by adding below tag when you provision the Azure VM. If the VM already exists, you will need to restart the VM to make it effective.

Please add the tag “platformsettings.host_environment.disablehyperthreading” and set it as “true”.

To check if you are running a hyper-threaded VM, run the lscpu command in the Linux VM.

If Thread(s) per core = 1, then hyper-threading has been disabled.

If Thread(s) per core = 2, then hyper-threading has been enabled.

在Azure NetApp Files (ANF)上執行EDA工作之效能調校

微軟的 NFS 解決方案:Azure NetApp Files (ANF) 已被各種行業廣泛採用,包括許多在 Azure 上運行其電子設計自動化 (EDA) 工作負載的半導體公司。

Azure NetApp Files 提供了 3 種不同的服務級別 (Service Level) 以確保吞吐量 (throughput)、提供從 Windows 或 Linux VM 連接的 NFS 3.0/NFS4.1/SMB 的各種掛載協議,操作簡單,只需幾分鐘即可完成設置。企業可以將他們的應用程序無縫遷移到 Azure,並提供類似於本地 NetApps 的體驗和性能。

本文的目的是分享在 Azure NetApp Files 上運行SPEC EDA Benchamrk及FIO等測試所得到的經驗,並:

  • 提供現實世界中實用的性能最佳實踐 (Performance Best Practice)。
  • 利用多個NFS 磁片區 (Volume) 來檢視 ANF 的橫向擴展功能。
  • 成本效益分析,提供使用者選擇最適合 ANF 的服務級別。

Performance best practice- running EDA workloads on Azure NetApp Files (microsoft.com)

在Azure上執行NCBI BLAST

BLAST可以用來比對不同DNA或胺基酸的序列,可以用來追查Covid-19的源頭,或是人類和尼安德塔人的基因相似度。用一般機器跑BLAST通常非常耗時,這篇文章除教導如何在Azure上跑BLAST及其最佳化的過程。

BLAST can be used to compare different DNA or protein sequences, and can be used to trace the origin of Covid-19, or the genetic similarity between humans and Neanderthals. Running BLAST is usually very time-consuming. This article will guide you how to run BLAST on Azure, optimization process, and best practice.

Running NCBI BLAST on Azure – Performance, Scalability and Best Practice (microsoft.com)

機器學習的生命週期作業:Machine Learning Operationalization

這篇文章會帶您透過幾個簡單的指令,快速的將 TensorFlow, CNTK 或是 Python 所建立的預測模型,部署到 Azure Container Service (ACS)HDInsight Spark 上,以達到高擴充性的需求。

AML CLI (Azure Machine Learning Command Line Interface) 是個全新的 Azure 機器學習指令集,目前是 preview 版本,目的在將機器學習的生命週期,例如 Experiment, Model training, Deployment, Management 等.能透過指令自動化流程處理。同時支援 CNTK, TenserFlow 等不同的機器學習框架,未來也將支援如 GPU/FPGA 等機器,協助資料科學家們對模型生命週期的訓練及管理。

GitHub 上有完整範例及文件並隨時更新,已可在 Linux Data Science Virtual Machine (DSVM) 上使用。

環境準備

首先你需要有 Azure 訂用帳戶 (取得訂用帳戶),然後依說明文件建一個 DSVM 出來 (要完成以下練習,只要選擇最便宜的機器即可)。

透過 SSH 連線至 DSVM (可使用 X2Go Putty )後,執行以下指令:

$ wget -q http://amlsamples.blob.core.windows.net/scripts/amlupdate.sh -O – | sudo bash –

$ sudo /opt/microsoft/azureml/initial_setup.sh

注意: 請登出再重新登入以讓改變有效

接下來執行以下指令來設定 AML CLI 環境:

$ az login

$ aml env setup

以上指令會在這個 DSVM 中新增以下這些服務:

  • A resource group
  • A storage account
  • An Azure Container Registry (ACR)
  • An Azure Container Service (ACS)
  • Application insights

注意:

  1. 首先你會被要求到 https://aka.ms/devicelogin 輸入一組代碼,再登入您的 Azure 帳號,確保你有足夠的權限新增服務。
  2. 得輸入小於20個字元、只能包含小寫字母及數字的環境名稱 (Environment names)。

之後你隨時可以執行以下指令來了解所有的環境設定:

$ aml env show

amlenv1

使用 Jupyter

身為資料科學家,您可以使用喜歡的 IDE 來寫作。若使用 Jupyter,在 DSVM 中是跑在 https://<machine-ip-address&gt;:8000 ,請直接以瀏覽器打開並以登入 DSVM 的帳密登入。

在以下資料夾中可分別找到即時及批次服務的範例:

即時: azureml/realtime/realtimewebservices.ipynb notebook

批次: azureml/batch/batchwebservices.ipynb notebook

jupyter1-1

照著步驟即可訓練出一個預測模型:

jupyter2-1

CNTK, TensorFlow 及 Python 範例

利用 AML 部署

若是即時服務 (realtime),會部署到 Azure Container Service (ACS),若是批次服務 (batch) 會部署到 HDInsight Spark,以達成高擴充性及高可用性的目標,無論您的預測模型是由 TensorFlow、CNTK 或 Python 所建制的。

以 realtime 服務範例。SSH到DSVM後,切換到訓練出來的預測模型所在資料夾:

$ cd ~/notebooks/azureml/realtime

接下來執行以下指令,就能部署 realtime service 至所在的 DSVM:

$ aml env local

$ aml service create realtime -f testing.py -m housing.model -s webserviceschema.json -n mytestapp

部署成功後的畫面:

amlenv2

你也可以執行以下指令,部署到 Azure Container Service (ACS) cluster 中:

$ aml env cluster

$ aml service create realtime -f testing.py -m housing.model -s webserviceschema.json -n mytestapp

了解更多 AML CLI 指令

https://github.com/Azure/Machine-Learning-Operationalization/blob/master/aml-cli-reference.md 可看到所有的指令,例如可以執行

$ aml service list

會看到所有已部署的 realtime 或 batch 服務

在 Azure Machine Learning 中處理影像資料 (以辨識人臉為例)

本文將使用 Azure Machine Learning Studio,一次匯入數張影像檔,再經由一個預先訓練過的模型,偵測這些影像中是否含有人臉。

步驟一:開通 Azure 「機器學習」帳號

1. 不需要信用卡就可以免費開始使用 Azure Machine Learning (https://studio.azureml.net/):擁有 10GB Azure Storage 的 Datasets 空間、最多建制 100 modules 以及一小時的 Machine Learning experiments 時間。

image

2. 如果你是成立不到五年的新創公司,可以免費申請 BizSpark 方案,享有每個月 NT$4,700 額度的 Azure credit。開通時亦無需輸入信用卡,所以沒有付費的風險。

3. 如果你是 MSDN 訂閱用戶,本來就有 Azure 免費額度,只要開通即可。

4. 當然你也可以直接申請免費試用一個月,取得 NT$6,300 元的 Azure 信用額度。

(如果你是學校老師或學生,有更多 Azure 免費資源)

步驟二:選擇合適的照片上傳至 Azure Blob 儲存體

影像、音樂、影片等檔案通常較大,Azure Blob 儲存體提供了便宜彈性的儲存空間,可作為 Azure Machine Learning 連結使用。

首先我選擇了以下 4 張照片:

image

然後將它們上傳至 Azure Blob (可見此文有詳細的上傳步驟):

image

步驟三:匯入影像、偵測人臉

接下來我們要使用一個預先訓練過、用來偵測人臉的分類模組,並將影像檔作為資料源,逐一分析各影像裡是否含有人臉。當然未來你也可以利用 “Import Images” 模組所匯進來的影像,訓練出你自己的預測模型。

登入 Azure ML Studio,在空白的 Experiment 裡拉進”Pre-trained Cascade Image Classification”、“Import Images”、”Score Model”以及 “Execute R Script” 模組,並連結如以下:

image

在 “Import Images” 中設定你剛剛上傳影像的 Blob URL 位址。若你的 Blob 是設定為非公開存取的話,則需要再輸入帳號密碼。以 Public URL 為例:

image

然後在 “Execute R Script” 模組中,貼入以下 R Script。其重點在 Line 4,這行程式是把偵測人臉預測結果的三個欄位取出來。

   1: # Map 1-based optional input ports to variables

   2: dataset1 <- maml.mapInputPort(1) # class: data.frame

   3:  

   4: data.set = data.frame('Image Name'=dataset1['Image Name'], 'Score Labels'=dataset1['Scored Labels'], 'Label Probabilities'=dataset1['Scored Probabilities'])

   5:  

   6:  

   7: # Select data.frame to be sent to the output Dataset port

   8: maml.mapOutputPort("data.set");

步驟四:執行結果

按下 Run,等待執行結束。

我們先來看 “Import Images” 幫我們作了什麼事,選擇 Visualize 之後,會發現它幫每一個影像的每一個像素都轉換為 RGB 數值。觀察以下可發現,我們共匯入了 4 個影像,而因為每個影像是 640*427 像素,每一像素有 R, G, B 3 個值,所以每個影像後面有 640*427*3 = 819,480 個欄位:

image

我們再到 “Execute R Script” 觀察最後執行結果。

image

看來這個預先訓練的人臉辨識模型準確度不錯,第 1 張小狗照片判斷沒有人臉 (false),第 2 到 4 張都成功判別出有人臉 (true)。

image

備註:

1. “Import Images” 支援下列的影像格式:

  • Windows 點陣圖檔案:*.bmp、*.dib
  • JPEG 檔案:*.jpeg、*.jpg、*.jpe
  • JPEG 2000 檔案:*.jp2
  • 可攜式網路圖形:*.png
  • 可攜式影像格式:*.pbm、*.pgm、*.ppm
  • Sun 點陣:*.sr、*.ras
  • TIFF 檔案:*.tiff、*.tif

2. 請注意影像檔及 Blob 的技術細節,匯入過程中出現的錯誤通常來自這些規範:

  • 所有影像必須相同大小。
  • 所有影像必須具有相同的色頻。例如,您不能混用灰階 與 RGB 影像。
  • 每個影像的像素數目有其上限 (實際測試發現其上限數目其實遠大於官方文件說的 65536)。 不過,影像數目不受任何限制。
  • 如果您是將 Blob Container 作資料來源,則此 Container 中不能包含 Blob,只能包含影像檔。

3. “Import Images” 在第一次執行時會花較久的時間,但在影像 cached 之後即可省略匯入的動作。

延伸閱讀:

Azure 「機器學習」初體驗
Azure 「機器學習」FAQ
Azure 「機器學習」:我該用哪種演算法 (algorithms)?

[Azure 筆記] 上傳檔案到 Azure Blob 儲存體

電腦裡有硬碟可以儲存照片、影片、MP3 等檔案,微軟的公有雲上也有專門用來儲存這種非結構化資料的儲存體 Azure Blob。本文是紀錄如何設定 Azure Blob 並上傳一些照片,以作為後續使用。

步驟一:取得 Azure 帳號

如果您還沒有 Azure 帳號:

  1. 可以直接申請免費試用一個月,取得 NT$6,300 元的 Azure 信用額度。
  2. 如果你是成立不到五年的新創公司,可以免費申請 BizSpark 方案,享有每個月 NT$4,700 額度的 Azure credit。開通時無需輸入信用卡,所以沒有付費的風險。
  3. 如果你是 MSDN 訂閱用戶,本來就有 Azure 免費額度,只要開通即可。

步驟二:登入至 Azure 入口網站,新增一個 Blob

畫面左下角選擇 NEW –> Storage –> QUICK CREATE,給定一個 URL,建立一個 Storage。

image

然後點選剛剛新增出來的 Storage,選擇 Container,並新增一個 Blob:

image

至此,你已成功在 Azure 上建立了一個 Blob! 它的結構如以下,我們即可以開始上傳各種檔案。

Blob1

步驟三:上傳檔案到 Azure Blob

網路上有許多類似「檔案總管」的 Azure Storage 管理小工具,讓你能很簡單的上傳、下載、刪除、觀看檔案以及管理目錄。

我從中挑了一個開放源碼的 Azure Storage Explore 來使用。下載安裝之後,登入你的 Azure 帳號,瀏覽至剛剛建立的 Blob 中,點選 Upload 就能在硬碟中選擇你要上傳的檔案。

image

回到 Azure 管理畫面,即可看到有 4 張照片已被上傳成功讓其他應用程式使用,例如:在 Azure Machine Learning 中處理影像資料 (以辨識人臉為例)

image

在 Excel 裡使用 Azure 「機器學習」預測服務

不需要會寫程式,現在只要打開 Excel 就能直接呼叫 Azure 「機器學習」的服務來作預測。

步驟一:到 Office 市集中下載免費的 Excel Azure ML 增益集 (Add-in)

安裝時需要登入您的 Microsoft Account 帳號,日後不論您是使用 iOS、Android、桌面、甚至網頁版本的 Excel,就都能直接使用。

image

(是的! 現在增益集可以發佈至 Office 市集進行銷售囉! 有興趣開發的人可以到 Office 開發官網了解)

步驟二:打開 Excel 並選擇此 Add-in

image

步驟三:執行 (以「鐵達尼號生還率預測」為例)

各位可以先把以下資料複製後貼到 Excel,作為我們的預測資料。

PassengerClass Gender Age SiblingSpouse ParentChild FarePrice PortEmbarkation
2 female 40 2 1 50 C
1 male 20 1 3 200 C
2 female 55 0 1 50 C
3 female 90 4 2 50 C
1 male 20 2 1 90 C
1 male 2 2 2 80 C

 

選擇「鐵達尼號生還率預測」服務 (Titanic Survivor Predictor) 後:

  1. 在 Input 選取以上這個表格
  2. 在 output 輸入 H1 欄位
  3. 然後按下 Predict,就可看到預測結果了!

image

(女生生存率超高的! 男生只有 2 歲的小孩有高生存率。原因當然是當時以婦女及小孩為優先逃生)。

使用你自已的 Web Service

當然你可以使用自已設計出來的 Azure 機器學習服務,只要依此文的步驟取得 Web Service 的 URL 及 API Key 再貼上即可。

批次執行 (Batch Execution)

你可以在 Predict 的下拉選擇中選擇 As a batch,即能讓你在 Excel 中測試大量批次執行。

分享您的 Excel 工作表

許多公司及個人都已在使用 Excel 儲存及處理資料,如銷售紀錄、客戶資訊等等。只要透過這個 Excel Add-in 加入 Web Service 並儲存後,所有打開這個 Excel 檔案的人即能直接使用這個服務來預測自己的資料,無需知道背後其實使用了「機器學習」的服務,整個過程不需寫程式且操作方便。

其他功能及應用:

  • 打開 VIEW SCHEMA,即可了解 input 及 output 的所有資料欄位及格式

image

  • 自動預測

如果勾選 Auto Predict 的話,只要選取的表格資料有變動,就會自動更新預測結果。

image

延伸閱讀:

General Availability of Free Excel Add-In for Azure ML

如何利用 Azure 「機器學習」贏得黑客松 (Hackathon)?

預測某個 YouBike 租借站在某個時間點是否還有車可以借、是否還有車位可以停;預測某個城市在不同的時間發生犯罪的機率;依據下眼瞼的照片判斷貧血的程度;找出不同的開車模式和車禍發生機率的關係。以上都是你可以利用 Azure  Machine Learning「機器學習」贏得一場黑客松 (Hackathon) 的題目,甚至成為你開始新創公司的契機!

本文將介紹使用 Azure 「機器學習」的步驟及各種資源,方便你在黑客松活動中使用。其中前二個步驟可以在參加之前即先行完成。

步驟一:開通 Azure 「機器學習」帳號

1. 不需要信用卡就可以免費開始使用 Azure Machine Learning (https://studio.azureml.net/):擁有 10GB Azure Storage 的 Datasets 空間、最多建制 100 modules 以及一小時的 Machine Learning experiments 時間。

image

2. 如果你是成立不到五年的新創公司,可以免費申請 BizSpark 方案,享有每個月 NT$4,700 額度的 Azure credit。開通時亦無需輸入信用卡,所以沒有付費的風險。

3. 如果你是 MSDN 訂閱用戶,本來就有 Azure 免費額度,只要開通即可。

4. 當然你也可以直接申請免費試用一個月,取得 NT$6,300 元的 Azure 信用額度。

(如果你是學校老師或學生,有更多 Azure 免費資源)

步驟二:學習使用 Azure Machine Learning Studio

如果你是機器學習的完全初學者,除了可先閱讀專門爲初學者所寫的二篇文章之外:

Azure 「機器學習」初體驗
如果你搭上了鐵達尼號,有機會生還嗎?

強列建議走一遍官方中文教學:在 Azure Machine Learning Studio 中建立您的第一個實驗

步驟三:尋找合適的訓練資料

如同文章一開始所提出的各種問題,Azure 「機器學習」的強項即是能根據歷史資料作數值預測 (Regression)、分類  (Classification) 或是分群 (Clustering),成為解決這些問題的強力工具。請記得,能問出一個好問題、進而定出一個好題目,常常是贏得一場黑客松非常重要的關鍵!

定出題目之後,就要尋找合適的資料作為機器學習模組的訓練之用了。資料集 (datasets) 的提供可以透過直接上傳(如 .csv 格式)、或是提供連結 (如 OData feed provider) 的方式。若要使用公開資料,以下是幾個常用的國內外站點:政府資料開發平台美國政府開放平台KaggleUC Irvine Machine Learning Repository 等。

步驟四:建構你的學習模型

「機器學習」之中,若是作為數值預測 (Regression) 或分類 (Classification) 之用途.皆是屬於監督式學習 (Supervised Learning) 的範疇。監督式學習基本上會遵守以下的流程:

image

別小看了其中”資料清理”的工作喔! 因為你所選擇的訓練資料,可能有缺漏或不全之處需要補全或是移除、有些欄位 (如姓名、ID等) 不應該作為訓練之用、有些資料需要先”類別化” (Categorized) 以作為訓練之用並讓使用者選擇 (如性別、鐵達尼號的上船港口等)。建議大家可看看”鐵達尼號”的模型如何作資料清理,並據此學習。

步驟五:選擇合適的演算法

在此文章中有介紹各種不同演算法,及各自的使用時機,大方向如下:

  • 如果您期望的解答是一個數值的話 => Regression (迴歸分析)
  • 如果您的問題能夠以 Yes/No 來回答 => Classification (分類)
  • 如果您想將具相同特性的資料群集分類 => Clustering (分群)

微軟也製作了一個 PDF 小抄可供下載,方便大家依步驟判斷,以選擇最合適的演算法:

Machine Learning Algorithm cheat sheet: Learn how to choose a Machine Learning algorithm.

步驟六:優化你的訓練模型

個人覺得 Azure Machine Learning Studio 這個工具最酷的地方,就是可以自動找到最適合的演算法設定參數了。例如,我用了決策樹 (Decision Tree) 演算法,但我怎麼知道節點或是葉子的數目該設為多少呢?

預設的單一參數 (Single Parameter) 設定:

image2

你只要更改為參數區間 (Parameter Range),就能設定參數範圍 (以等差或等比遞增)、指定數個參數、或是混合設定。訓練模型就會自動根據你的設定找出最佳的參數!

image3

選擇參數來最佳化 Azure Machine Learning 中的演算法

同時也不要忘記,可在 “Score Model” 及 “Evaluate Model” 中檢視你的模型預測準確度。

多元分類評估結果

在 Azure Machine Learning 中評估模型效能

在 Azure Machine Learning 中解譯模型結果

步驟七:發佈為 Web Service

模型優化之後,就可以發佈為 Web Service 以進行預測了。在下方選擇 “SET UP WEB SERVICE” => “Predictive Web Service” ,再點選 “DEPLOY WEB SERVICE” 即可佈署使用。

Convert to scoring experiment

Deploy the web service

部署 Azure Machine Learning Web 服務

步驟八:使用 Web Service

最貼心的是,還提供 C#, Python 及 R 語言的 sample code,協助大家節省時間贏得比賽!

image

Web Service 提供了兩種呼叫方式

1. Request/Response: 提供快速可延展的呼叫服務,接受一或多筆資料作為輸入、也可輸出一或多筆結果,適合用在單筆且快速回應的需求,例如即時回應使用者對股市收盤行情的預測。

2. Batch Execution:適合處理批次、大量、非同步的資料,例如批次性的處理 IoT 在一段時間之中收集的所有資料。

希望以上對大家有幫助,值得一提的是,2015 年 8 月舉辦的台大 HackNTU 中,前 2 名都是與 Azure Machine Learning 有關的喔!

image

其中第一名使用了Project Oxford 服務,包括 Speech APIs (Speech recognition + Text to Speech Conversion 等),其背後機制即是微軟的「機器學習」;第二名則是運用 Azure 機器學習來訓練六種手語手勢。

千人黑客松HackNTU得獎團隊揭曉 語言學習App、手語辨識系統、救災無人機獲獎

image

延伸閱讀:

1. How to win a hackathon using Azure Machine Learning – 作者為微軟總部高級主管 Jennifer Marsman,本篇主題及內容來自她的文章,並已取得她的同意作適當的翻譯及在地化。

2. 本部落格所有機器學習相關文章: http://blogs.msdn.com/b/mengtsai/archive/tags/machine+learning/

Azure 校園免費方案整理 (學生及老師適用)

1. 所有學生:“Azure for Students” 方案開放給所有學生,不用信用卡即能開始使用,直接至 Microsoft Azure for DreamSpark 認證您的學生身份,即可免費使用多種 Azure 公有雲服務,目前包含以下 4 種,將會不定期持續新增:

  • Azure App Service Web Apps is a part of a fully managed cloud offering that enables you to build and deploy web apps in seconds. Use ASP.NET, Java, PHP, Node.js or Python. Run popular web apps and CMS solutions. Set up continuous integration and deployment workflows with VSO, GitHub, TeamCity, Hudson or BitBucket – enabling you to automatically build, test and deploy your web app on each successful code check-in or integration tests.
  • MySQL Database from ClearDB adds the power of MySQL to your Web Apps. With clearDB MySQL you can deploy more kinds of web apps and CMS solutions such as WordPress, Joomla, Acquia Drupal, phpBB, and more.
  • Application Insights provides a 360° view across availability, performance and usage of your ASP.NET services and mobile applications for Windows Phone, iOS and Android platforms. Search and analyze your data to continuously improve your application, prioritize future investments and improve overall customer experience.
  • Visual Studio Online is the fastest and easiest way yet to plan, build, and ship software across a variety of platforms. Get up and running in minutes on our cloud infrastructure without having to install or configure a single server.

2. 學校開課Microsoft Educator Grant Program provides access to Azure for use in the classroom by university students and their professor.

請直接填寫相關資料即可申請: http://www.microsoftazurepass.com/azureu

  • Faculty will receive a 12 month, $250/month account
  • Students will receive a 6 month, $100/month account

3. 研究專案Microsoft Azure for Research 目前有 Ebola Research,Azure Machine Learning, Climate Data Initiative 等不同的專案可申請:http://research.microsoft.com/en-US/projects/azure/awards.aspx