Skip to content
vector_add_2.py 553 B
Newer Older
# Required imports for the exercise
from pycuda import autoinit
from pycuda import gpuarray
import numpy as np
from pycuda.elementwise import ElementwiseKernel

# Initialize vectors "a" and "b" with some numbers,
# and vector "c" with zeros
# Use numpy to define single precision vectors
# a = ...
# b = ...
# c = ...

# Create the corresponding vectors in GPU memory
# a_gpu = ...
# b_gpu = ...
# c_gpu = ...

# Define a CUDA function for vector addition
# using an element-wise kernel
# ...

# Call the created function
# ...

# Get the result
# ...