Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 517285c

Browse files
saudetkarllessard
authored andcommitted
Add initial build workflow for CI using GitHub Actions
1 parent 71ea087 commit 517285c

File tree

5 files changed

+126
-12
lines changed

5 files changed

+126
-12
lines changed

.github/workflows/ci.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: CI jobs
2+
on: [push, pull_request]
3+
4+
jobs:
5+
linux-x86_64:
6+
runs-on: ubuntu-latest
7+
container: nvidia/cuda:10.1-cudnn7-devel-centos7
8+
strategy:
9+
matrix:
10+
ext: ["", -mkl, -gpu, -mkl-gpu]
11+
steps:
12+
- name: Install environment
13+
run: |
14+
yum -y update
15+
yum -y install centos-release-scl-rh epel-release
16+
yum -y install java-1.8.0-openjdk-devel devtoolset-7 rh-git218 rh-maven35 patch python36-devel python36-pip python36-six
17+
echo Downloading Bazel
18+
curl -L https://github.com/bazelbuild/bazel/releases/download/0.29.1/bazel-0.29.1-installer-linux-x86_64.sh -o bazel.sh --retry 10
19+
bash bazel.sh
20+
- name: Checkout repository
21+
uses: actions/checkout@v1
22+
- name: Build project
23+
run: |
24+
source scl_source enable devtoolset-7 rh-git218 rh-maven35 || true
25+
git --version
26+
gcc --version
27+
mvn -version
28+
bazel version
29+
df -h
30+
echo Executing Maven without Wagon HTTP pool that fails under Docker
31+
mvn clean install -B -U -e -Dmaven.wagon.http.pool=false -Djavacpp.platform=linux-x86_64 -Djavacpp.platform.extension=${{ matrix.ext }}
32+
df -h
33+
macosx-x86_64:
34+
runs-on: macos-latest
35+
strategy:
36+
matrix:
37+
ext: ["", -mkl]
38+
steps:
39+
- name: Install environment
40+
run: |
41+
python3 -m pip install six
42+
echo Downloading Bazel
43+
curl -L https://github.com/bazelbuild/bazel/releases/download/0.29.1/bazel-0.29.1-installer-darwin-x86_64.sh -o bazel.sh --retry 10
44+
bash bazel.sh
45+
- name: Checkout repository
46+
uses: actions/checkout@v1
47+
- name: Build project
48+
run: |
49+
git --version
50+
clang --version
51+
mvn -version
52+
bazel version
53+
df -h
54+
echo Executing Maven
55+
mvn clean install -B -U -e -Djavacpp.platform=macosx-x86_64 -Djavacpp.platform.extension=${{ matrix.ext }}
56+
df -h
57+
windows-x86_64:
58+
runs-on: windows-latest
59+
strategy:
60+
matrix:
61+
ext: ["", -mkl, -gpu, -mkl-gpu]
62+
steps:
63+
- name: Install environment
64+
shell: cmd
65+
run: |
66+
python -m pip install six
67+
echo Removing some unused stuff to avoid running out of disk space
68+
rm.exe -Rf "C:/Program Files (x86)/Android" "C:/Program Files/dotnet" "%CONDA%" "%GOROOT_1_10_X64%" "%GOROOT_1_11_X64%" "%GOROOT_1_12_X64%" "%GOROOT_1_13_X64%" "C:\hostedtoolcache\windows\Ruby" "C:\Rust"
69+
echo Removing old versions of MSVC that interfere with Bazel
70+
bash.exe -lc "find 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/' -iname '14.1*' -exec rm -Rf {} \;"
71+
echo Downloading Bazel
72+
mkdir C:\bazel
73+
curl.exe -L https://github.com/bazelbuild/bazel/releases/download/0.29.1/bazel-0.29.1-windows-x86_64.exe -o C:/bazel/bazel.exe --retry 10
74+
echo Installing CUDA
75+
curl.exe -L http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_426.00_windows.exe -o cuda.exe
76+
curl.exe -L https://developer.download.nvidia.com/compute/redist/cudnn/v7.6.4/cudnn-10.1-windows7-x64-v7.6.4.38.zip -o cudnn.zip
77+
cuda.exe -s
78+
mkdir cuda
79+
unzip.exe cudnn.zip
80+
cp.exe -a cuda/include cuda/lib cuda/bin "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/"
81+
- name: Checkout repository
82+
uses: actions/checkout@v1
83+
- name: Build project
84+
shell: cmd
85+
run: |
86+
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
87+
set "CUDA_PATH=%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v10.1"
88+
set "CUDA_PATH_V10_1=%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v10.1"
89+
set "PATH=C:\bazel;%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin;%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v10.1\libnvvp;%PATH%"
90+
echo Shorten work paths to prevent Bazel from reaching MAX_PATH limit
91+
set "TEST_TMPDIR=C:\tmp"
92+
set "TMPDIR=C:\tmp"
93+
set "TEMP=C:\tmp"
94+
set "TMP=C:\tmp"
95+
mkdir C:\tmp
96+
git --version
97+
cl
98+
call mvn -version
99+
bazel version
100+
df -h
101+
wmic pagefile list /format:list
102+
echo Executing Maven
103+
call mvn clean install -B -U -e -Djavacpp.platform=windows-x86_64 -Djavacpp.platform.extension=${{ matrix.ext }}
104+
df -h
105+
wmic pagefile list /format:list

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ artifact includes transitively all the artifacts above as a single dependency:
119119

