タグ

cudaとpycudaに関するrawwellのブックマーク (1)

  • Tutorial - pycuda 2024.1.2 documentation

    Tutorial¶ Getting started¶ Before you can use PyCuda, you have to import and initialize it: import pycuda.driver as cuda import pycuda.autoinit from pycuda.compiler import SourceModule Note that you do not have to use pycuda.autoinit– initialization, context creation, and cleanup can also be performed manually, if desired. Transferring Data¶ The next step in most programs is to transfer data onto

    rawwell
    rawwell 2009/04/03
    mod = cuda.SourceModule(""" __global__ void doublify(float *a) { int idx = threadIdx.x + threadIdx.y*4; a[idx] *= 2; } """) If there aren’t any errors, the code is now compiled and loaded onto the device. We find a reference to our pycuda.driver.Function and call it, specifying a_g
  • 1