Move CMakeList.txt to top level

This commit is contained in:
Tom Lin 2021-12-03 13:26:09 +00:00
parent 365d1a3601
commit 65b8b51b35
10 changed files with 49 additions and 52 deletions

View File

@ -55,9 +55,6 @@ jobs:
test-cpp: test-cpp:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
defaults:
run:
working-directory: ./src
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -83,75 +80,75 @@ jobs:
- name: Test compile gcc @ CMake 3.13 - name: Test compile gcc @ CMake 3.13
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build gcc all ${{ env.CMAKE_3_13_BIN }} run: ./src/ci-test-compile.sh ./build gcc all ${{ env.CMAKE_3_13_BIN }}
- name: Test compile clang @ CMake 3.13 - name: Test compile clang @ CMake 3.13
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build clang all ${{ env.CMAKE_3_13_BIN }} run: ./src/ci-test-compile.sh ./build clang all ${{ env.CMAKE_3_13_BIN }}
- name: Test compile nvhpc @ CMake 3.13 - name: Test compile nvhpc @ CMake 3.13
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build nvhpc all ${{ env.CMAKE_3_13_BIN }} run: ./src/ci-test-compile.sh ./build nvhpc all ${{ env.CMAKE_3_13_BIN }}
- name: Test compile aocc @ CMake 3.13 - name: Test compile aocc @ CMake 3.13
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build aocc all ${{ env.CMAKE_3_13_BIN }} run: ./src/ci-test-compile.sh ./build aocc all ${{ env.CMAKE_3_13_BIN }}
- name: Test compile aomp @ CMake 3.13 - name: Test compile aomp @ CMake 3.13
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build aomp all ${{ env.CMAKE_3_13_BIN }} run: ./src/ci-test-compile.sh ./build aomp all ${{ env.CMAKE_3_13_BIN }}
- name: Test compile hip @ CMake 3.13 - name: Test compile hip @ CMake 3.13
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build hip all ${{ env.CMAKE_3_13_BIN }} run: ./src/ci-test-compile.sh ./build hip all ${{ env.CMAKE_3_13_BIN }}
- name: Test compile dpcpp @ CMake 3.13 - name: Test compile dpcpp @ CMake 3.13
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build dpcpp all ${{ env.CMAKE_3_13_BIN }} run: ./src/ci-test-compile.sh ./build dpcpp all ${{ env.CMAKE_3_13_BIN }}
- name: Test compile hipsycl @ CMake 3.13 - name: Test compile hipsycl @ CMake 3.13
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build hipsycl all ${{ env.CMAKE_3_13_BIN }} run: ./src/ci-test-compile.sh ./build hipsycl all ${{ env.CMAKE_3_13_BIN }}
- name: Test compile gcc @ CMake 3.15 - name: Test compile gcc @ CMake 3.15
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build gcc all ${{ env.CMAKE_3_15_BIN }} run: ./src/ci-test-compile.sh ./build gcc all ${{ env.CMAKE_3_15_BIN }}
- name: Test compile clang @ CMake 3.15 - name: Test compile clang @ CMake 3.15
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build clang all ${{ env.CMAKE_3_15_BIN }} run: ./src/ci-test-compile.sh ./build clang all ${{ env.CMAKE_3_15_BIN }}
- name: Test compile nvhpc @ CMake 3.15 - name: Test compile nvhpc @ CMake 3.15
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build nvhpc all ${{ env.CMAKE_3_15_BIN }} run: ./src/ci-test-compile.sh ./build nvhpc all ${{ env.CMAKE_3_15_BIN }}
- name: Test compile aocc @ CMake 3.15 - name: Test compile aocc @ CMake 3.15
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build aocc all ${{ env.CMAKE_3_15_BIN }} run: ./src/ci-test-compile.sh ./build aocc all ${{ env.CMAKE_3_15_BIN }}
- name: Test compile aomp @ CMake 3.15 - name: Test compile aomp @ CMake 3.15
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build aomp all ${{ env.CMAKE_3_15_BIN }} run: ./src/ci-test-compile.sh ./build aomp all ${{ env.CMAKE_3_15_BIN }}
- name: Test compile hip @ CMake 3.15 - name: Test compile hip @ CMake 3.15
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build hip all ${{ env.CMAKE_3_15_BIN }} run: ./src/ci-test-compile.sh ./build hip all ${{ env.CMAKE_3_15_BIN }}
- name: Test compile dpcpp @ CMake 3.15 - name: Test compile dpcpp @ CMake 3.15
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build dpcpp all ${{ env.CMAKE_3_15_BIN }} run: ./src/ci-test-compile.sh ./build dpcpp all ${{ env.CMAKE_3_15_BIN }}
- name: Test compile hipsycl @ CMake 3.15 - name: Test compile hipsycl @ CMake 3.15
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build hipsycl all ${{ env.CMAKE_3_15_BIN }} run: ./src/ci-test-compile.sh ./build hipsycl all ${{ env.CMAKE_3_15_BIN }}
- name: Test compile gcc @ CMake 3.18 - name: Test compile gcc @ CMake 3.18
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build gcc all ${{ env.CMAKE_3_18_BIN }} run: ./src/ci-test-compile.sh ./build gcc all ${{ env.CMAKE_3_18_BIN }}
- name: Test compile clang @ CMake 3.18 - name: Test compile clang @ CMake 3.18
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build clang all ${{ env.CMAKE_3_18_BIN }} run: ./src/ci-test-compile.sh ./build clang all ${{ env.CMAKE_3_18_BIN }}
- name: Test compile nvhpc @ CMake 3.18 - name: Test compile nvhpc @ CMake 3.18
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build nvhpc all ${{ env.CMAKE_3_18_BIN }} run: ./src/ci-test-compile.sh ./build nvhpc all ${{ env.CMAKE_3_18_BIN }}
- name: Test compile aocc @ CMake 3.18 - name: Test compile aocc @ CMake 3.18
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build aocc all ${{ env.CMAKE_3_18_BIN }} run: ./src/ci-test-compile.sh ./build aocc all ${{ env.CMAKE_3_18_BIN }}
- name: Test compile aomp @ CMake 3.18 - name: Test compile aomp @ CMake 3.18
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build aomp all ${{ env.CMAKE_3_18_BIN }} run: ./src/ci-test-compile.sh ./build aomp all ${{ env.CMAKE_3_18_BIN }}
- name: Test compile hip @ CMake 3.18 - name: Test compile hip @ CMake 3.18
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build hip all ${{ env.CMAKE_3_18_BIN }} run: ./src/ci-test-compile.sh ./build hip all ${{ env.CMAKE_3_18_BIN }}
- name: Test compile dpcpp @ CMake 3.18 - name: Test compile dpcpp @ CMake 3.18
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build dpcpp all ${{ env.CMAKE_3_18_BIN }} run: ./src/ci-test-compile.sh ./build dpcpp all ${{ env.CMAKE_3_18_BIN }}
- name: Test compile hipsycl @ CMake 3.18 - name: Test compile hipsycl @ CMake 3.18
if: ${{ ! cancelled() }} if: ${{ ! cancelled() }}
run: ./ci-test-compile.sh ./build hipsycl all ${{ env.CMAKE_3_18_BIN }} run: ./src/ci-test-compile.sh ./build hipsycl all ${{ env.CMAKE_3_18_BIN }}

