Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial changes for tensorflow gpu #38293

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions tensorflow-gpu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
package:
name: tensorflow-gpu
version: 0_git20241219
epoch: 1
description: tensorflow-gpu
copyright:
- license: Apache-2.0
dependencies:
runtime:
- python-3.11
- py3.11-pip
- bash

vars:
pypi-package: tensorflow-gpu
prefix: /usr

environment:
contents:
packages:
# TODO add CUDA pkgs
- build-base
- busybox
- py3.11-pip
- python-3.11
environment:
# This is needed to work around the error "ValueError: ZIP does not support timestamps before 1980"
SOURCE_DATE_EPOCH: 315532800

pipeline:
- uses: git-checkout
with:
expected-commit: d311fe017c036143186f9185f491fa6d6461a84e
repository: https://github.com/tensorflow/build
branch: master

- working-directory: tensorflow_runtime_dockerfiles
pipeline:
- name: Install gpu requirements
runs: |
python3 -m pip install \
--no-cache-dir \
--root ${{targets.contextdir}} \
--prefix ${{vars.prefix}} \
-r gpu.requirements.txt

- name: Install Tensorflow
runs: |
python3 -m pip install \
--no-cache-dir \
--root ${{targets.contextdir}} \
--prefix ${{vars.prefix}} \
${{vars.pypi-package}}

- name: Install jupyter requirements
runs: |
python3 -m pip install \
--no-cache-dir \
--root ${{targets.contextdir}} \
--prefix ${{vars.prefix}} \
-r jupyter.requirements.txt \
-U

- name: Install bashrc
runs: |
mkdir -p ${{targets.contextdir}}/etc
cp bashrc ${{targets.contextdir}}/etc/bash.bashrc

- name: Install tensorflow tutorials
runs: |
mkdir -p ${{targets.contextdir}}/tf/tensorflow-tutorials
cp jupyter.readme.md ${{targets.contextdir}}/tf/tensorflow-tutorials/README.md

- name: Cleanup pycache
runs: |
find . -name '__pycache__' -exec rm -rf {} +

test:
environment:
contents:
packages:
- curl
pipeline:
- name: Test import of IPython kernel for Jupyter
runs: |
python3 -m ipykernel.kernelspec
- name: Test Tensorflow library
runs: |
cat <<"EOF" >test.py
import tensorflow as tf

# Check TensorFlow version
print("TensorFlow version:", tf.__version__)

# Check if TensorFlow can access the GPU
print("Is built with CUDA:", tf.test.is_built_with_cuda())
print("Available devices:")
for device in tf.config.list_physical_devices():
print(device)

# Perform a simple computation
a = tf.constant([1.0, 2.0, 3.0])
b = tf.constant([4.0, 5.0, 6.0])
c = tf.add(a, b)
print("Result of addition:", c.numpy())
EOF
python test.py
- name: Test Juputer notebook run
runs: |
jupyter notebook --notebook-dir=/tf --ip 0.0.0.0 --no-browser --allow-root >/dev/null 2>&1 &
pid=$!
sleep 5
curl --fail --location --request GET --head --silent localhost:8888
kill $pid

update:
enabled: true
git: {}
schedule:
period: daily
reason: Upstream does not maintain tags or releases
Loading