Skip to content

Commit 4343cc7

Browse files
authored
Fix install download script and statically link nvrtc (#452)
* don't use npx * use CMake 3.26 (with a patch) so we can statically link libnvrtc * organize workspace settings, ensure consistent vscode terminal cwd * use npx again * fix install_native_module if using npm 9 and npx is run by yarn 1 * switch back to using npx regular style * make npm install work on node v19.6.0 and npm v9.4.1 * update cmake-js to use my fork with fixes * don't need to include nvrtc_builtins_static * set lower and upper bounds on CUDA major version (currently both 11) * remove npm_config_nodedir testing override * throw a helpful error message * update copyright year * remove @rapidsai/core postinstall cmake-js script * fix devel packages local build with new cmake-js * fix files list * update lists of files that invalidate the images
1 parent 439fcdb commit 4343cc7

File tree

29 files changed

+1438
-1411
lines changed

29 files changed

+1438
-1411
lines changed

.github/actions/build-and-publish-image-ssh/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ runs:
114114
shell: bash
115115
run: |
116116
cp -ar "$HOME"/.{ssh,gitconfig} "$(realpath -m "${{ inputs.context }}")/dev/";
117-
sed -i "s@$HOME@/root@g" "$(realpath -m "${{ inputs.context }}")/dev/.ssh/config";
117+
sed -i "s@$HOME@/opt/rapids@g" "$(realpath -m "${{ inputs.context }}")/dev/.ssh/config";
118118
- name: Build image
119119
id: docker-build
120120
uses: docker/build-push-action@v2

.github/workflows/build-and-push-image-ssh.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,13 @@ jobs:
112112
with:
113113
base_sha: ${{ steps.last_main_commit.outputs.commit_hash }}
114114
files: |
115+
.npmrc
116+
yarn.lock
117+
lerna.json
115118
${{ inputs.file }}
116119
${{ inputs.files-to-diff }}
117-
lerna.json
118120
.github/workflows/merge.pr.yml
119-
.github/workflows/build-and-push-image.yml
121+
.github/workflows/build-and-push-image-ssh.yml
120122
.github/actions/build-and-publish-image-ssh/action.yml
121123
122124
- name: Set environment variables

.github/workflows/build-and-push-image.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,11 @@ jobs:
103103
with:
104104
base_sha: ${{ steps.last_main_commit.outputs.commit_hash }}
105105
files: |
106+
.npmrc
107+
yarn.lock
108+
lerna.json
106109
${{ inputs.file }}
107110
${{ inputs.files-to-diff }}
108-
lerna.json
109111
.github/workflows/merge.pr.yml
110112
.github/workflows/build-and-push-image.yml
111113
.github/actions/build-and-publish-image/action.yml

.github/workflows/merge.pr.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ jobs:
2121
file: dev/dockerfiles/devel/main.Dockerfile
2222
manual-build: ${{ github.event_name == 'workflow_dispatch' }}
2323
files-to-diff: |
24-
.npmrc
2524
modules
26-
yarn.lock
2725
build-args: |
2826
"UCX_VERSION=1.12.1"
2927
@@ -39,9 +37,7 @@ jobs:
3937
file: dev/dockerfiles/devel/package.Dockerfile
4038
manual-build: ${{ github.event_name == 'workflow_dispatch' }}
4139
files-to-diff: |
42-
.npmrc
4340
modules
44-
yarn.lock
4541
dev/dockerfiles/devel/main.Dockerfile
4642
build-args: |
4743
"CUDAARCHS=ALL"
@@ -77,8 +73,8 @@ jobs:
7773
devel: devel-main
7874
file: dev/dockerfiles/runtime/cudf.Dockerfile
7975
files-to-diff: |
80-
.npmrc
8176
modules/(core|rmm|cuda|cudf)
77+
dev/dockerfiles/runtime/base.Dockerfile
8278
manual-build: ${{ github.event_name == 'workflow_dispatch' }}
8379

8480
build-and-publish-runtime-cuml-image:
@@ -95,8 +91,8 @@ jobs:
9591
devel: devel-main
9692
file: dev/dockerfiles/runtime/cuml.Dockerfile
9793
files-to-diff: |
98-
.npmrc
9994
modules/(core|rmm|cuda|cudf|cuml)
95+
dev/dockerfiles/runtime/base.Dockerfile
10096
manual-build: ${{ github.event_name == 'workflow_dispatch' }}
10197

10298
build-and-publish-runtime-cugraph-image:
@@ -113,8 +109,8 @@ jobs:
113109
devel: devel-main
114110
file: dev/dockerfiles/runtime/cugraph.Dockerfile
115111
files-to-diff: |
116-
.npmrc
117112
modules/(core|rmm|cuda|cudf|cugraph)
113+
dev/dockerfiles/runtime/base.Dockerfile
118114
manual-build: ${{ github.event_name == 'workflow_dispatch' }}
119115

120116
build-and-publish-runtime-cuspatial-image:
@@ -131,8 +127,8 @@ jobs:
131127
devel: devel-main
132128
file: dev/dockerfiles/runtime/cuspatial.Dockerfile
133129
files-to-diff: |
134-
.npmrc
135130
modules/(core|rmm|cuda|cudf|cuspatial)
131+
dev/dockerfiles/runtime/base.Dockerfile
136132
manual-build: ${{ github.event_name == 'workflow_dispatch' }}
137133

138134
build-and-publish-runtime-glfw-image:
@@ -149,8 +145,8 @@ jobs:
149145
devel: devel-main
150146
file: dev/dockerfiles/runtime/glfw.Dockerfile
151147
files-to-diff: |
152-
.npmrc
153148
modules/(core|glfw|webgl)
149+
dev/dockerfiles/runtime/base.Dockerfile
154150
manual-build: ${{ github.event_name == 'workflow_dispatch' }}
155151

156152
build-and-publish-runtime-sql-image:
@@ -167,8 +163,8 @@ jobs:
167163
devel: devel-main
168164
file: dev/dockerfiles/runtime/sql.Dockerfile
169165
files-to-diff: |
170-
.npmrc
171166
modules/(core|rmm|cuda|cudf|sql)
167+
dev/dockerfiles/runtime/base.Dockerfile
172168
manual-build: ${{ github.event_name == 'workflow_dispatch' }}
173169
build-args: |
174170
"UCX_VERSION=1.12.1"
@@ -187,8 +183,8 @@ jobs:
187183
devel: devel-main
188184
file: dev/dockerfiles/runtime/main.Dockerfile
189185
files-to-diff: |
190-
.npmrc
191186
modules/(core|cuda|glfw|webgl|rmm|cudf|sql|cuml|cugraph|cuspatial|deck.gl|jsdom)
187+
dev/dockerfiles/runtime/base.Dockerfile
192188
manual-build: ${{ github.event_name == 'workflow_dispatch' }}
193189
build-args: |
194190
"UCX_VERSION=1.12.1"
@@ -207,8 +203,8 @@ jobs:
207203
devel: devel-main
208204
file: dev/dockerfiles/runtime/demo.Dockerfile
209205
files-to-diff: |
210-
.npmrc
211206
modules/demo
207+
dev/dockerfiles/runtime/base.Dockerfile
212208
manual-build: ${{ github.event_name == 'workflow_dispatch' }}
213209
build-args: |
214210
"UCX_VERSION=1.12.1"
@@ -224,7 +220,8 @@ jobs:
224220
image: runtime-notebook
225221
file: dev/dockerfiles/runtime/notebook.Dockerfile
226222
files-to-diff: |
227-
.npmrc
228223
**/*.ipynb
229224
modules/demo
225+
dev/dockerfiles/runtime/base.Dockerfile
226+
dev/dockerfiles/runtime/demo.Dockerfile
230227
manual-build: ${{ github.event_name == 'workflow_dispatch' }}

dev/dockerfiles/devel/main.Dockerfile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ ${CUDA_HOME}/nvvm/lib64:\
3737
${CUDA_HOME}/lib64/stubs"
3838

3939
ARG GCC_VERSION=9
40-
ARG CMAKE_VERSION=3.24.1
40+
ARG CMAKE_VERSION=3.26.0-rc1
4141
ARG SCCACHE_VERSION=0.2.15
4242
ARG LINUX_VERSION=ubuntu20.04
4343

@@ -77,8 +77,6 @@ deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitw
7777
gfortran \
7878
ninja-build \
7979
gcc-${GCC_VERSION} g++-${GCC_VERSION} gdb \
80-
cmake=${CMAKE_VERSION}-0kitware1${LINUX_VERSION}.1 \
81-
cmake-data=${CMAKE_VERSION}-0kitware1${LINUX_VERSION}.1 \
8280
curl libssl-dev libcurl4-openssl-dev xz-utils zlib1g-dev liblz4-dev \
8381
# From opengl/glvnd:devel
8482
pkg-config \
@@ -89,6 +87,16 @@ deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitw
8987
&& echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf \
9088
&& echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf \
9189
\
90+
# Install cmake
91+
&& wget --no-hsts -q -O /tmp/cmake_${CMAKE_VERSION}.sh \
92+
https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-$(uname -p).sh \
93+
&& bash /tmp/cmake_${CMAKE_VERSION}.sh --skip-license --exclude-subdir --prefix=/usr \
94+
# Fix FindCUDAToolkit.cmake finding the nvrtc_builtins_static library
95+
# TODO: Remove this once https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8162 is released
96+
&& sed -i \
97+
's/nvrtc_builtins_static DEPS cuda_driver/nvrtc_builtins_static ALT nvrtc-builtins_static DEPS cuda_driver/g' \
98+
/usr/share/cmake-3.26/Modules/FindCUDAToolkit.cmake \
99+
\
92100
# Install sccache
93101
&& curl -SsL "https://github.com/mozilla/sccache/releases/download/v$SCCACHE_VERSION/sccache-v$SCCACHE_VERSION-$(uname -m)-unknown-linux-musl.tar.gz" \
94102
| tar -C /usr/bin -zf - --wildcards --strip-components=1 -x */sccache \
@@ -312,6 +320,7 @@ export PROMPT_COMMAND=\"history -a; \$PROMPT_COMMAND\";\n\
312320

313321
ENV NO_UPDATE_NOTIFIER=1
314322
ENV RAPIDSAI_SKIP_DOWNLOAD=1
323+
ENV npm_config_nodedir=/usr/local
315324
ENV NODE_PATH=/usr/local/lib/node_modules
316325
ENV NODE_OPTIONS="--experimental-vm-modules --trace-uncaught"
317326

dev/dockerfiles/devel/package.Dockerfile

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,19 @@ COPY --chown=rapids:rapids yarn.lock yarn.lock
3131
COPY --chown=rapids:rapids scripts scripts
3232
COPY --chown=rapids:rapids modules modules
3333

34-
USER root
35-
3634
ENV RAPIDSAI_SKIP_DOWNLOAD=1
3735

38-
RUN --mount=type=ssh,required=true \
39-
--mount=type=secret,id=sccache_credentials \
40-
--mount=type=bind,source=dev/.ssh,target=/root/.ssh,rw \
41-
--mount=type=bind,source=dev/.gitconfig,target=/etc/gitconfig \
36+
RUN --mount=type=ssh,uid=1000,gid=1000,required=true \
37+
--mount=type=secret,id=sccache_credentials,uid=1000,gid=1000 \
38+
--mount=type=bind,source=dev/.ssh,target=/opt/rapids/.ssh,rw \
39+
--mount=type=bind,source=dev/.gitconfig,target=/opt/rapids/.gitconfig \
40+
sudo chown -R $(id -u):$(id -g) /opt/rapids; \
4241
if [ -f /run/secrets/sccache_credentials ]; then \
4342
export $(grep -v '^#' /run/secrets/sccache_credentials | xargs -d '\n'); \
4443
fi; \
4544
# Add GitHub's public keys to known_hosts
46-
if [ ! -f /root/.ssh/known_hosts ]; then \
47-
curl -s https://api.github.com/meta | jq -r '.ssh_keys | map("github.com \(.)") | .[]' > /root/.ssh/known_hosts; \
45+
if [ ! -f /opt/rapids/.ssh/known_hosts ]; then \
46+
curl -s https://api.github.com/meta | jq -r '.ssh_keys | map("github.com \(.)") | .[]' > /opt/rapids/.ssh/known_hosts; \
4847
fi; \
4948
echo -e "build context:\n$(find .)" \
5049
&& bash -c 'echo -e "\

modules/core/bin/cmake-js/linux.sh

Lines changed: 0 additions & 56 deletions
This file was deleted.

modules/core/bin/exec_cmake.js

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
3+
set -Eeo pipefail
4+
5+
if ! type jq >/dev/null 2>&1; then
6+
exit 0;
7+
fi
8+
9+
cwd="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )";
10+
11+
RAPIDS_MODULES_PATH="$(realpath "$cwd/../../../")";
12+
13+
if [[ "$(basename "$RAPIDS_MODULES_PATH")" != modules ]]; then
14+
exit 0;
15+
fi
16+
17+
# Get the latest `compile_commands.json` from each module
18+
compile_command_files="$( \
19+
find "$RAPIDS_MODULES_PATH" -mindepth 1 -maxdepth 1 -type d | xargs -n1 -I__ \
20+
bash -c 'find __ -type f \
21+
-path "*build/*/compile_commands.json" \
22+
-exec stat -c "%y %n" {} + \
23+
| sort -r \
24+
| head -n1' \
25+
| grep -Eo "$RAPIDS_MODULES_PATH/.*$" || echo "" \
26+
)";
27+
28+
# Now merge them all together
29+
jq -s '.|flatten' $(echo "$compile_command_files") \
30+
> "$RAPIDS_MODULES_PATH/../compile_commands.json" \
31+
|| true;

0 commit comments

Comments
 (0)