diff options
-rw-r--r-- | .github/workflows/build-windows-2019-cpu.yml | 49 | ||||
-rw-r--r-- | .github/workflows/macos-cpu.yml (renamed from .github/workflows/build-macos-10.15-cpu.yml) | 2 | ||||
-rw-r--r-- | .github/workflows/ubuntu-cpu.yml (renamed from .github/workflows/build-ubuntu-18.04-cpu.yml) | 17 | ||||
-rw-r--r-- | .github/workflows/ubuntu-gpu.yml | 84 | ||||
-rw-r--r-- | .github/workflows/windows-cpu.yml | 66 | ||||
-rw-r--r-- | .github/workflows/windows-gpu.yml | 63 | ||||
-rw-r--r-- | _CMakeSettingsCI_CPU.json | 28 | ||||
-rw-r--r-- | _CMakeSettingsCI_GPU.json (renamed from CMakeSettingsCI.json) | 6 | ||||
-rw-r--r-- | scripts/ci/README.md | 1 | ||||
-rwxr-xr-x | scripts/ci/install_cuda_ubuntu.sh | 99 | ||||
-rw-r--r-- | scripts/ci/install_cuda_windows.ps1 | 121 | ||||
-rwxr-xr-x | scripts/ci/install_mkl.sh | 7 | ||||
-rw-r--r-- | src/3rd_party/CMakeLists.txt | 2 |
13 files changed, 489 insertions, 56 deletions
diff --git a/.github/workflows/build-windows-2019-cpu.yml b/.github/workflows/build-windows-2019-cpu.yml deleted file mode 100644 index 13ef6614..00000000 --- a/.github/workflows/build-windows-2019-cpu.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: windows-2019-cpu - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: windows-2019 - - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - submodules: recursive - - - name: Prepare vcpkg - uses: lukka/run-vcpkg@v3 - with: - vcpkgArguments: protobuf - vcpkgGitCommitId: 6185aa76504a5025f36754324abf307cc776f3da - vcpkgDirectory: ${{ github.workspace }}/vcpkg/ - vcpkgTriplet: x64-windows-static - - # Note that we build with a simplified CMake settings JSON file - - name: Run CMake - uses: lukka/run-cmake@v2 - with: - buildDirectory: ${{ github.workspace }}/build/ - cmakeAppendedArgs: -G Ninja - cmakeListsOrSettingsJson: CMakeSettingsJson - cmakeSettingsJsonPath: ${{ github.workspace }}/CMakeSettingsCI.json - useVcpkgToolchainFile: true - - - name: Run unit tests - working-directory: build/Debug/ - run: ctest - - - name: Print versions - working-directory: build/Debug/ - run: | - .\marian.exe --version - .\marian-decoder.exe --version - .\marian-scorer.exe --version - .\spm_encode.exe --version - diff --git a/.github/workflows/build-macos-10.15-cpu.yml b/.github/workflows/macos-cpu.yml index 824915b8..07f2a9dd 100644 --- a/.github/workflows/build-macos-10.15-cpu.yml +++ b/.github/workflows/macos-cpu.yml @@ -1,4 +1,4 @@ -name: macos-10.5-cpu +name: macOS CPU-only on: push: diff --git a/.github/workflows/build-ubuntu-18.04-cpu.yml b/.github/workflows/ubuntu-cpu.yml index 0b37e4f4..4217053c 100644 --- a/.github/workflows/build-ubuntu-18.04-cpu.yml +++ b/.github/workflows/ubuntu-cpu.yml @@ -1,4 +1,4 @@ -name: ubuntu-18.04-cpu +name: Ubuntu 18.04 CPU-only on: push: @@ -7,7 +7,7 @@ on: branches: [ master ] jobs: - build: + build-and-upload: runs-on: ubuntu-18.04 @@ -41,7 +41,8 @@ jobs: run: | mkdir -p build cd build - cmake .. -DCOMPILE_CPU=on -DCOMPILE_CUDA=off -DCOMPILE_EXAMPLES=on -DCOMPILE_SERVER=on -DCOMPILE_TESTS=on \ + cmake .. -DCMAKE_BUILD_TYPE=Release \ + -DCOMPILE_CPU=on -DCOMPILE_CUDA=off -DCOMPILE_EXAMPLES=on -DCOMPILE_SERVER=on -DCOMPILE_TESTS=on \ -DUSE_FBGEMM=on -DUSE_SENTENCEPIECE=on \ -DBOOST_ROOT=$BOOST_ROOT_1_69_0 -DBOOST_INCLUDEDIR=$BOOST_ROOT_1_69_0/include -DBOOST_LIBRARYDIR=$BOOST_ROOT_1_69_0/lib \ -DBoost_ARCHITECTURE=-x64 @@ -62,3 +63,13 @@ jobs: ./marian-scorer --version ./spm_encode --version + - name: Prepare archive + working-directory: build + run: tar zcvf marian-ubuntu-release-static.tar.gz marian* + + # Marian is built with FBGEMM, so there are some restrictions on what CPUs the executables can be run + - name: Upload archive + uses: actions/upload-artifact@v2 + with: + name: marian-ubuntu-release-static.tar.gz + path: build/marian-ubuntu-release-static.tar.gz diff --git a/.github/workflows/ubuntu-gpu.yml b/.github/workflows/ubuntu-gpu.yml new file mode 100644 index 00000000..ccea606b --- /dev/null +++ b/.github/workflows/ubuntu-gpu.yml @@ -0,0 +1,84 @@ +name: Ubuntu CPU+CUDA + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + include: + # Ubuntu 20.04 supports CUDA 11+ + # Ubuntu 18.04 supports CUDA 10.1+ + - os: ubuntu-18.04 + cuda: "10.2" + gcc: 8 + # Ubuntu 16.04 supports CUDA 8+ + - os: ubuntu-16.04 + cuda: "10.2" + gcc: 7 + - os: ubuntu-16.04 + cuda: 9.2 + gcc: 7 + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive + + # The following packages are already installed on GitHub-hosted runners: build-essential openssl libssl-dev + # No need to install libprotobuf{17,10,9v5} on Ubuntu {20,18,16}.04 because it is installed together with libprotobuf-dev + - name: Install dependencies + run: sudo apt-get install -y libgoogle-perftools-dev libprotobuf-dev protobuf-compiler + + # https://software.intel.com/content/www/us/en/develop/articles/installing-intel-free-libs-and-python-apt-repo.html + - name: Install MKL + run: | + wget -qO- "https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB" | sudo apt-key add - + sudo sh -c "echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list" + sudo apt-get update -o Dir::Etc::sourcelist="/etc/apt/sources.list.d/intel-mkl.list" + sudo apt-get install -y --no-install-recommends intel-mkl-64bit-2020.0-088 + + # The script simplifies installation of different versions of CUDA + - name: Install CUDA + run: ./scripts/ci/install_cuda_ubuntu.sh ${{ matrix.cuda }} + + # Boost is already installed on GitHub-hosted runners in a non-standard location + # https://github.com/actions/virtual-environments/issues/687#issuecomment-610471671 + - name: Configure CMake + run: | + mkdir -p build + cd build + CC=/usr/bin/gcc-${{ matrix.gcc }} CXX=/usr/bin/g++-${{ matrix.gcc }} CUDAHOSTCXX=/usr/bin/g++-${{ matrix.gcc }} \ + cmake .. \ + -DCOMPILE_CPU=on -DCOMPILE_CUDA=on -DCOMPILE_EXAMPLES=on -DCOMPILE_SERVER=on -DCOMPILE_TESTS=on \ + -DUSE_FBGEMM=on -DUSE_SENTENCEPIECE=on \ + -DBOOST_ROOT=$BOOST_ROOT_1_69_0 -DBOOST_INCLUDEDIR=$BOOST_ROOT_1_69_0/include -DBOOST_LIBRARYDIR=$BOOST_ROOT_1_69_0/lib \ + -DBoost_ARCHITECTURE=-x64 \ + -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-${{ matrix.cuda }} + + - name: Compile + working-directory: build + run: make -j2 + + # Unit tests are not run because GitHub-hosted runners do not have GPUs + # TODO: add a flag to CMake to compile unit tests only on CPU + #- name: Run unit tests + #working-directory: build + #run: make test + + - name: Print versions + working-directory: build + run: | + ./marian --version + ./marian-decoder --version + ./marian-scorer --version + ./spm_encode --version + diff --git a/.github/workflows/windows-cpu.yml b/.github/workflows/windows-cpu.yml new file mode 100644 index 00000000..b6543d0d --- /dev/null +++ b/.github/workflows/windows-cpu.yml @@ -0,0 +1,66 @@ +name: Windows CPU-only + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build-and-upload: + + runs-on: windows-2019 + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Download MKL + run: | + Invoke-WebRequest -Uri https://romang.blob.core.windows.net/mariandev/ci/mkl-2020.1-windows-static.zip -TimeoutSec 600 -OutFile mkl.zip + Expand-Archive -Force mkl.zip ${{ github.workspace }}/mkl + # Set MKLROOT environment variables so that CMake can find MKL. + # GITHUB_WORKSPACE is an environment variable available on all GitHub-hosted runners + echo "::set-env name=MKLROOT::$env:GITHUB_WORKSPACE/mkl" + shell: powershell + + - name: Prepare vcpkg + uses: lukka/run-vcpkg@v2 + with: + vcpkgArguments: protobuf + vcpkgGitCommitId: 6185aa76504a5025f36754324abf307cc776f3da + vcpkgDirectory: ${{ github.workspace }}/vcpkg/ + vcpkgTriplet: x64-windows-static + + # Build with a simplified CMake settings JSON file + - name: Run CMake + uses: lukka/run-cmake@v2 + with: + buildDirectory: ${{ github.workspace }}/build/ + cmakeAppendedArgs: -G Ninja + cmakeListsOrSettingsJson: CMakeSettingsJson + # JSON file must be in the same directory as the main CMakeLists.txt + cmakeSettingsJsonPath: ${{ github.workspace }}/_CMakeSettingsCI_CPU.json + useVcpkgToolchainFile: true + + - name: Run unit tests + working-directory: build/Release/ + run: ctest + + #- name: Print versions + #working-directory: build/Release/ + #run: | + #.\marian.exe --version + #.\marian-decoder.exe --version + #.\marian-scorer.exe --version + #.\spm_encode.exe --version + #shell: powershell + + # Marian is built with FBGEMM, so there are some restrictions on what CPUs the executables can be run + - name: Upload archive + uses: actions/upload-artifact@v2 + with: + name: marian-windows-release-static + path: build/Release/marian*.exe diff --git a/.github/workflows/windows-gpu.yml b/.github/workflows/windows-gpu.yml new file mode 100644 index 00000000..360b64f4 --- /dev/null +++ b/.github/workflows/windows-gpu.yml @@ -0,0 +1,63 @@ +name: Windows CPU+CUDA + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: windows-2019 + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Install CUDA + run: | + .\scripts\ci\install_cuda_windows.ps1 "10.2" + # Set path to CUDA for subsequent steps so that CMake can find it + echo "::set-env name=CUDA_PATH::$env:CUDA_PATH" + echo "::add-path::$env:CUDA_PATH/bin" + shell: powershell + + - name: Download MKL + run: | + Invoke-WebRequest -Uri https://romang.blob.core.windows.net/mariandev/ci/mkl-2020.1-windows-static.zip -TimeoutSec 600 -OutFile mkl.zip + Expand-Archive -Force mkl.zip ${{ github.workspace }}/mkl + # Set MKLROOT environment variables so that CMake can find MKL. + # GITHUB_WORKSPACE is an environment variable available on all GitHub-hosted runners + echo "::set-env name=MKLROOT::$env:GITHUB_WORKSPACE/mkl" + shell: powershell + + - name: Prepare vcpkg + uses: lukka/run-vcpkg@v2 + with: + vcpkgArguments: protobuf + vcpkgGitCommitId: 6185aa76504a5025f36754324abf307cc776f3da + vcpkgDirectory: ${{ github.workspace }}/vcpkg/ + vcpkgTriplet: x64-windows-static + + # Build with a simplified CMake settings JSON file. + # On Windows+CUDA we compile with COMPILE_CUDA=on and USE_NCCL=off + - name: Run CMake + uses: lukka/run-cmake@v2 + with: + buildDirectory: ${{ github.workspace }}/build/ + cmakeAppendedArgs: -G Ninja + cmakeListsOrSettingsJson: CMakeSettingsJson + # JSON file must be in the same directory as the main CMakeLists.txt + cmakeSettingsJsonPath: ${{ github.workspace }}/_CMakeSettingsCI_GPU.json + useVcpkgToolchainFile: true + + - name: Print versions + working-directory: build/Debug/ + run: | + .\marian.exe --version + .\marian-decoder.exe --version + .\marian-scorer.exe --version + .\spm_encode.exe --version diff --git a/_CMakeSettingsCI_CPU.json b/_CMakeSettingsCI_CPU.json new file mode 100644 index 00000000..e9751882 --- /dev/null +++ b/_CMakeSettingsCI_CPU.json @@ -0,0 +1,28 @@ +{
+ "configurations": [
+ {
+ "name": "Release",
+ "generator": "Ninja",
+ "configurationType": "Release",
+ "inheritEnvironments": [ "msvc_x64" ],
+ "cmakeCommandArgs": "",
+ "buildCommandArgs": "-v",
+ "ctestCommandArgs": "",
+ "variables": [
+ { "name": "OPENSSL_USE_STATIC_LIBS:BOOL", "value": "TRUE" },
+ { "name": "OPENSSL_MSVC_STATIC_RT:BOOL", "value": "TRUE" },
+
+ { "name": "COMPILE_CUDA:BOOL", "value": "FALSE" },
+ { "name": "COMPILE_CPU:BOOL", "value": "TRUE" },
+ { "name": "COMPILE_EXAMPLES:BOOL", "value": "FALSE" },
+ { "name": "COMPILE_SERVER:BOOL", "value": "FALSE" },
+ { "name": "COMPILE_TESTS:BOOL", "value": "TRUE" },
+
+ { "name": "USE_FBGEMM:BOOL", "value": "TRUE" },
+ { "name": "USE_MPI:BOOL", "value": "FALSE" },
+ { "name": "USE_SENTENCEPIECE:BOOL", "value": "TRUE" },
+ { "name": "USE_STATIC_LIBS:BOOL", "value": "TRUE" }
+ ]
+ }
+ ]
+}
diff --git a/CMakeSettingsCI.json b/_CMakeSettingsCI_GPU.json index 00cdb918..12e56cd2 100644 --- a/CMakeSettingsCI.json +++ b/_CMakeSettingsCI_GPU.json @@ -12,7 +12,7 @@ { "name": "OPENSSL_USE_STATIC_LIBS:BOOL", "value": "TRUE" },
{ "name": "OPENSSL_MSVC_STATIC_RT:BOOL", "value": "TRUE" },
- { "name": "COMPILE_CUDA:BOOL", "value": "FALSE" },
+ { "name": "COMPILE_CUDA:BOOL", "value": "TRUE" },
{ "name": "COMPILE_CPU:BOOL", "value": "TRUE" },
{ "name": "COMPILE_EXAMPLES:BOOL", "value": "FALSE" },
{ "name": "COMPILE_SERVER:BOOL", "value": "FALSE" },
@@ -20,6 +20,7 @@ { "name": "USE_FBGEMM:BOOL", "value": "TRUE" },
{ "name": "USE_MPI:BOOL", "value": "FALSE" },
+ { "name": "USE_NCCL:BOOL", "value": "FALSE" },
{ "name": "USE_SENTENCEPIECE:BOOL", "value": "TRUE" },
{ "name": "USE_STATIC_LIBS:BOOL", "value": "TRUE" }
]
@@ -36,7 +37,7 @@ { "name": "OPENSSL_MSVC_STATIC_RT:BOOL", "value": "TRUE" },
{ "name": "OPENSSL_USE_STATIC_LIBS:BOOL", "value": "TRUE" },
- { "name": "COMPILE_CUDA:BOOL", "value": "FALSE" },
+ { "name": "COMPILE_CUDA:BOOL", "value": "TRUE" },
{ "name": "COMPILE_CPU:BOOL", "value": "TRUE" },
{ "name": "COMPILE_EXAMPLES:BOOL", "value": "FALSE" },
{ "name": "COMPILE_SERVER:BOOL", "value": "FALSE" },
@@ -44,6 +45,7 @@ { "name": "USE_FBGEMM:BOOL", "value": "TRUE" },
{ "name": "USE_MPI:BOOL", "value": "FALSE" },
+ { "name": "USE_NCCL:BOOL", "value": "FALSE" },
{ "name": "USE_SENTENCEPIECE:BOOL", "value": "TRUE" },
{ "name": "USE_STATIC_LIBS:BOOL", "value": "TRUE" }
]
diff --git a/scripts/ci/README.md b/scripts/ci/README.md new file mode 100644 index 00000000..d6137262 --- /dev/null +++ b/scripts/ci/README.md @@ -0,0 +1 @@ +Scripts for continuous integration. diff --git a/scripts/ci/install_cuda_ubuntu.sh b/scripts/ci/install_cuda_ubuntu.sh new file mode 100755 index 00000000..8dc77eda --- /dev/null +++ b/scripts/ci/install_cuda_ubuntu.sh @@ -0,0 +1,99 @@ +#!/usr/bin/env bash + +## ------------------------------------------------------------------ +## Install CUDA version on Ubuntu via a network CUDA installer. +## The first and only argument is CUDA MAJOR.MINOR version. +## Ubuntu version is automatically detected from lsb_release. +## +## Example usage: +## bash install_cuda_ubuntu.sh 10.2 +## +## Based on: https://github.com/ptheywood/cuda-cmake-github-actions +## ------------------------------------------------------------------ + +if [[ $# -lt 1 ]]; then + echo "Illegal number of parameters." + echo "Usage: $0 <CUDA_VERSION>" + exit 2 +fi + +## ------------------------------------------------------------------ +## Find CUDA and OS versions +## ------------------------------------------------------------------ + +# Get CUDA version. +CUDA_VERSION_MAJOR_MINOR=$1 +CUDA_MAJOR=$(echo "${CUDA_VERSION_MAJOR_MINOR}" | cut -d. -f1) +CUDA_MINOR=$(echo "${CUDA_VERSION_MAJOR_MINOR}" | cut -d. -f2) +echo "CUDA_MAJOR: ${CUDA_MAJOR}" +echo "CUDA_MINOR: ${CUDA_MINOR}" + +# If we don't know the CUDA_MAJOR or MINOR, error. +if [ -z "${CUDA_MAJOR}" ] ; then + echo "Error: Unknown CUDA Major version. Aborting." + exit 1 +fi +if [ -z "${CUDA_MINOR}" ] ; then + echo "Error: Unknown CUDA Minor version. Aborting." + exit 1 +fi + +# Find the OS. +UBUNTU_VERSION=$(lsb_release -sr) +UBUNTU_VERSION="${UBUNTU_VERSION//.}" + +echo "UBUNTU_VERSION: ${UBUNTU_VERSION}" +# If we don't know the Ubuntu version, error. +if [ -z ${UBUNTU_VERSION} ]; then + echo "Error: Unknown Ubuntu version. Aborting." + exit 1 +fi + +## ------------------------------------------------------------------ +## Select CUDA packages to install +## ------------------------------------------------------------------ + +CUDA_PACKAGES_IN=( + "command-line-tools" + "libraries-dev" +) + +CUDA_PACKAGES="" +for package in "${CUDA_PACKAGES_IN[@]}"; do + # Build the full package name and append to the string. + CUDA_PACKAGES+=" cuda-${package}-${CUDA_MAJOR}-${CUDA_MINOR}" +done + +echo "CUDA_PACKAGES ${CUDA_PACKAGES}" + +## ------------------------------------------------------------------ +## Prepare to install +## ------------------------------------------------------------------ + +PIN_FILENAME="cuda-ubuntu${UBUNTU_VERSION}.pin" +PIN_URL="https://developer.download.nvidia.com/compute/cuda/repos/ubuntu${UBUNTU_VERSION}/x86_64/${PIN_FILENAME}" +APT_KEY_URL="http://developer.download.nvidia.com/compute/cuda/repos/ubuntu${UBUNTU_VERSION}/x86_64/7fa2af80.pub" +REPO_URL="http://developer.download.nvidia.com/compute/cuda/repos/ubuntu${UBUNTU_VERSION}/x86_64/" + +echo "PIN_FILENAME ${PIN_FILENAME}" +echo "PIN_URL ${PIN_URL}" +echo "APT_KEY_URL ${APT_KEY_URL}" + +## ------------------------------------------------------------------ +## Install CUDA +## ------------------------------------------------------------------ + +echo "Adding CUDA Repository" +wget ${PIN_URL} +sudo mv ${PIN_FILENAME} /etc/apt/preferences.d/cuda-repository-pin-600 +sudo apt-key adv --fetch-keys ${APT_KEY_URL} +sudo add-apt-repository "deb ${REPO_URL} /" +sudo apt-get update + +echo "Installing CUDA packages ${CUDA_PACKAGES}" +sudo apt-get -y install ${CUDA_PACKAGES} + +if [[ $? -ne 0 ]]; then + echo "CUDA Installation Error." + exit 1 +fi diff --git a/scripts/ci/install_cuda_windows.ps1 b/scripts/ci/install_cuda_windows.ps1 new file mode 100644 index 00000000..34c365bb --- /dev/null +++ b/scripts/ci/install_cuda_windows.ps1 @@ -0,0 +1,121 @@ +## ------------------------------------------------------------------ +## Install CUDA version on Windows via a network CUDA installer checking +## Visual Studio dependencies. +## +## Example usage: +## .\install_cuda_windows.ps1 "10.2" +## +## Based on: https://github.com/ptheywood/cuda-cmake-github-actions +## Changes: +## - Changed format of input arguments +## - Do not check compatibility with Visual Studio +## ------------------------------------------------------------------ + +Param( + [Parameter(Mandatory=$true)] + $cuda +) + +## ------------------------------------------------------------------ +## Constants +## ------------------------------------------------------------------ + +# Dictionary of known cuda versions and thier download URLS, which do not follow a consistent pattern :( +$CUDA_KNOWN_URLS = @{ + "8.0" = "http://developer.nvidia.com/compute/cuda/8.0/Prod2/network_installers/cuda_8.0.61_win10_network-exe"; + "9.0" = "http://developer.nvidia.com/compute/cuda/9.0/Prod/network_installers/cuda_9.0.176_win10_network-exe"; + # CUDA 9.1 is removed from supported CUDA versions because its nvcc package is named differently + "9.2" = "http://developer.nvidia.com/compute/cuda/9.2/Prod2/network_installers2/cuda_9.2.148_win10_network"; + "10.0" = "http://developer.nvidia.com/compute/cuda/10.0/Prod/network_installers/cuda_10.0.130_win10_network"; + "10.1" = "http://developer.download.nvidia.com/compute/cuda/10.1/Prod/network_installers/cuda_10.1.243_win10_network.exe"; + "10.2" = "http://developer.download.nvidia.com/compute/cuda/10.2/Prod/network_installers/cuda_10.2.89_win10_network.exe"; + "11.0" = "http://developer.download.nvidia.com/compute/cuda/11.0.1/network_installers/cuda_11.0.1_win10_network.exe" +} + +## ------------------------------------------------------------------ +## Select CUDA version +## ------------------------------------------------------------------ + +# Get the cuda version from the argument +$CUDA_VERSION_FULL = $cuda + +# Validate CUDA version, extracting components via regex +$cuda_ver_matched = $CUDA_VERSION_FULL -match "^(?<major>[1-9][0-9]*)\.(?<minor>[0-9]+)$" +if(-not $cuda_ver_matched){ + Write-Output "Invalid CUDA version specified, <major>.<minor> required. Got '$CUDA_VERSION_FULL'." + exit 1 +} +$CUDA_MAJOR=$Matches.major +$CUDA_MINOR=$Matches.minor + +echo "CUDA $($CUDA_MAJOR).$($CUDA_MINOR)" + +## ------------------------------------------------------------------ +## Select CUDA packages to install +## ------------------------------------------------------------------ + +# cuda_runtime.h is in nvcc <= 10.2, but cudart >= 11.0 +# List of subpackages: https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html#install-cuda-software +$CUDA_PACKAGES_IN = @( + "nvcc"; + "visual_studio_integration"; + "cublas_dev"; + "curand_dev"; + "cusparse_dev"; + "nvrtc_dev"; + "cudart"; +) + +$CUDA_PACKAGES = "" +Foreach ($package in $CUDA_PACKAGES_IN) { + $CUDA_PACKAGES += " $($package)_$($CUDA_MAJOR).$($CUDA_MINOR)" +} +echo "CUDA packages: $($CUDA_PACKAGES)" + +## ------------------------------------------------------------------ +## Prepare download +## ------------------------------------------------------------------ + +# Select the download link if known, otherwise have a guess. +$CUDA_REPO_PKG_REMOTE="" +if($CUDA_KNOWN_URLS.containsKey($CUDA_VERSION_FULL)){ + $CUDA_REPO_PKG_REMOTE=$CUDA_KNOWN_URLS[$CUDA_VERSION_FULL] +} else{ + Write-Output "Error: URL for CUDA ${$CUDA_VERSION_FULL} not known" + exit 1 +} +$CUDA_REPO_PKG_LOCAL="cuda_$($CUDA_VERSION_FULL)_win10_network.exe" + +## ------------------------------------------------------------------ +## Install CUDA +## ------------------------------------------------------------------ + +# Get CUDA network installer +Write-Output "Downloading CUDA Network Installer for $($CUDA_VERSION_FULL) from: $($CUDA_REPO_PKG_REMOTE)" +Invoke-WebRequest $CUDA_REPO_PKG_REMOTE -OutFile $CUDA_REPO_PKG_LOCAL | Out-Null +if(Test-Path -Path $CUDA_REPO_PKG_LOCAL){ + Write-Output "Downloading Complete" +} else { + Write-Output "Error: Failed to download $($CUDA_REPO_PKG_LOCAL) from $($CUDA_REPO_PKG_REMOTE)" + exit 1 +} + +# Invoke silent install of CUDA (via network installer) +Write-Output "Installing CUDA $($CUDA_VERSION_FULL). Subpackages $($CUDA_PACKAGES)" +Start-Process -Wait -FilePath .\"$($CUDA_REPO_PKG_LOCAL)" -ArgumentList "-s $($CUDA_PACKAGES)" + +# Check the return status of the CUDA installer. +if (!$?) { + Write-Output "Error: CUDA installer reported error. $($LASTEXITCODE)" + exit 1 +} + +## ------------------------------------------------------------------ +## Set CUDA_PATH +## ------------------------------------------------------------------ + +# Store the CUDA_PATH in the environment for the current session, to be forwarded in the action. +$CUDA_PATH = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v$($CUDA_MAJOR).$($CUDA_MINOR)" +# Set environmental variables in this session +$env:CUDA_PATH = "$($CUDA_PATH)" +Write-Output "CUDA_PATH $($CUDA_PATH)" diff --git a/scripts/ci/install_mkl.sh b/scripts/ci/install_mkl.sh new file mode 100755 index 00000000..4037396e --- /dev/null +++ b/scripts/ci/install_mkl.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +# https://software.intel.com/content/www/us/en/develop/articles/installing-intel-free-libs-and-python-apt-repo.html +wget -qO- "https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB" | sudo apt-key add - +sudo sh -c "echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list" +sudo apt-get update -o Dir::Etc::sourcelist="/etc/apt/sources.list.d/intel-mkl.list" +sudo apt-get install --no-install-recommends intel-mkl-64bit-2020.0-088 diff --git a/src/3rd_party/CMakeLists.txt b/src/3rd_party/CMakeLists.txt index 6f465e5d..66e159db 100644 --- a/src/3rd_party/CMakeLists.txt +++ b/src/3rd_party/CMakeLists.txt @@ -133,7 +133,7 @@ if(CUDA_FOUND) BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/nccl CONFIGURE_COMMAND "" BUILD_COMMAND - $(MAKE) -f ${CMAKE_CURRENT_SOURCE_DIR}/nccl/Makefile src.build + ${CMAKE_MAKE_PROGRAM} -f ${CMAKE_CURRENT_SOURCE_DIR}/nccl/Makefile src.build BUILDDIR=${CMAKE_BINARY_DIR}/local CUDA_HOME=${CUDA_TOOLKIT_ROOT_DIR} CUDA8_GENCODE=${GENCODE} CXX=${CMAKE_CXX_COMPILER} INSTALL_COMMAND "") |