๐Ÿ“šSTUDY/Etc

[DirectML] DirectML ์ •๋ฆฌ + ์˜ˆ์ œ (1)

ํ•ด๋Š”์„  2022. 6. 11. 20:46

https://github.com/microsoft/DirectML

 

GitHub - microsoft/DirectML: DirectML is a high-performance, hardware-accelerated DirectX 12 library for machine learning. Direc

DirectML is a high-performance, hardware-accelerated DirectX 12 library for machine learning. DirectML provides GPU acceleration for common machine learning tasks across a broad range of supported ...

github.com

 

Direct-Machine Learning (DirectML)์€ ๋จธ์‹ ๋Ÿฌ๋‹์„ ์œ„ํ•œ DirectX 12 GPU ๊ฐ€์† ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ(API)๋‹ค. DirectX 12๋ฅผ ์ง€์›ํ•œ๋‹ค๋ฉด AMD, Intel, NVIDIA, ์‹ฌ์ง€์–ด Qualcomm์˜ GPU๊นŒ์ง€ ์ง€์›ํ•œ๋‹ค. DirectML์„ ์ด์šฉํ•˜๋ฉด CUDA๋ฅผ ์ง€์›ํ•˜์ง€ ์•Š๋Š” GPU์—์„œ๋„ ๊ฐ€์† ์—ฐ์‚ฐ (๋จธ์‹ ๋Ÿฌ๋‹, ๋”ฅ๋Ÿฌ๋‹)์„ ๋Œ๋ฆด ์ˆ˜ ์žˆ๋‹ค!

 

์ด ๊ธ€์—์„œ๋Š” DirectML readme๋ฅผ ์ •๋ฆฌํ•˜๊ณ , ์ œ๊ณต๋˜๋Š” ์˜ˆ์ œ๋ฅผ ๋Œ๋ ค๋ณด๋ ค๊ณ  ํ•œ๋‹ค. 

 

 

DirectML ์š”๊ตฌ์‚ฌํ•ญ

Software

DirectML์€ Windows 10์˜ ์‹œ์Šคํ…œ ๊ตฌ์„ฑ ์š”์†Œ๋กœ ๋ฐฐํฌ๋˜์–ด Windows 10 version 1903 (build 10.0.18362) ์ด์ƒ์—์„œ ๋ณ„๋‹ค๋ฅธ ์„ค์น˜ ์—†์ด ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•˜๋‹ค.

DirectML version 1.4.0 ๋ถ€ํ„ฐ๋Š” Microsoft.AI.DirectML (.NET)์œผ๋กœ๋„ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•ด์„œ ๊ณ ์ •๋œ ๋ฒ„์ „์„ ์‚ฌ์šฉํ•˜๊ณ  ์‹ถ๊ฑฐ๋‚˜ ์œ„ ๋ฒ„์ „ ์ด์ „์—์„œ ์‚ฌ์šฉํ•˜๊ณ  ์‹ถ์„ ๋•Œ nuget์„ ์‚ฌ์šฉํ•˜์—ฌ ์ƒˆ๋กœ ๋ฐ›์„ ์ˆ˜๋„ ์žˆ๋‹ค.

 

Hardware

DirectML์—๋Š” DirectX 12 ์ง€์› ์žฅ์น˜๊ฐ€ ํ•„์š”ํ•œ๋ฐ, ์ตœ๊ทผ ์ถœ์‹œ๋œ ๊ฑฐ์˜ ๋ชจ๋“  ์ƒ์šฉ ๊ทธ๋ž˜ํ”ฝ ์นด๋“œ๋Š” DirectX 12๋ฅผ ์ง€์›ํ•œ๋‹ค. 

์œˆ๋„์šฐ์—์„œ๋Š” ์ž‘์—…๊ด€๋ฆฌ์ž์—์„œ GPU์˜ DirectX version์„ ํ™•์ธ๊ฐ€๋Šฅํ•˜๋‹ค

DirectX 12์˜ ๊ฒฝ์šฐ,

  • AMD GCN 1st Gen (Radeon HD 7000 series)๊ณผ ๊ทธ ์ด์ƒ
  • Intel Haswell (4th-gen core) HD Integrated Graphics์™€ ๊ทธ ์ด์ƒ
  • NVIDIA Kepler (GTX 600 series)์™€ ๊ทธ ์ด์ƒ
  • Qualcomm Adreno 600๊ณผ ๊ทธ ์ด์ƒ ์‹œ๋ฆฌ์ฆˆ์—์„œ ์ง€์›๋œ๋‹ค.

 

 

DirectML Samples

๋จผ์ € ๊ฐ€์žฅ ๊ฐ„๋‹จํ•˜๊ฒŒ ๋Œ๋ ค๋ณผ ์ˆ˜ ์žˆ๋Š” "HelloDirectML" ์˜ˆ์ œ๋ฅผ ๋Œ๋ ค๋ณด์•˜๋‹ค.

  • HelloDirectML: A minimal "hello world" application that executes a single DirectML operator.

์ด ์˜ˆ์ œ๋Š” D3D12์™€ DirectML์„ ์ตํ™”ํ•˜๊ณ , operator๋ฅผ ์ƒ์„ฑ ๋ฐ ์ปดํŒŒ์ผํ•˜๊ณ , GPU์—์„œ operator๋ฅผ ์‹คํ–‰ํ•˜๊ณ  ๊ฒฐ๊ณผ๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” ์ตœ์†Œํ•œ์˜ ํŒŒ์ดํ”„๋ผ์ธ์„ ๋‹ด์€ ์˜ˆ์ œ์ด๋‹ค. ์—ฐ์‚ฐ์€ f(x)=x๊ฐ€ ๋‚˜์˜ค๋Š” identity ์—ฐ์‚ฐ์ž๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.

GPU ํ”„๋กœํŒŒ์ผ๋Ÿฌ ๋””๋ฒ„๊น…์„ ์‹คํ–‰ํ•˜๋ฉด, ๋‹ค์Œ๊ณผ ๊ฐ™์ด GPU๋ฅผ ํ™œ์šฉํ•ด์„œ output์„ ๋‚ด์—ˆ์Œ์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค.

 

 

 

 

์ตœ์ข…๋ชฉํ‘œ

=> Hololens2์˜ amd gpu์—์„œ directML์„ ์ด์šฉํ•˜์—ฌ GPU๋กœ deep learning ๋Œ๋ฆฌ๋Š” ๊ฒƒ์„ ํ™•์ธํ•˜๊ธฐ.