120120
Be aware though that the native library is quite large and including too many versions of it may
121121
significantly increase the size of your JAR. So it is good practice to limit your dependencies to
122-
the platforms you are targeting.
122+
the platforms you are targeting. For this purpose the `-platform` artifacts include profiles that follow
123+
the conventions established on this page:
124+
* [Reducing the Number of Dependencies](https://github.com/bytedeco/javacpp-presets/wiki/Reducing-the-Number-of-Dependencies)
123125

124126
*Note: the `tensorflow-starters` artifact is not available at this moment*
125127

tensorflow-core/tensorflow-core-api/WORKSPACE

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ http_archive(
1515
],
1616
patch_args = ["-p1"],
1717
urls = [
18-
"https://mirror.bazel.build/github.com/tensorflow/tensorflow/archive/v2.0.0.tar.gz",
19-
"https://github.com/tensorflow/tensorflow/archive/v2.0.0.tar.gz",
18+
"https://mirror.bazel.build/github.com/tensorflow/tensorflow/archive/v2.1.0-rc2.tar.gz",
19+
"https://github.com/tensorflow/tensorflow/archive/v2.1.0-rc2.tar.gz",
2020
],
21-
sha256 = "49b5f0495cd681cbcb5296a4476853d4aea19a43bdd9f179c928a977308a0617",
22-
strip_prefix = "tensorflow-2.0.0"
21+
sha256 = "8f0c227024fe2dffc691e71f4498c217f604d045079db254a300720db1eb4693",
22+
strip_prefix = "tensorflow-2.1.0-rc2"
2323
)
2424

2525
# START: Upstream TensorFlow dependencies

tensorflow-core/tensorflow-core-api/build.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
77

88
export BAZEL_VC="${VCINSTALLDIR:-}"
99
if [[ -d $BAZEL_VC ]]; then
10-
# Work around compiler issues on Windows documented mainly in configure.py
10+
# Work around compiler issues on Windows documented mainly in configure.py but also elsewhere
1111
export BUILD_FLAGS="--copt=//arch:AVX `#--copt=//arch:AVX2` --copt=-DWIN32_LEAN_AND_MEAN --host_copt=-DWIN32_LEAN_AND_MEAN --copt=-DNOGDI --host_copt=-DNOGDI --define=override_eigen_strong_inline=true"
1212
# https://software.intel.com/en-us/articles/intel-optimization-for-tensorflow-installation-guide#wind_B_S
1313
export PATH=$PATH:$(pwd)/bazel-tensorflow-core-api/external/mkl_windows/lib/
1414
export PYTHON_BIN_PATH=$(which python.exe)
1515
else
16-
export BUILD_FLAGS="--copt=-msse4.1 --copt=-msse4.2 --copt=-mavx `#--copt=-mavx2 --copt=-mfma`"
16+
export BUILD_FLAGS="--copt=-msse4.1 --copt=-msse4.2 --copt=-mavx `#--copt=-mavx2 --copt=-mfma` --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 --linkopt=-lstdc++ --host_linkopt=-lstdc++"
1717
export PYTHON_BIN_PATH=$(which python3)
1818
fi
1919

