def HandleGpaDx11GetDeviceInfo(src, dest, fileName, version, copyDest): TEMP_DIR = os.environ.get("TEMP") if TEMP_DIR is None: DEST_PATH = scriptRoot else: DEST_PATH = TEMP_DIR GpaDx11GetDeviceInfoArchiveFileName = fileName GpaDx11GetDeviceInfoArchiveAbsPath = os.path.join( DEST_PATH, GpaDx11GetDeviceInfoArchiveFileName) if dest != "default": DEST_PATH = dest copyArchive = os.path.join(scriptRoot, "..", copyDest) # clean up targetPath, collapsing any ../ and converting / to \ for Windows copyArchive = os.path.normpath(copyArchive) dx11DeviceInfoPlatform64File = version + "/Bin/x64/GPUPerfAPIDXGetAMDDeviceInfo-x64.dll" dx11DeviceInfoPlatformFile = version + "/Bin/x86/GPUPerfAPIDXGetAMDDeviceInfo.dll" dx11DeviceInfoPlatform64FileAbsPath = os.path.join( copyArchive, dx11DeviceInfoPlatform64File) dx11DeviceInfoPlatformFileAbsPath = os.path.join( copyArchive, dx11DeviceInfoPlatformFile) if (os.path.isfile(dx11DeviceInfoPlatform64FileAbsPath) & os.path.isfile(dx11DeviceInfoPlatformFileAbsPath)): print("The DXGetAMDDeviceInfo libraries already exist") return if (GpaUtils.Download(src, DEST_PATH, GpaDx11GetDeviceInfoArchiveFileName)): print("GPAGetDeviceInfo version " + version + " downloaded successfully") dx11getDeviceInfoArchive = zipfile.ZipFile( GpaDx11GetDeviceInfoArchiveAbsPath) dx11getDeviceInfoArchive.extract(dx11DeviceInfoPlatform64File, copyArchive) dx11getDeviceInfoArchive.extract(dx11DeviceInfoPlatformFile, copyArchive) dx11getDeviceInfoArchive.close() os.remove(GpaDx11GetDeviceInfoArchiveAbsPath) if (os.path.isfile(dx11DeviceInfoPlatform64FileAbsPath) & os.path.isfile(dx11DeviceInfoPlatformFileAbsPath)): print( "The DXGetAMDDeviceInfo libraries have been copied successfully" ) return print("The DXGetAMDDeviceInfo libraries were unable to be copied") return else: print("Unable to download the GPUPerfAPI archive") return
def HandleVulkan(vulkanSrc, VulkanDest, vulkanInstallerFileName, version, installationPath): VULKAN_SDK = os.environ.get("VULKAN_SDK") if True == args.skipvulkansdk: if VULKAN_SDK is None: print("Please make sure the VULKAN_SDK env var is set to a valid Vulkan SDK installation, or use the --downloadvulkansdk or --skipvulkansdk option.") return VulkanSDKFile = vulkanInstallerFileName if "Linux" == MACHINE_OS: LINUX_HOME=os.environ.get("HOME") DEST_PATH=LINUX_HOME if ("default" != installationPath): if (not os.path.isdir(installationPath)): os.makedirs(installationPath) else: installationPath = LINUX_HOME else: TEMP_DIR=os.environ.get("TEMP") if TEMP_DIR is None: DEST_PATH=scriptRoot else: DEST_PATH=TEMP_DIR installationPath = scriptRoot VulkanSDKInstaller = os.path.join(DEST_PATH, VulkanSDKFile) if VulkanDest != "default": DEST_PATH = VulkanDest os.chdir(installationPath) if False == args.downloadvulkansdk: if "Windows" == MACHINE_OS: if VULKAN_SDK is not None: if (os.path.isfile(VULKAN_SDK + VULKAN_LIB_PATH + VULKAN_LIB_FILENAME)) and (os.path.isfile(VULKAN_SDK + VULKAN_HEADER_FILE_PATH)): print("The Vulkan SDK is already installed") return if "Linux" == MACHINE_OS: installRootPath = os.path.join(installationPath, "VulkanSDK", version, "x86_64") if (os.path.isfile(installRootPath + VULKAN_LIB_PATH + VULKAN_LIB_FILENAME)) and (os.path.isfile(installRootPath + VULKAN_HEADER_FILE_PATH)): print("The Vulkan SDK is already installed") return vulkanSrc = vulkanSrc + "?Human=true" if (GpaUtils.Download(vulkanSrc, DEST_PATH, VulkanSDKFile)): st = os.stat(VulkanSDKInstaller) os.chmod(VulkanSDKInstaller, st.st_mode | stat.S_IEXEC) print("Starting VulkanSDK installer. Please follow the instructions...") print(VulkanSDKInstaller) installVulkanSDKProcess = subprocess.Popen([VulkanSDKInstaller], shell = True) installVulkanSDKProcess.wait() if "Windows" == MACHINE_OS: # Check if VULKAN_SDK environment variable is set VulkanSDKInstalledPath = os.environ.get("VULKAN_SDK") if (VulkanSDKInstalledPath is None): print("The VULKAN_SDK environment variable is not set. This means that either the installation failed or you might need to restart the command shell in which you are running to refresh the environment variables.") else: if (os.path.isfile(VulkanSDKInstalledPath + VULKAN_LIB_PATH + VULKAN_LIB_FILENAME)) and (os.path.isfile(VulkanSDKInstalledPath + VULKAN_HEADER_FILE_PATH)): print("The Vulkan SDK has been installed") if "Linux" == MACHINE_OS: installRootPath = os.path.join(installationPath, "VulkanSDK", version, "x86_64") if (os.path.isfile(installRootPath + VULKAN_LIB_PATH + VULKAN_LIB_FILENAME)) and (os.path.isfile(installRootPath + VULKAN_HEADER_FILE_PATH)): print("The Vulkan SDK has been installed") os.remove(VulkanSDKInstaller) os.chdir(scriptRoot) return