示例#1
0
def main():
    
    for platform in cl.get_platforms():
        print "Platform %r version: %s" % (platform.name, platform.version)
        
        for device in platform.devices():
            print " ++  %s Device %r" % (DMAP[device.type], device.name) 
            
            print "     | global_mem_size", device.global_mem_size / (1024 ** 2), 'Mb'
            print "     | local_mem_size", device.local_mem_size / (1024 ** 1), 'Kb'
            print "     | max_mem_alloc_size", device.max_mem_alloc_size / (1024 ** 2), 'Mb'
            print "     | has_image_support", device.has_image_support
            print "     | has_native_kernel", device.has_native_kernel
            print "     | max_compute_units", device.max_compute_units
            print "     | max_work_item_dimension", device.max_work_item_dimensions
            print "     | max_work_item_sizes", device.max_work_item_sizes
            print "     | max_work_group_size", device.max_work_group_size
            print "     | max_clock_frequency", device.max_clock_frequency, 'MHz'
            print "     | address_bits", device.address_bits, 'bits'
            print "     | max_read_image_args", device.max_read_image_args
            print "     | max_write_image_args", device.max_write_image_args
            print "     | max_image2d_shape", device.max_image2d_shape
            print "     | max_image3d_shape", device.max_image3d_shape
            print "     | max_parameter_size", device.max_parameter_size, 'bytes'
            print "     | max_const_buffer_size", device.max_const_buffer_size, 'bytes'
            print "     | has_local_mem", device.has_local_mem
            print "     | host_unified_memory", device.host_unified_memory
            print "     | available", device.available
            print "     | compiler_available", device.compiler_available
            print "     | driver_version", device.driver_version
            print "     | device_profile", device.profile
            print "     | version", device.version
#            print "     | extensions", device.extensions
            print 
示例#2
0
 def test_properties(self):
     platform = get_platforms()[0]
     
     properties = ContextProperties()
     
     properties.platform = platform
             
     self.assertEqual(platform.name, properties.platform.name)
     
     ctx = Context(device_type=DEVICE_TYPE, properties=properties)
示例#3
0
def main():

    for platform in cl.get_platforms():
        print "Platform %r version: %s" % (platform.name, platform.version)

        for device in platform.devices():
            print " ++  %s Device %r" % (DMAP[device.type], device.name)

            print "     | global_mem_size", device.global_mem_size / (1024**
                                                                      2), 'Mb'
            print "     | local_mem_size", device.local_mem_size / (1024**
                                                                    1), 'Kb'
            print "     | max_mem_alloc_size", device.max_mem_alloc_size / (
                1024**2), 'Mb'
            print "     | has_image_support", device.has_image_support
            print "     | has_native_kernel", device.has_native_kernel
            print "     | max_compute_units", device.max_compute_units
            print "     | max_work_item_dimension", device.max_work_item_dimensions
            print "     | max_work_item_sizes", device.max_work_item_sizes
            print "     | max_work_group_size", device.max_work_group_size
            print "     | max_clock_frequency", device.max_clock_frequency, 'MHz'
            print "     | address_bits", device.address_bits, 'bits'
            print "     | max_read_image_args", device.max_read_image_args
            print "     | max_write_image_args", device.max_write_image_args
            print "     | max_image2d_shape", device.max_image2d_shape
            print "     | max_image3d_shape", device.max_image3d_shape
            print "     | max_parameter_size", device.max_parameter_size, 'bytes'
            print "     | max_const_buffer_size", device.max_const_buffer_size, 'bytes'
            print "     | has_local_mem", device.has_local_mem
            print "     | host_unified_memory", device.host_unified_memory
            print "     | available", device.available
            print "     | compiler_available", device.compiler_available
            print "     | driver_version", device.driver_version
            print "     | device_profile", device.profile
            print "     | version", device.version
            #            print "     | extensions", device.extensions
            print
示例#4
0
 def test_get_devices(self):
     plat = get_platforms()[0]
     devices = plat.devices
     native_kernels = [dev.has_native_kernel for dev in devices]
示例#5
0
 def test_get_platforms(self):
     platforms = get_platforms()
'''
Display informations on all the devices for each OpenCL platform.
'''

from numpy import *
import opencl

dev_types = {
    opencl.DEVICE_TYPE_CPU: 'CPU',
    opencl.DEVICE_TYPE_GPU: 'GPU',
    opencl.DEVICE_TYPE_ACCELERATOR: 'Accelerator',
    opencl.DEVICE_TYPE_DEFAULT: 'Default',
}

if __name__ == '__main__':
    for p in opencl.get_platforms():
        print 'Platform', p.id
        print '  Name:', p.name
        print '  Vendor:', p.vendor
        print '  Version:', p.version
        print '  Profile:', p.profile
        print
        for d in p.devices:
            print '  Device', d.id
            print '    Name:', d.name
            print '    Vendor:', d.vendor
            print '    Version:', d.version
            print '    Profile:', d.profile
            print '    Extensions:', d.extensions
            print '    Type:', dev_types[d.type]
            print '    Vendor ID:', d.type