Skip to content

Commit

Permalink
Switch Windows OpenCL build instructions to msys2.
Browse files Browse the repository at this point in the history
  • Loading branch information
davecgh committed Sep 6, 2023
1 parent 9e1209a commit 709d7c9
Showing 1 changed file with 46 additions and 36 deletions.
82 changes: 46 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,23 +118,57 @@ go build -tags opencladl

### Windows

#### Pre-Requisites
#### OpenCL Build Instructions (Works with Both NVIDIA and AMD)

##### OpenCL Pre-Requisites

- Download and install the official Go Windows binaries from [https://golang.dl/](https://golang.org/dl/)
- Download and install Git for Windows from [https://git-for-windows.github.io/](https://git-for-windows.github.io/)
* Make sure to select the Git-Bash option when prompted
- Download the MinGW-w64 installer from [https://sourceforge.net/projects/mingw-w64/files/Toolchains targetting Win32/Personal Builds/mingw-builds/installer/](https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/)
* Select the x64 toolchain and use defaults for the other questions
- `git clone https://github.com/decred/gominer`
- Download OpenCL SDK from [https://github.com/GPUOpen-LibrariesAndSDKs/OCL-SDK/releases/tag/1.0](https://github.com/GPUOpen-LibrariesAndSDKs/OCL-SDK/releases/tag/1.0)
- Unzip or untar the downloaded `lightOCLSDK` archive to `C:\appsdk`
* Ensure the folders `C:\appsdk\include` and `C:\appsdk\lib` are populated
- Download and install [MSYS2](https://www.msys2.org/)
- Make sure you uncheck `Run MSYS2 now.`
- Launch the `MSYS2 MINGW64` shell from the start menu
- NOTE: The `MSYS2` installer will launch the `UCRT64` shell by default if
you didn't uncheck `Run MSYS2 now` as instructed. That shell will not work,
so close it if you forgot to uncheck it in the installer.
- From within the `MSYS2 MINGW64` shell enter the following commands to install
`gcc`, `git`, `go`, `unzip`, and the `gominer` source code
- `pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-tools mingw-w64-x86_64-go git unzip`
- `wget https://github.com/GPUOpen-LibrariesAndSDKs/OCL-SDK/files/1406216/lightOCLSDK.zip`
- `unzip -d /c/appsdk lightOCLSDK.zip`
- `git clone https://github.com/decred/gominer`
- **Close the `MSYS2 MINGW64` and relaunch it**
- NOTE: This is necessary to ensure all of the new environment variables are set properly
- Go to the appropriate section for either NVIDIA or AMD depending on which type of GPU you have

###### OpenCL with NVIDIA

- Build gominer
- `cd ~/gominer`
- `go build -tags opencl`
- Test `gominer` detects your GPU
- `./gominer -l`

##### OpenCL with AMD

#### Build Instructions
- Change to the library directory C:\appsdk\lib\x86_64
* `cd /c/appsdk/lib/x86_64`
- Copy and prepare the ADL library for linking
- `cp /c/Windows/SysWOW64/atiadlxx.dll .`
- `gendef atiadlxx.dll`
- `dlltool --output-lib libatiadlxx.a --input-def atiadlxx.def`
- Build gominer
- `cd ~/gominer`
- `go build -tags opencl`
- Test `gominer` detects your GPU
- `./gominer -l`

##### CUDA
#### CUDA Build Instructions (NVIDIA only)

**NOTE**: The CUDA version of the Blake3 gominer is not yet compatible to
windows.
**NOTE**: The CUDA version of the Blake3 gominer is not yet compatible with
Windows.

###### Pre-Requisites
##### Pre-Requisites

- Download Microsoft Visual Studio 2013 from [https://www.microsoft.com/en-us/download/details.aspx?id=44914](https://www.microsoft.com/en-us/download/details.aspx?id=44914)
- Add `C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin` to your PATH
Expand All @@ -148,27 +182,3 @@ windows.
- Copy dependencies:
* ```copy obj/decred.dll .```
* ```copy nvidia/NVSMI/nvml.dll .```

##### OpenCL/ADL

###### Pre-Requisites

- Download OpenCL SDK from [https://github.com/GPUOpen-LibrariesAndSDKs/OCL-SDK/releases/tag/1.0](https://github.com/GPUOpen-LibrariesAndSDKs/OCL-SDK/releases/tag/1.0)
- Unzip or untar the downloaded `lightOCLSDK` archive to `C:\appsdk`
* Ensure the folders `C:\appsdk\include` and `C:\appsdk\lib` are populated
- Change to the library directory C:\appsdk\lib\x86_64
* `cd /D C:\appsdk\lib\x86_64`
- Copy and prepare the ADL library for linking
* `copy c:\Windows\SysWOW64\atiadlxx.dll .`
* `gendef atiadlxx.dll`
* `dlltool --output-lib libatiadlxx.a --input-def atiadlxx.def`

###### Steps

- For OpenCL:
* `cd gominer`
* `go build -tags opencl`

- For OpenCL with AMD Device Library (ADL) support:
* `cd gominer`
* `go build -tags opencladl`

0 comments on commit 709d7c9

Please sign in to comment.