Skip to content

Commit

Permalink
Merge pull request #99 from trws/fix-cmake
Browse files Browse the repository at this point in the history
Fix cmake
  • Loading branch information
trws authored Feb 18, 2022
2 parents 1f2fcf7 + def399a commit fef85a6
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 31 deletions.
24 changes: 10 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ list (APPEND camp_headers ${PROJECT_BINARY_DIR}/include/camp/config.hpp)
# backends
set (camp_depends)

set (camp_backends target_openmp openmp cuda hip sycl)
set (camp_backends openmp cuda hip sycl)
# NOTE: camp itself doesn't require a hip or cuda compiler,
# but some of its features are activated by having a device compiler
set (camp_runtime_backends cuda hip)
Expand All @@ -58,11 +58,15 @@ foreach (backend ${camp_backends})
string(TOUPPER "${backend}" suffix)
if ("${ENABLE_${suffix}}")
set ("CAMP_ENABLE_${suffix}" On)
endif()
if ("CAMP_ENABLE_${suffix}")
if (backend IN_LIST camp_runtime_backends)
list (APPEND camp_depends ${backend}_runtime)
else()
list (APPEND camp_depends ${backend})
set (backend ${backend}_runtime)
endif()
if (TARGET blt::${backend})
set (backend blt::${backend})
endif()
list (APPEND camp_depends ${backend})
endif()
endforeach()

Expand All @@ -77,10 +81,6 @@ if (ENABLE_CUDA)
message(FATAL_ERROR "Trying to use CUDA version ${CUDA_VERSION_STRING}. CAMP requires CUDA version 10.1 or newer.")
endif()

set(camp_depends
${camp_depends}
cuda_runtime)

if(ENABLE_NV_TOOLS_EXT)
set(camp_depends
${camp_depends}
Expand All @@ -89,13 +89,9 @@ if (ENABLE_CUDA)
endif ()

if (ENABLE_HIP)
if("${HIP_VERSION_STRING}" VERSION_LESS "3.5")
message(FATAL_ERROR "Trying to use HIP/ROCm version ${HIP_VERSION_STRING}. CAMP requires HIP/ROCm version 3.5 or newer. ")
if("${hip_VERSION}" VERSION_LESS "3.5")
message(FATAL_ERROR "Trying to use HIP/ROCm version ${hip_VERSION}. CAMP requires HIP/ROCm version 3.5 or newer. ")
endif()

set(camp_depends
${camp_depends}
hip_runtime)
endif ()

# end backends
Expand Down
10 changes: 2 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,12 @@ ARG BUILD_EXTRA=""
ARG CMAKE_BUILD_OPTS="--build build --verbose --parallel ${PARALLEL} ${BUILD_EXTRA}"
ARG CUDA_IMG_SUFFIX="-devel-ubuntu18.04"

FROM ubuntu:bionic AS clang_base
RUN apt-get update && apt-get install -y --no-install-recommends gpg gpg-agent wget curl software-properties-common unzip && apt-get clean && rm -rf /var/lib/apt/lists/*

### start compiler base images ###
# there is no official container in the hub, but there is an official script
# to install clang/llvm by version, installs a bit more than we need, but we
# do not have to maintain it, so I'm alright with that
FROM clang_base AS clang
ARG VER
ADD ./scripts/get-llvm.sh get-llvm.sh
RUN ./get-llvm.sh $VER bah
FROM ghcr.io/rse-ops/clang-ubuntu-20.04:llvm-${VER} AS clang
ENV LD_LIBRARY_PATH=/opt/view/lib

FROM gcc:${VER} AS gcc

Expand Down Expand Up @@ -71,7 +66,6 @@ ARG CMAKE_OPTIONS
ARG CMAKE_BUILD_OPTS
ARG COMPILER
ENV COMPILER=${COMPILER:-g++}
ENV HCC_AMDGPU_TARGET=gfx900
RUN /bin/bash -c "[[ -f ~/setup_env.sh ]] && source ~/setup_env.sh ; ${PRE_CMD} && cmake ${CMAKE_OPTIONS} -DCMAKE_CXX_COMPILER=${COMPILER} ."
RUN /bin/bash -c "[[ -f ~/setup_env.sh ]] && source ~/setup_env.sh ; ${PRE_CMD} && cmake ${CMAKE_BUILD_OPTS}"
RUN /bin/bash -c "[[ -f ~/setup_env.sh ]] && source ~/setup_env.sh ; ${PRE_CMD} && cd build && ctest ${CTEST_OPTIONS}"
Expand Down
10 changes: 5 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@ jobs:
clang10:
base_img: clang
compiler: clang++
ver: 10
ver: 10.0.0
clang10-debug:
base_img: clang
compiler: clang++
ver: 10
ver: 10.0.0
cmake_extra: -DCMAKE_CXX_FLAGS=-fsanitize=address
build_type: Debug
clang-latest:
base_img: clang
compiler: clang++
ver: latest
ver: 13.0.0
# NVIDIA no longer supports "latest", must update manually
nvcc10:
base_img: nvcc
Expand All @@ -88,8 +88,8 @@ jobs:
ver: 11.4.1
rocm:
base_img: rocm
cmake_extra: -DHIP_CLANG_PATH=/opt/rocm/llvm/bin -DENABLE_HIP=On -DENABLE_OPENMP=Off -DENABLE_CUDA=Off
compiler: /opt/rocm/bin/amdclang++
cmake_extra: -DROCM_PATH=/opt/rocm -DENABLE_HIP=On -DENABLE_OPENMP=Off -DENABLE_CUDA=Off
compiler: /opt/rocm/llvm/bin/amdclang++
sycl:
base_img: oneapi
compiler: dpcpp
Expand Down
2 changes: 1 addition & 1 deletion extern/blt
Submodule blt updated 137 files
4 changes: 2 additions & 2 deletions scripts/get-llvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ set -eux
VER=$1
curl -O https://apt.llvm.org/llvm.sh
if [[ "${VER}" = 'latest' ]] ; then
VER=$(grep LLVM_VERSION llvm.sh | head -n 1 | sed -e 's/LLVM_VERSION=//')
VER=all
fi
bash llvm.sh ${VER}
bash llvm.sh ${VER} all

ln -s /usr/bin/clang-${VER} /usr/bin/clang
ln -s /usr/bin/clang++-${VER} /usr/bin/clang++
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function(camp_add_test TESTNAME)
endif()

if(ENABLE_HIP)
list(APPEND _depends hip)
list(APPEND _depends blt::hip)
endif()

if(ABT_DEPENDS_ON)
Expand Down

0 comments on commit fef85a6

Please sign in to comment.