Skip to content

Commit

Permalink
Merge branch 'master' of github.com:arition/torch-js
Browse files Browse the repository at this point in the history
  • Loading branch information
arition committed Dec 2, 2020
2 parents 1eed411 + c060879 commit 97f76dd
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 9 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/publish-prebuild-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: publish-prebuild

on:
push:
branches: [cuda-test]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
if: "!contains(github.event.head_commit.message, 'publish-prebuild skip')"

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install CUDA on windows-latest
if: ${{ matrix.os == 'windows-latest' }}
shell: powershell
env:
cuda: "11.0.2"
cudnn: "8.0.5.39"
run: |
# Install CUDA via a powershell script
.\.github\workflows\scripts\install_cuda_windows.ps1
if ($?) {
# Set paths for subsequent steps, using $env:CUDA_PATH
echo "Adding CUDA to CUDA_PATH, CUDA_PATH_X_Y and PATH"
echo "CUDA_PATH=$($env:CUDA_PATH)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "$($env:CUDA_PATH_VX_Y)=$($env:CUDA_PATH)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "$($env:CUDA_PATH)/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
}
- name: Install CUDA on ubuntu-latest
if: ${{ matrix.os == 'ubuntu-latest' }}
shell: bash
env:
cuda: "11.0"
cudnn: "8.0.5.39"
run: |
source ./.github/workflows/scripts/install_cuda_ubuntu.sh
if [[ $? -eq 0 ]]; then
# Set paths for subsequent steps, using ${CUDA_PATH}
echo "Adding CUDA to CUDA_PATH, PATH and LD_LIBRARY_PATH"
echo "CUDA_PATH=${CUDA_PATH}" >> $GITHUB_ENV
echo "${CUDA_PATH}/bin" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
fi
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '14'

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Install packages
run: yarn upgrade --dev

- name: Prebuild
run: yarn build-prebuild
12 changes: 6 additions & 6 deletions .github/workflows/publish-prebuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ jobs:
if ($?) {
# Set paths for subsequent steps, using $env:CUDA_PATH
echo "Adding CUDA to CUDA_PATH, CUDA_PATH_X_Y and PATH"
echo "::set-env name=CUDA_PATH::$env:CUDA_PATH"
echo "::set-env name=$env:CUDA_PATH_VX_Y::$env:CUDA_PATH"
echo "::add-path::$env:CUDA_PATH/bin"
echo "CUDA_PATH=$($env:CUDA_PATH)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "$($env:CUDA_PATH_VX_Y)=$($env:CUDA_PATH)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "$($env:CUDA_PATH)/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
}
- name: Install CUDA on ubuntu-latest
Expand All @@ -50,9 +50,9 @@ jobs:
if [[ $? -eq 0 ]]; then
# Set paths for subsequent steps, using ${CUDA_PATH}
echo "Adding CUDA to CUDA_PATH, PATH and LD_LIBRARY_PATH"
echo "::set-env name=CUDA_PATH::${CUDA_PATH}"
echo "::add-path::${CUDA_PATH}/bin"
echo "::set-env name=LD_LIBRARY_PATH::${CUDA_PATH}/lib:${LD_LIBRARY_PATH}"
echo "CUDA_PATH=${CUDA_PATH}" >> $GITHUB_ENV
echo "${CUDA_PATH}/bin" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
fi
- name: Install node
Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/scripts/install_cuda_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ $CUDA_PACKAGES_IN = @(
"cusparse_dev";
"nvrtc_dev";
"cudart";
"nsight_nvtx";
)


Expand All @@ -30,8 +31,7 @@ $CUDA_PACKAGES_IN = @(

# Get the cuda version from the environment as env:cuda.
$CUDA_VERSION_FULL = $env:cuda
$CUDNN_VERSION = $env:cudnn
# Make sure CUDA_VERSION_FULL is set and valid, otherwise error.
$CUDNN_VERSION_FULL = $env:cudnn

# Validate CUDA version, extracting components via regex
$cuda_ver_matched = $CUDA_VERSION_FULL -match "^(?<major>[1-9][0-9]*)\.(?<minor>[0-9]+)\.(?<patch>[0-9]+)$"
Expand All @@ -43,6 +43,17 @@ $CUDA_MAJOR=$Matches.major
$CUDA_MINOR=$Matches.minor
$CUDA_PATCH=$Matches.patch

# Validate CUDNN version, extracting components via regex
$cudnn_ver_matched = $CUDNN_VERSION_FULL -match "^(?<major>[0-9]+)\.(?<minor>[0-9]+)\.(?<patch>[0-9]+)\.(?<build>[0-9]+)$"
if(-not $cuda_ver_matched){
Write-Output "Invalid CUDNN version specified, <major>.<minor>.<patch>.<build> required. '$CUDNN_VERSION_FULL'."
exit 1
}
$CUDNN_MAJOR=$Matches.major
$CUDNN_MINOR=$Matches.minor
$CUDNN_PATCH=$Matches.patch
$CUDNN_BUILD=$Matches.build

## ------------------------------------------------
## Select CUDA packages to install from environment
## ------------------------------------------------
Expand Down Expand Up @@ -116,9 +127,10 @@ $CUDA_PATH_VX_Y = "CUDA_PATH_V$($CUDA_MAJOR)_$($CUDA_MINOR)"
# Append $CUDA_PATH/bin to path.
# Set CUDA_PATH as an environmental variable

$CUDNN_ZIP_REMOTE = "https://github.com/arition/files/releases/download/files/cudnn-$($CUDA_MAJOR).$($CUDA_MINOR)-windows10-x64-v$($CUDNN_VERSION).zip"
$CUDNN_ZIP_REMOTE = "http://developer.download.nvidia.com/compute/redist/cudnn/v$($CUDNN_MAJOR).$($CUDNN_MINOR).$($CUDNN_PATCH)/cudnn-$($CUDA_MAJOR).$($CUDA_MINOR)-windows-x64-v$($CUDNN_VERSION_FULL).zip"
$CUDNN_ZIP_LOCAL = Join-Path $TEMP_PATH "cudnn.zip"

Write-Output "Downloading CUDNN zip for $($CUDNN_VERSION_FULL) from: $($CUDNN_ZIP_REMOTE)"
Invoke-WebRequest $CUDNN_ZIP_REMOTE -OutFile $CUDNN_ZIP_LOCAL | Out-Null
if(Test-Path -Path $CUDNN_ZIP_LOCAL){
Write-Output "Downloading Complete"
Expand Down

0 comments on commit 97f76dd

Please sign in to comment.