View File

@ -49,7 +49,7 @@ endmacro()
#set(CXX_EXTRA_FLAGS -O2) #set(CXX_EXTRA_FLAGS -O2)
#set(CMAKE_CXX_COMPILER /usr/lib/aomp/bin/clang++) #set(CMAKE_CXX_COMPILER /usr/lib/aomp/bin/clang++)
#set(MODEL OMP) #set(MODEL omp)
##set(OFFLOAD "AMD:gfx803") ##set(OFFLOAD "AMD:gfx803")
#set(OFFLOAD "NVIDIA:sm_35") #set(OFFLOAD "NVIDIA:sm_35")
#set(CXX_EXTRA_FLAGS --cuda-path=/opt/cuda-10.2/) #set(CXX_EXTRA_FLAGS --cuda-path=/opt/cuda-10.2/)
@ -112,7 +112,7 @@ if ((DEFINED CXX_EXTRA_FLAGS) AND (NOT DEFINED CXX_EXTRA_LINK_FLAGS))
endif () endif ()
# include our macros # include our macros
include(register_models.cmake) include(cmake/register_models.cmake)
# register out models <model_name> <preprocessor_def_name> <source files...> # register out models <model_name> <preprocessor_def_name> <source files...>
register_model(omp OMP OMPStream.cpp) register_model(omp OMP OMPStream.cpp)
@ -185,8 +185,8 @@ message(STATUS "Executable : ${EXE_NAME}")
# below we have all the usual CMake target setup steps # below we have all the usual CMake target setup steps
include_directories(.) include_directories(src)
add_executable(${EXE_NAME} ${IMPL_SOURCES} main.cpp) add_executable(${EXE_NAME} ${IMPL_SOURCES} src/main.cpp)
target_link_libraries(${EXE_NAME} PUBLIC ${LINK_LIBRARIES}) target_link_libraries(${EXE_NAME} PUBLIC ${LINK_LIBRARIES})
target_compile_definitions(${EXE_NAME} PUBLIC ${IMPL_DEFINITIONS}) target_compile_definitions(${EXE_NAME} PUBLIC ${IMPL_DEFINITIONS})

