From T3_KR_KNU
Revision as of 01:59, 12 May 2021 by Hanbi (Talk | contribs) (Created page with "== HTCondor 에서 GPU 사용하기 == === Ex 1) Matrix === matrix.py import numpy as np from timeit import default_timer as timer from numba import vectorize @vector...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

HTCondor 에서 GPU 사용하기

Ex 1) Matrix

matrix.py

import numpy as np
from timeit import default_timer as timer
from numba import vectorize

@vectorize(['float32(float32, float32)'], target='cuda')

def pow(a, b):
    return a ** b

vec_size = 100000000
a = b = np.array(np.random.sample(vec_size), dtype=np.float32)
c = np.zeros(vec_size, dtype=np.float32)
start = timer()
c = pow(a,b)
duration = timer() - start
print(duration)