示例#1
0
 public static function getDevices(Platform $platform = null, $type = Cl::DEVICE_TYPE_DEFAULT)
 {
     $platformId = $platform ? $platform->getId() : null;
     $devices = array();
     foreach (cl_get_device_ids($platformId, $type) as $deviceId) {
         $devices[] = new Device($deviceId);
     }
     return $devices;
 }
示例#2
0
文件: Cl.php 项目: rsky/php-opencl
 public static function createSomeContext()
 {
     $platforms = Platform::getPlatforms();
     foreach ($platforms as $platform) {
         $devices = $platform->getDevices(self::DEVICE_TYPE_ALL);
         foreach ($devices as $device) {
             return new Context($device);
         }
     }
     return null;
 }