View File

@ -71,7 +71,7 @@ The project supports building with CMake >= 3.13.0, it can be installed without
As with any CMake project, first configure the project: As with any CMake project, first configure the project:
```shell ```shell
> cd babelstream/src > cd babelstream
> cmake -Bbuild -H. -DMODEL=<model> <model specific flags prefixed with -D...> # configure the build, build type defaults to Release > cmake -Bbuild -H. -DMODEL=<model> <model specific flags prefixed with -D...> # configure the build, build type defaults to Release
> cmake --build build # compile it > cmake --build build # compile it
> ./build/<model>-stream # executable available at ./build/ > ./build/<model>-stream # executable available at ./build/
@ -85,7 +85,7 @@ There are assigned those to `RELEASE_FLAGS`, and you can override them if requir
To find out what flag each model supports or requires, simply configure while only specifying the model. To find out what flag each model supports or requires, simply configure while only specifying the model.
For example: For example:
```shell ```shell
> cd babelstream/src > cd babelstream
> cmake -Bbuild -H. -DMODEL=ocl > cmake -Bbuild -H. -DMODEL=ocl
... ...
- Common Release flags are `-O3`, set RELEASE_FLAGS to override - Common Release flags are `-O3`, set RELEASE_FLAGS to override
@ -108,7 +108,7 @@ For example:
OpenCL_LIBRARY (optional, default=): Path to OpenCL library, usually called libOpenCL.so OpenCL_LIBRARY (optional, default=): Path to OpenCL library, usually called libOpenCL.so
... ...
``` ```
Alternatively, refer to the [CI script](./ci-test-compile.sh), which test-compiles most of the models, and see which flags are used there. Alternatively, refer to the [CI script](./src/ci-test-compile.sh), which test-compiles most of the models, and see which flags are used there.
*It is recommended that you delete the `build` directory when you change any of the build flags.* *It is recommended that you delete the `build` directory when you change any of the build flags.*

View File

@ -134,7 +134,7 @@ macro(register_model NAME PREPROCESSOR_NAME)
list(APPEND REGISTERED_MODELS "${NAME}") list(APPEND REGISTERED_MODELS "${NAME}")
string(TOUPPER ${NAME} MODEL_UPPER) string(TOUPPER ${NAME} MODEL_UPPER)
list(APPEND IMPL_${MODEL_UPPER}_SOURCES "${NAME}/${ARGN}") list(APPEND IMPL_${MODEL_UPPER}_SOURCES "src/${NAME}/${ARGN}")
list(APPEND IMPL_${MODEL_UPPER}_DEFINITIONS "${PREPROCESSOR_NAME}") list(APPEND IMPL_${MODEL_UPPER}_DEFINITIONS "${PREPROCESSOR_NAME}")
endmacro() endmacro()
@ -142,8 +142,8 @@ endmacro()
macro(load_model MODEL) macro(load_model MODEL)
if ("${MODEL}" IN_LIST REGISTERED_MODELS) if ("${MODEL}" IN_LIST REGISTERED_MODELS)
string(TOLOWER "${MODEL}" MODEL_LOWER) string(TOLOWER "${MODEL}" MODEL_LOWER)
set(MODEL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${MODEL_LOWER}/model.cmake) set(MODEL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/${MODEL_LOWER}/model.cmake)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/${MODEL_LOWER}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/${MODEL_LOWER})
if (NOT EXISTS ${MODEL_FILE}) if (NOT EXISTS ${MODEL_FILE})
message(FATAL_ERROR "${MODEL_FILE} not found, perhaps it needs to be implemented?") message(FATAL_ERROR "${MODEL_FILE} not found, perhaps it needs to be implemented?")
endif () endif ()

View File

