Skip to content

Commit

Permalink
Merge pull request #320 from janden/docker_no_compil
Browse files Browse the repository at this point in the history
Move all compilation from docker to jenkins
  • Loading branch information
blackwer authored Jul 27, 2023
2 parents 8b6d627 + b28479e commit 5f7dc6c
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 43 deletions.
24 changes: 19 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,39 @@ pipeline {
}
}
environment {
HOME = "$WORKSPACE/build"
HOME = "$WORKSPACE"
PYBIN = "/opt/python/cp38-cp38/bin"
LIBRARY_PATH = "$WORKSPACE/build"
LD_LIBRARY_PATH = "$WORKSPACE/build"
}
steps {
sh '''#!/bin/bash -ex
nvidia-smi
'''
sh '''#!/bin/bash -ex
cp -r /io/build/test/cuda cuda_tests
cd cuda_tests
echo $HOME
'''
sh '''#!/bin/bash -ex
cuda_arch=$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader|head -n 1| sed "s/\\.//")
cmake -B build . -DFINUFFT_USE_CUDA=ON \
-DFINUFFT_USE_CPU=OFF \
-DFINUFFT_BUILD_TESTS=ON \
-DCMAKE_CUDA_ARCHITECTURES="$cuda_arch" \
-DBUILD_TESTING=ON
cd build
make -j4
'''
sh '''#!/bin/bash -ex
cd build/test/cuda
ctest --output-on-failure
'''
sh '${PYBIN}/python3 -m venv $HOME'
sh '''#!/bin/bash -ex
source $HOME/bin/activate
python3 -m pip install --upgrade pip
LIBRARY_PATH=/io/build python3 -m pip install -e python/cufinufft
python3 -m pip install -e python/cufinufft
python3 -m pip install pytest
python3 -m pytest
python3 -m pytest python/cufinufft
'''
}
}
Expand Down
14 changes: 14 additions & 0 deletions tools/cufinufft/build-library.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -e -u -x

mkdir -p /io/build
cd /io/build

cmake -D FINUFFT_USE_CUDA=ON \
-D FINUFFT_USE_CPU=OFF \
-D FINUFFT_BUILD_TESTS=ON \
-D CMAKE_CUDA_ARCHITECTURES="35;50;60;70;75;80" \
-D BUILD_TESTING=ON \
..

make -j4
23 changes: 18 additions & 5 deletions tools/cufinufft/distribution_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,32 @@ dockerhub=janden

echo "# build the wheel"
docker build \
--file ci/docker/cuda${cuda_version}/Dockerfile-x86_64 \
--file tools/cufinufft/docker/cuda${cuda_version}/Dockerfile-x86_64 \
--tag ${dockerhub}/cufinufft-${cufinufft_version}-${manylinux_version} .


echo "# Run the container, invoking the build-wheels script to generate the wheels"
docker run \
echo "# Create the container and start it"
docker create \
--gpus all \
--interactive \
--tty \
--volume $(pwd)/wheelhouse:/io/wheelhouse \
--env PLAT=${manylinux_version}_x86_64 \
${dockerhub}/cufinufft-${cufinufft_version}-${manylinux_version} \
/io/ci/build-wheels.sh
--name cufinufft \
${dockerhub}/cufinufft-${cufinufft_version}-${manylinux_version}

docker start cufinufft

echo "# Build the library and install it"
docker exec cufinufft /io/tools/cufinufft/build-library.sh
docker exec cufinufft cp /io/build/libcufinufft.so /usr/lib

echo "# Build the wheels"
docker exec cufinufft /io/tools/cufinufft/build-wheels.sh

echo "# Shut down the container and remove it"
docker stop cufinufft
docker rm cufinufft

echo "# Copy the wheels we care about to the dist folder"
mkdir -p dist
Expand Down
34 changes: 1 addition & 33 deletions tools/cufinufft/docker/cuda11.0/Dockerfile-x86_64
Original file line number Diff line number Diff line change
Expand Up @@ -67,41 +67,9 @@ RUN yum install -y \
devtoolset-9-gcc-c++ && \
rm -rf /var/cache/yum/*

RUN scl enable devtoolset-9 -- g++ --version
ENV PATH /opt/rh/devtoolset-9/root/usr/bin:${PATH}

# finufft reqs
RUN yum install -y \
cmake && \
rm -rf /var/cache/yum/*

# Okay, so now we can begin cufinufft
#
# Only copy the C++/CUDA code (this way the cache is not invalidated by changes
# to the Python code or to the docs).
COPY src /io/src
COPY fortran /io/fortran
COPY include /io/include
COPY test /io/test
COPY perftest /io/perftest
COPY examples /io/examples
COPY cmake /io/cmake
COPY contrib /io/contrib
COPY CMakeLists.txt /io/

# Set up cmake and build the code.
RUN mkdir -p /io/build
WORKDIR /io/build
RUN scl enable devtoolset-9 -- cmake -D FINUFFT_USE_CUDA=ON -D FINUFFT_USE_CPU=OFF -D CMAKE_CUDA_ARCHITECTURES="35;50;60;70;75;80" -DBUILD_TESTING=ON -DFINUFFT_BUILD_TESTS=ON ..
RUN scl enable devtoolset-9 -- make -j4

WORKDIR /io

# And we need to pack it in our LD path
ENV LD_LIBRARY_PATH /io/build:${LD_LIBRARY_PATH}

# Now copy the rest of the repository in.
COPY python /io/python
COPY docs /io/docs
COPY tools /io/tools

CMD ["/bin/bash"]

0 comments on commit 5f7dc6c

Please sign in to comment.