ย
Visual Studio ์ค์นCUDA ์ค์นCuDNN ์ค์นzlibwapi.dll ์ค์ ํ๊ฒฝ๋ณ์ ์ถ๊ฐtensorflow ์ค์นGPU ํ
์คํธ
ย
ย
Visual Studio ์ค์น
- .NET ๋ฐ์คํฌํ ๊ฐ๋ฐ ๋ฐ C++๋ฅผ ์ฌ์ฉํ ๋ฐ์คํฌํ ๊ฐ๋ฐ ์ค์นํ๊ธฐ

ย
ย
CUDA ์ค์น
- Windows > x86_64 > 10 > exe(local) ์ ํ (๋งํฌ)

- ๋น ๋ฅธ ์ค์น๋ก ์ค์นํ๊ธฐ

ย
ย
CuDNN ์ค์น
- NVIDIA ๊ณ์ ๊ฐ์ ๋ฐ ๋ก๊ทธ์ธ ํ์
- zip ํ์ผ ๋ค์ด๋ฐ์ ํ, ์ ์ ํ ๊ฒฝ๋ก์ ์์ถํด์ ํ๊ธฐ
ย
ย
zlibwapi.dll ์ค์
- ์์ ์ฌ์ดํธ์์ Windows ์ฌ์ฉ์๋ฅผ ์ํ ZLIB DLL์ ๋ค์ด๋ฐ๋๋ค.
- ํด๋น ํ์ผ์ ์์ถํด์ ํ ๋ค, zlibwapi.dll ํ์ผ์ CUDA ๊ฒฝ๋ก์ bin ํ์ผ๋ก ๋ณต์ฌ๋ถ์ฌ๋ฃ๊ธฐํ๋ค.
- C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\bin
ย
ย
ํ๊ฒฝ๋ณ์ ์ถ๊ฐ
- ์ค์ ์ฑ > ์ ๋ณด > ๊ณ ๊ธ ์์คํ ์ค์ > ํ๊ฒฝ๋ณ์ ์ ํ

- ์์คํ ๋ณ์์ Path์ ์๋์ ๊ฒฝ๋ก ์ถ๊ฐ
- C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\include
- C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\extras\CUPTI\lib64
- ${cuDNN ์์ถํด์ ํด๋}\bin
- ์ฐธ๊ณ ์ด๋ฏธ์ง

ย
ย
tensorflow ์ค์น
- pip๋ฅผ ์ด์ฉํ์ฌ tensorflow ์ค์นํ๊ธฐ
pip3 install tensorflow
ย
ย
GPU ํ ์คํธ
- gpu ํ์ธ
import tensorflow as tf from tensorflow.python.client import device_lib print("gpu_device_name:\n", tf.test.gpu_device_name()) print("--" * 20) print("list_physical_devices:\n", tf.config.list_physical_devices('GPU')) print("--" * 20) print("list_local_devices:\n", device_lib.list_local_devices())


- ํ์ต ํ ์คํธ
import os import tensorflow as tf mnist = tf.keras.datasets.mnist (X_train, y_train), (X_test, y_test) = mnist.load_data() X_train, X_test = X_train.reshape(60000, 28 * 28) / 255.0, X_test.reshape(10000, 28 * 28) / 255.0 model = tf.keras.models.Sequential([ tf.keras.layers.Dense(128, activation='relu', input_shape=(28 * 28,)), tf.keras.layers.Dense(256, activation='relu'), tf.keras.layers.Dense(10, activation='softmax') ]) model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy']) model.fit(X_train, y_train, epochs=20) model.evaluate(X_test, y_test, verbose=2)


ย