Unverified Commit 6d048853 authored by Jinjing Zhou's avatar Jinjing Zhou Committed by GitHub
Browse files

[Backend] Turn to official dlpack for Tensorflow (#1511)

* Turn to official dlpack

* fix

* fix
parent 02850212
...@@ -102,6 +102,7 @@ pipeline { ...@@ -102,6 +102,7 @@ pipeline {
docker { docker {
label "linux-c52x-node" label "linux-c52x-node"
image "dgllib/dgl-ci-lint" image "dgllib/dgl-ci-lint"
alwaysPull true
} }
} }
steps { steps {
...@@ -121,6 +122,7 @@ pipeline { ...@@ -121,6 +122,7 @@ pipeline {
docker { docker {
label "linux-c52x-node" label "linux-c52x-node"
image "dgllib/dgl-ci-cpu:conda" image "dgllib/dgl-ci-cpu:conda"
alwaysPull true
} }
} }
steps { steps {
...@@ -138,6 +140,7 @@ pipeline { ...@@ -138,6 +140,7 @@ pipeline {
label "linux-c52x-node" label "linux-c52x-node"
image "dgllib/dgl-ci-gpu:conda" image "dgllib/dgl-ci-gpu:conda"
args "-u root" args "-u root"
alwaysPull true
} }
} }
steps { steps {
...@@ -173,6 +176,7 @@ pipeline { ...@@ -173,6 +176,7 @@ pipeline {
docker { docker {
label "linux-c52x-node" label "linux-c52x-node"
image "dgllib/dgl-ci-cpu:conda" image "dgllib/dgl-ci-cpu:conda"
alwaysPull true
} }
} }
steps { steps {
...@@ -200,6 +204,7 @@ pipeline { ...@@ -200,6 +204,7 @@ pipeline {
docker { docker {
label "linux-c52x-node" label "linux-c52x-node"
image "dgllib/dgl-ci-cpu:conda" image "dgllib/dgl-ci-cpu:conda"
alwaysPull true
} }
} }
stages { stages {
...@@ -221,6 +226,7 @@ pipeline { ...@@ -221,6 +226,7 @@ pipeline {
label "linux-gpu-node" label "linux-gpu-node"
image "dgllib/dgl-ci-gpu:conda" image "dgllib/dgl-ci-gpu:conda"
args "--runtime nvidia" args "--runtime nvidia"
alwaysPull true
} }
} }
stages { stages {
...@@ -241,6 +247,7 @@ pipeline { ...@@ -241,6 +247,7 @@ pipeline {
docker { docker {
label "linux-c52x-node" label "linux-c52x-node"
image "dgllib/dgl-ci-cpu:conda" image "dgllib/dgl-ci-cpu:conda"
alwaysPull true
} }
} }
stages { stages {
...@@ -292,6 +299,7 @@ pipeline { ...@@ -292,6 +299,7 @@ pipeline {
label "linux-gpu-node" label "linux-gpu-node"
image "dgllib/dgl-ci-gpu:conda" image "dgllib/dgl-ci-gpu:conda"
args "--runtime nvidia" args "--runtime nvidia"
alwaysPull true
} }
} }
stages { stages {
...@@ -318,6 +326,7 @@ pipeline { ...@@ -318,6 +326,7 @@ pipeline {
docker { docker {
label "linux-c52x-node" label "linux-c52x-node"
image "dgllib/dgl-ci-cpu:conda" image "dgllib/dgl-ci-cpu:conda"
alwaysPull true
} }
} }
stages { stages {
...@@ -344,6 +353,7 @@ pipeline { ...@@ -344,6 +353,7 @@ pipeline {
label "linux-gpu-node" label "linux-gpu-node"
image "dgllib/dgl-ci-gpu:conda" image "dgllib/dgl-ci-gpu:conda"
args "--runtime nvidia" args "--runtime nvidia"
alwaysPull true
} }
} }
stages { stages {
......
...@@ -3,8 +3,7 @@ dependencies: ...@@ -3,8 +3,7 @@ dependencies:
- python=3.6.9 - python=3.6.9
- pip - pip
- pip: - pip:
- tensorflow==2.2.0rc1 - tensorflow==2.2.0
# - tf-nightly==2.2.0.dev20200327
- tfdlpack - tfdlpack
- pytest - pytest
- nose - nose
......
...@@ -3,8 +3,7 @@ dependencies: ...@@ -3,8 +3,7 @@ dependencies:
- python=3.6.9 - python=3.6.9
- pip - pip
- pip: - pip:
- tensorflow==2.2.0rc1 - tensorflow==2.2.0
# - tf-nightly==2.2.0.dev20200327
- tfdlpack-gpu - tfdlpack-gpu
- pytest - pytest
- nose - nose
......
...@@ -13,7 +13,7 @@ from ... import ndarray as nd ...@@ -13,7 +13,7 @@ from ... import ndarray as nd
from ... import kernel as K from ... import kernel as K
from ...function.base import TargetCode from ...function.base import TargetCode
if os.getenv("USE_OFFICIAL_TFDLPACK", False): if not os.getenv("USE_TFDLPACK", False):
if LooseVersion(tf.__version__) < LooseVersion("2.2.0"): if LooseVersion(tf.__version__) < LooseVersion("2.2.0"):
raise RuntimeError("DGL requires tensorflow>=2.2.0 for the official DLPack support.") raise RuntimeError("DGL requires tensorflow>=2.2.0 for the official DLPack support.")
...@@ -21,7 +21,7 @@ if os.getenv("USE_OFFICIAL_TFDLPACK", False): ...@@ -21,7 +21,7 @@ if os.getenv("USE_OFFICIAL_TFDLPACK", False):
return tf.experimental.dlpack.to_dlpack(input) return tf.experimental.dlpack.to_dlpack(input)
def zerocopy_from_dlpack(dlpack_tensor): def zerocopy_from_dlpack(dlpack_tensor):
# TODO(Jinjing): Tensorflow requires memory to be 64-bit aligned. We check the # TODO(Jinjing): Tensorflow requires memory to be 64-bytes aligned. We check the
# alignment and make a copy if needed. The functionality is better in TF's main repo. # alignment and make a copy if needed. The functionality is better in TF's main repo.
aligned = nd.from_dlpack(dlpack_tensor).to_dlpack(64) aligned = nd.from_dlpack(dlpack_tensor).to_dlpack(64)
return tf.experimental.dlpack.from_dlpack(aligned) return tf.experimental.dlpack.from_dlpack(aligned)
......
...@@ -22,7 +22,7 @@ rm -rf _download ...@@ -22,7 +22,7 @@ rm -rf _download
pushd build pushd build
cmake $CMAKE_VARS .. cmake $CMAKE_VARS ..
make -j4 make -j8
popd popd
pushd python pushd python
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment