From 6f23d9954b101af98a40fcf26ec4e51124b7f24b Mon Sep 17 00:00:00 2001 From: Ryoichi Ando Date: Thu, 9 Jan 2025 01:00:25 +0900 Subject: [PATCH] add Dockerfile --- Dockerfile | 17 +++++++++++++++++ README.md | 6 +++++- examples/needle.ipynb | 8 +++++--- 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3caaaa0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 + +ENV NVIDIA_DRIVER_CAPABILITIES=utility,compute +ENV LANG=en_US.UTF-8 + +RUN apt update +RUN apt install -y git python3 curl + +RUN mkdir -p /root/ppf-contact-solver +WORKDIR /root/ppf-contact-solver + +RUN curl https://raw.githubusercontent.com/st-tech/ppf-contact-solver/refs/heads/main/warmup.py -o warmup.py +RUN python3 warmup.py + +WORKDIR /root/ +RUN rm -rf ppf-contact-solver +RUN rm -rf /var/lib/apt/lists/* \ No newline at end of file diff --git a/README.md b/README.md index be4711f..79d7867 100644 --- a/README.md +++ b/README.md @@ -426,13 +426,17 @@ git clone https://github.com/st-tech/ppf-contact-solver.git Move into the ```ppf-contact-solver``` and let ```warmup.py``` do all the rest 💤: +> [!NOTE] +> If you’re suspicious, you can look around ```warmup.py``` before you proceed. Run `less warmup.py`, scroll all the way to the bottom, and hit `q` to quit. + ``` cd ppf-contact-solver python3 warmup.py ``` > [!NOTE] -> If you’re suspicious, you can look around ```warmup.py``` before you proceed. Run `less warmup.py`, scroll all the way to the bottom, and hit `q` to quit. +> If you encounter issues in ```warmup.py```, you can try our pre-build Docker image ```ghcr.io/st-tech/ppf-contact-solver-base:latest```, which does not need to run ```warmup.py```. +> See ``Dockerfile`` to learn how this image is built. Now we're set. Let's kick in the compilation!🏃 diff --git a/examples/needle.ipynb b/examples/needle.ipynb index 1e76ebe..885e71c 100644 --- a/examples/needle.ipynb +++ b/examples/needle.ipynb @@ -7,6 +7,8 @@ "metadata": {}, "outputs": [], "source": [ + "import random\n", + "\n", "from frontend import App\n", "\n", "app = App.create(\"needle\")\n", @@ -14,7 +16,7 @@ "V, F = app.mesh.square(res=129)\n", "app.asset.add.tri(\"sheet\", V, F)\n", "\n", - "V, F = app.mesh.cone(height=5, Nr=40, Ny=64, Nb=12, radius=1)\n", + "V, F = app.mesh.cone(height=5, Nr=20, Ny=32, Nb=12, radius=1)\n", "app.asset.add.tri(\"cone\", V, F)\n", "\n", "V, F, T = app.mesh.icosphere(r=0.25, subdiv_count=4).tetrahedralize()\n", @@ -22,14 +24,14 @@ "\n", "scene = app.scene.create(\"needle-sphere\")\n", "scene.add(\"cone\").scale(0.2).rotate(90, \"x\").at(0, -0.25, 0).jitter().pin()\n", - "scene.add(\"sphere\").at(0, 1, 0).jitter().pin().pull().hold(1.0).unpin()\n", + "scene.add(\"sphere\").at(0, 1, 0).pin().pull().hold(1.0).unpin()\n", "\n", "n, space = 5, 0.05\n", "for i in range(n):\n", " y = (i + 1) * space\n", " deg = i * 90 / n\n", " obj = scene.add(\"sheet\").direction([1, 0, 0], [0, 1, 0])\n", - " obj.at(0, y, 0).jitter().rotate(90, \"x\").rotate(deg, \"y\")\n", + " obj.at(0, y, 0).rotate(90, \"x\").rotate(deg + 5 * random.random(), \"y\")\n", "\n", "fixed = scene.build().report()\n", "fixed.preview()"