From 79094f5ec8050a4533033516de29b2210668db34 Mon Sep 17 00:00:00 2001 From: Alexander Novotny Date: Tue, 22 Apr 2025 15:09:20 +0000 Subject: [PATCH 1/9] Add dev container --- .devcontainer/Dockerfile | 31 +++++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 12 ++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..1681db865 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,31 @@ +FROM ubuntu:24.04 + +RUN apt update -y && apt install -y \ + gcc \ + g++ \ + cmake \ + ninja-build \ + git \ + libopenblas-dev \ + && apt clean && rm -rf /var/lib/apt/lists/* + +# Install SuiteSparse for klu +RUN git clone --single-branch --depth 1 --branch v7.10.2 https://github.com/DrTimothyAldenDavis/SuiteSparse.git /tmp/suitesparse && \ + cd /tmp/suitesparse && \ + mkdir -p build && cd build && \ + cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DSUITESPARSE_ENABLE_PROJECTS="klu" .. && \ + ninja -j $(nproc) && \ + ninja install && \ + rm -rf /tmp/suitesparse + +# Install sundials using klu from previous step +RUN git clone --single-branch --depth 1 --branch v7.3.0 https://github.com/LLNL/sundials.git /tmp/sundials && \ + cd /tmp/sundials && \ + mkdir -p build && cd build && \ + cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DENABLE_KLU=ON \ + -DKLU_ROOT=/usr/local/lib/cmake/KLU .. && \ + ninja -j $(nproc) && \ + ninja install && \ + rm -rf /tmp/sundials diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..5770346df --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,12 @@ +{ + "build": { + "dockerfile": "Dockerfile" + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cpptools" + ] + } + } +} \ No newline at end of file From b752a2d1f52bd5d9138cb9228b2889f73c7383e5 Mon Sep 17 00:00:00 2001 From: Alexander Novotny Date: Tue, 22 Apr 2025 15:14:52 +0000 Subject: [PATCH 2/9] Update contributing.md with container info --- CONTRIBUTING.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 01fe28e12..268288936 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -399,3 +399,7 @@ class Matrix // No, class is outside GridKit namespace { // matrix code }; +``` + +## Development Container +A development container is available for all developers using VS Code to develop. This will automatically install all pre-requisite software you need to develop in GridKit. Any developer who wishes to use this setup can follow [this tutorial](https://code.visualstudio.com/docs/devcontainers/tutorial) and simply use the option "Reopen Folder in Container" rather than "New Dev Container...", which will automatically build the included container. \ No newline at end of file From 8036307154e7d12396f453055fa8762d18475bf1 Mon Sep 17 00:00:00 2001 From: alexander-novo Date: Tue, 22 Apr 2025 15:19:44 +0000 Subject: [PATCH 3/9] Apply pre-commmit fixes --- .devcontainer/devcontainer.json | 2 +- CONTRIBUTING.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 5770346df..fa5dc63f0 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -9,4 +9,4 @@ ] } } -} \ No newline at end of file +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 268288936..583735b65 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -402,4 +402,4 @@ class Matrix // No, class is outside GridKit namespace ``` ## Development Container -A development container is available for all developers using VS Code to develop. This will automatically install all pre-requisite software you need to develop in GridKit. Any developer who wishes to use this setup can follow [this tutorial](https://code.visualstudio.com/docs/devcontainers/tutorial) and simply use the option "Reopen Folder in Container" rather than "New Dev Container...", which will automatically build the included container. \ No newline at end of file +A development container is available for all developers using VS Code to develop. This will automatically install all pre-requisite software you need to develop in GridKit. Any developer who wishes to use this setup can follow [this tutorial](https://code.visualstudio.com/docs/devcontainers/tutorial) and simply use the option "Reopen Folder in Container" rather than "New Dev Container...", which will automatically build the included container. From 1de8b994b3d0e1b4331916a59dfc89e9592d1cf7 Mon Sep 17 00:00:00 2001 From: Alexander Novotny Date: Wed, 28 May 2025 18:22:46 -0400 Subject: [PATCH 4/9] Update dockerfile to include sundials fixes --- .devcontainer/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 1681db865..4fc54cab5 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -20,7 +20,8 @@ RUN git clone --single-branch --depth 1 --branch v7.10.2 https://github.com/DrTi rm -rf /tmp/suitesparse # Install sundials using klu from previous step -RUN git clone --single-branch --depth 1 --branch v7.3.0 https://github.com/LLNL/sundials.git /tmp/sundials && \ +RUN git clone --single-branch --branch develop https://github.com/LLNL/sundials.git /tmp/sundials && \ + git checkout 07d21c2c5ae33211a9a2fafd8eac56de5582dce0 && \ cd /tmp/sundials && \ mkdir -p build && cd build && \ cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ From d66984ddc08a5b8028a2ffed9625a68d728d4dca Mon Sep 17 00:00:00 2001 From: Alexander Novotny Date: Thu, 29 May 2025 12:09:22 -0400 Subject: [PATCH 5/9] Fix dockerfile issue --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 4fc54cab5..27b4b634b 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -21,8 +21,8 @@ RUN git clone --single-branch --depth 1 --branch v7.10.2 https://github.com/DrTi # Install sundials using klu from previous step RUN git clone --single-branch --branch develop https://github.com/LLNL/sundials.git /tmp/sundials && \ - git checkout 07d21c2c5ae33211a9a2fafd8eac56de5582dce0 && \ cd /tmp/sundials && \ + git checkout 07d21c2c5ae33211a9a2fafd8eac56de5582dce0 && \ mkdir -p build && cd build && \ cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DENABLE_KLU=ON \ From e6590ce944ee8d55e4ff61cfb7a6b6263e0b2e89 Mon Sep 17 00:00:00 2001 From: Alexander Novotny Date: Thu, 29 May 2025 16:11:42 +0000 Subject: [PATCH 6/9] Remove ninja num thread specification (not needed) --- .devcontainer/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 27b4b634b..58db73f88 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -15,7 +15,7 @@ RUN git clone --single-branch --depth 1 --branch v7.10.2 https://github.com/DrTi mkdir -p build && cd build && \ cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DSUITESPARSE_ENABLE_PROJECTS="klu" .. && \ - ninja -j $(nproc) && \ + ninja && \ ninja install && \ rm -rf /tmp/suitesparse @@ -27,6 +27,6 @@ RUN git clone --single-branch --branch develop https://github.com/LLNL/sundials. cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DENABLE_KLU=ON \ -DKLU_ROOT=/usr/local/lib/cmake/KLU .. && \ - ninja -j $(nproc) && \ + ninja && \ ninja install && \ rm -rf /tmp/sundials From 5803c44571019b0546c74c72c8c68bdba6ceddb4 Mon Sep 17 00:00:00 2001 From: Alexander Novotny Date: Fri, 30 May 2025 12:19:18 -0400 Subject: [PATCH 7/9] Simpler ninja commands --- .devcontainer/Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 58db73f88..961376f38 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -15,7 +15,6 @@ RUN git clone --single-branch --depth 1 --branch v7.10.2 https://github.com/DrTi mkdir -p build && cd build && \ cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DSUITESPARSE_ENABLE_PROJECTS="klu" .. && \ - ninja && \ ninja install && \ rm -rf /tmp/suitesparse @@ -27,6 +26,5 @@ RUN git clone --single-branch --branch develop https://github.com/LLNL/sundials. cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DENABLE_KLU=ON \ -DKLU_ROOT=/usr/local/lib/cmake/KLU .. && \ - ninja && \ ninja install && \ rm -rf /tmp/sundials From cb8dbdbb66878386bfff4e984ded2d48adb8eef3 Mon Sep 17 00:00:00 2001 From: Alexander Novotny Date: Fri, 30 May 2025 12:20:24 -0400 Subject: [PATCH 8/9] Simplify cmake options --- .devcontainer/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 961376f38..3802f8c3b 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -24,7 +24,6 @@ RUN git clone --single-branch --branch develop https://github.com/LLNL/sundials. git checkout 07d21c2c5ae33211a9a2fafd8eac56de5582dce0 && \ mkdir -p build && cd build && \ cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DENABLE_KLU=ON \ - -DKLU_ROOT=/usr/local/lib/cmake/KLU .. && \ + -DENABLE_KLU=ON .. && \ ninja install && \ rm -rf /tmp/sundials From 4b7f28404bbc6ea17f639ba6a5aa4b5b3aa9d66f Mon Sep 17 00:00:00 2001 From: Alexander Novotny Date: Fri, 30 May 2025 13:29:26 -0400 Subject: [PATCH 9/9] Reduce container size a bit Don't install "recommended" packages through `apt`. Also install `make` since it is recommended by `cmake`. --- .devcontainer/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 3802f8c3b..b5408c2f0 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,11 +1,13 @@ FROM ubuntu:24.04 -RUN apt update -y && apt install -y \ +RUN apt update -y && apt install -y --no-install-recommends\ gcc \ g++ \ + make \ cmake \ ninja-build \ git \ + ca-certificates \ libopenblas-dev \ && apt clean && rm -rf /var/lib/apt/lists/*