From 6a5d998568957dce68aa4aa3a28ba84bf315ffc7 Mon Sep 17 00:00:00 2001 From: sharvil10 Date: Fri, 6 Sep 2024 13:37:34 -0700 Subject: [PATCH 1/3] Gaudi OpenShift notebook container added Signed-off-by: sharvil10 --- .../gaudi/demo/oneapi-sample.ipynb | 315 ++++++++++++++++++ .../gaudi/docker/Dockerfile.rhel9.2 | 235 +++++++++++++ .../gaudi/docker/Dockerfile.rhel9.4 | 248 ++++++++++++++ .../openshift-ai/gaudi/docker/builder/run | 39 +++ .../gaudi/docker/docker-compose.yaml | 50 +++ .../gaudi/docker/install-python310.sh | 90 +++++ .../openshift-ai/gaudi/docker/install_efa.sh | 22 ++ .../gaudi/docker/install_packages.sh | 32 ++ .../gaudi/docker/licenses/LICENSE.txt | 201 +++++++++++ .../gaudi/docker/requirements.txt | 43 +++ .../gaudi/docker/start-notebook.sh | 42 +++ .../gaudi/docker/utils/process.sh | 19 ++ .../openshift-ai/{ => oneapi}/README.md | 0 .../{ => oneapi}/assets/step-1.png | Bin .../{ => oneapi}/assets/step-2.png | Bin .../{ => oneapi}/assets/step-3.png | Bin .../{ => oneapi}/assets/step-4.png | Bin .../manifests/intel-optimized-ml.yaml | 0 .../manifests/intel-optimized-pytorch.yaml | 0 .../manifests/intel-optimized-tensorflow.yaml | 0 20 files changed, 1336 insertions(+) create mode 100644 enterprise/redhat/openshift-ai/gaudi/demo/oneapi-sample.ipynb create mode 100644 enterprise/redhat/openshift-ai/gaudi/docker/Dockerfile.rhel9.2 create mode 100644 enterprise/redhat/openshift-ai/gaudi/docker/Dockerfile.rhel9.4 create mode 100755 enterprise/redhat/openshift-ai/gaudi/docker/builder/run create mode 100644 enterprise/redhat/openshift-ai/gaudi/docker/docker-compose.yaml create mode 100755 enterprise/redhat/openshift-ai/gaudi/docker/install-python310.sh create mode 100755 enterprise/redhat/openshift-ai/gaudi/docker/install_efa.sh create mode 100755 enterprise/redhat/openshift-ai/gaudi/docker/install_packages.sh create mode 100644 enterprise/redhat/openshift-ai/gaudi/docker/licenses/LICENSE.txt create mode 100644 enterprise/redhat/openshift-ai/gaudi/docker/requirements.txt create mode 100755 enterprise/redhat/openshift-ai/gaudi/docker/start-notebook.sh create mode 100755 enterprise/redhat/openshift-ai/gaudi/docker/utils/process.sh rename enterprise/redhat/openshift-ai/{ => oneapi}/README.md (100%) rename enterprise/redhat/openshift-ai/{ => oneapi}/assets/step-1.png (100%) rename enterprise/redhat/openshift-ai/{ => oneapi}/assets/step-2.png (100%) rename enterprise/redhat/openshift-ai/{ => oneapi}/assets/step-3.png (100%) rename enterprise/redhat/openshift-ai/{ => oneapi}/assets/step-4.png (100%) rename enterprise/redhat/openshift-ai/{ => oneapi}/manifests/intel-optimized-ml.yaml (100%) rename enterprise/redhat/openshift-ai/{ => oneapi}/manifests/intel-optimized-pytorch.yaml (100%) rename enterprise/redhat/openshift-ai/{ => oneapi}/manifests/intel-optimized-tensorflow.yaml (100%) diff --git a/enterprise/redhat/openshift-ai/gaudi/demo/oneapi-sample.ipynb b/enterprise/redhat/openshift-ai/gaudi/demo/oneapi-sample.ipynb new file mode 100644 index 00000000..9bd94af3 --- /dev/null +++ b/enterprise/redhat/openshift-ai/gaudi/demo/oneapi-sample.ipynb @@ -0,0 +1,315 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "1e973d1b-c6d0-48a5-a774-0f114101e81e", + "metadata": {}, + "source": [ + "# Getting started with PyTorch on Intel® Gaudi.\n", + "\n", + "This notebook is to help you get started quickly using the Intel® Gaudi accelerator in this container. A simple MNIST model is trained on the Gaudi acclerator. You can tune some of the parameters below to change configuration of the training. For more information and reference please refer to the official documentation of [Intel® Gaudi acclerator](https://docs.habana.ai/en/latest/index.html)." + ] + }, + { + "cell_type": "markdown", + "id": "7eaacf55-bea2-43be-bb48-163848db1a30", + "metadata": { + "tags": [] + }, + "source": [ + "### Setup modes for training\n", + "\n", + "1. lazy_mode: Set to True(False) to enable(disable) lazy mode.\n", + "2. enable_amp: Set to True(False) to enable Automatic Mixed Precision.\n", + "3. epochs: Number of epochs for training\n", + "4. lr: Learning rate for training\n", + "5. batch_size: Number of samples in a batch\n", + "6. milestones: Milestone epochs for the stepLR scheduler." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5e7cf831-6fe6-46ed-a6fd-f2651cc226af", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "lazy_mode = False\n", + "enable_amp = False\n", + "epochs = 20\n", + "batch_size = 128\n", + "lr = 0.01\n", + "milestones = [10,15]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cee8ad90-c52d-4a50-876f-ce0762cb1b62", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "import os\n", + "os.environ['HABANA_LOGS']='/opt/app-root/logs'\n", + "if lazy_mode:\n", + " os.environ['PT_HPU_LAZY_MODE'] = '1'\n", + "else:\n", + " os.environ['PT_HPU_LAZY_MODE'] = '0'" + ] + }, + { + "cell_type": "markdown", + "id": "6eac33d0-2e64-4233-8b3f-40bb7217fef8", + "metadata": { + "tags": [] + }, + "source": [ + "### Import packages" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "06ad44ff-9744-4d6f-af90-375e64717b59", + "metadata": {}, + "outputs": [], + "source": [ + "import torch\n", + "import torch.nn as nn\n", + "import torch.optim as optim\n", + "import torch.nn.functional as F\n", + "import torchvision\n", + "import torchvision.transforms as transforms\n", + "import os\n", + "\n", + "# Import Habana Torch Library\n", + "import habana_frameworks.torch.core as htcore" + ] + }, + { + "cell_type": "markdown", + "id": "062de7f3-4561-4af3-a9ed-2c4cfc918f2f", + "metadata": {}, + "source": [ + "### Define Model" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9df57abb-0b63-4e1c-9d9b-87e74964300e", + "metadata": {}, + "outputs": [], + "source": [ + "class SimpleModel(nn.Module):\n", + " def __init__(self):\n", + " super(SimpleModel, self).__init__()\n", + "\n", + " self.fc1 = nn.Linear(784, 256)\n", + " self.fc2 = nn.Linear(256, 64)\n", + " self.fc3 = nn.Linear(64, 10)\n", + "\n", + " def forward(self, x):\n", + "\n", + " out = x.view(-1,28*28)\n", + " out = F.relu(self.fc1(out))\n", + " out = F.relu(self.fc2(out))\n", + " out = self.fc3(out)\n", + "\n", + " return out" + ] + }, + { + "cell_type": "markdown", + "id": "d899885b-5b4d-4557-a90c-9d507875c2ee", + "metadata": {}, + "source": [ + "### Define training routine" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7b17e9aa-fa11-4870-a7d4-183b803177ab", + "metadata": {}, + "outputs": [], + "source": [ + "def train(net,criterion,optimizer,trainloader,device):\n", + "\n", + " net.train()\n", + " if not lazy_mode:\n", + " net = torch.compile(net,backend=\"hpu_backend\")\n", + " train_loss = 0.0\n", + " correct = 0\n", + " total = 0\n", + "\n", + " for batch_idx, (data, targets) in enumerate(trainloader):\n", + "\n", + " data, targets = data.to(device), targets.to(device)\n", + "\n", + " optimizer.zero_grad()\n", + " if enable_amp:\n", + " with torch.autocast(device_type=\"hpu\", dtype=torch.bfloat16):\n", + " outputs = net(data)\n", + " loss = criterion(outputs, targets)\n", + " else:\n", + " outputs = net(data)\n", + " loss = criterion(outputs, targets)\n", + "\n", + " loss.backward()\n", + " \n", + " # API call to trigger execution\n", + " if lazy_mode:\n", + " htcore.mark_step()\n", + " \n", + " optimizer.step()\n", + "\n", + " # API call to trigger execution\n", + " if lazy_mode:\n", + " htcore.mark_step()\n", + "\n", + " train_loss += loss.item()\n", + " _, predicted = outputs.max(1)\n", + " total += targets.size(0)\n", + " correct += predicted.eq(targets).sum().item()\n", + "\n", + " train_loss = train_loss/(batch_idx+1)\n", + " train_acc = 100.0*(correct/total)\n", + " print(\"Training loss is {} and training accuracy is {}\".format(train_loss,train_acc))" + ] + }, + { + "cell_type": "markdown", + "id": "b7a22d69-a91f-48e1-8fac-e1cfe68590b7", + "metadata": {}, + "source": [ + "### Define testing routine" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f9aa379b-b376-4623-9b5c-f778c3d90ce7", + "metadata": {}, + "outputs": [], + "source": [ + "def test(net,criterion,testloader,device):\n", + "\n", + " net.eval()\n", + " test_loss = 0\n", + " correct = 0\n", + " total = 0\n", + "\n", + " with torch.no_grad():\n", + "\n", + " for batch_idx, (data, targets) in enumerate(testloader):\n", + "\n", + " data, targets = data.to(device), targets.to(device)\n", + " \n", + " if enable_amp:\n", + " with torch.autocast(device_type=\"hpu\", dtype=torch.bfloat16):\n", + " outputs = net(data)\n", + " loss = criterion(outputs, targets)\n", + " else:\n", + " outputs = net(data)\n", + " loss = criterion(outputs, targets)\n", + "\n", + "\n", + " # API call to trigger execution\n", + " if lazy_mode:\n", + " htcore.mark_step()\n", + "\n", + " test_loss += loss.item()\n", + " _, predicted = outputs.max(1)\n", + " total += targets.size(0)\n", + " correct += predicted.eq(targets).sum().item()\n", + "\n", + " test_loss = test_loss/(batch_idx+1)\n", + " test_acc = 100.0*(correct/total)\n", + " print(\"Testing loss is {} and testing accuracy is {}\".format(test_loss,test_acc))" + ] + }, + { + "cell_type": "markdown", + "id": "22e76af9-e355-4299-b84d-f34c9a25e76d", + "metadata": {}, + "source": [ + "### Run the main routine to train and test the model" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1c8ddfb1-d4f7-44b2-aff0-f86f1db8c971", + "metadata": {}, + "outputs": [], + "source": [ + "load_path = './data'\n", + "save_path = './checkpoints'\n", + "\n", + "if(not os.path.exists(save_path)):\n", + " os.makedirs(save_path)\n", + "\n", + "# Target the Gaudi HPU device\n", + "device = torch.device(\"hpu\")\n", + "\n", + "# Data\n", + "transform = transforms.Compose([\n", + " transforms.ToTensor(),\n", + "])\n", + "\n", + "trainset = torchvision.datasets.MNIST(root=load_path, train=True,\n", + " download=True, transform=transform)\n", + "trainloader = torch.utils.data.DataLoader(trainset, batch_size=batch_size,\n", + " shuffle=True, num_workers=2)\n", + "testset = torchvision.datasets.MNIST(root=load_path, train=False,\n", + " download=True, transform=transform)\n", + "testloader = torch.utils.data.DataLoader(testset, batch_size=batch_size,\n", + " shuffle=False, num_workers=2)\n", + "\n", + "net = SimpleModel()\n", + "net.to(device)\n", + "\n", + "criterion = nn.CrossEntropyLoss()\n", + "optimizer = optim.SGD(net.parameters(), lr=lr,\n", + " momentum=0.9, weight_decay=5e-4)\n", + "scheduler = torch.optim.lr_scheduler.MultiStepLR(optimizer, milestones=milestones, gamma=0.1)\n", + "\n", + "for epoch in range(1, epochs+1):\n", + " print(\"=====================================================================\")\n", + " print(\"Epoch : {}\".format(epoch))\n", + " train(net,criterion,optimizer,trainloader,device)\n", + " test(net,criterion,testloader,device)\n", + "\n", + " torch.save(net.state_dict(), os.path.join(save_path,'epoch_{}.pth'.format(epoch)))\n", + "\n", + " scheduler.step()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3.10", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.14" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/Dockerfile.rhel9.2 b/enterprise/redhat/openshift-ai/gaudi/docker/Dockerfile.rhel9.2 new file mode 100644 index 00000000..8cbea97f --- /dev/null +++ b/enterprise/redhat/openshift-ai/gaudi/docker/Dockerfile.rhel9.2 @@ -0,0 +1,235 @@ +ARG BASE_IMAGE +ARG BASE_TAG +FROM ${BASE_IMAGE}:${BASE_TAG} AS gaudi-base +ARG ARTIFACTORY_URL +ARG VERSION +ARG REVISION + +LABEL vendor="Intel Corporation" +LABEL release="${VERSION}-${REVISION}" + +COPY licenses /licenses + +ENV HOME="/opt/app-root/src" +WORKDIR /opt/app-root/src + +RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \ + dnf clean all && rm -rf /var/cache/yum + +RUN echo "[BaseOS]" > /etc/yum.repos.d/CentOS-Linux-BaseOS.repo && \ + echo "name=CentOS Linux 9 - BaseOS" >> /etc/yum.repos.d/CentOS-Linux-BaseOS.repo && \ + echo "baseurl=https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os" >> /etc/yum.repos.d/CentOS-Linux-BaseOS.repo && \ + echo "gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official-SHA256" >> /etc/yum.repos.d/CentOS-Linux-BaseOS.repo && \ + echo "gpgcheck=1" >> /etc/yum.repos.d/CentOS-Linux-BaseOS.repo + +RUN echo "[centos9]" > /etc/yum.repos.d/CentOS-Linux-AppStream.repo && \ + echo "name=CentOS Linux 9 - AppStream" >> /etc/yum.repos.d/CentOS-Linux-AppStream.repo && \ + echo "baseurl=https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os" >> /etc/yum.repos.d/CentOS-Linux-AppStream.repo && \ + echo "gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official-SHA256" >> /etc/yum.repos.d/CentOS-Linux-AppStream.repo && \ + echo "gpgcheck=1" >> /etc/yum.repos.d/CentOS-Linux-AppStream.repo + +RUN dnf install -y \ + clang \ + cmake3 \ + cpp \ + gcc \ + gcc-c++ \ + glibc \ + glibc-headers \ + glibc-devel \ + jemalloc \ + libarchive \ + libksba \ + unzip \ + llvm \ + lsof \ + python3-devel \ + openssh-clients \ + openssl \ + openssl-devel \ + libjpeg-devel \ + openssh-server \ + lsb_release \ + wget \ + git \ + libffi-devel \ + bzip2-devel \ + zlib-devel \ + mesa-libGL \ + iproute \ + python3-dnf-plugin-versionlock && \ + # update pkgs (except OS version) for resolving potentials CVEs + dnf versionlock add redhat-release* && \ + dnf update -y && \ + dnf clean all && rm -rf /var/cache/yum + +ENV PYTHON_VERSION=3.10 +COPY install-python310.sh . +RUN ./install-python310.sh rhel9.2 && rm install-python310.sh +ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH + +COPY install_efa.sh . +RUN ./install_efa.sh && rm install_efa.sh && rm -rf /etc/ld.so.conf.d/efa.conf /etc/profile.d/efa.sh + +ENV LIBFABRIC_VERSION="1.20.0" +ENV LIBFABRIC_ROOT="/opt/habanalabs/libfabric-${LIBFABRIC_VERSION}" +ENV MPI_ROOT=/opt/amazon/openmpi +ENV LD_LIBRARY_PATH=$LIBFABRIC_ROOT/lib:${MPI_ROOT}/lib:/usr/lib/habanalabs:$LD_LIBRARY_PATH +ENV PATH=${LIBFABRIC_ROOT}/bin:${MPI_ROOT}/bin:$PATH +ENV OPAL_PREFIX=${MPI_ROOT} +ENV MPICC=${MPI_ROOT}/bin/mpicc +ENV RDMAV_FORK_SAFE=1 +ENV FI_EFA_USE_DEVICE_RDMA=1 + +RUN echo "[habanalabs]" > /etc/yum.repos.d/habanalabs.repo && \ + echo "name=Habana RH9 Linux repo" >> /etc/yum.repos.d/habanalabs.repo && \ + echo "baseurl=https://${ARTIFACTORY_URL}/artifactory/rhel/9/9.2" >> /etc/yum.repos.d/habanalabs.repo && \ + echo "gpgkey=https://${ARTIFACTORY_URL}/artifactory/rhel/9/9.2/repodata/repomd.xml.key" >> /etc/yum.repos.d/habanalabs.repo && \ + echo "gpgcheck=1" >> /etc/yum.repos.d/habanalabs.repo + +# for Habana GPG key with SHA-1 signature +RUN update-crypto-policies --set DEFAULT:SHA1 + +RUN dnf install -y habanalabs-rdma-core-"$VERSION"-"$REVISION".el9 \ + habanalabs-thunk-"$VERSION"-"$REVISION".el9 \ + habanalabs-firmware-tools-"$VERSION"-"$REVISION".el9 \ + habanalabs-graph-"$VERSION"-"$REVISION".el9 && \ + rm -f /etc/yum.repos.d/habanalabs.repo && rm -f /etc/yum.repos.d/habana.repo && rm -rf /tmp/* && \ + dnf clean all && rm -rf /var/cache/yum + +RUN rpm -V habanalabs-rdma-core && rpm -V habanalabs-thunk && rpm -V habanalabs-firmware-tools && rpm -V habanalabs-graph + +# There is no need to store pip installation files inside docker image +ENV PIP_NO_CACHE_DIR=on +ENV PIP_DISABLE_PIP_VERSION_CHECK=1 +ENV RDMA_CORE_ROOT=/opt/habanalabs/rdma-core/src +ENV RDMA_CORE_LIB=${RDMA_CORE_ROOT}/build/lib + +RUN wget -nv -O /tmp/libfabric-${LIBFABRIC_VERSION}.tar.bz2 https://github.com/ofiwg/libfabric/releases/download/v${LIBFABRIC_VERSION}/libfabric-${LIBFABRIC_VERSION}.tar.bz2 && \ + cd /tmp/ && tar xf /tmp/libfabric-${LIBFABRIC_VERSION}.tar.bz2 && \ + cd /tmp/libfabric-${LIBFABRIC_VERSION} && \ + ./configure --prefix=$LIBFABRIC_ROOT --enable-psm3-verbs --enable-verbs=yes --with-synapseai=/usr && \ + make && make install && cd / && rm -rf /tmp/libfabric-${LIBFABRIC_VERSION}.tar.bz2 /tmp/libfabric-${LIBFABRIC_VERSION} + +RUN wget -nv -O /tmp/main.zip https://github.com/HabanaAI/hccl_ofi_wrapper/archive/refs/heads/main.zip && \ + unzip /tmp/main.zip -d /tmp && \ + cd /tmp/hccl_ofi_wrapper-main && \ + make && cp -f libhccl_ofi_wrapper.so /usr/lib/habanalabs/libhccl_ofi_wrapper.so && \ + cd / && \ + rm -rf /tmp/main.zip /tmp/hccl_ofi_wrapper-main + +ENV GC_KERNEL_PATH=/usr/lib/habanalabs/libtpc_kernels.so +ENV HABANA_LOGS=/opt/app-root/log/habana_logs/ +ENV HABANA_SCAL_BIN_PATH=/opt/habanalabs/engines_fw +ENV HABANA_PLUGINS_LIB_PATH=/opt/habanalabs/habana_plugins + +ENV APP_ROOT="/opt/app-root" + +RUN python3.10 -m pip install "pip>=23.3" "setuptools>=70.0.0" "wheel==0.38.4" + +WORKDIR ${APP_ROOT} + +RUN python3.10 -m venv ${APP_ROOT} && \ + wget -O ${APP_ROOT}/bin/fix-permissions \ + https://raw.githubusercontent.com/sclorg/s2i-python-container/master/3.9-minimal/root/usr/bin/fix-permissions && \ + chown -R 1001:0 ${APP_ROOT} && \ + chmod +x ${APP_ROOT}/bin/fix-permissions && \ + ${APP_ROOT}/bin/fix-permissions ${APP_ROOT} -P && \ + echo "unset BASH_ENV PROMPT_COMMAND ENV" >> ${APP_ROOT}/bin/activate + +USER 1001 + +ENV BASH_ENV="${APP_ROOT}/bin/activate" +ENV ENV="${APP_ROOT}/bin/activate" +ENV PROMPT_COMMAND=". ${APP_ROOT}/bin/activate" + +SHELL ["/bin/bash", "-c"] + +RUN python -m pip install habana_media_loader=="${VERSION}"."${REVISION}" + + +FROM gaudi-base AS gaudi-pytorch + +ARG PT_VERSION +ARG VERSION +ARG REVISION +ARG ARTIFACTORY_URL +ENV BASE_NAME=rhel9.2 + +LABEL name="PyTorch Installer" +LABEL summary="Habanalabs PyTorch installer layer for RHEL9.2" +LABEL description="Image with pre installed Habanalabs packages for PyTorch" + +RUN echo "/usr/lib/habanalabs" > $(python -c "import sysconfig; print(sysconfig.get_path('platlib'))")/habanalabs-graph.pth + +USER root + +RUN echo "[CRB]" > /etc/yum.repos.d/CentOS-Linux-CRB.repo && \ + echo "name=CentOS Linux 9 - CRB" >> /etc/yum.repos.d/CentOS-Linux-CRB.repo && \ + echo "baseurl=https://mirror.stream.centos.org/9-stream/CRB/x86_64/os" >> /etc/yum.repos.d/CentOS-Linux-CRB.repo && \ + echo "gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official-SHA256" >> /etc/yum.repos.d/CentOS-Linux-CRB.repo && \ + echo "gpgcheck=1" >> /etc/yum.repos.d/CentOS-Linux-CRB.repo + +RUN dnf install --allowerasing -y \ + curl \ + cairo-devel \ + numactl-devel \ + iproute \ + which \ + zlib-devel \ + lapack-devel \ + openblas-devel \ + numactl \ + gperftools-devel && \ + dnf clean all && rm -rf /var/cache/yum + +RUN dnf config-manager --add-repo https://yum.repos.intel.com/mkl/setup/intel-mkl.repo -y && \ + dnf install --allowerasing -y intel-mkl-64bit-2020.4-912 && \ + dnf clean all && rm -rf /var/cache/yum + +# Set LD_PRELOAD after all required installations to +# avoid warnings during docker creation +ENV LD_PRELOAD=/lib64/libtcmalloc.so.4 +ENV TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD=7516192768 + +RUN rm -rf /tmp/* + +USER 1001 + +COPY --chown=1001:0 install_packages.sh . +RUN ./install_packages.sh && rm -f install_packages.sh + +USER root + +RUN /sbin/ldconfig && echo "source /etc/profile.d/habanalabs.sh" >> ~/.bashrc && \ + chown 1001:0 ~/.bashrc + +USER 1001 + +FROM gaudi-pytorch AS gaudi-notebooks + +WORKDIR ${APP_ROOT}/src + +COPY --chown=1001:0 requirements.txt requirements.txt +COPY --chown=1001:0 start-notebook.sh /opt/app-root/bin +COPY --chown=1001:0 builder /opt/app-root/builder +COPY --chown=1001:0 utils /opt/app-root/bin/utils + +USER 1001 + +RUN python -m pip install -r requirements.txt && \ + chmod -R g+w ${APP_ROOT}/lib/python3.10/site-packages && \ + fix-permissions ${APP_ROOT} -P && \ + chmod -R g+w /opt/app-root/src && \ + sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \ + jupyter labextension disable "@jupyterlab/apputils-extension:announcements" + +RUN cd ${APP_ROOT}/ && \ + git clone https://github.com/HabanaAI/vllm-fork.git && \ + cd vllm-fork && \ + VLLM_TARGET_DEVICE=hpu pip install -e . + +WORKDIR ${APP_ROOT}/src +ENV NOTEBOOK_SAMPLE_LINK="https://raw.githubusercontent.com/sharvil10/ai-containers/main/enterprise/redhat/openshift-ai/gaudi/demo/Getting-started.ipynb" + +ENTRYPOINT ["bash", "-c", "/opt/app-root/builder/run"] diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/Dockerfile.rhel9.4 b/enterprise/redhat/openshift-ai/gaudi/docker/Dockerfile.rhel9.4 new file mode 100644 index 00000000..41a26399 --- /dev/null +++ b/enterprise/redhat/openshift-ai/gaudi/docker/Dockerfile.rhel9.4 @@ -0,0 +1,248 @@ +ARG BASE_IMAGE +ARG BASE_TAG +FROM ${BASE_IMAGE}:${BASE_TAG} AS gaudi-base +ARG ARTIFACTORY_URL +ARG VERSION +ARG REVISION + +LABEL vendor="Intel Corporation" +LABEL release="${VERSION}-${REVISION}" + +COPY licenses /licenses + +ENV HOME="/opt/app-root/src" +WORKDIR /opt/app-root/src + +RUN echo "[BaseOS]" > /etc/yum.repos.d/CentOS-Linux-BaseOS.repo && \ + echo "name=CentOS Linux 9 - BaseOS" >> /etc/yum.repos.d/CentOS-Linux-BaseOS.repo && \ + echo "baseurl=https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os" >> /etc/yum.repos.d/CentOS-Linux-BaseOS.repo && \ + echo "gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official-SHA256" >> /etc/yum.repos.d/CentOS-Linux-BaseOS.repo && \ + echo "gpgcheck=1" >> /etc/yum.repos.d/CentOS-Linux-BaseOS.repo + +RUN echo "[centos9]" > /etc/yum.repos.d/CentOS-Linux-AppStream.repo && \ + echo "name=CentOS Linux 9 - AppStream" >> /etc/yum.repos.d/CentOS-Linux-AppStream.repo && \ + echo "baseurl=https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os" >> /etc/yum.repos.d/CentOS-Linux-AppStream.repo && \ + echo "gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official-SHA256" >> /etc/yum.repos.d/CentOS-Linux-AppStream.repo && \ + echo "gpgcheck=1" >> /etc/yum.repos.d/CentOS-Linux-AppStream.repo + +RUN echo "[CRB]" > /etc/yum.repos.d/CentOS-Linux-CRB.repo && \ + echo "name=CentOS Linux 9 - CRB" >> /etc/yum.repos.d/CentOS-Linux-CRB.repo && \ + echo "baseurl=https://mirror.stream.centos.org/9-stream/CRB/x86_64/os" >> /etc/yum.repos.d/CentOS-Linux-CRB.repo && \ + echo "gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official-SHA256" >> /etc/yum.repos.d/CentOS-Linux-CRB.repo && \ + echo "gpgcheck=1" >> /etc/yum.repos.d/CentOS-Linux-CRB.repo + +RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \ + dnf clean all && rm -rf /var/cache/yum + +RUN dnf install -y \ + clang \ + cmake3 \ + cpp \ + gcc \ + gcc-c++ \ + glibc \ + glibc-headers \ + glibc-devel \ + jemalloc \ + libarchive \ + libksba \ + unzip \ + llvm \ + lsof \ + python3-devel \ + openssh-clients \ + openssl-1:3.0.7-27.el9 \ + openssl-devel-1:3.0.7-27.el9 \ + libjpeg-devel \ + openssh-server \ + lsb_release \ + wget \ + git \ + libffi-devel \ + bzip2-devel \ + zlib-devel \ + mesa-libGL \ + iproute \ + python3.11 \ + python3.11-pip \ + python3.11-devel \ + ffmpeg-free \ + perl-Net-SSLeay-1.92-2.el9 \ + python3-dnf-plugin-versionlock && \ + # update pkgs (except OS version) for resolving potentials CVEs + dnf versionlock add redhat-release* openssl* perl-Net-SSLeay && \ + dnf update -y && \ + dnf clean all && rm -rf /var/cache/yum + +RUN alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2 && \ + alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 && \ + alternatives --set python3 /usr/bin/python3.11 && \ + alternatives --install /usr/bin/pip3 pip3 /usr/bin/pip3.11 2 && \ + alternatives --install /usr/bin/pip3 pip3 /usr/bin/pip3.9 1 && \ + alternatives --set pip3 /usr/bin/pip3.11 + +COPY install_efa.sh . +RUN ./install_efa.sh && rm install_efa.sh && rm -rf /etc/ld.so.conf.d/efa.conf /etc/profile.d/efa.sh + +ENV LIBFABRIC_VERSION="1.20.0" +ENV LIBFABRIC_ROOT="/opt/habanalabs/libfabric-${LIBFABRIC_VERSION}" +ENV MPI_ROOT=/opt/amazon/openmpi +ENV LD_LIBRARY_PATH=$LIBFABRIC_ROOT/lib:${MPI_ROOT}/lib:/usr/lib/habanalabs:$LD_LIBRARY_PATH +ENV PATH=${LIBFABRIC_ROOT}/bin:${MPI_ROOT}/bin:$PATH +ENV OPAL_PREFIX=${MPI_ROOT} +ENV MPICC=${MPI_ROOT}/bin/mpicc +ENV RDMAV_FORK_SAFE=1 +ENV FI_EFA_USE_DEVICE_RDMA=1 + +RUN echo "[habanalabs]" > /etc/yum.repos.d/habanalabs.repo && \ + echo "name=Habana RH9 Linux repo" >> /etc/yum.repos.d/habanalabs.repo && \ + echo "baseurl=https://${ARTIFACTORY_URL}/artifactory/rhel/9/9.4" >> /etc/yum.repos.d/habanalabs.repo && \ + echo "gpgkey=https://${ARTIFACTORY_URL}/artifactory/rhel/9/9.4/repodata/repomd.xml.key" >> /etc/yum.repos.d/habanalabs.repo && \ + echo "gpgcheck=1" >> /etc/yum.repos.d/habanalabs.repo + +# for Habana GPG key with SHA-1 signature +RUN update-crypto-policies --set DEFAULT:SHA1 + +RUN dnf install -y habanalabs-rdma-core-"$VERSION"-"$REVISION".el9 \ + habanalabs-thunk-"$VERSION"-"$REVISION".el9 \ + habanalabs-firmware-tools-"$VERSION"-"$REVISION".el9 \ + habanalabs-graph-"$VERSION"-"$REVISION".el9 && \ + rm -f /etc/yum.repos.d/habanalabs.repo && rm -f /etc/yum.repos.d/habana.repo && rm -rf /tmp/* && \ + dnf clean all && rm -rf /var/cache/yum + +RUN rpm -V habanalabs-rdma-core && rpm -V habanalabs-thunk && rpm -V habanalabs-firmware-tools && rpm -V habanalabs-graph + +# There is no need to store pip installation files inside docker image +ENV PIP_NO_CACHE_DIR=on +ENV PIP_DISABLE_PIP_VERSION_CHECK=1 +ENV RDMA_CORE_ROOT=/opt/habanalabs/rdma-core/src +ENV RDMA_CORE_LIB=${RDMA_CORE_ROOT}/build/lib + +RUN wget -nv -O /tmp/libfabric-${LIBFABRIC_VERSION}.tar.bz2 https://github.com/ofiwg/libfabric/releases/download/v${LIBFABRIC_VERSION}/libfabric-${LIBFABRIC_VERSION}.tar.bz2 && \ + cd /tmp/ && tar xf /tmp/libfabric-${LIBFABRIC_VERSION}.tar.bz2 && \ + cd /tmp/libfabric-${LIBFABRIC_VERSION} && \ + ./configure --prefix=$LIBFABRIC_ROOT --enable-psm3-verbs --enable-verbs=yes --with-synapseai=/usr && \ + make && make install && cd / && rm -rf /tmp/libfabric-${LIBFABRIC_VERSION}.tar.bz2 /tmp/libfabric-${LIBFABRIC_VERSION} + +RUN wget -nv -O /tmp/main.zip https://github.com/HabanaAI/hccl_ofi_wrapper/archive/refs/heads/main.zip && \ + unzip /tmp/main.zip -d /tmp && \ + cd /tmp/hccl_ofi_wrapper-main && \ + make && cp -f libhccl_ofi_wrapper.so /usr/lib/habanalabs/libhccl_ofi_wrapper.so && \ + cd / && \ + rm -rf /tmp/main.zip /tmp/hccl_ofi_wrapper-main + +ENV APP_ROOT="/opt/app-root" + +RUN python3.11 -m pip install pip==23.3.1 setuptools==67.3.3 wheel==0.38.4 + +WORKDIR ${APP_ROOT} + +RUN python3.11 -m venv ${APP_ROOT} && \ + wget -O ${APP_ROOT}/bin/fix-permissions \ + https://raw.githubusercontent.com/sclorg/s2i-python-container/master/3.9-minimal/root/usr/bin/fix-permissions && \ + chown -R 1001:0 ${APP_ROOT} && \ + chmod +x ${APP_ROOT}/bin/fix-permissions && \ + ${APP_ROOT}/bin/fix-permissions ${APP_ROOT} -P && \ + echo "unset BASH_ENV PROMPT_COMMAND ENV" >> ${APP_ROOT}/bin/activate + +USER 1001 + +ENV BASH_ENV="${APP_ROOT}/bin/activate" +ENV ENV="${APP_ROOT}/bin/activate" +ENV PROMPT_COMMAND=". ${APP_ROOT}/bin/activate" + +SHELL ["/bin/bash", "-c"] + +RUN python -m pip install habana_media_loader=="${VERSION}"."${REVISION}" + +ENV GC_KERNEL_PATH=/usr/lib/habanalabs/libtpc_kernels.so +ENV HABANA_LOGS=/opt/app-root/log/habana_logs/ +ENV HABANA_SCAL_BIN_PATH=/opt/habanalabs/engines_fw +ENV HABANA_PLUGINS_LIB_PATH=/opt/habanalabs/habana_plugins + +FROM gaudi-base AS gaudi-pytorch + +ARG PT_VERSION +ARG VERSION +ARG REVISION +ARG ARTIFACTORY_URL +ENV BASE_NAME=rhel9.4 + +LABEL name="PyTorch Installer" +LABEL summary="Habanalabs PyTorch installer layer for RHEL9.2" +LABEL description="Image with pre installed Habanalabs packages for PyTorch" + +RUN echo "/usr/lib/habanalabs" > $(python -c "import sysconfig; print(sysconfig.get_path('platlib'))")/habanalabs-graph.pt + +USER root + +RUN echo "[CRB]" > /etc/yum.repos.d/CentOS-Linux-CRB.repo && \ + echo "name=CentOS Linux 9 - CRB" >> /etc/yum.repos.d/CentOS-Linux-CRB.repo && \ + echo "baseurl=https://mirror.stream.centos.org/9-stream/CRB/x86_64/os" >> /etc/yum.repos.d/CentOS-Linux-CRB.repo && \ + echo "gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official-SHA256" >> /etc/yum.repos.d/CentOS-Linux-CRB.repo && \ + echo "gpgcheck=1" >> /etc/yum.repos.d/CentOS-Linux-CRB.repo + +RUN dnf install --allowerasing -y \ + curl \ + cairo-devel \ + numactl-devel \ + iproute \ + which \ + zlib-devel \ + lapack-devel \ + openblas-devel \ + numactl \ + gperftools-devel && \ + dnf clean all && rm -rf /var/cache/yum + +RUN dnf config-manager --add-repo https://yum.repos.intel.com/mkl/setup/intel-mkl.repo -y && \ + dnf install --allowerasing -y intel-mkl-64bit-2020.4-912 && \ + dnf clean all && rm -rf /var/cache/yum + +RUN rm -rf /tmp/* + +USER 1001 + +COPY --chown=1001:0 install_packages.sh . + +# Set LD_PRELOAD after all required installations to +# avoid warnings during docker creation +ENV LD_PRELOAD=/lib64/libtcmalloc.so.4 +ENV TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD=7516192768 + +RUN ./install_packages.sh && rm -f install_packages.sh + +USER root + +RUN /sbin/ldconfig && echo "source /etc/profile.d/habanalabs.sh" >> ~/.bashrc && \ + chown 1001:0 ~/.bashrc + +USER 1001 + +FROM gaudi-pytorch AS gaudi-notebooks + +WORKDIR ${APP_ROOT}/src + +COPY --chown=1001:0 requirements.txt requirements.txt +COPY --chown=1001:0 start-notebook.sh /opt/app-root/bin +COPY --chown=1001:0 builder /opt/app-root/builder +COPY --chown=1001:0 utils /opt/app-root/bin/utils + +USER 1001 + +RUN python -m pip install -r requirements.txt && \ + chmod -R g+w ${APP_ROOT}/lib/python3.11/site-packages && \ + fix-permissions ${APP_ROOT} -P && \ + chmod -R g+w /opt/app-root/src && \ + sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \ + jupyter labextension disable "@jupyterlab/apputils-extension:announcements" + +RUN cd ${APP_ROOT}/ && \ + git clone https://github.com/HabanaAI/vllm-fork.git && \ + cd vllm-fork && \ + VLLM_TARGET_DEVICE=hpu pip install -e . + +WORKDIR ${APP_ROOT}/src +ENV JUPYTER_PRELOAD_REPOS="https://github.com/IntelAI/oneAPI-samples" +ENV REPO_BRANCH="main" +ENTRYPOINT ["bash", "-c", "/opt/app-root/builder/run"] diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/builder/run b/enterprise/redhat/openshift-ai/gaudi/docker/builder/run new file mode 100755 index 00000000..687bb745 --- /dev/null +++ b/enterprise/redhat/openshift-ai/gaudi/docker/builder/run @@ -0,0 +1,39 @@ +#!/bin/bash + +set -eo pipefail + +set -x + +APP_ROOT=${APP_ROOT:-/workspace} + +# Pre-clone repositories defined in JUPYTER_PRELOAD_REPOS +if [ -n "${JUPYTER_PRELOAD_REPOS}" ]; then + for repo in `echo ${JUPYTER_PRELOAD_REPOS} | tr ',' ' '`; do + # Check for the presence of "@branch" in the repo string + REPO_BRANCH=$(echo ${repo} | cut -s -d'@' -f2) + if [[ -n ${REPO_BRANCH} ]]; then + # Remove the branch from the repo string and convert REPO_BRANCH to git clone arg + repo=$(echo ${repo} | cut -d'@' -f1) + REPO_BRANCH="-b ${REPO_BRANCH}" + fi + echo "Checking if repository $repo exists locally" + REPO_DIR=$(basename ${repo}) + if [ -d "${REPO_DIR}" ]; then + pushd ${REPO_DIR} + # Do nothing if the repo already exists + echo "The ${repo} has already been cloned" + : + popd + else + GIT_SSL_NO_VERIFY=true git clone ${repo} ${REPO_DIR} ${REPO_BRANCH} + fi + done +fi + +if [ -n "${NOTEBOOK_SAMPLES_LINK}" ]; then + for link in `echo ${NOTEBOOK_SAMPLES_LINK} | tr ',' ' '`; do + wget ${link} + done +fi + +${APP_ROOT}/bin/start-notebook.sh "$@" diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/docker-compose.yaml b/enterprise/redhat/openshift-ai/gaudi/docker/docker-compose.yaml new file mode 100644 index 00000000..1724a4c7 --- /dev/null +++ b/enterprise/redhat/openshift-ai/gaudi/docker/docker-compose.yaml @@ -0,0 +1,50 @@ +services: + gaudi-base: + build: + args: + BASE_IMAGE: ${BASE_IMAGE:-registry.access.redhat.com/ubi9/ubi} + BASE_TAG: ${RHEL_OS:-9.2} + http_proxy: ${http_proxy} + https_proxy: ${https_proxy} + no_proxy: "" + ARTIFACTORY_URL: ${ARTIFACTORY_URL:-vault.habana.ai} + VERSION: ${VERSION:-1.17.0} + REVISION: ${REVISION:-495} + context: . + target: gaudi-base + dockerfile: Dockerfile.rhel${RHEL_OS:-9.2} + image: gaudi-base:${RHEL_OS:-9.2}-${VERSION:-1.17.0}-${REVISION:-495} + gaudi-pytorch: + build: + args: + BASE_IMAGE: ${BASE_IMAGE:-registry.access.redhat.com/ubi9/ubi} + BASE_TAG: ${RHEL_OS:-9.2} + BASE_NAME: rhel${RHEL_OS:-rhel9.2} + PT_VERSION: ${PT_VERSION:-2.3.1} + http_proxy: ${http_proxy} + https_proxy: ${https_proxy} + no_proxy: "" + ARTIFACTORY_URL: ${ARTIFACTORY_URL:-vault.habana.ai} + VERSION: ${VERSION:-1.17.0} + REVISION: ${REVISION:-495} + context: . + target: gaudi-pytorch + dockerfile: Dockerfile.rhel${RHEL_OS:-9.2} + image: gaudi-pytorch:${RHEL_OS:-9.2}-${VERSION:-1.17.0}-${REVISION:-495} + gaudi-notebooks: + build: + args: + BASE_IMAGE: ${BASE_IMAGE:-registry.access.redhat.com/ubi9/ubi} + BASE_TAG: ${RHEL_OS:-9.2} + BASE_NAME: ${BASE_NAME:-rhel9.2} + PT_VERSION: ${PT_VERSION:-2.3.1} + http_proxy: ${http_proxy} + https_proxy: ${https_proxy} + no_proxy: "" + ARTIFACTORY_URL: ${ARTIFACTORY_URL:-vault.habana.ai} + VERSION: ${VERSION:-1.17.0} + REVISION: ${REVISION:-495} + context: . + target: gaudi-notebooks + dockerfile: Dockerfile.rhel${RHEL_OS:-9.2} + image: gaudi-notebooks:${RHEL_OS:-9.2}-${VERSION:-1.17.0}-${REVISION:-495} diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/install-python310.sh b/enterprise/redhat/openshift-ai/gaudi/docker/install-python310.sh new file mode 100755 index 00000000..78acab46 --- /dev/null +++ b/enterprise/redhat/openshift-ai/gaudi/docker/install-python310.sh @@ -0,0 +1,90 @@ +#!/bin/bash +set -e + +_BASE_NAME=${1:-"ubuntu22.04"} +_SSL_LIB="" + +# preinstall dependencies and define variables +case "${_BASE_NAME}" in + *ubuntu22.04*) + echo "Skip install Python3.10 from source on Ubuntu22.04" + exit 0; + ;; + *debian* | *ubuntu*) + apt update + apt install -y libsqlite3-dev libreadline-dev + ;; + *rhel*) + yum install -y sqlite-devel readline-devel xz-devel + ;; + *tencentos3.1*) + dnf install -y sqlite-devel readline-devel zlib-devel xz-devel bzip2-devel libffi-devel + wget -nv -O /opt/openssl-1.1.1w.tar.gz https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz && \ + cd /opt/ && \ + tar xzf openssl-1.1.1w.tar.gz && \ + rm -rf openssl-1.1.1w.tar.gz && \ + cd openssl-1.1.1w && \ + ./config --prefix=/usr/local/openssl-1.1.1w shared zlib && \ + make && make install + ln -s /etc/pki/tls/cert.pem /usr/local/openssl-1.1.1w/ssl/cert.pem + + PATH=$PATH:/usr/local/protoc/bin:/usr/local/openssl-1.1.1w/bin + LD_LIBRARY_PATH=/usr/local/openssl-1.1.1w/lib:$LD_LIBRARY_PATH + _SSL_LIB="--with-openssl=/usr/local/openssl-1.1.1w" + ;; + *amzn2*) + yum install -y sqlite-devel readline-devel + wget -nv -O /opt/openssl-1.1.1w.tar.gz https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz && \ + cd /opt/ && \ + tar xzf openssl-1.1.1w.tar.gz && \ + rm -rf openssl-1.1.1w.tar.gz && \ + cd openssl-1.1.1w && \ + ./config --prefix=/usr/local/openssl-1.1.1w shared zlib && \ + make && make install + ln -s /etc/pki/tls/cert.pem /usr/local/openssl-1.1.1w/ssl/cert.pem + + PATH=$PATH:/usr/local/protoc/bin:/usr/local/openssl-1.1.1w/bin + LD_LIBRARY_PATH=/usr/local/openssl-1.1.1w/lib:$LD_LIBRARY_PATH + _SSL_LIB="--with-openssl=/usr/local/openssl-1.1.1w" + ;; +esac + +# install Python +wget -nv -O /opt/Python-3.10.14.tgz https://www.python.org/ftp/python/3.10.14/Python-3.10.14.tgz +cd /opt/ +tar xzf Python-3.10.14.tgz +rm -f Python-3.10.14.tgz +cd Python-3.10.14 +./configure --enable-optimizations --enable-loadable-sqlite-extensions --enable-shared $_SSL_LIB +make -j && make altinstall + +# post install +case "${_BASE_NAME}" in + *rhel9*) + alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 2 && \ + alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 && \ + alternatives --set python3 /usr/local/bin/python3.10 + export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH + ;; + *tencentos3.1*) + alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 4 && \ + alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 3 && \ + alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2 && \ + alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1 && \ + alternatives --set python3 /usr/local/bin/python3.10 + export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH + ;; + *amzn2*) + update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 3 && \ + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2 && \ + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1 + ;; + *debian*) + update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 3 + update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.8 2 + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1 + ;; +esac + +python3 -m pip install --upgrade pip setuptools + diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/install_efa.sh b/enterprise/redhat/openshift-ai/gaudi/docker/install_efa.sh new file mode 100755 index 00000000..bb6f6803 --- /dev/null +++ b/enterprise/redhat/openshift-ai/gaudi/docker/install_efa.sh @@ -0,0 +1,22 @@ +#!/bin/bash -ex + +DEFAULT_EFA_INSTALLER_VER=1.29.0 +efa_installer_version=${1:-$DEFAULT_EFA_INSTALLER_VER} + +tmp_dir=$(mktemp -d) +wget -nv https://efa-installer.amazonaws.com/aws-efa-installer-$efa_installer_version.tar.gz -P $tmp_dir +tar -xf $tmp_dir/aws-efa-installer-$efa_installer_version.tar.gz -C $tmp_dir +pushd $tmp_dir/aws-efa-installer +case $(. /etc/os-release ; echo -n $ID) in + rhel) + # we cannot install dkms packages on RHEL images due to OCP rules + rm -f RPMS/RHEL8/x86_64/dkms*.rpm + ;; + tencentos) + dnf install -y RPMS/ROCKYLINUX8/x86_64/rdma-core/libibverbs-46.0-1.el8.x86_64.rpm RPMS/ROCKYLINUX8/x86_64/rdma-core/libibverbs-utils-46.0-1.el8.x86_64.rpm + patch -f -p1 -i /tmp/tencentos_efa_patch.txt --reject-file=tencentos_efa_patch.rej --no-backup-if-mismatch + ;; +esac +./efa_installer.sh -y --skip-kmod --skip-limit-conf --no-verify +popd +rm -rf $tmp_dir diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/install_packages.sh b/enterprise/redhat/openshift-ai/gaudi/docker/install_packages.sh new file mode 100755 index 00000000..a2cf8dda --- /dev/null +++ b/enterprise/redhat/openshift-ai/gaudi/docker/install_packages.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -ex + +pt_package_name="pytorch_modules-v${PT_VERSION}_${VERSION}_${REVISION}.tgz" +os_string="ubuntu${OS_NUMBER}" +case "${BASE_NAME}" in + *rhel9.2*) + os_string="rhel92" + ;; + *rhel9.4*) + os_string="rhel94" + ;; + *rhel8*) + os_string="rhel86" + ;; + *amzn2*) + os_string="amzn2" + ;; + *tencentos*) + os_string="tencentos31" + ;; +esac +pt_artifact_path="https://${ARTIFACTORY_URL}/artifactory/gaudi-pt-modules/${VERSION}/${REVISION}/pytorch/${os_string}" + +tmp_path=$(mktemp --directory) +wget --no-verbose "${pt_artifact_path}/${pt_package_name}" +tar -xf "${pt_package_name}" -C "${tmp_path}"/. +pushd "${tmp_path}" +./install.sh $VERSION $REVISION +popd +# cleanup +rm -rf "${tmp_path}" "${pt_package_name}" diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/licenses/LICENSE.txt b/enterprise/redhat/openshift-ai/gaudi/docker/licenses/LICENSE.txt new file mode 100644 index 00000000..f49a4e16 --- /dev/null +++ b/enterprise/redhat/openshift-ai/gaudi/docker/licenses/LICENSE.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/requirements.txt b/enterprise/redhat/openshift-ai/gaudi/docker/requirements.txt new file mode 100644 index 00000000..86eefdfe --- /dev/null +++ b/enterprise/redhat/openshift-ai/gaudi/docker/requirements.txt @@ -0,0 +1,43 @@ +# LLM Packages +deepspeed @ git+https://github.com/HabanaAI/DeepSpeed.git@1.17.0 + +# Datascience and useful extensions +kafka-python~=2.0.2 +matplotlib~=3.8.3 +pandas~=2.2.0 +plotly~=5.20.0 +scikit-learn +scipy~=1.12.0 +skl2onnx~=1.16.0 +codeflare-sdk~=0.18.0 + +# DB connectors +pymongo~=4.6.2 +psycopg~=3.1.18 +pyodbc~=5.1.0 +mysql-connector-python~=8.3.0 + +# JupyterLab packages +odh-elyra~=3.16.7 +jupyterlab~=3.6.7 # Wait on upgrade till plugins are ready +jupyter-bokeh~=3.0.7 # Upgrade would bring in jupyterlab 4 +jupyter-server~=2.14.1 +jupyter-server-proxy~=4.2.0 # Upgrade would bring in jupyterlab 4 +jupyter-server-terminals~=0.5.3 +jupyterlab-git~=0.44.0 +jupyterlab-lsp~=4.2.0 +jupyterlab-widgets~=3.0.10 +jupyter-resource-usage~=0.7.2 +nbdime~=3.2.1 +nbgitpuller~=1.2.0 + +# pycodestyle is dependency of below packages +# and to achieve compatible of pycodestyle with python-lsp-server[all] +# pinned the below packages +autopep8~=2.0.4 +flake8~=7.0.0 +# Base packages +wheel~=0.43.0 +setuptools>=70.0.0 +pip>=23.3 +aiohttp==3.10.2 diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/start-notebook.sh b/enterprise/redhat/openshift-ai/gaudi/docker/start-notebook.sh new file mode 100755 index 00000000..4431dbad --- /dev/null +++ b/enterprise/redhat/openshift-ai/gaudi/docker/start-notebook.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +# Load bash libraries +SCRIPT_DIR=${APP_ROOT}/bin +source ${SCRIPT_DIR}/utils/process.sh + +if [ -f "${SCRIPT_DIR}/utils/setup-elyra.sh" ]; then + source ${SCRIPT_DIR}/utils/setup-elyra.sh +fi + +# Initialize notebooks arguments variable +NOTEBOOK_PROGRAM_ARGS="" + +# Set default ServerApp.port value if NOTEBOOK_PORT variable is defined +if [ -n "${NOTEBOOK_PORT}" ]; then + NOTEBOOK_PROGRAM_ARGS+="--ServerApp.port=${NOTEBOOK_PORT} " +fi + +# Set default ServerApp.base_url value if NOTEBOOK_BASE_URL variable is defined +if [ -n "${NOTEBOOK_BASE_URL}" ]; then + NOTEBOOK_PROGRAM_ARGS+="--ServerApp.base_url=${NOTEBOOK_BASE_URL} " +fi + +# Set default ServerApp.root_dir value if NOTEBOOK_ROOT_DIR variable is defined +if [ -n "${NOTEBOOK_ROOT_DIR}" ]; then + NOTEBOOK_PROGRAM_ARGS+="--ServerApp.root_dir=${NOTEBOOK_ROOT_DIR} " +else + NOTEBOOK_PROGRAM_ARGS+="--ServerApp.root_dir=${HOME} " +fi + +# Add additional arguments if NOTEBOOK_ARGS variable is defined +if [ -n "${NOTEBOOK_ARGS}" ]; then + NOTEBOOK_PROGRAM_ARGS+=${NOTEBOOK_ARGS} +fi + +echo ${NOTEBOOK_PROGRAM_ARGS} + +# Start the JupyterLab notebook +start_process jupyter lab ${NOTEBOOK_PROGRAM_ARGS} \ + --ServerApp.ip=0.0.0.0 \ + --ServerApp.allow_origin="*" \ + --ServerApp.open_browser=False \ No newline at end of file diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/utils/process.sh b/enterprise/redhat/openshift-ai/gaudi/docker/utils/process.sh new file mode 100755 index 00000000..4da716a9 --- /dev/null +++ b/enterprise/redhat/openshift-ai/gaudi/docker/utils/process.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +function start_process() { + trap stop_process TERM INT + + echo "Running command: $@" + "$@" & + + PID=$! + wait $PID + trap - TERM INT + wait $PID + STATUS=$? + exit $STATUS +} + +function stop_process() { + kill -TERM $PID +} diff --git a/enterprise/redhat/openshift-ai/README.md b/enterprise/redhat/openshift-ai/oneapi/README.md similarity index 100% rename from enterprise/redhat/openshift-ai/README.md rename to enterprise/redhat/openshift-ai/oneapi/README.md diff --git a/enterprise/redhat/openshift-ai/assets/step-1.png b/enterprise/redhat/openshift-ai/oneapi/assets/step-1.png similarity index 100% rename from enterprise/redhat/openshift-ai/assets/step-1.png rename to enterprise/redhat/openshift-ai/oneapi/assets/step-1.png diff --git a/enterprise/redhat/openshift-ai/assets/step-2.png b/enterprise/redhat/openshift-ai/oneapi/assets/step-2.png similarity index 100% rename from enterprise/redhat/openshift-ai/assets/step-2.png rename to enterprise/redhat/openshift-ai/oneapi/assets/step-2.png diff --git a/enterprise/redhat/openshift-ai/assets/step-3.png b/enterprise/redhat/openshift-ai/oneapi/assets/step-3.png similarity index 100% rename from enterprise/redhat/openshift-ai/assets/step-3.png rename to enterprise/redhat/openshift-ai/oneapi/assets/step-3.png diff --git a/enterprise/redhat/openshift-ai/assets/step-4.png b/enterprise/redhat/openshift-ai/oneapi/assets/step-4.png similarity index 100% rename from enterprise/redhat/openshift-ai/assets/step-4.png rename to enterprise/redhat/openshift-ai/oneapi/assets/step-4.png diff --git a/enterprise/redhat/openshift-ai/manifests/intel-optimized-ml.yaml b/enterprise/redhat/openshift-ai/oneapi/manifests/intel-optimized-ml.yaml similarity index 100% rename from enterprise/redhat/openshift-ai/manifests/intel-optimized-ml.yaml rename to enterprise/redhat/openshift-ai/oneapi/manifests/intel-optimized-ml.yaml diff --git a/enterprise/redhat/openshift-ai/manifests/intel-optimized-pytorch.yaml b/enterprise/redhat/openshift-ai/oneapi/manifests/intel-optimized-pytorch.yaml similarity index 100% rename from enterprise/redhat/openshift-ai/manifests/intel-optimized-pytorch.yaml rename to enterprise/redhat/openshift-ai/oneapi/manifests/intel-optimized-pytorch.yaml diff --git a/enterprise/redhat/openshift-ai/manifests/intel-optimized-tensorflow.yaml b/enterprise/redhat/openshift-ai/oneapi/manifests/intel-optimized-tensorflow.yaml similarity index 100% rename from enterprise/redhat/openshift-ai/manifests/intel-optimized-tensorflow.yaml rename to enterprise/redhat/openshift-ai/oneapi/manifests/intel-optimized-tensorflow.yaml From a27286e7ba9a94ae82739fb9d8053125c002f024 Mon Sep 17 00:00:00 2001 From: sharvil10 Date: Mon, 9 Sep 2024 13:15:24 -0700 Subject: [PATCH 2/3] Lint errors fiex Signed-off-by: sharvil10 --- .github/dependabot.yml | 8 + classical-ml/.actions.json | 2 +- .../gaudi/docker/Dockerfile.rhel9.2 | 5 +- .../gaudi/docker/Dockerfile.rhel9.4 | 5 +- .../openshift-ai/gaudi/docker/builder/run | 50 ++--- .../gaudi/docker/docker-compose.yaml | 14 ++ .../gaudi/docker/install-python310.sh | 141 ++++++------ .../openshift-ai/gaudi/docker/install_efa.sh | 44 ++-- .../gaudi/docker/install_packages.sh | 46 ++-- .../gaudi/docker/licenses/LICENSE.txt | 201 ------------------ .../gaudi/docker/requirements.txt | 2 +- .../gaudi/docker/start-notebook.sh | 39 +++- .../gaudi/docker/utils/process.sh | 35 ++- preset/classical-ml/.actions.json | 2 +- preset/classical-ml/tests.yaml | 12 +- preset/data-analytics/.actions.json | 2 +- preset/data-analytics/tests.yaml | 6 +- python/.actions.json | 2 +- test-runner/dev-requirements.txt | 2 +- test-runner/requirements.txt | 2 +- 20 files changed, 260 insertions(+), 360 deletions(-) delete mode 100644 enterprise/redhat/openshift-ai/gaudi/docker/licenses/LICENSE.txt diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1fe07741..9b0e9789 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -95,3 +95,11 @@ updates: package-ecosystem: pip schedule: interval: weekly + - directory: enterprise/redhat/openshift-ai/gaudi/docker + groups: + preset: + patterns: + - "requirements.txt" + package-ecosystem: pip + schedule: + interval: weekly diff --git a/classical-ml/.actions.json b/classical-ml/.actions.json index 36e21ad8..e7e793d3 100644 --- a/classical-ml/.actions.json +++ b/classical-ml/.actions.json @@ -1,5 +1,5 @@ { "PACKAGE_OPTION": ["idp", "pip"], "experimental": [true], - "runner_label": ["PVC"] + "runner_label": ["clx"] } diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/Dockerfile.rhel9.2 b/enterprise/redhat/openshift-ai/gaudi/docker/Dockerfile.rhel9.2 index 8cbea97f..d1449fd8 100644 --- a/enterprise/redhat/openshift-ai/gaudi/docker/Dockerfile.rhel9.2 +++ b/enterprise/redhat/openshift-ai/gaudi/docker/Dockerfile.rhel9.2 @@ -8,8 +8,6 @@ ARG REVISION LABEL vendor="Intel Corporation" LABEL release="${VERSION}-${REVISION}" -COPY licenses /licenses - ENV HOME="/opt/app-root/src" WORKDIR /opt/app-root/src @@ -63,6 +61,9 @@ RUN dnf install -y \ dnf update -y && \ dnf clean all && rm -rf /var/cache/yum +RUN mkdir -p /licenses && \ + wget -O /licenses/LICENSE https://raw.githubusercontent.com/intel/ai-containers/main/LICENSE + ENV PYTHON_VERSION=3.10 COPY install-python310.sh . RUN ./install-python310.sh rhel9.2 && rm install-python310.sh diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/Dockerfile.rhel9.4 b/enterprise/redhat/openshift-ai/gaudi/docker/Dockerfile.rhel9.4 index 41a26399..18eeef28 100644 --- a/enterprise/redhat/openshift-ai/gaudi/docker/Dockerfile.rhel9.4 +++ b/enterprise/redhat/openshift-ai/gaudi/docker/Dockerfile.rhel9.4 @@ -8,8 +8,6 @@ ARG REVISION LABEL vendor="Intel Corporation" LABEL release="${VERSION}-${REVISION}" -COPY licenses /licenses - ENV HOME="/opt/app-root/src" WORKDIR /opt/app-root/src @@ -74,6 +72,9 @@ RUN dnf install -y \ dnf update -y && \ dnf clean all && rm -rf /var/cache/yum +RUN mkdir -p /licenses && \ + wget -O /licenses/LICENSE https://raw.githubusercontent.com/intel/ai-containers/main/LICENSE + RUN alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2 && \ alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 && \ alternatives --set python3 /usr/bin/python3.11 && \ diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/builder/run b/enterprise/redhat/openshift-ai/gaudi/docker/builder/run index 687bb745..f91d869e 100755 --- a/enterprise/redhat/openshift-ai/gaudi/docker/builder/run +++ b/enterprise/redhat/openshift-ai/gaudi/docker/builder/run @@ -4,36 +4,36 @@ set -eo pipefail set -x -APP_ROOT=${APP_ROOT:-/workspace} +APP_ROOT=${APP_ROOT:-/opt/app-root} # Pre-clone repositories defined in JUPYTER_PRELOAD_REPOS if [ -n "${JUPYTER_PRELOAD_REPOS}" ]; then - for repo in `echo ${JUPYTER_PRELOAD_REPOS} | tr ',' ' '`; do - # Check for the presence of "@branch" in the repo string - REPO_BRANCH=$(echo ${repo} | cut -s -d'@' -f2) - if [[ -n ${REPO_BRANCH} ]]; then - # Remove the branch from the repo string and convert REPO_BRANCH to git clone arg - repo=$(echo ${repo} | cut -d'@' -f1) - REPO_BRANCH="-b ${REPO_BRANCH}" - fi - echo "Checking if repository $repo exists locally" - REPO_DIR=$(basename ${repo}) - if [ -d "${REPO_DIR}" ]; then - pushd ${REPO_DIR} - # Do nothing if the repo already exists - echo "The ${repo} has already been cloned" - : - popd - else - GIT_SSL_NO_VERIFY=true git clone ${repo} ${REPO_DIR} ${REPO_BRANCH} - fi - done + for repo in $(echo "${JUPYTER_PRELOAD_REPOS}" | tr ',' ' '); do + # Check for the presence of "@branch" in the repo string + REPO_BRANCH=$(echo "${repo}" | cut -s -d'@' -f2) + if [[ -n ${REPO_BRANCH} ]]; then + # Remove the branch from the repo string and convert REPO_BRANCH to git clone arg + repo=$(echo "${repo}" | cut -d'@' -f1) + REPO_BRANCH="-b ${REPO_BRANCH}" + fi + echo "Checking if repository $repo exists locally" + REPO_DIR=$(basename "${repo}") + if [ -d "${REPO_DIR}" ]; then + pushd "${REPO_DIR}" + # Do nothing if the repo already exists + echo "The ${repo} has already been cloned" + : + popd + else + GIT_SSL_NO_VERIFY=true git clone "${repo}" "${REPO_DIR}" "${REPO_BRANCH}" + fi + done fi if [ -n "${NOTEBOOK_SAMPLES_LINK}" ]; then - for link in `echo ${NOTEBOOK_SAMPLES_LINK} | tr ',' ' '`; do - wget ${link} - done + for link in $(echo "${NOTEBOOK_SAMPLES_LINK}" | tr ',' ' '); do + wget "${link}" + done fi -${APP_ROOT}/bin/start-notebook.sh "$@" +"${APP_ROOT}"/bin/start-notebook.sh "$@" diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/docker-compose.yaml b/enterprise/redhat/openshift-ai/gaudi/docker/docker-compose.yaml index 1724a4c7..d2901e32 100644 --- a/enterprise/redhat/openshift-ai/gaudi/docker/docker-compose.yaml +++ b/enterprise/redhat/openshift-ai/gaudi/docker/docker-compose.yaml @@ -1,3 +1,17 @@ +# Copyright (c) 2024 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + services: gaudi-base: build: diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/install-python310.sh b/enterprise/redhat/openshift-ai/gaudi/docker/install-python310.sh index 78acab46..a9d25005 100755 --- a/enterprise/redhat/openshift-ai/gaudi/docker/install-python310.sh +++ b/enterprise/redhat/openshift-ai/gaudi/docker/install-python310.sh @@ -1,4 +1,18 @@ #!/bin/bash +# Copyright (c) 2024 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -e _BASE_NAME=${1:-"ubuntu22.04"} @@ -6,47 +20,47 @@ _SSL_LIB="" # preinstall dependencies and define variables case "${_BASE_NAME}" in - *ubuntu22.04*) - echo "Skip install Python3.10 from source on Ubuntu22.04" - exit 0; - ;; - *debian* | *ubuntu*) - apt update - apt install -y libsqlite3-dev libreadline-dev - ;; - *rhel*) - yum install -y sqlite-devel readline-devel xz-devel - ;; - *tencentos3.1*) - dnf install -y sqlite-devel readline-devel zlib-devel xz-devel bzip2-devel libffi-devel - wget -nv -O /opt/openssl-1.1.1w.tar.gz https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz && \ - cd /opt/ && \ - tar xzf openssl-1.1.1w.tar.gz && \ - rm -rf openssl-1.1.1w.tar.gz && \ - cd openssl-1.1.1w && \ - ./config --prefix=/usr/local/openssl-1.1.1w shared zlib && \ - make && make install - ln -s /etc/pki/tls/cert.pem /usr/local/openssl-1.1.1w/ssl/cert.pem +*ubuntu22.04*) + echo "Skip install Python3.10 from source on Ubuntu22.04" + exit 0 + ;; +*debian* | *ubuntu*) + apt update + apt install -y libsqlite3-dev libreadline-dev + ;; +*rhel*) + yum install -y sqlite-devel readline-devel xz-devel + ;; +*tencentos3.1*) + dnf install -y sqlite-devel readline-devel zlib-devel xz-devel bzip2-devel libffi-devel + wget -nv -O /opt/openssl-1.1.1w.tar.gz https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz && + cd /opt/ && + tar xzf openssl-1.1.1w.tar.gz && + rm -rf openssl-1.1.1w.tar.gz && + cd openssl-1.1.1w && + ./config --prefix=/usr/local/openssl-1.1.1w shared zlib && + make && make install + ln -s /etc/pki/tls/cert.pem /usr/local/openssl-1.1.1w/ssl/cert.pem - PATH=$PATH:/usr/local/protoc/bin:/usr/local/openssl-1.1.1w/bin - LD_LIBRARY_PATH=/usr/local/openssl-1.1.1w/lib:$LD_LIBRARY_PATH - _SSL_LIB="--with-openssl=/usr/local/openssl-1.1.1w" - ;; - *amzn2*) - yum install -y sqlite-devel readline-devel - wget -nv -O /opt/openssl-1.1.1w.tar.gz https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz && \ - cd /opt/ && \ - tar xzf openssl-1.1.1w.tar.gz && \ - rm -rf openssl-1.1.1w.tar.gz && \ - cd openssl-1.1.1w && \ - ./config --prefix=/usr/local/openssl-1.1.1w shared zlib && \ - make && make install - ln -s /etc/pki/tls/cert.pem /usr/local/openssl-1.1.1w/ssl/cert.pem + PATH=$PATH:/usr/local/protoc/bin:/usr/local/openssl-1.1.1w/bin + LD_LIBRARY_PATH=/usr/local/openssl-1.1.1w/lib:$LD_LIBRARY_PATH + _SSL_LIB="--with-openssl=/usr/local/openssl-1.1.1w" + ;; +*amzn2*) + yum install -y sqlite-devel readline-devel + wget -nv -O /opt/openssl-1.1.1w.tar.gz https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz && + cd /opt/ && + tar xzf openssl-1.1.1w.tar.gz && + rm -rf openssl-1.1.1w.tar.gz && + cd openssl-1.1.1w && + ./config --prefix=/usr/local/openssl-1.1.1w shared zlib && + make && make install + ln -s /etc/pki/tls/cert.pem /usr/local/openssl-1.1.1w/ssl/cert.pem - PATH=$PATH:/usr/local/protoc/bin:/usr/local/openssl-1.1.1w/bin - LD_LIBRARY_PATH=/usr/local/openssl-1.1.1w/lib:$LD_LIBRARY_PATH - _SSL_LIB="--with-openssl=/usr/local/openssl-1.1.1w" - ;; + PATH=$PATH:/usr/local/protoc/bin:/usr/local/openssl-1.1.1w/bin + LD_LIBRARY_PATH=/usr/local/openssl-1.1.1w/lib:$LD_LIBRARY_PATH + _SSL_LIB="--with-openssl=/usr/local/openssl-1.1.1w" + ;; esac # install Python @@ -60,31 +74,30 @@ make -j && make altinstall # post install case "${_BASE_NAME}" in - *rhel9*) - alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 2 && \ - alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 && \ - alternatives --set python3 /usr/local/bin/python3.10 - export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH - ;; - *tencentos3.1*) - alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 4 && \ - alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 3 && \ - alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2 && \ - alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1 && \ - alternatives --set python3 /usr/local/bin/python3.10 - export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH - ;; - *amzn2*) - update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 3 && \ - update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2 && \ - update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1 - ;; - *debian*) - update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 3 - update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.8 2 - update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1 - ;; +*rhel9*) + alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 2 && + alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 && + alternatives --set python3 /usr/local/bin/python3.10 + export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH + ;; +*tencentos3.1*) + alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 4 && + alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 3 && + alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2 && + alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1 && + alternatives --set python3 /usr/local/bin/python3.10 + export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH + ;; +*amzn2*) + update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 3 && + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2 && + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1 + ;; +*debian*) + update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 3 + update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.8 2 + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1 + ;; esac python3 -m pip install --upgrade pip setuptools - diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/install_efa.sh b/enterprise/redhat/openshift-ai/gaudi/docker/install_efa.sh index bb6f6803..4175e8f8 100755 --- a/enterprise/redhat/openshift-ai/gaudi/docker/install_efa.sh +++ b/enterprise/redhat/openshift-ai/gaudi/docker/install_efa.sh @@ -1,22 +1,40 @@ #!/bin/bash -ex +# Copyright (c) 2024 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + DEFAULT_EFA_INSTALLER_VER=1.29.0 efa_installer_version=${1:-$DEFAULT_EFA_INSTALLER_VER} tmp_dir=$(mktemp -d) -wget -nv https://efa-installer.amazonaws.com/aws-efa-installer-$efa_installer_version.tar.gz -P $tmp_dir -tar -xf $tmp_dir/aws-efa-installer-$efa_installer_version.tar.gz -C $tmp_dir -pushd $tmp_dir/aws-efa-installer -case $(. /etc/os-release ; echo -n $ID) in - rhel) - # we cannot install dkms packages on RHEL images due to OCP rules - rm -f RPMS/RHEL8/x86_64/dkms*.rpm - ;; - tencentos) - dnf install -y RPMS/ROCKYLINUX8/x86_64/rdma-core/libibverbs-46.0-1.el8.x86_64.rpm RPMS/ROCKYLINUX8/x86_64/rdma-core/libibverbs-utils-46.0-1.el8.x86_64.rpm - patch -f -p1 -i /tmp/tencentos_efa_patch.txt --reject-file=tencentos_efa_patch.rej --no-backup-if-mismatch - ;; +wget -nv https://efa-installer.amazonaws.com/aws-efa-installer-"$efa_installer_version".tar.gz -P "$tmp_dir" +tar -xf "$tmp_dir"/aws-efa-installer-"$efa_installer_version".tar.gz -C "$tmp_dir" +pushd "$tmp_dir"/aws-efa-installer +# shellcheck disable=SC1091 +case $( + . /etc/os-release + echo -n "$ID" +) in +rhel) + # we cannot install dkms packages on RHEL images due to OCP rules + rm -f RPMS/RHEL8/x86_64/dkms*.rpm + ;; +tencentos) + dnf install -y RPMS/ROCKYLINUX8/x86_64/rdma-core/libibverbs-46.0-1.el8.x86_64.rpm RPMS/ROCKYLINUX8/x86_64/rdma-core/libibverbs-utils-46.0-1.el8.x86_64.rpm + patch -f -p1 -i /tmp/tencentos_efa_patch.txt --reject-file=tencentos_efa_patch.rej --no-backup-if-mismatch + ;; esac ./efa_installer.sh -y --skip-kmod --skip-limit-conf --no-verify popd -rm -rf $tmp_dir +rm -rf "$tmp_dir" diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/install_packages.sh b/enterprise/redhat/openshift-ai/gaudi/docker/install_packages.sh index a2cf8dda..d67bb4f3 100755 --- a/enterprise/redhat/openshift-ai/gaudi/docker/install_packages.sh +++ b/enterprise/redhat/openshift-ai/gaudi/docker/install_packages.sh @@ -1,24 +1,38 @@ #!/bin/bash +# Copyright (c) 2024 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -ex pt_package_name="pytorch_modules-v${PT_VERSION}_${VERSION}_${REVISION}.tgz" os_string="ubuntu${OS_NUMBER}" case "${BASE_NAME}" in - *rhel9.2*) - os_string="rhel92" - ;; - *rhel9.4*) - os_string="rhel94" - ;; - *rhel8*) - os_string="rhel86" - ;; - *amzn2*) - os_string="amzn2" - ;; - *tencentos*) - os_string="tencentos31" - ;; +*rhel9.2*) + os_string="rhel92" + ;; +*rhel9.4*) + os_string="rhel94" + ;; +*rhel8*) + os_string="rhel86" + ;; +*amzn2*) + os_string="amzn2" + ;; +*tencentos*) + os_string="tencentos31" + ;; esac pt_artifact_path="https://${ARTIFACTORY_URL}/artifactory/gaudi-pt-modules/${VERSION}/${REVISION}/pytorch/${os_string}" @@ -26,7 +40,7 @@ tmp_path=$(mktemp --directory) wget --no-verbose "${pt_artifact_path}/${pt_package_name}" tar -xf "${pt_package_name}" -C "${tmp_path}"/. pushd "${tmp_path}" -./install.sh $VERSION $REVISION +./install.sh "$VERSION" "$REVISION" popd # cleanup rm -rf "${tmp_path}" "${pt_package_name}" diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/licenses/LICENSE.txt b/enterprise/redhat/openshift-ai/gaudi/docker/licenses/LICENSE.txt deleted file mode 100644 index f49a4e16..00000000 --- a/enterprise/redhat/openshift-ai/gaudi/docker/licenses/LICENSE.txt +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/requirements.txt b/enterprise/redhat/openshift-ai/gaudi/docker/requirements.txt index 86eefdfe..9d3a3ca7 100644 --- a/enterprise/redhat/openshift-ai/gaudi/docker/requirements.txt +++ b/enterprise/redhat/openshift-ai/gaudi/docker/requirements.txt @@ -31,7 +31,7 @@ jupyter-resource-usage~=0.7.2 nbdime~=3.2.1 nbgitpuller~=1.2.0 -# pycodestyle is dependency of below packages +# pycodestyle is dependency of below packages # and to achieve compatible of pycodestyle with python-lsp-server[all] # pinned the below packages autopep8~=2.0.4 diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/start-notebook.sh b/enterprise/redhat/openshift-ai/gaudi/docker/start-notebook.sh index 4431dbad..f13aa7d8 100755 --- a/enterprise/redhat/openshift-ai/gaudi/docker/start-notebook.sh +++ b/enterprise/redhat/openshift-ai/gaudi/docker/start-notebook.sh @@ -1,11 +1,27 @@ #!/usr/bin/env bash +# Copyright (c) 2024 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Load bash libraries SCRIPT_DIR=${APP_ROOT}/bin -source ${SCRIPT_DIR}/utils/process.sh +# shellcheck disable=SC1091 +source "${SCRIPT_DIR}"/utils/process.sh if [ -f "${SCRIPT_DIR}/utils/setup-elyra.sh" ]; then - source ${SCRIPT_DIR}/utils/setup-elyra.sh + # shellcheck disable=SC1091 + source "${SCRIPT_DIR}"/utils/setup-elyra.sh fi # Initialize notebooks arguments variable @@ -13,30 +29,31 @@ NOTEBOOK_PROGRAM_ARGS="" # Set default ServerApp.port value if NOTEBOOK_PORT variable is defined if [ -n "${NOTEBOOK_PORT}" ]; then - NOTEBOOK_PROGRAM_ARGS+="--ServerApp.port=${NOTEBOOK_PORT} " + NOTEBOOK_PROGRAM_ARGS+="--ServerApp.port=${NOTEBOOK_PORT} " fi # Set default ServerApp.base_url value if NOTEBOOK_BASE_URL variable is defined if [ -n "${NOTEBOOK_BASE_URL}" ]; then - NOTEBOOK_PROGRAM_ARGS+="--ServerApp.base_url=${NOTEBOOK_BASE_URL} " + NOTEBOOK_PROGRAM_ARGS+="--ServerApp.base_url=${NOTEBOOK_BASE_URL} " fi # Set default ServerApp.root_dir value if NOTEBOOK_ROOT_DIR variable is defined if [ -n "${NOTEBOOK_ROOT_DIR}" ]; then - NOTEBOOK_PROGRAM_ARGS+="--ServerApp.root_dir=${NOTEBOOK_ROOT_DIR} " + NOTEBOOK_PROGRAM_ARGS+="--ServerApp.root_dir=${NOTEBOOK_ROOT_DIR} " else - NOTEBOOK_PROGRAM_ARGS+="--ServerApp.root_dir=${HOME} " + NOTEBOOK_PROGRAM_ARGS+="--ServerApp.root_dir=${HOME} " fi # Add additional arguments if NOTEBOOK_ARGS variable is defined if [ -n "${NOTEBOOK_ARGS}" ]; then - NOTEBOOK_PROGRAM_ARGS+=${NOTEBOOK_ARGS} + NOTEBOOK_PROGRAM_ARGS+=${NOTEBOOK_ARGS} fi -echo ${NOTEBOOK_PROGRAM_ARGS} +echo "${NOTEBOOK_PROGRAM_ARGS}" # Start the JupyterLab notebook +# shellcheck disable=SC2086 start_process jupyter lab ${NOTEBOOK_PROGRAM_ARGS} \ - --ServerApp.ip=0.0.0.0 \ - --ServerApp.allow_origin="*" \ - --ServerApp.open_browser=False \ No newline at end of file + --ServerApp.ip=0.0.0.0 \ + --ServerApp.allow_origin="*" \ + --ServerApp.open_browser=False diff --git a/enterprise/redhat/openshift-ai/gaudi/docker/utils/process.sh b/enterprise/redhat/openshift-ai/gaudi/docker/utils/process.sh index 4da716a9..95028188 100755 --- a/enterprise/redhat/openshift-ai/gaudi/docker/utils/process.sh +++ b/enterprise/redhat/openshift-ai/gaudi/docker/utils/process.sh @@ -1,19 +1,34 @@ #!/usr/bin/env bash +# Copyright (c) 2024 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + function start_process() { - trap stop_process TERM INT + trap stop_process TERM INT - echo "Running command: $@" - "$@" & + echo "Running command:" "$@" + echo -e "$@" + "$@" & - PID=$! - wait $PID - trap - TERM INT - wait $PID - STATUS=$? - exit $STATUS + PID=$! + wait $PID + trap - TERM INT + wait $PID + STATUS=$? + exit $STATUS } function stop_process() { - kill -TERM $PID + kill -TERM "$PID" } diff --git a/preset/classical-ml/.actions.json b/preset/classical-ml/.actions.json index 639f025c..bc955304 100644 --- a/preset/classical-ml/.actions.json +++ b/preset/classical-ml/.actions.json @@ -1,5 +1,5 @@ { "PYTHON_VERSION": ["3.9", "3.10"], "experimental": [true], - "runner_label": ["PVC"] + "runner_label": ["clx"] } diff --git a/preset/classical-ml/tests.yaml b/preset/classical-ml/tests.yaml index 14529526..919eb4e9 100644 --- a/preset/classical-ml/tests.yaml +++ b/preset/classical-ml/tests.yaml @@ -21,23 +21,23 @@ # img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-classical-ml-${RELEASE:-2024.1.0}-py3.9 modin-${PYTHON_VERSION:-3.9}: cmd: conda run -n classical-ml sample-tests/modin/test_modin.sh - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-classical-ml-${RELEASE:-2024.1.0}-py${PYTHON_VERSION:-3.9} + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-classical-ml-${RELEASE:-2024.2.0}-py${PYTHON_VERSION:-3.9} shm_size: 10.24G modin-notebook-${PYTHON_VERSION:-3.9}: cmd: papermill --log-output jupyter/modin/IntelModin_Vs_Pandas.ipynb -k classical-ml - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-classical-ml-${RELEASE:-2024.1.0}-py${PYTHON_VERSION:-3.9} + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-classical-ml-${RELEASE:-2024.2.0}-py${PYTHON_VERSION:-3.9} notebook: True scikit-${PYTHON_VERSION:-3.9}: cmd: conda run -n classical-ml sample-tests/scikit/test_scikit.sh - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-classical-ml-${RELEASE:-2024.1.0}-py${PYTHON_VERSION:-3.9} + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-classical-ml-${RELEASE:-2024.2.0}-py${PYTHON_VERSION:-3.9} scikit-notebook-${PYTHON_VERSION:-3.9}: cmd: papermill --log-output jupyter/sklearn/Intel_Extension_For_SKLearn_GettingStarted.ipynb -k classical-ml - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-classical-ml-${RELEASE:-2024.1.0}-py${PYTHON_VERSION:-3.9} + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-classical-ml-${RELEASE:-2024.2.0}-py${PYTHON_VERSION:-3.9} notebook: True xgboost-${PYTHON_VERSION:-3.9}: cmd: conda run -n classical-ml sample-tests/xgboost/test_xgboost.sh - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-classical-ml-${RELEASE:-2024.1.0}-py${PYTHON_VERSION:-3.9} + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-classical-ml-${RELEASE:-2024.2.0}-py${PYTHON_VERSION:-3.9} xgboost-notebook-${PYTHON_VERSION:-3.9}: cmd: papermill --log-output jupyter/xgboost/IntelPython_XGBoost_Performance.ipynb -k classical-ml - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-classical-ml-${RELEASE:-2024.1.0}-py${PYTHON_VERSION:-3.9} + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-classical-ml-${RELEASE:-2024.2.0}-py${PYTHON_VERSION:-3.9} notebook: True diff --git a/preset/data-analytics/.actions.json b/preset/data-analytics/.actions.json index 639f025c..bc955304 100644 --- a/preset/data-analytics/.actions.json +++ b/preset/data-analytics/.actions.json @@ -1,5 +1,5 @@ { "PYTHON_VERSION": ["3.9", "3.10"], "experimental": [true], - "runner_label": ["PVC"] + "runner_label": ["clx"] } diff --git a/preset/data-analytics/tests.yaml b/preset/data-analytics/tests.yaml index 5aff8c81..846bf0b9 100644 --- a/preset/data-analytics/tests.yaml +++ b/preset/data-analytics/tests.yaml @@ -14,12 +14,12 @@ dataset-librarian-${PYTHON_VERSION:-3.9}: cmd: conda run -n data-analytics bash -c 'yes | python -m dataset_librarian.dataset -n msmarco --download -d ~/msmarco' - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-data-analytics-${RELEASE:-2024.1.0}-py${PYTHON_VERSION:-3.9} + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-data-analytics-${RELEASE:-2024.2.0}-py${PYTHON_VERSION:-3.9} modin-${PYTHON_VERSION:-3.9}: cmd: conda run -n data-analytics sample-tests/modin/test_modin.sh - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-data-analytics-${RELEASE:-2024.1.0}-py${PYTHON_VERSION:-3.9} + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-data-analytics-${RELEASE:-2024.2.0}-py${PYTHON_VERSION:-3.9} shm_size: 10G modin-notebook-${PYTHON_VERSION:-3.9}: cmd: papermill --log-output jupyter/modin/IntelModin_Vs_Pandas.ipynb -k data-analytics - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-data-analytics-${RELEASE:-2024.1.0}-py${PYTHON_VERSION:-3.9} + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-data-analytics-${RELEASE:-2024.2.0}-py${PYTHON_VERSION:-3.9} notebook: True diff --git a/python/.actions.json b/python/.actions.json index db103a36..1112d076 100644 --- a/python/.actions.json +++ b/python/.actions.json @@ -1,5 +1,5 @@ { "IDP_VERSION": ["full", "core"], "experimental": [true], - "runner_label": ["PVC"] + "runner_label": ["clx"] } diff --git a/test-runner/dev-requirements.txt b/test-runner/dev-requirements.txt index 2f4f8fbf..e409fb0f 100644 --- a/test-runner/dev-requirements.txt +++ b/test-runner/dev-requirements.txt @@ -3,7 +3,7 @@ coverage>=7.5.0 coveralls>=4.0.1 expandvars>=0.12.0 hypothesis>=6.100.1 -pydantic==2.8.2 +pydantic==2.9.1 pylint>=3.1.0 pytest>=8.1.1 python_on_whales>=0.70.1 diff --git a/test-runner/requirements.txt b/test-runner/requirements.txt index 79752623..ee95cc0a 100644 --- a/test-runner/requirements.txt +++ b/test-runner/requirements.txt @@ -1,5 +1,5 @@ expandvars>=0.12.0 -pydantic==2.8.2 +pydantic==2.9.1 python_on_whales>=0.70.1 pyyaml>=6.0.1 tabulate>=0.9.0 From 4273a71826fc8621298bf614c487e734a72c7db5 Mon Sep 17 00:00:00 2001 From: sharvil10 Date: Tue, 10 Sep 2024 10:02:49 -0700 Subject: [PATCH 3/3] Fixed group name in dependabot Signed-off-by: sharvil10 --- .github/dependabot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9b0e9789..4289ee44 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -97,7 +97,7 @@ updates: interval: weekly - directory: enterprise/redhat/openshift-ai/gaudi/docker groups: - preset: + gaudi-openshift: patterns: - "requirements.txt" package-ecosystem: pip