diff --git a/Jenkinsfile b/Jenkinsfile index 89951e3ba..bc7c64f02 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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 ''' } } diff --git a/tools/cufinufft/build-library.sh b/tools/cufinufft/build-library.sh new file mode 100755 index 000000000..988096879 --- /dev/null +++ b/tools/cufinufft/build-library.sh @@ -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 diff --git a/tools/cufinufft/distribution_helper.sh b/tools/cufinufft/distribution_helper.sh index 901473dad..014d51ecd 100755 --- a/tools/cufinufft/distribution_helper.sh +++ b/tools/cufinufft/distribution_helper.sh @@ -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 diff --git a/tools/cufinufft/docker/cuda11.0/Dockerfile-x86_64 b/tools/cufinufft/docker/cuda11.0/Dockerfile-x86_64 index 3ac5b8561..4b09fc392 100644 --- a/tools/cufinufft/docker/cuda11.0/Dockerfile-x86_64 +++ b/tools/cufinufft/docker/cuda11.0/Dockerfile-x86_64 @@ -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"]