Exemple #1
0
def _initialize_cublas():
  global sgemm

  try:
    cublas.cublasInit()
    sgemm = cublas.cublasSgemm
  except AttributeError:
    handle = cublas.cublasCreate()
    def sgemm(*args):
      cublas.cublasSgemm(handle, *args)
def _initialize_cublas():
    global sgemm

    util.log_info('Initializing cublas.')
    try:
        cublas.cublasInit()
        sgemm = cublas.cublasSgemm
    except AttributeError:
        handle = cublas.cublasCreate()

        def sgemm(*args):
            cublas.cublasSgemm(handle, *args)
Exemple #3
0
import sys
from time import time
import pycuda
import pycuda.autoinit
from pycuda import gpuarray
from pycuda.gpuarray import GPUArray
from pycuda.elementwise import ElementwiseKernel
from pycuda.compiler import SourceModule
import cPickle
from scikits.cuda import cublas
import cudaconv2
#from scikits.cuda import linalg
#linalg.init()

try:
  cublas.cublasInit()
  sgemm = cublas.cublasSgemm
except AttributeError:
  handle = cublas.cublasCreate()
  def sgemm(*args):
    cublas.cublasSgemm(handle, *args)

class Timer:
  def __init__(self):
    self.func_time = {}
    self.last_time = 0.0

  def start(self):
    self.last_time = time()

  def end(self, func_name):
Exemple #4
0
from pycuda.elementwise import ElementwiseKernel
from pycuda.gpuarray import GPUArray
from scikits.cuda import cublas
from time import time
from util import *
import cPickle
import cudaconv2
import numpy as np
import pycuda
import sys
import pycuda.autoinit
#from scikits.cuda import linalg
#linalg.init()

try:
    cublas.cublasInit()
    sgemm = cublas.cublasSgemm
except AttributeError:
    handle = cublas.cublasCreate()

    def sgemm(*args):
        cublas.cublasSgemm(handle, *args)


class CompiledSource(object):
    def __init__(self, src, kernel):
        print >> sys.stderr, 'Compiling...', kernel
        self.module = SourceModule(src)
        self.kernel = self.module.get_function(kernel)

    def __call__(self, *args, **kw):
 def setUp(self):
     cublas.cublasInit()