fireice-uk / xmr-stak

Free Monero RandomX Miner and unified CryptoNight miner
GNU General Public License v3.0
4.05k stars 1.79k forks source link

Continuous integration on Azure pipeline (Windows env) #2154

Open albertogeniola opened 5 years ago

albertogeniola commented 5 years ago

Hi all, I've succeeded in setting up a AppVeyor pipeline to compile my version of XMR-Stak (btw, very nice work with the .appveyor.yml file you provided). Now, I wanted to do the same on Azure pipelines, which seems to be very nice.

So, I've converted the entire AppVeyor script into corresponding Azure pipeline tasks. The problem is that the CMake command fails complaining about a missing C compiler:

-- The CXX compiler identification is unknown
##[error]CMake Error at CMakeLists.txt:1 (project):
No CMAKE_C_COMPILER could be found.

The reason why this hapens seems to be related to the missing compiler ("Visual Studio 15 2017 Win64" -T v141,host=x64). In fact, when running the following command, the system complains about not being able to find the requested file.

call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=14.11

So, in other words, it's clear that the VC++140 is missing from both the Hosted and HostedVS2017 hosted-images. To solve this issue, I've tried to manually trigger the installation of the VC++140 libraries by downloading the vs_enterprise.exe installer and issuing the installation command. The command seems to succeeed, but no C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat is installed.

For your convenience, here there is the YAML I'm using as Azure pipeline configuration

- script: |
   call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=14.11
   call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsMSBuildCmd.bat"
   mkdir build
   cd build
   set CMAKE_PREFIX_PATH=C:\xmr-stak-dep\hwloc;C:\xmr-stak-dep\libmicrohttpd;C:\xmr-stak-dep\openssl;
   cmake -G "Visual Studio 15 2017 Win64" -T v141,host=x64 .. -DCUDA_ARCH=30
   cmake --build . --config Release --target install
  failOnStderr: true

  displayName: Build

Is there anyone who succeeded in compiling XMRStak on hosted images on azure pipelines?

Spudz76 commented 5 years ago

For builds without CUDA, you don't have to hold the toolset to a specific version, and the environment should just use the latest 14.16 or such (whatever is in the Azure image by default). The dep-pack version 2 or 3 should work still, although I go collect the deps from their various distribution sites rather than actually use any deps pack from here.

Also CUDA 10 tends to work with the latest toolset anyway, you only "need" to pin the toolset to 14.0/14.11 in order to compile CUDA 8 or 9.x as they have an upper limit of compatibility, and the headers will toss fatal exceptions during compile. The docs should probably suggest attempting the latest toolkit, and only downgrade once CUDA headers throw their version errors, or there are linkage errors with the deps (if the link ABI changes).

CPU and OpenCL and core net/loop code all works in any MSVC version.

Probably removing the toolset limitations will allow the Azure image to work without much additional core MSVC installation/modification.

Spudz76 commented 5 years ago

I also had retooled the AppVeyor and CMake stuff here a while ago (needs rebased) Check out my dev-cmake fork

You may get some insight from some of the parts I updated/upgraded. This all worked very nicely at the time but the code it is based upon is old now (possibly no CN2v2 etc) - I would not build the fork/branch directly.

Spudz76 commented 5 years ago

With a CUDA capability 3.x (CUDA_ARCH=30) you should be fine using CUDA10. The only reason to run less is to run CUDA8 for Fermi (2.x) or for some odd cases like laptop GPUs that don't have a CUDA10 driver (so they need a CUDA9 version to match their last driver).