This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
import pycuda.autoinit | |
import pycuda.driver as drv | |
from pycuda.compiler import SourceModule | |
from pycuda.gpuarray import to_gpu | |
mod = SourceModule(""" | |
typedef struct _pair | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add(A,B,reps) | |
for i in 1:reps | |
C = A + B | |
end | |
end | |
function add_bc(A,B,reps) | |
for i in 1:reps | |
C = A .+ B | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function test(f) | |
tmin = 1e10 | |
for i in 1:5 | |
t = time() | |
f() | |
t = time() - t | |
if t < tmin | |
tmin = t | |
end | |
end |
NewerOlder