Best Phoronix-test-suite code snippet using phodevi_system.sw_opencl_driver
phodevi_system.php
Source:phodevi_system.php
...64 case 'vulkan-driver':65 $property = new phodevi_device_property('sw_vulkan_driver', phodevi::std_caching);66 break;67 case 'opencl-driver':68 $property = new phodevi_device_property('sw_opencl_driver', phodevi::std_caching);69 break;70 case 'opengl-vendor':71 $property = new phodevi_device_property('sw_opengl_vendor', phodevi::smart_caching);72 break;73 case 'desktop-environment':74 $property = new phodevi_device_property('sw_desktop_environment', phodevi::smart_caching);75 break;76 case 'operating-system':77 $property = new phodevi_device_property('sw_operating_system', phodevi::smart_caching);78 break;79 case 'os-version':80 $property = new phodevi_device_property('sw_os_version', phodevi::smart_caching);81 break;82 case 'kernel':83 $property = new phodevi_device_property('sw_kernel', phodevi::smart_caching);84 break;85 case 'kernel-architecture':86 $property = new phodevi_device_property('sw_kernel_architecture', phodevi::smart_caching);87 break;88 case 'kernel-date':89 $property = new phodevi_device_property('sw_kernel_date', phodevi::smart_caching);90 break;91 case 'kernel-string':92 $property = new phodevi_device_property('sw_kernel_string', phodevi::smart_caching);93 break;94 case 'kernel-parameters':95 $property = new phodevi_device_property('sw_kernel_parameters', phodevi::std_caching);96 break;97 case 'compiler':98 $property = new phodevi_device_property('sw_compiler', phodevi::std_caching);99 break;100 case 'system-layer':101 $property = new phodevi_device_property('sw_system_layer', phodevi::std_caching);102 break;103 case 'environment-variables':104 $property = new phodevi_device_property('sw_environment_variables', phodevi::std_caching);105 break;106 }107 return $property;108 }109 public static function sw_username()110 {111 // Gets the system user's name112 if(function_exists('posix_getpwuid') && function_exists('posix_getuid'))113 {114 $userinfo = posix_getpwuid(posix_getuid());115 $username = $userinfo['name'];116 }117 else118 {119 $username = trim(getenv('USERNAME'));120 }121 return $username;122 }123 public static function sw_system_layer()124 {125 $layer = null;126 if(phodevi::is_windows() && pts_client::executable_in_path('winecfg.exe') && ($wine = phodevi::read_property('system', 'wine-version')))127 {128 $layer = $wine;129 }130 else131 {132 // Report virtualization133 $layer = phodevi::read_property('system', 'virtualized-mode');134 }135 return $layer;136 }137 public static function sw_hostname()138 {139 $hostname = 'Unknown';140 if(($bin = pts_client::executable_in_path('hostname')))141 {142 $hostname = trim(shell_exec($bin . ' 2>&1'));143 }144 else if(phodevi::is_windows())145 {146 $hostname = getenv('USERDOMAIN');147 }148 return $hostname;149 }150 public static function sw_vendor_identifier()151 {152 // Returns the vendor identifier used with the External Dependencies and other distro-specific features153 $vendor = phodevi::is_linux() ? phodevi_linux_parser::read_lsb_distributor_id() : false;154 if(!$vendor)155 {156 $vendor = phodevi::read_property('system', 'operating-system');157 if(($spos = strpos($vendor, ' ')) > 1)158 {159 $vendor = substr($vendor, 0, $spos);160 }161 }162 return str_replace(array(' ', '/'), '', strtolower($vendor));163 }164 public static function sw_filesystem()165 {166 // Determine file-system type167 $fs = null;168 if(phodevi::is_macosx())169 {170 $fs = phodevi_osx_parser::read_osx_system_profiler('SPSerialATADataType', 'FileSystem');171 if($fs == null && pts_client::executable_in_path('mount'))172 {173 $mount = shell_exec('mount 2>&1');174 if(stripos($mount, ' on / (hfs, local, journaled)') !== false)175 {176 $fs = 'Journaled HFS+';177 }178 else if(stripos($mount, ' on / (hfs') !== false)179 {180 $fs = 'HFS+';181 }182 }183 }184 else if(phodevi::is_bsd())185 {186 if(pts_client::executable_in_path('mount'))187 {188 $mount = shell_exec('mount 2>&1');189 if(($start = strpos($mount, 'on / (')) != false)190 {191 // FreeBSD, DragonflyBSD mount formatting192 /*193 -bash-4.0$ mount194 ROOT on / (hammer, local)195 /dev/da0s1a on /boot (ufs, local)196 /pfs/@@-1:00001 on /var (null, local)197 /pfs/@@-1:00002 on /tmp (null, local)198 /pfs/@@-1:00003 on /usr (null, local)199 /pfs/@@-1:00004 on /home (null, local)200 /pfs/@@-1:00005 on /usr/obj (null, local)201 /pfs/@@-1:00006 on /var/crash (null, local)202 /pfs/@@-1:00007 on /var/tmp (null, local)203 procfs on /proc (procfs, local)204 */205 // TODO: improve this in case there are other partitions, etc206 $fs = substr($mount, $start + 6);207 $fs = substr($fs, 0, strpos($fs, ','));208 }209 else if(($start = strpos($mount, 'on / type')) != false)210 {211 // OpenBSD 5.0 formatting is slightly different from above FreeBSD example212 // TODO: improve this in case there are other partitions, etc213 $fs = substr($mount, $start + 10);214 $fs = substr($fs, 0, strpos($fs, ' '));215 }216 }217 }218 else if(phodevi::is_hurd())219 {220 // Very rudimentary Hurd filesystem detection support but works for at least a clean Debian GNU/Hurd EXT2 install221 if(pts_client::executable_in_path('mount'))222 {223 $mount = shell_exec('mount 2>&1');224 if(($start = strpos($mount, 'on / type')) != false)225 {226 $fs = substr($mount, $start + 10);227 $fs = substr($fs, 0, strpos($fs, ' '));228 if(substr($fs, -2) == 'fs')229 {230 $fs = substr($fs, 0, -2);231 }232 }233 }234 }235 else if(phodevi::is_linux() || phodevi::is_solaris())236 {237 $fs = trim(shell_exec('stat ' . pts_client::test_install_root_path() . ' -L -f -c %T 2> /dev/null'));238 switch($fs)239 {240 case 'ext2/ext3':241 if(isset(phodevi::$vfs->mounts))242 {243 $fstab = phodevi::$vfs->mounts;244 $fstab = str_replace('/boot ', 'IGNORE', $fstab);245 $using_ext2 = strpos($fstab, ' ext2') !== false;246 $using_ext3 = strpos($fstab, ' ext3') !== false;247 $using_ext4 = strpos($fstab, ' ext4') !== false;248 if(!$using_ext2 && !$using_ext3 && $using_ext4)249 {250 $fs = 'ext4';251 }252 else if(!$using_ext2 && !$using_ext4 && $using_ext3)253 {254 $fs = 'ext3';255 }256 else if(!$using_ext3 && !$using_ext4 && $using_ext2)257 {258 $fs = 'ext2';259 }260 else if(is_dir('/proc/fs/ext4/'))261 {262 $fs = 'ext4';263 }264 else if(is_dir('/proc/fs/ext3/'))265 {266 $fs = 'ext3';267 }268 }269 break;270 case 'Case-sensitive Journaled HFS+':271 $fs = 'HFS+';272 break;273 case 'MS-DOS FAT32':274 $fs = 'FAT32';275 break;276 case 'UFSD_NTFS_COMPR':277 $fs = 'NTFS';278 break;279 case 'ecryptfs':280 if(isset(phodevi::$vfs->mounts))281 {282 // An easy attempt to determine what file-system is underneath ecryptfs if being compared283 // For now just attempt to figure out the root file-system.284 if(($s = strrpos(phodevi::$vfs->mounts, ' / ')) !== false)285 {286 $s = substr(phodevi::$vfs->mounts, ($s + 3));287 $s = substr($s, 0, strpos($s, ' '));288 if($s != null && !isset($s[18]) && $s != 'rootfs'&& pts_strings::string_only_contains($s, pts_strings::CHAR_LETTER | pts_strings::CHAR_NUMERIC))289 {290 $fs = $s . ' (ecryptfs)';291 }292 }293 }294 break;295 default:296 if(substr($fs, 0, 9) == 'UNKNOWN (')297 {298 $magic_block = substr($fs, 9, -1);299 $known_magic_blocks = array(300 '0x9123683e' => 'Btrfs',301 '0x2fc12fc1' => 'zfs', // KQ Infotech ZFS302 '0x482b' => 'HFS+',303 '0x65735546' => 'FUSE',304 '0x565a4653' => 'ReiserFS',305 '0x52345362' => 'Reiser4',306 '0x3434' => 'NILFS2',307 '0x5346414f' => 'OpenAFS',308 '0x47504653' => 'GPFS',309 '0x5941ff53' => 'YAFFS',310 '0xff534d42' => 'CIFS',311 '0x24051905' => 'UBIFS',312 '0x1021994' => 'TMPFS',313 '0x73717368' => 'SquashFS',314 '0xc97e8168' => 'LogFS',315 '0x5346544E' => 'NTFS',316 '0xf15f' => 'eCryptfs',317 '0x61756673' => 'AuFS',318 '0xbd00bd0' => 'Lustre',319 '0xaad7aaea' => 'PanFS', // Panasas FS320 '0xf2f52010' => 'F2FS',321 '0xc36400' => 'CephFS',322 '0xca451a4e' => 'BcacheFS'323 );324 foreach($known_magic_blocks as $hex => $name)325 {326 if($magic_block == $hex)327 {328 $fs = $name;329 break;330 }331 }332 }333 break;334 }335 if(strpos($fs, 'UNKNOWN') !== false && isset(phodevi::$vfs->mounts))336 {337 $mounts = phodevi::$vfs->mounts;338 $fs_r = array();339 $fs_checks = array(340 'squashfs' => 'SquashFS',341 'aufs' => 'AuFS',342 'unionfs' => 'UnionFS'343 );344 foreach($fs_checks as $fs_module => $fs_name)345 {346 if(strpos($mounts, $fs_module) != false)347 {348 array_push($fs_r, $fs_name);349 }350 }351 if(count($fs_r) > 0)352 {353 $fs = implode(' + ', $fs_r);354 }355 }356 }357 else if(phodevi::is_windows())358 {359 return null;360 }361 if(empty($fs))362 {363 $fs = 'Unknown';364 }365 return $fs;366 }367 public static function sw_virtualized_mode()368 {369 // Reports if system is running virtualized370 $virtualized = null;371 $mobo = phodevi::read_name('motherboard');372 $gpu = phodevi::read_name('gpu');373 $cpu = phodevi::read_property('cpu', 'model');374 if(strpos($cpu, 'QEMU') !== false || (is_readable('/sys/class/dmi/id/bios_vendor') && pts_file_io::file_get_contents('/sys/class/dmi/id/bios_vendor') == 'QEMU'))375 {376 $virtualized = 'QEMU';377 if(strpos($cpu, 'QEMU Virtual') !== false)378 {379 $qemu_version = substr($cpu, (strrpos($cpu, ' ') + 1));380 if(pts_strings::is_version($qemu_version))381 {382 $virtualized .= ' ' . $qemu_version;383 }384 }385 }386 else if(stripos($gpu, 'VMware') !== false || (is_readable('/sys/class/dmi/id/product_name') && stripos(pts_file_io::file_get_contents('/sys/class/dmi/id/product_name'), 'VMware') !== false))387 {388 $virtualized = 'VMware';389 }390 else if(stripos($gpu, 'VirtualBox') !== false || stripos(phodevi::read_name('motherboard'), 'VirtualBox') !== false)391 {392 $virtualized = 'VirtualBox';393 if($vbox_manage = pts_client::executable_in_path('VBoxManage'))394 {395 $vbox_manage = trim(shell_exec($vbox_manage . ' --version 2> /dev/null'));396 if(is_numeric(substr($vbox_manage, 0, 1)))397 {398 $virtualized .= ' ' . $vbox_manage;399 }400 }401 else if($modinfo = pts_client::executable_in_path('modinfo'))402 {403 $modinfo = trim(shell_exec('modinfo -F version vboxguest 2> /dev/null'));404 if($modinfo != null && pts_strings::is_version(str_ireplace(array('_', 'RC', 'beta'), null, $modinfo)))405 {406 $virtualized .= ' ' . $modinfo;407 }408 }409 }410 else if(is_file('/sys/class/dmi/id/sys_vendor') && pts_file_io::file_get_contents('/sys/class/dmi/id/sys_vendor') == 'Xen')411 {412 $virtualized = pts_file_io::file_get_contents('/sys/class/dmi/id/product_name');413 if(strpos($virtualized, 'Xen') === false)414 {415 $virtualized = 'Xen ' . $virtualized;416 }417 // version string418 $virtualized .= ' ' . pts_file_io::file_get_contents('/sys/class/dmi/id/product_version');419 // $virtualized should be then e.g. 'Xen HVM domU 4.1.1'420 }421 else if(stripos($gpu, 'Microsoft Hyper-V') !== false)422 {423 $virtualized = 'Microsoft Hyper-V Server';424 }425 else if(stripos($mobo, 'Parallels Software') !== false)426 {427 $virtualized = 'Parallels Virtualization';428 }429 else if(is_file('/sys/hypervisor/type'))430 {431 $type = pts_file_io::file_get_contents('/sys/hypervisor/type');432 $version = array();433 foreach(array('major', 'minor', 'extra') as $v)434 {435 if(is_file('/sys/hypervisor/version/' . $v))436 {437 $v = pts_file_io::file_get_contents('/sys/hypervisor/version/' . $v);438 }439 else440 {441 continue;442 }443 if($v != null)444 {445 if(!empty($version) && substr($v, 0, 1) != '.')446 {447 $v = '.' . $v;448 }449 array_push($version, $v);450 }451 }452 $virtualized = ucwords($type) . ' ' . implode('', $version) . ' Hypervisor';453 }454 if($systemd_virt = pts_client::executable_in_path('systemd-detect-virt'))455 {456 $systemd_virt = trim(shell_exec($systemd_virt . ' 2> /dev/null'));457 if($systemd_virt != null && $systemd_virt != 'none')458 {459 switch($systemd_virt)460 {461 case 'kvm':462 $systemd_virt = 'KVM';463 break;464 case 'oracle':465 $systemd_virt = 'Oracle';466 break;467 }468 if($virtualized != null && stripos($virtualized, $systemd_virt) === false && stripos($systemd_virt, $virtualized) === false)469 {470 $virtualized = $systemd_virt . ' ' . $virtualized;471 }472 else if($virtualized == null)473 {474 $virtualized = $systemd_virt;475 }476 }477 }478 return $virtualized;479 }480 public static function sw_environment_variables()481 {482 $check_variables = array('LIBGL', '__GL', 'DRI_');483 $to_report = array();484 if(stripos(phodevi::read_property('system', 'opengl-driver'), 'Mesa'))485 {486 array_push($check_variables, 'MESA', 'GALLIUM');487 }488 if(isset($_SERVER))489 {490 foreach($_SERVER as $name => &$value)491 {492 foreach($check_variables as $var)493 {494 if(stripos($name, $var) !== false && $name != '__GL_SYNC_TO_VBLANK')495 {496 array_push($to_report, $name . '=' . $value);497 break;498 }499 }500 }501 }502 return implode(' ', array_unique($to_report));503 }504 public static function sw_compiler()505 {506 // Returns version of the compiler (if present)507 $compilers = array();508 if($gcc = pts_client::executable_in_path('gcc'))509 {510 if(!is_link($gcc) || strpos(readlink($gcc), 'gcc') !== false)511 {512 // GCC513 // If it's a link, ensure that it's not linking to llvm/clang or something514 $version = trim(shell_exec('gcc -dumpversion 2>&1'));515 if(pts_strings::is_version($version))516 {517 $v = shell_exec('gcc -v 2>&1');518 if(($t = strrpos($v, $version . ' ')) !== false)519 {520 $v = substr($v, ($t + strlen($version) + 1));521 $v = substr($v, 0, strpos($v, ' '));522 if($v != null && is_numeric($v))523 {524 // On development versions the release date is expressed525 // e.g. gcc version 4.7.0 20120314 (prerelease) (GCC)526 $version .= ' ' . $v;527 }528 else529 {530 $v = shell_exec('gcc --version 2>&1');531 if(($t = strrpos($v, $version)) !== false)532 {533 $v = substr($v, $t);534 $v = substr($v, 0, strpos(str_replace(PHP_EOL, ' ', $v), ' '));535 if(($t = strpos($v, ')')) !== false)536 {537 $v = substr($v, 0, $t);538 }539 if(pts_strings::is_version($version))540 {541 $version = $v;542 }543 }544 }545 }546 $compilers['gcc'] = 'GCC ' . $version;547 }548 }549 }550 if(pts_client::executable_in_path('opencc'))551 {552 // Open64553 $compilers['opencc'] = 'Open64 ' . trim(shell_exec('opencc -dumpversion 2>&1'));554 }555 if(pts_client::executable_in_path('pathcc'))556 {557 // PathCC / EKOPath / PathScale Compiler Suite558 $compilers['pathcc'] = 'PathScale ' . trim(shell_exec('pathcc -dumpversion 2>&1'));559 }560 if(pts_client::executable_in_path('tcc'))561 {562 // TCC - Tiny C Compiler563 $tcc = explode(' ', trim(shell_exec('tcc -v 2>&1')));564 if($tcc[1] == 'version')565 {566 $compilers['opencc'] = 'TCC ' . $tcc[2];567 }568 }569 if(pts_client::executable_in_path('pcc'))570 {571 // PCC - Portable C Compiler572 $pcc = explode(' ', trim(shell_exec('pcc -version 2>&1')));573 if($pcc[0] == 'pcc')574 {575 $compilers['pcc'] = 'PCC ' . $pcc[1] . (is_numeric($pcc[2]) ? ' ' . $pcc[2] : null);576 }577 }578 if(pts_client::executable_in_path('pgcpp') || pts_client::executable_in_path('pgCC'))579 {580 // The Portland Group Compilers581 $compilers['pgcpp'] = 'PGI C-C++ Workstation';582 }583 if(pts_client::executable_in_path('clang'))584 {585 // Clang586 $compiler_info = shell_exec('clang --version 2> /dev/null');587 if(($cv_pos = stripos($compiler_info, 'clang version')) !== false)588 {589 // With Clang 3.0 and prior, the --version produces output where the first line is:590 // e.g. clang version 3.0 (branches/release_30 142590)591 $compiler_info = substr($compiler_info, ($cv_pos + 14));592 $clang_version = substr($compiler_info, 0, strpos($compiler_info, ' '));593 // XXX: the below check bypass now because e.g. Ubuntu appends '-ubuntuX', etc that breaks check594 if(pts_strings::is_version($clang_version) || true)595 {596 // Also see if there is a Clang SVN tag to fetch597 $compiler_info = substr($compiler_info, 0, strpos($compiler_info, PHP_EOL));598 if(($cv_pos = strpos($compiler_info, ')')) !== false)599 {600 $compiler_info = substr($compiler_info, 0, $cv_pos);601 $compiler_info = substr($compiler_info, (strrpos($compiler_info, ' ') + 1));602 if(is_numeric($compiler_info))603 {604 // Right now Clang/LLVM uses SVN system and their revisions are only numeric605 $clang_version .= ' (SVN ' . $compiler_info . ')';606 }607 }608 $compiler_info = 'Clang ' . $clang_version;609 }610 else611 {612 $compiler_info = null;613 }614 }615 else616 {617 $compiler_info = substr($compiler_info, 0, strpos($compiler_info, PHP_EOL));618 }619 // Clang620 if(empty($compiler_info) && stripos($compiler_info, 'not found'))621 {622 // At least with Clang ~3.0 the -dumpversion is reporting '4.2.1' ratherthan the useful information...623 // This is likely just for GCC command compatibility, so only use this as a fallback624 $compiler_info = 'Clang ' . trim(shell_exec('clang -dumpversion 2> /dev/null'));625 }626 $compilers['clang'] = $compiler_info;627 }628 if(($llvm_ld = pts_client::executable_in_path('llvm-link')) || ($llvm_ld = pts_client::executable_in_path('llvm-ld')))629 {630 // LLVM - Low Level Virtual Machine631 // Reading the version from llvm-ld (the LLVM linker) should be safe as well for finding out version of LLVM in use632 // As of LLVM 3.2svn, llvm-ld seems to be llvm-link633 $info = trim(shell_exec($llvm_ld . ' -version 2> /dev/null'));634 if(($s = strpos($info, 'version')) != false)635 {636 $info = substr($info, 0, strpos($info, PHP_EOL, $s));637 $info = substr($info, (strrpos($info, ' ') + 1));638 if(pts_strings::is_version(str_replace('svn', null, $info)))639 {640 $compilers['llvmc'] = 'LLVM ' . $info;641 }642 }643 }644 else if(pts_client::executable_in_path('llvm-config'))645 {646 // LLVM - Low Level Virtual Machine config647 $info = trim(shell_exec('llvm-config --version 2> /dev/null'));648 if(pts_strings::is_version(str_replace('svn', null, $info)))649 {650 $compilers['llvmc'] = 'LLVM ' . $info;651 }652 }653 else if(pts_client::executable_in_path('llvmc'))654 {655 // LLVM - Low Level Virtual Machine (llvmc)656 $info = trim(shell_exec('llvmc -version 2>&1'));657 if(($s = strpos($info, 'version')) != false)658 {659 $info = substr($info, 0, strpos($info, "\n", $s));660 $info = substr($info, strrpos($info, "\n"));661 $compilers['llvmc'] = trim($info);662 }663 }664 if(pts_client::executable_in_path('suncc'))665 {666 // Sun Studio / SunCC667 $info = trim(shell_exec('suncc -V 2>&1'));668 if(($s = strpos($info, 'Sun C')) != false)669 {670 $info = substr($info, $s);671 $info = substr($info, 0, strpos($info, "\n"));672 $compilers['suncc'] = $info;673 }674 }675 if(pts_client::executable_in_path('ioc'))676 {677 // Intel Offline Compiler (IOC) SDK for OpenCL678 // -v e.g. : Intel(R) SDK for OpenCL* - Offline Compiler 2012 Command-Line Client, version 1.0.2679 $info = trim(shell_exec('ioc -version 2>&1')) . ' ';680 if(($s = strpos($info, 'Offline Compiler ')) != false)681 {682 $compilers['ioc'] = 'Intel IOC SDK';683 $sv = substr($info, ($s + 17));684 $sv = substr($sv, 0, strpos($sv, ' '));685 if(is_numeric($sv))686 {687 $compilers['ioc'] .= ' ' . $sv;688 }689 if(($s = strpos($info, 'version ')) != false)690 {691 $sv = substr($info, ($s + 8));692 $sv = substr($sv, 0, strpos($sv, ' '));693 if(pts_strings::is_version($sv))694 {695 $compilers['ioc'] .= ' v' . $sv;696 }697 }698 }699 }700 if(pts_client::executable_in_path('icc'))701 {702 // Intel C++ Compiler703 $compilers['icc'] = 'ICC';704 }705 if(phodevi::is_macosx() && pts_client::executable_in_path('xcodebuild'))706 {707 $xcode = phodevi_osx_parser::read_osx_system_profiler('SPDeveloperToolsDataType', 'Xcode');708 $xcode = substr($xcode, 0, strpos($xcode, ' '));709 if($xcode)710 {711 $compilers['Xcode'] = 'Xcode ' . $xcode;712 }713 }714 if(($nvcc = pts_client::executable_in_path('nvcc')) || is_executable(($nvcc = '/usr/local/cuda/bin/nvcc')))715 {716 // Check outside of PATH too since by default the CUDA Toolkit goes to '/usr/local/cuda/' and relies upon user to update system717 // NVIDIA CUDA Compiler Driver718 $nvcc = shell_exec($nvcc . ' --version 2>&1');719 if(($s = strpos($nvcc, 'release ')) !== false)720 {721 $nvcc = str_replace(array(','), null, substr($nvcc, ($s + 8)));722 $nvcc = substr($nvcc, 0, strpos($nvcc, ' '));723 if(pts_strings::is_version($nvcc))724 {725 $compilers['CUDA'] = 'CUDA ' . $nvcc;726 }727 }728 }729 // Try to make the compiler that's used by default to appear first730 if(pts_client::read_env('CC') && isset($compilers[basename(pts_strings::first_in_string(pts_client::read_env('CC'), ' '))]))731 {732 $cc_env = basename(pts_strings::first_in_string(pts_client::read_env('CC'), ' '));733 $default_compiler = $compilers[$cc_env];734 unset($compilers[$cc_env]);735 array_unshift($compilers, $default_compiler);736 }737 else if(pts_client::executable_in_path('cc') && is_link(pts_client::executable_in_path('cc')))738 {739 $cc_link = basename(readlink(pts_client::executable_in_path('cc')));740 if(isset($compilers[$cc_link]))741 {742 $default_compiler = $compilers[$cc_link];743 unset($compilers[pts_client::read_env('CC')]);744 array_unshift($compilers, $default_compiler);745 }746 }747 return implode(' + ', array_unique($compilers));748 }749 public static function sw_kernel_string()750 {751 return trim(phodevi::read_property('system', 'kernel') . ' (' . phodevi::read_property('system', 'kernel-architecture') . ') ' . phodevi::read_property('system', 'kernel-date'));752 }753 public static function sw_kernel_date()754 {755 $date = null;756 $k = phodevi::read_property('system', 'kernel');757 if(strpos($k, '99') !== false || stripos($k, 'rc') !== false)758 {759 // For now at least only report kernel build date when it looks like it's a devel kernel760 $v = php_uname('v');761 if(($x = stripos($v, 'SMP ')) !== false)762 {763 $v = substr($v, ($x + 4));764 $date = strtotime($v);765 if($date != false)766 {767 $date = date('Ymd', $date);768 }769 }770 }771 return $date;772 }773 public static function sw_kernel()774 {775 return php_uname('r');776 }777 public static function sw_kernel_parameters()778 {779 $parameters = null;780 if(is_file('/proc/cmdline') && is_file('/proc/modules'))781 {782 $modules = array();783 foreach(explode(PHP_EOL, pts_file_io::file_get_contents('/proc/modules')) as $module_line)784 {785 $module_line = explode(' ', $module_line);786 if(isset($module_line[0]) && !empty($module_line[0]))787 {788 array_push($modules, $module_line[0]);789 }790 }791 if(!empty($modules))792 {793 $to_report = array();794 $cmdline = explode(' ', pts_file_io::file_get_contents('/proc/cmdline'));795 foreach($cmdline as $option)796 {797 if(($t = strpos($option, '.')) !== false)798 {799 if(in_array(substr($option, 0, $t), $modules))800 {801 array_push($to_report, $option);802 }803 }804 }805 if(!empty($to_report))806 {807 $parameters = implode(' ', $to_report);808 }809 }810 }811 return $parameters;812 }813 public static function sw_kernel_architecture()814 {815 // Find out the kernel archiecture816 if(phodevi::is_windows())817 {818 //$kernel_arch = strpos($_SERVER['PROCESSOR_ARCHITECTURE'], 64) !== false || strpos($_SERVER['PROCESSOR_ARCHITEW6432'], 64 != false) ? 'x86_64' : 'i686';819 if(isset($_SERVER['PROCESSOR_ARCHITEW6432']))820 {821 $kernel_arch = $_SERVER['PROCESSOR_ARCHITEW6432'] == 'AMD64' ? 'x86_64' : 'i686';822 }823 else824 {825 $kernel_arch = 'x86_64';826 }827 }828 else829 {830 $kernel_arch = php_uname('m');831 switch($kernel_arch)832 {833 case 'X86-64':834 case 'amd64':835 $kernel_arch = 'x86_64';836 break;837 case 'i86pc':838 case 'i586':839 case 'i686-AT386':840 $kernel_arch = 'i686';841 break;842 }843 }844 return $kernel_arch;845 }846 public static function sw_os_version()847 {848 // Returns OS version849 if(phodevi::is_macosx())850 {851 $os = phodevi_osx_parser::read_osx_system_profiler('SPSoftwareDataType', 'SystemVersion');852 853 $start_pos = strpos($os, '.');854 $end_pos = strrpos($os, '.');855 $start_pos = strrpos(substr($os, 0, $start_pos), ' ');856 $end_pos = strpos($os, ' ', $end_pos);857 858 $os_version = substr($os, $start_pos + 1, $end_pos - $start_pos);859 }860 else if(phodevi::is_linux())861 {862 $os_version = phodevi_linux_parser::read_lsb('Release');863 if($os_version == null)864 {865 if(is_readable('/etc/os-release'))866 $os_release = parse_ini_file('/etc/os-release');867 else if(is_readable('/usr/lib/os-release'))868 $os_release = parse_ini_file('/usr/lib/os-release');869 else870 $os_release = null;871 if(isset($os_release['VERSION_ID']) && !empty($os_release['VERSION_ID']))872 {873 $os_version = $os_release['VERSION_ID'];874 }875 else if(isset($os_release['VERSION']) && !empty($os_release['VERSION']))876 {877 $os_version = $os_release['VERSION'];878 }879 $os_version = pts_strings::keep_in_string($os_version, pts_strings::CHAR_LETTER | pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DECIMAL | pts_strings::CHAR_SPACE | pts_strings::CHAR_DASH | pts_strings::CHAR_UNDERSCORE);880 }881 }882 else883 {884 $os_version = php_uname('r');885 }886 887 return $os_version;888 }889 public static function sw_operating_system()890 {891 if(!PTS_IS_CLIENT)892 {893 // TODO: Figure out why this function is sometimes called from OpenBenchmarking.org....894 return false;895 }896 // Determine the operating system release897 if(phodevi::is_linux())898 {899 $vendor = phodevi_linux_parser::read_lsb_distributor_id();900 if($vendor == null)901 {902 if(is_readable('/etc/os-release'))903 $os_release = parse_ini_file('/etc/os-release');904 else if(is_readable('/usr/lib/os-release'))905 $os_release = parse_ini_file('/usr/lib/os-release');906 else907 $os_release = null;908 if(isset($os_release['PRETTY_NAME']) && !empty($os_release['PRETTY_NAME']))909 {910 $vendor = $os_release['PRETTY_NAME'];911 }912 else if(isset($os_release['NAME']) && !empty($os_release['NAME']))913 {914 $vendor = $os_release['NAME'];915 }916 }917 if(($x = stripos($vendor, ' for ')) !== false)918 {919 $vendor = substr($vendor, 0, $x);920 }921 $vendor = str_replace(array(' Software'), null, $vendor);922 }923 else if(phodevi::is_hurd())924 {925 $vendor = php_uname('v');926 }927 else928 {929 $vendor = null;930 }931 $version = phodevi::read_property('system', 'os-version');932 if(!$vendor)933 {934 $os = null;935 // Try to detect distro for those not supplying lsb_release936 $files = pts_file_io::glob('/etc/*-version');937 for($i = 0; $i < count($files) && $os == null; $i++)938 {939 $file = file_get_contents($files[$i]);940 if(trim($file) != null)941 {942 $os = substr($file, 0, strpos($file, "\n"));943 }944 }945 946 if($os == null)947 {948 $files = pts_file_io::glob('/etc/*-release');949 for($i = 0; $i < count($files) && $os == null; $i++)950 {951 $file = file_get_contents($files[$i]);952 if(trim($file) != null)953 {954 $proposed_os = substr($file, 0, strpos($file, PHP_EOL));955 if(strpos($proposed_os, '=') == false)956 {957 $os = $proposed_os;958 }959 }960 else if($i == (count($files) - 1))961 {962 $os = ucwords(substr(($n = basename($files[$i])), 0, strpos($n, '-')));963 } 964 }965 }966 if($os == null && is_file('/etc/release'))967 {968 $file = file_get_contents('/etc/release');969 $os = substr($file, 0, strpos($file, "\n"));970 }971 if($os == null && is_file('/etc/palm-build-info'))972 {973 // Palm / webOS Support974 $os = phodevi_parser::parse_equal_delimited_file('/etc/palm-build-info', 'PRODUCT_VERSION_STRING');975 }976 if($os == null)977 {978 if(phodevi::is_windows())979 {980 $os = trim(exec('ver'));981 }982 if(is_file('/etc/debian_version'))983 {984 $os = 'Debian ' . php_uname('s') . ' ' . ucwords(pts_file_io::file_get_contents('/etc/debian_version'));985 }986 else987 {988 $os = php_uname('s');989 }990 }991 else if(strpos($os, ' ') === false)992 {993 // The OS string is only one word, likely a problem...994 if(is_file('/etc/arch-release') && stripos($os, 'Arch') === false)995 {996 // On at least some Arch installs (ARM) the file is empty so would have missed above check997 $os = trim('Arch Linux ' . $os);998 }999 }1000 }1001 else if(stripos($vendor, $version) === false)1002 {1003 $os = $vendor . ' ' . $version;1004 }1005 else1006 {1007 $os = $vendor;1008 }1009 if(($break_point = strpos($os, ':')) > 0)1010 {1011 $os = substr($os, $break_point + 1);1012 }1013 1014 if(phodevi::is_macosx())1015 {1016 $os = phodevi_osx_parser::read_osx_system_profiler('SPSoftwareDataType', 'SystemVersion');1017 }1018 if(($break_point = strpos($os, '(')) > 0)1019 {1020 $os = substr($os, 0, $break_point);1021 }1022 $os = trim($os);1023 return $os;1024 }1025 public static function sw_desktop_environment()1026 {1027 $desktop = null;1028 $desktop_environment = null;1029 $desktop_version = null;1030 $desktop_session = pts_client::read_env('DESKTOP_SESSION');1031 if(pts_client::is_process_running('gnome-shell'))1032 {1033 // GNOME 3.0 / GNOME Shell1034 $desktop_environment = 'GNOME Shell';1035 if(pts_client::executable_in_path('gnome-shell'))1036 {1037 $desktop_version = pts_strings::last_in_string(trim(shell_exec('gnome-shell --version 2> /dev/null')));1038 }1039 }1040 else if(pts_client::is_process_running('gnome-panel') || $desktop_session == 'gnome')1041 {1042 // GNOME1043 $desktop_environment = 'GNOME';1044 if(pts_client::executable_in_path('gnome-about'))1045 {1046 $desktop_version = pts_strings::last_in_string(trim(shell_exec('gnome-about --version 2> /dev/null')));1047 }1048 else if(pts_client::executable_in_path('gnome-session'))1049 {1050 $desktop_version = pts_strings::last_in_string(trim(shell_exec('gnome-session --version 2> /dev/null')));1051 }1052 }1053 else if(pts_client::is_process_running('unity-2d-panel') || $desktop_session == 'ubuntu-2d')1054 {1055 // Canonical / Ubuntu Unity 2D Desktop1056 $desktop_environment = 'Unity 2D';1057 if(pts_client::executable_in_path('unity'))1058 {1059 $desktop_version = pts_strings::last_in_string(trim(shell_exec('unity --version 2> /dev/null')));1060 }1061 }1062 else if(pts_client::is_process_running('unity-panel-service') || $desktop_session == 'ubuntu')1063 {1064 // Canonical / Ubuntu Unity Desktop1065 $desktop_environment = 'Unity';1066 if(pts_client::executable_in_path('unity'))1067 {1068 $desktop_version = pts_strings::last_in_string(trim(shell_exec('unity --version 2> /dev/null')));1069 }1070 }1071 else if($desktop_session == 'mate')1072 {1073 $desktop_environment = 'MATE';1074 if(pts_client::executable_in_path('mate-about'))1075 {1076 $desktop_version = pts_strings::last_in_string(trim(shell_exec('mate-about --version 2> /dev/null')));1077 }1078 }1079 else if(($kde5 = pts_client::is_process_running('kded5')))1080 {1081 // KDE 5.x1082 $desktop_environment = 'KDE Frameworks 5';1083 $desktop_version = null; // TODO XXX1084 }1085 else if(($dde = pts_client::is_process_running('dde-desktop')))1086 {1087 // KDE 5.x1088 $desktop_environment = 'Deepin Desktop Environment';1089 $desktop_version = null; // TODO XXX1090 }1091 else if(($kde4 = pts_client::is_process_running('kded4')) || pts_client::is_process_running('kded'))1092 {1093 // KDE 4.x1094 $desktop_environment = 'KDE';1095 $kde_output = trim(shell_exec(($kde4 ? 'kde4-config' : 'kde-config') . ' --version 2>&1'));1096 $kde_lines = explode("\n", $kde_output);1097 for($i = 0; $i < count($kde_lines) && empty($desktop_version); $i++)1098 {1099 $line_segments = pts_strings::colon_explode($kde_lines[$i]);1100 if(in_array($line_segments[0], array('KDE', 'KDE Development Platform')) && isset($line_segments[1]))1101 {1102 $v = trim($line_segments[1]);1103 if(($cut = strpos($v, ' ')) > 0)1104 {1105 $v = substr($v, 0, $cut);1106 }1107 $desktop_version = $v;1108 }1109 }1110 }1111 else if(pts_client::is_process_running('chromeos-wm'))1112 {1113 $chrome_output = trim(shell_exec('chromeos-wm -version'));1114 if($chrome_output == 'chromeos-wm')1115 {1116 // No version actually reported1117 $chrome_output = 'Chrome OS';1118 }1119 $desktop_environment = $chrome_output;1120 }1121 else if(pts_client::is_process_running('lxsession') || $desktop_session == 'lxde')1122 {1123 $lx_output = trim(shell_exec('lxpanel --version'));1124 $version = substr($lx_output, strpos($lx_output, ' ') + 1);1125 $desktop_environment = 'LXDE';1126 $desktop_version = $version;1127 }1128 else if(pts_client::is_process_running('xfce4-session') || pts_client::is_process_running('xfce-mcs-manager') || $desktop_session == 'xfce')1129 {1130 // Xfce 4.x1131 $desktop_environment = 'Xfce';1132 $xfce_output = trim(shell_exec('xfce4-session-settings --version 2>&1'));1133 if(($open = strpos($xfce_output, '(Xfce')) > 0)1134 {1135 $xfce_output = substr($xfce_output, strpos($xfce_output, ' ', $open) + 1);1136 $desktop_version = substr($xfce_output, 0, strpos($xfce_output, ')'));1137 }1138 }1139 else if(pts_client::is_process_running('sugar-session'))1140 {1141 // Sugar Desktop Environment (namely for OLPC)1142 $desktop_environment = 'Sugar';1143 $desktop_version = null; // TODO: where can the Sugar version be figured out?1144 }1145 else if(pts_client::is_process_running('openbox'))1146 {1147 $desktop_environment = 'Openbox';1148 $openbox_output = trim(shell_exec('openbox --version 2>&1'));1149 if(($openbox_d = stripos($openbox_output, 'Openbox ')) !== false)1150 {1151 $openbox_output = substr($openbox_output, ($openbox_d + 8));1152 $desktop_version = substr($openbox_output, 0, strpos($openbox_output, PHP_EOL));1153 }1154 }1155 else if(pts_client::is_process_running('cinnamon'))1156 {1157 $desktop_environment = 'Cinnamon';1158 $desktop_version = pts_strings::last_in_string(trim(shell_exec('cinnamon --version 2> /dev/null')));1159 }1160 else if(pts_client::is_process_running('enlightenment'))1161 {1162 $desktop_environment = 'Enlightenment';1163 $desktop_version = null; // No known -v / --version command on any Enlightenment component1164 }1165 else if(pts_client::is_process_running('consort-panel'))1166 {1167 $desktop_environment = 'Consort';1168 $desktop_version = null; // TODO: Haven't tested Consort Desktop yet1169 }1170 else if(pts_client::is_process_running('razor-desktop'))1171 {1172 $desktop_environment = 'Razor-qt';1173 $desktop_version = null; // TODO: Figure out how to determine razor version1174 }1175 else if(pts_client::is_process_running('icewm'))1176 {1177 $desktop_environment = 'IceWM';1178 $desktop_version = null;1179 }1180 if(!empty($desktop_environment))1181 {1182 $desktop = $desktop_environment;1183 if(!empty($desktop_version) && pts_strings::is_version($desktop_version))1184 {1185 $desktop .= ' ' . $desktop_version;1186 }1187 }1188 return $desktop;1189 }1190 public static function sw_display_server()1191 {1192 $display_servers = array();1193 if(phodevi::is_windows())1194 {1195 // TODO: determine what to do for Windows support1196 }1197 else1198 {1199 if(pts_client::is_process_running('weston'))1200 {1201 $info = 'Wayland Weston';1202 $vinfo = trim(shell_exec('weston --version 2>&1'));1203 if(pts_strings::last_in_string($vinfo) && pts_strings::is_version(pts_strings::last_in_string($vinfo)))1204 {1205 $info .= ' ' . pts_strings::last_in_string($vinfo);1206 }1207 array_push($display_servers, $info);1208 }1209 if(pts_client::is_process_running('unity-system-compositor'))1210 {1211 $unity_system_comp = trim(str_replace('unity-system-compositor', null, shell_exec('unity-system-compositor --version 2>&1')));1212 if(pts_strings::is_version($unity_system_comp))1213 {1214 array_push($display_servers, 'Unity-System-Compositor ' . $unity_system_comp);1215 }1216 }1217 if(($x_bin = (is_executable('/usr/libexec/Xorg.bin') ? '/usr/libexec/Xorg.bin' : false)) || ($x_bin = pts_client::executable_in_path('Xorg')) || ($x_bin = pts_client::executable_in_path('X')))1218 {1219 // Find graphics subsystem version1220 $info = shell_exec($x_bin . ' ' . (phodevi::is_solaris() ? ':0' : '') . ' -version 2>&1');1221 $pos = (($p = strrpos($info, 'Release Date')) !== false ? $p : strrpos($info, 'Build Date'));1222 $info = trim(substr($info, 0, $pos));1223 if($pos === false || getenv('DISPLAY') == false)1224 {1225 $info = null;1226 }1227 else if(($pos = strrpos($info, '(')) === false)1228 {1229 $info = trim(substr($info, strrpos($info, ' ')));1230 }1231 else1232 {1233 $info = trim(substr($info, strrpos($info, 'Server') + 6));1234 }1235 if($info != null)1236 {1237 array_push($display_servers, 'X Server ' . $info);1238 }1239 }1240 if(pts_client::is_process_running('surfaceflinger'))1241 {1242 array_push($display_servers, 'SurfaceFlinger');1243 }1244 if(pts_client::is_process_running('gnome-shell-wayland'))1245 {1246 array_push($display_servers, 'GNOME Shell Wayland');1247 }1248 if(empty($display_servers) && getenv('WAYLAND_DISPLAY') != false)1249 {1250 array_push($display_servers, 'Wayland');1251 }1252 }1253 return implode(' + ', $display_servers);1254 }1255 public static function sw_display_driver($with_version = true)1256 {1257 if(phodevi::is_windows())1258 {1259 return null;1260 }1261 $display_driver = phodevi::read_property('system', 'dri-display-driver');1262 if(empty($display_driver))1263 {1264 if(phodevi::is_ati_graphics() && phodevi::is_linux())1265 {1266 $display_driver = 'fglrx';1267 }1268 else if(phodevi::is_nvidia_graphics() || is_file('/proc/driver/nvidia/version'))1269 {1270 $display_driver = 'nvidia';1271 }1272 else if((phodevi::is_mesa_graphics() || phodevi::is_bsd()) && stripos(phodevi::read_property('gpu', 'model'), 'NVIDIA') !== false)1273 {1274 if(is_file('/sys/class/drm/version'))1275 {1276 // If there's DRM loaded and NVIDIA, it should be Nouveau1277 $display_driver = 'nouveau';1278 }1279 else1280 {1281 // The dead xf86-video-nv doesn't use any DRM1282 $display_driver = 'nv';1283 }1284 }1285 else1286 {1287 // Fallback to hopefully detect the module, takes the first word off the GPU string and sees if it is the module1288 // This works in at least the case of the Cirrus driver1289 $display_driver = strtolower(pts_strings::first_in_string(phodevi::read_property('gpu', 'model')));1290 }1291 }1292 if(!empty($display_driver))1293 {1294 $driver_version = phodevi_parser::read_xorg_module_version($display_driver . '_drv');1295 if($driver_version == false || $driver_version == '1.0.0')1296 {1297 switch($display_driver)1298 {1299 case 'amd':1300 // See if it's radeon driver1301 $driver_version = phodevi_parser::read_xorg_module_version('radeon_drv');1302 if($driver_version != false)1303 {1304 $display_driver = 'radeon';1305 }1306 // See if it's the newer AMDGPU driver1307 $driver_version = phodevi_parser::read_xorg_module_version('amdgpu_drv');1308 if($driver_version != false)1309 {1310 $display_driver = 'amdgpu';1311 }1312 break;1313 case 'vmwgfx':1314 // See if it's VMware driver1315 $driver_version = phodevi_parser::read_xorg_module_version('vmware_drv');1316 if($driver_version != false)1317 {1318 $display_driver = 'vmware';1319 }1320 break;1321 case 'radeon':1322 // RadeonHD driver also reports DRI driver as 'radeon', so try reading that instead1323 $driver_version = phodevi_parser::read_xorg_module_version('radeonhd_drv');1324 if($driver_version != false)1325 {1326 $display_driver = 'radeonhd';1327 }1328 $driver_version = phodevi_parser::read_xorg_module_version('amdgpu_drv');1329 if($driver_version != false)1330 {1331 $display_driver = 'amdgpu';1332 }1333 break;1334 case 'nvidia':1335 case 'NVIDIA':1336 case 'nouveau':1337 // NVIDIA's binary driver usually ends up reporting 1.0.01338 if(($nvs_value = phodevi_parser::read_nvidia_extension('NvidiaDriverVersion')))1339 {1340 $display_driver = 'NVIDIA';1341 $driver_version = $nvs_value;1342 }1343 else1344 {1345 // NVIDIA's binary driver appends their driver version on the end of the OpenGL version string1346 $glxinfo = phodevi_parser::software_glxinfo_version();1347 if(($pos = strpos($glxinfo, 'NVIDIA ')) != false)1348 {1349 $display_driver = 'NVIDIA';1350 $driver_version = substr($glxinfo, ($pos + 7));1351 }1352 }1353 break;1354 default:1355 if(is_readable('/sys/class/graphics/fb0/name'))1356 {1357 // This path works for at least finding NVIDIA Tegra 2 DDX (via tegra_fb)1358 $display_driver = file_get_contents('/sys/class/graphics/fb0/name');1359 $display_driver = str_replace(array('drm', '_fb'), null, $display_driver);1360 $driver_version = phodevi_parser::read_xorg_module_version($display_driver . '_drv');1361 }1362 break;1363 }1364 }1365 if($driver_version == false)1366 {1367 // If the version is empty, chances are the DDX driver string is incorrect1368 $display_driver = null;1369 // See if the VESA or fbdev driver is in use1370 foreach(array('modesetting', 'fbdev', 'vesa') as $drv)1371 {1372 $drv_version = phodevi_parser::read_xorg_module_version($drv . '_drv');1373 if($drv_version)1374 {1375 $display_driver = $drv;1376 $driver_version = $drv_version;1377 break;1378 }1379 }1380 }1381 if(!empty($driver_version) && $with_version && $driver_version != '0.0.0')1382 {1383 $display_driver .= ' ' . $driver_version;1384 // XXX: The below check is disabled since the Catalyst Version no longer seems reliably reported (circa Catalyst 13.x)1385 if(false && phodevi::is_ati_graphics() && strpos($display_driver, 'fglrx') !== false)1386 {1387 $catalyst_version = phodevi_linux_parser::read_amd_pcsdb('AMDPCSROOT/SYSTEM/LDC,Catalyst_Version');1388 if($catalyst_version != null && $catalyst_version > 10.1 && $catalyst_version != 10.5 && $catalyst_version != 11.8)1389 {1390 // This option was introduced around Catalyst 10.5 but seems to not be updated properly until Catalyst 10.11/10.121391 $display_driver .= ' Catalyst ' . $catalyst_version . '';1392 }1393 }1394 }1395 }1396 return $display_driver;1397 }1398 public static function sw_opengl_driver()1399 {1400 // OpenGL version1401 $info = null;1402 if(phodevi::is_windows())1403 {1404 $info = null; // TODO: Windows support1405 }1406 else if(pts_client::executable_in_path('nvidia-settings'))1407 {1408 $info = phodevi_parser::read_nvidia_extension('OpenGLVersion');1409 }1410 if($info == null)1411 {1412 $info = phodevi_parser::software_glxinfo_version();1413 if($info && ($pos = strpos($info, ' ')) != false && strpos($info, 'Mesa') === false)1414 {1415 $info = substr($info, 0, $pos);1416 }1417 $renderer = phodevi_parser::read_glx_renderer();1418 if($renderer && ($s = strpos($renderer, 'Gallium')) !== false)1419 {1420 $gallium = substr($renderer, $s);1421 $gallium = substr($gallium, 0, strpos($gallium, ' ', strpos($gallium, '.')));1422 $info .= ' ' . $gallium . '';1423 }1424 if($renderer && ($s = strpos($renderer, 'LLVM ')) !== false)1425 {1426 $llvm = substr($renderer, $s);1427 $llvm = substr($llvm, 0, strpos($llvm, ')'));1428 $info .= ' (' . $llvm . ')';1429 }1430 }1431 return $info;1432 }1433 public static function sw_vulkan_driver()1434 {1435 // Vulkan driver/version1436 $info = null;1437 if(isset(phodevi::$vfs->vulkaninfo))1438 {1439 if(($pos = strpos(phodevi::$vfs->vulkaninfo, 'Vulkan API Version:')) !== false)1440 {1441 $info = substr(phodevi::$vfs->vulkaninfo, $pos + 20);1442 $info = trim(substr($info, 0, strpos($info, "\n")));1443 }1444 }1445 if($info == null)1446 {1447 // A less than ideal fallback for some detection now1448 foreach(array_merge(pts_file_io::glob('/etc/vulkan/icd.d/*.json'), pts_file_io::glob('/usr/share/vulkan/icd.d/*.json')) as $icd_json)1449 {1450 $icd_json = json_decode(file_get_contents($icd_json), true);1451 if(isset($icd_json['ICD']['api_version']) && !empty($icd_json['ICD']['api_version']))1452 {1453 $info = trim($icd_json['ICD']['api_version']);1454 break;1455 }1456 }1457 }1458 return $info;1459 }1460 public static function sw_opencl_driver()1461 {1462 // OpenCL driver/version1463 $info = array();1464 if(isset(phodevi::$vfs->clinfo))1465 {1466 $sea = phodevi::$vfs->clinfo;1467 while(($pos = strpos($sea, 'Platform Version')) != false)1468 {1469 $sea = substr($sea, $pos + 18);1470 $info[] = trim(substr($sea, 0, strpos($sea, "\n")));1471 }1472 }1473 return implode(' + ', $info);1474 }...
sw_opencl_driver
Using AI Code Generation
1if (phodevi::is_linux())2{3 $opencl_driver = phodevi_system::sw_opencl_driver();4}5{6 $opencl_driver = null;7}8echo $opencl_driver;9if (phodevi::is_linux())10{11 $opencl_driver = phodevi_linux_parser::sw_opencl_driver();12}13{14 $opencl_driver = null;15}16echo $opencl_driver;17if (phodevi::is_linux())18{19 $opencl_driver = phodevi_parser::sw_opencl_driver();20}21{22 $opencl_driver = null;23}24echo $opencl_driver;25if (phodevi::is_linux())26{27 $opencl_driver = phodevi::read_property('sw_opencl_driver');28}29{30 $opencl_driver = null;31}32echo $opencl_driver;33if (phodevi::is_linux())34{35 $opencl_driver = phodevi::read_property('sw_opencl_driver');36}37{38 $opencl_driver = null;39}40echo $opencl_driver;41if (phodevi::is_linux())42{43 $opencl_driver = phodevi::read_property('sw_opencl_driver');44}45{46 $opencl_driver = null;47}48echo $opencl_driver;49if (phodevi::is_linux())50{51 $opencl_driver = phodevi::read_property('sw_opencl_driver');52}53{54 $opencl_driver = null;55}56echo $opencl_driver;57if (phodevi::is_linux())58{
sw_opencl_driver
Using AI Code Generation
1require_once 'phodevi.php';2require_once 'phodevi_opencl.php';3$opencl = new phodevi_opencl_driver();4$opencl->init();5if($opencl->is_supported())6{7 foreach($opencl->get_devices() as $device)8 {9';10 }11}12require_once 'phodevi.php';13require_once 'phodevi_opencl.php';14$opencl = new phodevi_opencl_driver();15$opencl->init();16if($opencl->is_supported())17{18 foreach($opencl->get_devices() as $device)19 {20';21 }22}23require_once 'phodevi.php';24require_once 'phodevi_opencl.php';25$opencl = new phodevi_opencl_driver();26$opencl->init();27if($opencl->is_supported())28{29 foreach($opencl->get_devices() as $device)30 {31';32 }33}34require_once 'phodevi.php';35require_once 'phodevi_opencl.php';36$opencl = new phodevi_opencl_driver();37$opencl->init();38if($opencl->is_supported())39{40 foreach($opencl->get_devices() as $device)41 {42';43 }44}45require_once 'phodevi.php';46require_once 'phodevi_opencl.php';47$opencl = new phodevi_opencl_driver();48$opencl->init();49if($opencl->is_supported())50{51 foreach($opencl->get_devices() as $device)52 {53';54 }55}56require_once 'phodevi.php';57require_once 'phodevi_opencl.php';
sw_opencl_driver
Using AI Code Generation
1include_once('/usr/share/php/phodevi/phodevi_system.php');2include_once('/usr/share/php/phodevi/phodevi_parser.php');3$opencl_driver = phodevi_system::sw_opencl_driver();4echo $opencl_driver;5include_once('/usr/share/php/phodevi/phodevi_system.php');6include_once('/usr/share/php/phodevi/phodevi_parser.php');7$opencl_driver = phodevi_system::sw_opencl_driver();8echo phodevi_parser::readable_format($opencl_driver);9include_once('/usr/share/php/phodevi/phodevi_system.php');10include_once('/usr/share/php/phodevi/phodevi_parser.php');11$opencl_driver = phodevi_system::sw_opencl_driver();12echo phodevi_parser::readable_format($opencl_driver, 'OpenCL Driver');13include_once('/usr/share/php/phodevi/phodevi_system.php');14include_once('/usr/share/php/phodevi/phodevi_parser.php');15$opencl_driver = phodevi_system::sw_opencl_driver();16echo phodevi_parser::readable_format($opencl_driver, 'OpenCL Driver', 'OpenCL Driver: ');17include_once('/usr/share/php/phodevi/phodevi_system.php');18include_once('/usr/share/php/phodevi/phodevi_parser.php');19$opencl_driver = phodevi_system::sw_opencl_driver();20echo phodevi_parser::readable_format($opencl_driver, 'OpenCL Driver', 'OpenCL Driver: ', 'N/A');21include_once('/usr/share/php/phodevi/phodevi_system.php');22include_once('/usr/share/php/phodevi/phodevi_parser.php');23$opencl_driver = phodevi_system::sw_opencl_driver();24echo phodevi_parser::readable_format($opencl_driver, 'OpenCL Driver', 'OpenCL Driver: ', 'N/A', 'N/A');
sw_opencl_driver
Using AI Code Generation
1include_once 'phodevi.php';2$driver = phodevi::read_property('system', 'sw_opencl_driver');3$driver_name = $driver[0];4$driver_version = $driver[1];5$driver_date = $driver[2];6$driver_status = $driver[3];7$driver_architecture = $driver[4];8$driver_opencl_version = $driver[5];9$driver_opencl_version_date = $driver[6];10$driver_opencl_version_status = $driver[7];11";12";13";14";15";16";17";18";19include_once 'phodevi.php';20$devices = phodevi::read_property('system', 'sw_opencl_devices');21$device_name = $devices[0];22$device_vendor = $devices[1];23$device_type = $devices[2];24$device_opencl_version = $devices[3];
sw_opencl_driver
Using AI Code Generation
1$opencl_driver = phodevi_system::sw_opencl_driver();2if($opencl_driver != null)3{4 echo $opencl_driver;5}6{7 echo "null";8}9$opencl_driver = phodevi_system::sw_opencl_driver();10if($opencl_driver != null)11{12 echo $opencl_driver;13}14{15 echo "null";16}17Recommended Posts: PHP | phodevi_system::sw_opencl_supported() function18PHP | phodevi_system::sw_opencl_status() function19PHP | phodevi_system::sw_opencl_version() function20PHP | phodevi_system::sw_opencl_devices() function21PHP | phodevi_system::sw_opencl_device() function22PHP | phodevi_system::sw_opencl_device_count() function
sw_opencl_driver
Using AI Code Generation
1include_once('/usr/share/php/phodevi/phodevi.php');2include_once('/usr/share/php/phodevi/system.php');3$opencl_driver = phodevi_system::sw_opencl_driver();4if($opencl_driver == 'opencl-driver-not-installed')5{6 echo 'OpenCL driver is not installed';7}8{9 echo 'OpenCL driver is installed';10}11include_once('/usr/share/php/phodevi/phodevi.php');12include_once('/usr/share/php/phodevi/system.php');13$opencl_driver = phodevi_system::sw_opencl_driver();14if($opencl_driver == 'opencl-driver-not-installed')15{16 echo 'OpenCL driver is not installed';17}18{19 echo 'OpenCL driver is installed';20}21include_once('/usr/share/php/phodevi/phodevi.php');22include_once('/usr/share/php/phodevi/system.php');23$opencl_driver = phodevi_system::sw_opencl_driver();24if($opencl_driver == 'opencl-driver-not-installed')25{26 echo 'OpenCL driver is not installed';27}28{29 echo 'OpenCL driver is installed';30}31include_once('/usr/share/php/phodevi/phodevi.php');32include_once('/usr/share/php/ph
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with sw_opencl_driver on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!