@@ -23,10 +23,15 @@ fi
2323

2424
if [[ "${EXTENSION:-}" == *gpu* ]]; then
2525
export BUILD_FLAGS="$BUILD_FLAGS --config=cuda"
26+
if [[ -z ${TF_CUDA_PATHS:-} ]] && [[ -d ${CUDA_PATH:-} ]]; then
27+
# Work around some issue with Bazel preventing it from detecting CUDA on Windows
28+
export TF_CUDA_PATHS="$CUDA_PATH"
29+
fi
2630
fi
2731

2832
# Build C API of TensorFlow itself including a target to generate ops for Java
2933
bazel build $BUILD_FLAGS --python_path="$PYTHON_BIN_PATH" --config=monolithic --output_filter=DONT_MATCH_ANYTHING --verbose_failures @org_tensorflow//tensorflow:tensorflow :java_op_gen_sources
34+
ls -l bazel-bin/external/org_tensorflow/tensorflow/
3035

3136
# Normalize some paths with symbolic links
3237
TENSORFLOW_SO=(bazel-bin/external/org_tensorflow/tensorflow/libtensorflow.so.?.?.?)
@@ -39,10 +44,12 @@ if [[ -f $TENSORFLOW_DYLIB ]]; then
3944
ln -sf $(basename $TENSORFLOW_DYLIB) bazel-bin/external/org_tensorflow/tensorflow/libtensorflow.dylib
4045
ln -sf $(basename $TENSORFLOW_DYLIB) bazel-bin/external/org_tensorflow/tensorflow/libtensorflow.2.dylib
4146
fi
42-
TENSORFLOW_LIB=(bazel-bin/external/org_tensorflow/tensorflow/tensorflow.dll.if.lib)
43-
if [[ -f $TENSORFLOW_LIB ]]; then
44-
ln -sf $(basename $TENSORFLOW_LIB) bazel-bin/external/org_tensorflow/tensorflow/tensorflow.lib
45-
fi
47+
TENSORFLOW_LIBS=(bazel-bin/external/org_tensorflow/tensorflow/tensorflow.dll.if.lib bazel-bin/external/org_tensorflow/tensorflow/libtensorflow.dll.ifso)
48+
for TENSORFLOW_LIB in ${TENSORFLOW_LIBS[@]}; do
49+
if [[ -f $TENSORFLOW_LIB ]]; then
50+
ln -sf $(basename $TENSORFLOW_LIB) bazel-bin/external/org_tensorflow/tensorflow/tensorflow.lib
51+
fi
52+
done
4653

4754
# Copy only main generated Java source files for ops
4855
mkdir -p src/gen/java/

tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/internal/c_api/presets/tensorflow.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public class tensorflow implements LoadEnabled, InfoMapper {
140140
case "linux-ppc64le":
141141
case "linux-x86_64":
142142
case "macosx-x86_64":
143-
lib += lib.equals("cudnn") ? "@.7" : lib.equals("nccl") ? "@.2" : lib.equals("nvinfer") ? "@.5" : lib.equals("cudart") ? "@.10.1" : "@.10";
143+
lib += lib.equals("cudnn") ? "@.7" : lib.equals("nccl") ? "@.2" : lib.equals("nvinfer") ? "@.6" : lib.equals("cudart") ? "@.10.1" : "@.10";
144144
break;
145145
case "windows-x86_64":
146146
lib += lib.equals("cudnn") ? "64_7" : lib.equals("cudart") ? "64_101" : "64_10";

0 commit comments

Comments
 (0)