示例#1
0
    def test_create_plan(self):
        G = gpyfftlib.GpyFFT()

        ctx = get_contexts()[0]
        queue = cl.CommandQueue(ctx)
        nd_data = np.array([[1, 2, 3, 4], [5, 6, 7, 8]], dtype=np.complex64)
        cl_data = cla.to_device(queue, nd_data)
        cl_data_transformed = cla.zeros_like(cl_data)

        plan = G.create_plan(ctx, cl_data.shape)

        print('plan.strides_in', plan.strides_in)
        print('plan.strides_out', plan.strides_out)
        print('plan.distances', plan.distances)
        print('plan.batch_size', plan.batch_size)
        del plan
        del G
示例#2
0
    def test_create_plan(self):
        G = gpyfftlib.GpyFFT()

        ctx = get_contexts()[0]
        queue = cl.CommandQueue(ctx)
        nd_data = np.array([[1, 2, 3, 4],
                            [5, 6, 7, 8]],
                           dtype=np.complex64)
        cl_data = cla.to_device(queue, nd_data)
        cl_data_transformed = cla.zeros_like(cl_data)

        plan = G.create_plan(ctx, cl_data.shape)

        print('plan.strides_in', plan.strides_in)
        print('plan.strides_out', plan.strides_out)
        print('plan.distances', plan.distances)
        print('plan.batch_size', plan.batch_size)
示例#3
0
 def test_callback_pre(self):
     for ctx in get_contexts():
         self.callback_pre(ctx)
示例#4
0
from __future__ import print_function
import unittest
from parameterized import parameterized
import numpy as np
import pyopencl as cl
import pyopencl.array as cla
from gpyfft import FFT
from gpyfft.test.util import get_contexts, has_double
"""
Some basic tests for high-level interface
"""

#TODO: perform tests for all contexts

contexts = [(ctx, ) for ctx in get_contexts()]
#contexts = []  # see what happens if no OpenCL GPU device available


class test_fft(unittest.TestCase):
    def test_context(self):
        self.assertTrue(contexts, msg='no OpenCL GPU device available')

    @parameterized.expand(contexts)
    def test_1d_inplace(self, ctx):
        queue = cl.CommandQueue(ctx)

        nd_data = np.arange(32, dtype=np.complex64)
        cl_data = cla.to_device(queue, nd_data)
        #cl_data_transformed = cla.zeros_like(cl_data)

        transform = FFT(ctx, queue, cl_data)
示例#5
0
import unittest
from nose_parameterized import parameterized
import numpy as np
import pyopencl as cl
import pyopencl.array as cla
from gpyfft import FFT
from gpyfft.test.util import get_contexts, has_double


"""
Some basic tests for high-level interface
"""

#TODO: perform tests for all contexts

contexts = [(ctx,) for ctx in get_contexts()]
#contexts = []  # see what happens if no OpenCL GPU device available

class test_fft(unittest.TestCase):

    def test_context(self):
        self.assertTrue(contexts, msg='no OpenCL GPU device available')
    
    @parameterized.expand(contexts)
    def test_1d_inplace(self, ctx):
        queue = cl.CommandQueue(ctx)
        
        nd_data = np.arange(32, dtype=np.complex64)
        cl_data = cla.to_device(queue, nd_data)
        #cl_data_transformed = cla.zeros_like(cl_data)
        
示例#6
0
 def test_callback_pre(self):
     for ctx in get_contexts():
         self.callback_pre(ctx)