๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
KAIST MASTER๐Ÿ“š/python

torch.cuda.is_available() False์—์„œ True๋กœ ๋งŒ๋“ค๊ธฐ

by ๋ง๋ž‘e 2021. 8. 25.

1. torch.cuda.is_available()

print(torch.cuda.is_available())

False

๋ฅผ ๋„ˆ๋ฌด ๋งŽ์ด ๋ด์„œ ๋‡Œ์ ˆ์˜ฌ๊บผ ๊ฐ™์•˜๋‹ค..ใ… ใ… ใ… ใ… ใ… ใ… 

์ „์— NVIDIA์žฌ์„ค์น˜ ํ•˜๋ฉด์„œ ๋ฒ„์ „์„ ๋ฐ”๊พผ๊ฒŒ ๋ฌธ์ œ์ธ ๊ฒƒ ๊ฐ™์•˜๋‹ค

๊ทธ๋ž˜์„œ ๋‹ค์‹œํ•œ๋ฒˆ ์žฌ์„ค์น˜ ํ•˜๊ธฐ๋Ÿฌ ํ–ˆ๋‹ค.

 

2. CUDA ์žฌ์„ค์น˜

https://deepflowest.tistory.com/338

 

[Window] CUDA 10.2 , cuDNN 7.6.5 ์„ค์น˜

โ–  ๊ธฐ์กด ๋ฒ„์ „, ํ™˜๊ฒฝ ํ™•์ธ OS : Windows 10 Graphic card : GTX1080 CUDA 11.1 โ–  ์„ค์น˜ ๋ฆฌ์ŠคํŠธ CUDA 10.2 cuDNN 7.6.5 1. ๊ธฐ์กด CUDA, NVIDIA ๋“œ๋ผ์ด๋ฒ„ ์‚ญ์ œ 1) "ํ”„๋กœ๊ทธ๋žจ ์ถ”๊ฐ€/์ œ๊ฑฐ" ์—์„œ "NVIDIA" ๊ฒ€์ƒ‰ ํ›„ ๊ด€๋ จ๋œ..

deepflowest.tistory.com

 

์ด ๋ธ”๋กœ๊ทธ๋ฅผ ์ฐธ๊ณ ํ•ด์„œ ์žฌ์„ค์น˜๋ฅผ ์ง„ํ–‰ํ–ˆ๋‹ค.

 

3. ํŒŒ์ด์ฐธ new project ๋งŒ๋“ค๊ธฐ

์ดˆ๋ฐ˜์— create anaconda ๊ฐ€์ƒํ™˜๊ฒฝ ๋งŒ๋“ค๊ณ 

import torch

def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    print(f'Hi, {name}')  # Press Ctrl+F8 to toggle the breakpoint.


# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    print_hi('PyCharm')
    print(torch.cuda.is_available())

# See PyCharm help at https://www.jetbrains.com/help/pycharm/

ํ„ฐ๋ฏธ๋„์—

conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

ํ•ด์„œ ํŒŒ์ดํ† ์น˜๋ฅผ ๊น”์•˜๋‹ค.๊ทธ๋‹ˆ๊นŒ ๋“œ๋””์–ด 

ใ… ใ… ใ… ๋“œ๋””์–ด True๊ฐ€ ๋‚˜์™”๋‹ค ใ… ใ… ใ… ใ… ใ… 

๋ˆˆ๋ฌผ์ข”์ข”

4. ์˜ค๋Š˜์˜ ๊ตํ›ˆ

๋ฒ„์ „ ๋งž์ถ”๋Š” ๊ฒƒ์€ ๋Œ€๋‹จํžˆ ์ค‘์š”ํ•˜๋‹ค...

๋Œ“๊ธ€