@ -88,30 +88,30 @@ run_build() {
### ###
# KOKKOS_SRC="/home/tom/Downloads/kokkos-3.3.00" # KOKKOS_SRC="/home/tom/Downloads/kokkos-3.3.00"
# RAJA_SRC="/home/tom/Downloads/RAJA-v0.13.0" # RAJA_SRC="/home/tom/Downloads/RAJA-v0.13.0"
#
# GCC_CXX="/usr/bin/g++" # GCC_CXX="$(which g++-10)"
# CLANG_CXX="/usr/bin/clang++" # CLANG_CXX="/usr/bin/clang++"
#
# NVHPC_SDK_DIR="/home/tom/Downloads/nvhpc_2021_212_Linux_x86_64_cuda_11.2/install_components/Linux_x86_64/21.2/" # NVHPC_SDK_DIR="/home/tom/Downloads/nvhpc_2021_219_Linux_x86_64_cuda_multi/install_components/Linux_x86_64/21.9/"
# NVHPC_NVCXX="$NVHPC_SDK_DIR/compilers/bin/nvc++" # NVHPC_NVCXX="$NVHPC_SDK_DIR/compilers/bin/nvc++"
# NVHPC_NVCC="$NVHPC_SDK_DIR/cuda/11.2/bin/nvcc" # NVHPC_NVCC="$NVHPC_SDK_DIR/cuda/11.4/bin/nvcc"
# NVHPC_CUDA_DIR="$NVHPC_SDK_DIR/cuda/11.2" # NVHPC_CUDA_DIR="$NVHPC_SDK_DIR/cuda/11.4"
# "$NVHPC_SDK_DIR/compilers/bin/makelocalrc" "$NVHPC_SDK_DIR/compilers/bin/" -x # "$NVHPC_SDK_DIR/compilers/bin/makelocalrc" "$NVHPC_SDK_DIR/compilers/bin/" -x
#
# AOCC_CXX="/opt/AMD/aocc-compiler-2.3.0/bin/clang++" # AOCC_CXX="/opt/AMD/aocc-compiler-2.3.0/bin/clang++"
# AOMP_CXX="/usr/lib/aomp/bin/clang++" # AOMP_CXX="/usr/lib/aomp/bin/clang++"
# OCL_LIB="/home/tom/Downloads/oclcpuexp-2020.11.11.0.04_rel/x64/libOpenCL.so" # OCL_LIB="/home/tom/Downloads/oclcpuexp-2020.11.11.0.04_rel/x64/libOpenCL.so"
#
# # AMD needs this rocm_path thing exported... # # AMD needs this rocm_path thing exported...
# export ROCM_PATH="/opt/rocm-4.0.0" # export ROCM_PATH="/opt/rocm-4.5.0"
# HIP_CXX="/opt/rocm-4.0.0/bin/hipcc" # HIP_CXX="/opt/rocm-4.5.0/bin/hipcc"
# COMPUTECPP_DIR="/home/tom/Desktop/computecpp_archive/ComputeCpp-CE-2.3.0-x86_64-linux-gnu" # COMPUTECPP_DIR="/home/tom/Downloads/ComputeCpp-CE-2.7.0-x86_64-linux-gnu/"
# DPCPP_DIR="/home/tom/Downloads/dpcpp_compiler" # DPCPP_DIR="/home/tom/Downloads/dpcpp_compiler"
# HIPSYCL_DIR="/opt/hipsycl/cff515c/" # HIPSYCL_DIR="/opt/hipsycl/cff515c/"
#
# ICPX_CXX="/opt/intel/oneapi/compiler/2021.1.2/linux/bin/icpx" # ICPX_CXX="/opt/intel/oneapi/compiler/2021.4.0/linux/bin/icpx"
# ICPC_CXX="/opt/intel/oneapi/compiler/2021.1.2/linux/bin/intel64/icpc"# TBB_LIB="/home/tom/Downloads/oneapi-tbb-2021.1.1/" # ICPC_CXX="/opt/intel/oneapi/compiler/2021.4.0/linux/bin/intel64/icpc"# TBB_LIB="/home/tom/Downloads/oneapi-tbb-2021.1.1/"
#
# GCC_STD_PAR_LIB="tbb" # GCC_STD_PAR_LIB="tbb"
# CLANG_STD_PAR_LIB="tbb" # CLANG_STD_PAR_LIB="tbb"
# GCC_OMP_OFFLOAD_AMD=false # GCC_OMP_OFFLOAD_AMD=false