GPU가 여러개 설치된 컴퓨터에서 TensorFlow를 사용할 경우 일반적으로 가장 첫번째(0)의 GPU를 사용하게 되는데.. 이때 아래의 코드를 통해 두번째(1)의 GPU를 사용하라고 지정할 수 있음
import tensorflow as tf import os os.environ["CUDA_VISIBLE_DEVICES"] = "1"
공간정보시스템 / 3차원 시각화 / 딥러닝 기반 기술 연구소 @지오서비스(GEOSERVICE)
GPU가 여러개 설치된 컴퓨터에서 TensorFlow를 사용할 경우 일반적으로 가장 첫번째(0)의 GPU를 사용하게 되는데.. 이때 아래의 코드를 통해 두번째(1)의 GPU를 사용하라고 지정할 수 있음
import tensorflow as tf import os os.environ["CUDA_VISIBLE_DEVICES"] = "1"
fun _w(name: String, firstValue: String, secondValue: String): String { val lastName = name[name.length - 1] if (lastName.toInt() < 0xAC00 || lastName.toInt() > 0xD7A3) return name val seletedValue = if ((lastName.toInt() - 0xAC00) % 28 > 0) firstValue else secondValue return name + seletedValue } fun main() { val text = "${_w("컴퓨터", "은", "는")} ${_w("키보드", "이", "가")} ${_w("우리", "을", "를")} 돕는다." println(text) }
결과는 다음과 같다.
이 컴퓨터는 키보드가 우리를 돕는다.