Beispiel #1
0
    def __init__(self, context, queue):
        """ Constructor.
		@param context OpenCL context where apply.
		@param queue OpenCL command queue.
		"""
        self.context = context
        self.queue = queue
        self.program = clUtils.loadProgram(context,
                                           clUtils.path() + "/lsqr.cl")
        # Create OpenCL objects as null objects, that we will generate
        # at the first iteration
        self.A = None
        self.b = None
        self.x0 = None
        self.x = None
        self.r = None
        # Create some useful operators
        self.dot_c_vec = ElementwiseKernel(context, "float c, float *v",
                                           "v[i] *= c")
        self.copy_vec = ElementwiseKernel(context, "float* out, float *in",
                                          "out[i] = in[i]")
        self.linear_comb = ElementwiseKernel(
            context, "float* z,"
            "float a, float *x, "
            "float b, float *y", "z[i] = a*x[i] + b*y[i]")
        self.prod = ElementwiseKernel(context, "float *z,"
                                      "float *x, float *y", "z[i] = x[i]*y[i]")
	def __init__(self, context, queue):
		""" Constructor.
		@param context OpenCL context where apply.
		@param queue OpenCL command queue.
		"""
		self.context = context
		self.queue   = queue
		self.program = clUtils.loadProgram(context, clUtils.path() + "/lsqr.cl")
		# Create OpenCL objects as null objects, that we will generate
		# at the first iteration
		self.A      = None
		self.b      = None
		self.x0     = None
		self.x      = None
		self.r      = None
		# Create some useful operators
		self.dot_c_vec   = ElementwiseKernel(context,
		                                     "float c, float *v",
		                                     "v[i] *= c")
		self.copy_vec    = ElementwiseKernel(context,
		                                     "float* out, float *in",
		                                     "out[i] = in[i]")
		self.linear_comb = ElementwiseKernel(context,
		                                     "float* z,"
		                                     "float a, float *x, "
		                                     "float b, float *y",
		                                     "z[i] = a*x[i] + b*y[i]")
		self.prod        = ElementwiseKernel(context,
		                                     "float *z,"
		                                     "float *x, float *y",
		                                     "z[i] = x[i]*y[i]")
	def __init__(self, context, queue):
		""" Constructor.
		@param context OpenCL context where apply.
		@param queue OpenCL command queue.
		"""
		self.context = context
		self.queue   = queue
		self.program = clUtils.loadProgram(context, clUtils.path() + "/lsqr.cl")
		# Create OpenCL objects as null objects, that we will generate
		# at the first iteration
		self.A      = None
		self.B      = None
		self.X0     = None
		self.X      = None
		self.R      = None
		# Create dot operator
		self.dot = ReductionKernel(context, np.float32, neutral="0",
		                           reduce_expr="a+b", map_expr="x[i]*y[i]",
		                           arguments="__global float *x, __global float *y")
		self.dot_c_vec   = ElementwiseKernel(context,
		                                     "float c, float *v",
		                                     "v[i] *= c")
		self.copy_vec    = ElementwiseKernel(context,
		                                     "float* out, float *in",
		                                     "out[i] = in[i]")
		self.linear_comb = ElementwiseKernel(context,
		                                     "float* z,"
		                                     "float a, float *x, "
		                                     "float b, float *y",
		                                     "z[i] = a*x[i] + b*y[i]")
		self.prod        = ElementwiseKernel(context,
		                                     "float* z,"
		                                     "float *x, float *y",
		                                     "z[i] = x[i]*y[i]")
Beispiel #4
0
	def __init__(self, context, queue):
		""" Constructor.
		@param context OpenCL context where apply.
		@param queue OpenCL command queue.
		"""
		self.context = context
		self.queue   = queue
		self.program = clUtils.loadProgram(context, clUtils.path() + "/jacobi.cl")
		# Create OpenCL objects as null objects, that we will generate
		# at the first iteration
		self.A      = None
		self.B      = None
		self.X0     = None
		self.X      = None
		self.R      = None
		self.x      = None
		self.n      = 0
Beispiel #5
0
	def __init__(self, context=None, queue=None):
		""" Constructor.
		@param context OpenCL context where apply.
		@param queue OpenCL command queue.
		"""
		self.context = context
		self.queue   = queue
		self.program = clUtils.loadProgram(context, clUtils.path() + "/matrixGen.cl")
		# Create OpenCL objects as null objects, that we will generate
		# at the first iteration
		self.A      = None
		self.B      = None
		self.dB     = None
		self.pos    = None
		self.area   = None
		self.normal = None
		self.p      = None
		self.gradp  = None
	def __init__(self, context, queue):
		""" Constructor.
		@param context OpenCL context where apply.
		@param queue OpenCL command queue.
		"""
		self.context = context
		self.queue   = queue
		self.program = clUtils.loadProgram(context, clUtils.path() + "/minres.cl")
		# Create OpenCL objects as null objects, that we will generate
		# at the first iteration
		self.A      = None
		self.B      = None
		self.X0     = None
		self.X      = None
		self.R      = None
		# Create dot operator
		self.dot = ReductionKernel(context, np.float32, neutral="0",
		                           reduce_expr="a+b", map_expr="x[i]*y[i]",
		                           arguments="__global float *x, __global float *y")
    def __init__(self, context, queue):
        """ Constructor.
		@param context OpenCL context where apply.
		@param queue OpenCL command queue.
		"""
        self.context = context
        self.queue = queue
        self.program = clUtils.loadProgram(context,
                                           clUtils.path() + "/jacobi.cl")
        # Create OpenCL objects as null objects, that we will generate
        # at the first iteration
        self.A = None
        self.B = None
        self.X0 = None
        self.X = None
        self.x = None
        # Create dot operator
        self.dot = ReductionKernel(
            context,
            np.float32,
            neutral="0",
            reduce_expr="a+b",
            map_expr="x[i]*y[i]",
            arguments="__global float *x, __global float *y")