install-opencl.ps1 1.33 KB
Newer Older
1
2
3
4
Write-Output "Installing OpenCL CPU platform"

$installer = "AMD-APP-SDKInstaller-v3.0.130.135-GA-windows-F-x64.exe"

5
6
Write-Output "Downloading OpenCL platform installer"
$ProgressPreference = "SilentlyContinue"  # progress bar bug extremely slows down download speed
7
8
9
10
11
$params = @{
    OutFile = "$installer"
    Uri = "https://github.com/microsoft/LightGBM/releases/download/v2.0.12/$installer"
}
Invoke-WebRequest @params
12

13
if (Test-Path "$installer") {
14
    Write-Output "Successfully downloaded OpenCL platform installer"
15
} else {
16
17
18
19
    Write-Output "Unable to download OpenCL platform installer"
    Write-Output "Setting EXIT"
    $host.SetShouldExit(-1)
    exit 1
20
21
}

22
# Install OpenCL platform from installer executable
23
Write-Output "Running OpenCL installer"
24
25
26
Invoke-Command -ScriptBlock {
    Start-Process "$installer" -ArgumentList '/S /V"/quiet /norestart /passive /log opencl.log"' -Wait
}
27
28

$property = Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors
29
if ($null -eq $property) {
30
31
32
33
34
35
    Write-Output "Unable to install OpenCL CPU platform"
    Write-Output "OpenCL installation log:"
    Get-Content "opencl.log"
    Write-Output "Setting EXIT"
    $host.SetShouldExit(-1)
    exit 1
36
} else {
37
38
39
    Write-Output "Successfully installed OpenCL CPU platform"
    Write-Output "Current OpenCL drivers:"
    Write-Output $property
40
}