https://www.44bits.io/ko/post/wsl2-install-and-basic-usage
wsl --set-version Ubuntu-18.04 2
https://docs.nvidia.com/cuda/wsl-user-guide/index.html#wsl2-system-requirements
https://ubuntu.com/blog/getting-started-with-cuda-on-ubuntu-on-wsl-2
docker ps가 에러가 떴다
21.08.30 win11으로 업데이트가 되니까 gpu인식도 잘 되고
1epoch당 5초이내 학습도 잘 되고
import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt
mnist = keras.datasets.mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train_norm, x_test_norm = x_train / 255.0, x_test / 255.0
x_train_reshaped=x_train_norm.reshape( -1, 28, 28, 1)
x_test_reshaped=x_test_norm.reshape( -1, 28, 28, 1)
model=keras.models.Sequential()
model.add(keras.layers.Conv2D(16, (3,3), activation='relu', input_shape=(28,28,1)))
model.add(keras.layers.MaxPool2D(2,2))
model.add(keras.layers.Conv2D(32, (3,3), activation='relu'))
model.add(keras.layers.MaxPooling2D((2,2)))
model.add(keras.layers.Flatten())
model.add(keras.layers.Dense(32, activation='relu'))
model.add(keras.layers.Dense(10, activation='softmax'))
model.summary()
model.compile(optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
# 모델 훈련
model.fit(x_train_reshaped, y_train, epochs=10)
ubuntu에서 하면 epoch당 2초가 걸린다.
ubuntu에서 2배나 빨리 되는 이유? --> driver version 때문인 것 같다.